FINERACT-2389: Fix the handling of nullable field overrides - E2E tests

This commit is contained in:
Peter Kovacs
2025-10-29 11:26:16 +01:00
committed by Adam Saghy
parent adc4ee3545
commit 8a86759773
3 changed files with 116 additions and 0 deletions
@@ -714,6 +714,12 @@ public class LoanStepDef extends AbstractStepDef {
createFullyCustomizedLoanWithInterestRateFrequency(data.get(1));
}
@When("Admin creates a fully customized loan with graceOnArrearsAgeing and following data:")
public void createFullyCustomizedLoanWithGraceOnArrearsAgeing(final DataTable table) throws IOException {
final List<List<String>> data = table.asLists();
createFullyCustomizedLoanWithGraceOnArrearsAgeing(data.get(1));
}
@When("Admin creates a fully customized loan with charges and following data:")
public void createFullyCustomizedLoanWithLoanCharges(final DataTable table) throws IOException {
final List<List<String>> data = table.asLists();
@@ -3758,6 +3764,80 @@ public class LoanStepDef extends AbstractStepDef {
eventCheckHelper.createLoanEventCheck(response);
}
public void createFullyCustomizedLoanWithGraceOnArrearsAgeing(final List<String> loanData) throws IOException {
final String loanProduct = loanData.get(0);
final String submitDate = loanData.get(1);
final String principal = loanData.get(2);
final BigDecimal interestRate = new BigDecimal(loanData.get(3));
final String interestTypeStr = loanData.get(4);
final String interestCalculationPeriodStr = loanData.get(5);
final String amortizationTypeStr = loanData.get(6);
final Integer loanTermFrequency = Integer.valueOf(loanData.get(7));
final String loanTermFrequencyType = loanData.get(8);
final Integer repaymentFrequency = Integer.valueOf(loanData.get(9));
final String repaymentFrequencyTypeStr = loanData.get(10);
final Integer numberOfRepayments = Integer.valueOf(loanData.get(11));
final Integer graceOnPrincipalPayment = Integer.valueOf(loanData.get(12));
final Integer graceOnInterestPayment = Integer.valueOf(loanData.get(13));
final Integer graceOnInterestCharged = Integer.valueOf(loanData.get(14));
final String transactionProcessingStrategyCode = loanData.get(15);
final String graceOnArrearsAgeingStr = loanData.get(16);
final Response<PostClientsResponse> clientResponse = testContext().get(TestContextKey.CLIENT_CREATE_RESPONSE);
final Long clientId = clientResponse.body().getClientId();
final DefaultLoanProduct product = DefaultLoanProduct.valueOf(loanProduct);
final Long loanProductId = loanProductResolver.resolve(product);
final LoanTermFrequencyType termFrequencyType = LoanTermFrequencyType.valueOf(loanTermFrequencyType);
final Integer loanTermFrequencyTypeValue = termFrequencyType.getValue();
final RepaymentFrequencyType repaymentFrequencyType = RepaymentFrequencyType.valueOf(repaymentFrequencyTypeStr);
final Integer repaymentFrequencyTypeValue = repaymentFrequencyType.getValue();
final InterestType interestType = InterestType.valueOf(interestTypeStr);
final Integer interestTypeValue = interestType.getValue();
final InterestCalculationPeriodTime interestCalculationPeriod = InterestCalculationPeriodTime.valueOf(interestCalculationPeriodStr);
final Integer interestCalculationPeriodValue = interestCalculationPeriod.getValue();
final AmortizationType amortizationType = AmortizationType.valueOf(amortizationTypeStr);
final Integer amortizationTypeValue = amortizationType.getValue();
final TransactionProcessingStrategyCode processingStrategyCode = TransactionProcessingStrategyCode
.valueOf(transactionProcessingStrategyCode);
final String transactionProcessingStrategyCodeValue = processingStrategyCode.getValue();
Integer graceOnArrearsAgeingValue = Integer.valueOf(graceOnArrearsAgeingStr);
final PostLoansRequest loansRequest = loanRequestFactory//
.defaultLoansRequest(clientId)//
.productId(loanProductId)//
.principal(new BigDecimal(principal))//
.interestRatePerPeriod(interestRate)//
.interestType(interestTypeValue)//
.interestCalculationPeriodType(interestCalculationPeriodValue)//
.amortizationType(amortizationTypeValue)//
.loanTermFrequency(loanTermFrequency)//
.loanTermFrequencyType(loanTermFrequencyTypeValue)//
.numberOfRepayments(numberOfRepayments)//
.repaymentEvery(repaymentFrequency)//
.repaymentFrequencyType(repaymentFrequencyTypeValue)//
.submittedOnDate(submitDate)//
.expectedDisbursementDate(submitDate)//
.graceOnPrincipalPayment(graceOnPrincipalPayment)//
.graceOnInterestPayment(graceOnInterestPayment)//
.graceOnInterestPayment(graceOnInterestCharged)//
.transactionProcessingStrategyCode(transactionProcessingStrategyCodeValue)//
.graceOnArrearsAgeing(graceOnArrearsAgeingValue);//
final Response<PostLoansResponse> response = loansApi.calculateLoanScheduleOrSubmitLoanApplication(loansRequest, "").execute();
testContext().set(TestContextKey.LOAN_CREATE_RESPONSE, response);
ErrorHelper.checkSuccessfulApiCall(response);
eventCheckHelper.createLoanEventCheck(response);
}
public void createFullyCustomizedLoanWithCharges(final List<String> loanData) throws IOException {
final String loanProduct = loanData.get(0);
final String submitDate = loanData.get(1);
@@ -2144,3 +2144,35 @@ Feature: LoanDelinquency
| 3 | RANGE_30 | 125.00 |
| 4 | RANGE_60 | 375.00 |
| 5 | RANGE_90 | 250.00 |
@TestRailId:C4140
Scenario: Verify that loan delinquent days are correct when graceOnArrearsAgeing is set on loan product level (value=3)
When Admin sets the business date to "01 January 2025"
And Admin creates a client with random data
And Admin creates a fully customized loan with the following data:
| 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 |
| 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 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
And Admin sets the business date to "15 May 2025"
And Admin runs inline COB job for Loan
Then Admin checks that delinquency range is: "RANGE_90" and has delinquentDate "2025-02-04"
And Loan has the following LOAN level delinquency data:
| classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays |
| RANGE_90 | 666.68 | 04 February 2025 | 100 | 103 |
@TestRailId:C4141
Scenario: Verify that loan delinquent days are correct when graceOnArrearsAgeing is overrided on loan level (value=5)
When Admin sets the business date to "01 January 2025"
And Admin creates a client with random data
And Admin creates a fully customized loan with graceOnArrearsAgeing and following data:
| 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 |
| 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 |
And Admin successfully approves the loan on "01 January 2025" with "1000" amount and expected disbursement date on "01 January 2025"
And Admin successfully disburse the loan on "01 January 2025" with "1000" EUR transaction amount
And Admin sets the business date to "15 May 2025"
And Admin runs inline COB job for Loan
Then Admin checks that delinquency range is: "RANGE_90" and has delinquentDate "2025-02-06"
And Loan has the following LOAN level delinquency data:
| classification | delinquentAmount | delinquentDate | delinquentDays | pastDueDays |
| RANGE_90 | 666.68 | 06 February 2025 | 98 | 103 |
@@ -1,6 +1,7 @@
@LoanOverrideFields
Feature: LoanOverrideFields
@TestRailId:C4142
Scenario: Verify that all nullable fields default to product when overrides not allowed and not provided
When Admin sets the business date to the actual date
When Admin creates a client with random data
@@ -15,6 +16,7 @@ Feature: LoanOverrideFields
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
@TestRailId:C4143
Scenario: Verify that all nullable fields ignore overrides when overrides not allowed
When Admin sets the business date to the actual date
When Admin creates a client with random data
@@ -29,6 +31,7 @@ Feature: LoanOverrideFields
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
@TestRailId:C4144
Scenario: Verify that nullable fields default to product when override is allowed but not provided
When Admin sets the business date to the actual date
When Admin creates a client with random data
@@ -43,6 +46,7 @@ Feature: LoanOverrideFields
Then LoanDetails has "graceOnInterestPayment" field with value: "1"
Then LoanDetails has "graceOnArrearsAgeing" field with value: "3"
@TestRailId:C4145
Scenario: Verify that nullable fields default to product when override is allowed and provided
When Admin sets the business date to the actual date
When Admin creates a client with random data