Skip to content

Commit 8a86759

Browse files
peter-kovacs-dpcadamsaghy
authored andcommitted
FINERACT-2389: Fix the handling of nullable field overrides - E2E tests
1 parent adc4ee3 commit 8a86759

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,12 @@ public void createFullyCustomizedLoanWithInterestRateFrequencyType(final DataTab
714714
createFullyCustomizedLoanWithInterestRateFrequency(data.get(1));
715715
}
716716

717+
@When("Admin creates a fully customized loan with graceOnArrearsAgeing and following data:")
718+
public void createFullyCustomizedLoanWithGraceOnArrearsAgeing(final DataTable table) throws IOException {
719+
final List<List<String>> data = table.asLists();
720+
createFullyCustomizedLoanWithGraceOnArrearsAgeing(data.get(1));
721+
}
722+
717723
@When("Admin creates a fully customized loan with charges and following data:")
718724
public void createFullyCustomizedLoanWithLoanCharges(final DataTable table) throws IOException {
719725
final List<List<String>> data = table.asLists();
@@ -3758,6 +3764,80 @@ public void createFullyCustomizedLoanWithInterestRateFrequency(final List<String
37583764
eventCheckHelper.createLoanEventCheck(response);
37593765
}
37603766

3767+
public void createFullyCustomizedLoanWithGraceOnArrearsAgeing(final List<String> loanData) throws IOException {
3768+
final String loanProduct = loanData.get(0);
3769+
final String submitDate = loanData.get(1);
3770+
final String principal = loanData.get(2);
3771+
final BigDecimal interestRate = new BigDecimal(loanData.get(3));
3772+
final String interestTypeStr = loanData.get(4);
3773+
final String interestCalculationPeriodStr = loanData.get(5);
3774+
final String amortizationTypeStr = loanData.get(6);
3775+
final Integer loanTermFrequency = Integer.valueOf(loanData.get(7));
3776+
final String loanTermFrequencyType = loanData.get(8);
3777+
final Integer repaymentFrequency = Integer.valueOf(loanData.get(9));
3778+
final String repaymentFrequencyTypeStr = loanData.get(10);
3779+
final Integer numberOfRepayments = Integer.valueOf(loanData.get(11));
3780+
final Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12));
3781+
final Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13));
3782+
final Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14));
3783+
final String transactionProcessingStrategyCode = loanData.get(15);
3784+
final String graceOnArrearsAgeingStr = loanData.get(16);
3785+
3786+
final Response<PostClientsResponse> clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
3787+
final Long clientId = clientResponse.body().getClientId();
3788+
3789+
final DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct);
3790+
final Long loanProductId = loanProductResolver.resolve(product);
3791+
3792+
final LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType);
3793+
final Integer loanTermFrequencyTypeValue = termFrequencyType.getValue();
3794+
3795+
final RepaymentFrequencyType repaymentFrequencyType = RepaymentFrequencyType.valueOf(repaymentFrequencyTypeStr);
3796+
final Integer repaymentFrequencyTypeValue = repaymentFrequencyType.getValue();
3797+
3798+
final InterestType interestType = InterestType.valueOf(interestTypeStr);
3799+
final Integer interestTypeValue = interestType.getValue();
3800+
3801+
final InterestCalculationPeriodTime interestCalculationPeriod = InterestCalculationPeriodTime.valueOf(interestCalculationPeriodStr);
3802+
final Integer interestCalculationPeriodValue = interestCalculationPeriod.getValue();
3803+
3804+
final AmortizationType amortizationType = AmortizationType.valueOf(amortizationTypeStr);
3805+
final Integer amortizationTypeValue = amortizationType.getValue();
3806+
3807+
final TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode
3808+
.valueOf(transactionProcessingStrategyCode);
3809+
final String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue();
3810+
3811+
Integer graceOnArrearsAgeingValue = Integer.valueOf(graceOnArrearsAgeingStr);
3812+
3813+
final PostLoansRequest loansRequest = loanRequestFactory//
3814+
.defaultLoansRequest(clientId)//
3815+
.productId(loanProductId)//
3816+
.principal(new BigDecimal(principal))//
3817+
.interestRatePerPeriod(interestRate)//
3818+
.interestType(interestTypeValue)//
3819+
.interestCalculationPeriodType(interestCalculationPeriodValue)//
3820+
.amortizationType(amortizationTypeValue)//
3821+
.loanTermFrequency(loanTermFrequency)//
3822+
.loanTermFrequencyType(loanTermFrequencyTypeValue)//
3823+
.numberOfRepayments(numberOfRepayments)//
3824+
.repaymentEvery(repaymentFrequency)//
3825+
.repaymentFrequencyType(repaymentFrequencyTypeValue)//
3826+
.submittedOnDate(submitDate)//
3827+
.expectedDisbursementDate(submitDate)//
3828+
.graceOnPrincipalPayment(graceOnPrincipalPayment)//
3829+
.graceOnInterestPayment(graceOnInterestPayment)//
3830+
.graceOnInterestPayment(graceOnInterestCharged)//
3831+
.transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue)//
3832+
.graceOnArrearsAgeing(graceOnArrearsAgeingValue);//
3833+
3834+
final Response<PostLoansResponse> response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute();
3835+
testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
3836+
ErrorHelper.checkSuccessfulApiCall(response);
3837+
3838+
eventCheckHelper.createLoanEventCheck(response);
3839+
}
3840+
37613841
public void createFullyCustomizedLoanWithCharges(final List<String> loanData) throws IOException {
37623842
final String loanProduct = loanData.get(0);
37633843
final String submitDate = loanData.get(1);

fineract-e2e-tests-runner/src/test/resources/features/LoanDelinquency.feature

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2144,3 +2144,35 @@ Feature: LoanDelinquency
21442144
| 3 | RANGE_30 | 125.00 |
21452145
| 4 | RANGE_60 | 375.00 |
21462146
| 5 | RANGE_90 | 250.00 |
2147+
2148+
@TestRailId:C4140
2149+
Scenario: Verify that loan delinquent days are correct when graceOnArrearsAgeing is set on loan product level (value=3)
2150+
When Admin sets the business date to "01 January 2025"
2151+
And Admin creates a client with random data
2152+
And Admin creates a fully customized loan with the following data:
2153+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
2154+
| LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES | 01 January 2025 | 1000 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
2155+
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
2156+
And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
2157+
And Admin sets the business date to "15 May 2025"
2158+
And Admin runs inline COB job for Loan
2159+
Then Admin checks that delinquency range is: "RANGE_90" and has delinquentDate "2025-02-04"
2160+
And Loan has the following LOAN level delinquency data:
2161+
| classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays |
2162+
| RANGE_90 | 666.68 | 04 February 2025 | 100 | 103 |
2163+
2164+
@TestRailId:C4141
2165+
Scenario: Verify that loan delinquent days are correct when graceOnArrearsAgeing is overrided on loan level (value=5)
2166+
When Admin sets the business date to "01 January 2025"
2167+
And Admin creates a client with random data
2168+
And Admin creates a fully customized loan with graceOnArrearsAgeing and following data:
2169+
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy | graceOnArrearsAgeing |
2170+
| LP2_PROGRESSIVE_ADVANCED_PAYMENT_ALLOCATION_BUYDOWN_FEES | 01 January 2025 | 1000 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | 5 |
2171+
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
2172+
And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
2173+
And Admin sets the business date to "15 May 2025"
2174+
And Admin runs inline COB job for Loan
2175+
Then Admin checks that delinquency range is: "RANGE_90" and has delinquentDate "2025-02-06"
2176+
And Loan has the following LOAN level delinquency data:
2177+
| classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays |
2178+
| RANGE_90 | 666.68 | 06 February 2025 | 98 | 103 |

fineract-e2e-tests-runner/src/test/resources/features/LoanOverrideFileds.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@LoanOverrideFields
22
Feature: LoanOverrideFields
33

4+
@TestRailId:C4142
45
Scenario: Verify that all nullable fields default to product when overrides not allowed and not provided
56
When Admin sets the business date to the actual date
67
When Admin creates a client with random data
@@ -15,6 +16,7 @@ Feature: LoanOverrideFields
1516
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
1617
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
1718

19+
@TestRailId:C4143
1820
Scenario: Verify that all nullable fields ignore overrides when overrides not allowed
1921
When Admin sets the business date to the actual date
2022
When Admin creates a client with random data
@@ -29,6 +31,7 @@ Feature: LoanOverrideFields
2931
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
3032
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
3133

34+
@TestRailId:C4144
3235
Scenario: Verify that nullable fields default to product when override is allowed but not provided
3336
When Admin sets the business date to the actual date
3437
When Admin creates a client with random data
@@ -43,6 +46,7 @@ Feature: LoanOverrideFields
4346
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
4447
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
4548

49+
@TestRailId:C4145
4650
Scenario: Verify that nullable fields default to product when override is allowed and provided
4751
When Admin sets the business date to the actual date
4852
When Admin creates a client with random data

0 commit comments

Comments
 (0)