FINERACT-2389: Fix the handling of nullable field overrides

This commit is contained in:
Oleksii Novikov
2025-10-29 11:26:16 +01:00
committed by Adam Saghy
parent b32837e9b4
commit adc4ee3545
11 changed files with 290 additions and 29 deletions
@@ -886,7 +886,8 @@ public abstract class BaseLoanIntegrationTest extends IntegrationTest {
.repaymentEvery(1)//
.repaymentFrequencyType(RepaymentFrequencyType.MONTHS.longValue())//
.interestType(interestType)//
.amortizationType(amortizationType);
.amortizationType(amortizationType)//
.graceOnArrearsAgeing(0);
}
private RequestSpecification createRequestSpecification(String authKey) {
@@ -1352,13 +1353,26 @@ public abstract class BaseLoanIntegrationTest extends IntegrationTest {
protected PostLoansRequest applyLoanRequest(Long clientId, Long loanProductId, String loanDisbursementDate, Double amount,
int numberOfRepayments, Consumer<PostLoansRequest> customizer) {
PostLoansRequest postLoansRequest = new PostLoansRequest().clientId(clientId).productId(loanProductId)
.expectedDisbursementDate(loanDisbursementDate).dateFormat(DATETIME_PATTERN)
.transactionProcessingStrategyCode(DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE_STRATEGY)
.locale("en").submittedOnDate(loanDisbursementDate).amortizationType(1).interestRatePerPeriod(BigDecimal.ZERO)
.interestCalculationPeriodType(1).interestType(0).repaymentEvery(30).repaymentFrequencyType(0)
.numberOfRepayments(numberOfRepayments).loanTermFrequency(numberOfRepayments * 30).loanTermFrequencyType(0)
.maxOutstandingLoanBalance(BigDecimal.valueOf(amount)).principal(BigDecimal.valueOf(amount)).loanType("individual");
PostLoansRequest postLoansRequest = new PostLoansRequest().clientId(clientId) //
.productId(loanProductId) //
.expectedDisbursementDate(loanDisbursementDate) //
.dateFormat(DATETIME_PATTERN) //
.transactionProcessingStrategyCode(DUE_PENALTY_INTEREST_PRINCIPAL_FEE_IN_ADVANCE_PENALTY_INTEREST_PRINCIPAL_FEE_STRATEGY) //
.locale("en") //
.submittedOnDate(loanDisbursementDate) //
.amortizationType(1) //
.interestRatePerPeriod(BigDecimal.ZERO) //
.interestCalculationPeriodType(1) //
.interestType(0) //
.repaymentEvery(30) //
.repaymentFrequencyType(0) //
.numberOfRepayments(numberOfRepayments) //
.loanTermFrequency(numberOfRepayments * 30) //
.loanTermFrequencyType(0) //
.maxOutstandingLoanBalance(BigDecimal.valueOf(amount)) //
.principal(BigDecimal.valueOf(amount)) //
.loanType("individual") //
.graceOnArrearsAgeing(0);
if (customizer != null) {
customizer.accept(postLoansRequest);
}
@@ -285,15 +285,15 @@ public class DelinquencyActionIntegrationTests extends BaseLoanIntegrationTest {
verifyLoanDelinquencyData(loanId, 6, new InstallmentDelinquencyData(4, 10, BigDecimal.valueOf(250.0)));
// Create Delinquency Pause for the Loan in the past
PostLoansDelinquencyActionResponse response = loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE,
"27 January 2023", "15 February 2023");
loanTransactionHelper.createLoanDelinquencyAction(loanId, PAUSE, "27 January 2023", "15 February 2023");
List<GetDelinquencyActionsResponse> loanDelinquencyActions = loanTransactionHelper.getLoanDelinquencyActions(loanId);
Assertions.assertNotNull(loanDelinquencyActions);
Assertions.assertEquals(1, loanDelinquencyActions.size());
Assertions.assertEquals("PAUSE", loanDelinquencyActions.get(0).getAction());
Assertions.assertEquals(LocalDate.parse("27 January 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getStartDate());
Assertions.assertEquals(LocalDate.parse("15 February 2023", dateTimeFormatter), loanDelinquencyActions.get(0).getEndDate());
Assertions.assertEquals("PAUSE", loanDelinquencyActions.getFirst().getAction());
Assertions.assertEquals(LocalDate.parse("27 January 2023", dateTimeFormatter),
loanDelinquencyActions.getFirst().getStartDate());
Assertions.assertEquals(LocalDate.parse("15 February 2023", dateTimeFormatter), loanDelinquencyActions.getFirst().getEndDate());
// Loan delinquency data calculation after backdated pause
verifyLoanDelinquencyData(loanId, 3, new InstallmentDelinquencyData(1, 3, BigDecimal.valueOf(250.0)));
@@ -137,8 +137,8 @@ public class LoanProductTestBuilder {
private String minimumGuaranteeFromOwnFunds = null;
private String minimumGuaranteeFromGuarantor = null;
private String isArrearsBasedOnOriginalSchedule = null;
private String graceOnPrincipalPayment = "1";
private String graceOnInterestPayment = "1";
private String graceOnPrincipalPayment = null;
private String graceOnInterestPayment = null;
private JsonObject allowAttributeOverrides = null;
private Boolean allowPartialPeriodInterestCalcualtion = false;
@@ -1368,8 +1368,8 @@ public class InitiateExternalAssetOwnerTransferTest extends BaseLoanIntegrationT
.withLoanTermFrequencyAsMonths().withNumberOfRepayments("4").withRepaymentEveryAfter("1")
.withRepaymentFrequencyTypeAsMonths().withInterestRatePerPeriod("2").withAmortizationTypeAsEqualInstallments()
.withInterestTypeAsDecliningBalance().withInterestCalculationPeriodTypeSameAsRepaymentPeriod()
.withExpectedDisbursementDate(date).withSubmittedOnDate(date).withCollaterals(collaterals)
.build(clientID, loanProductID, null);
.withExpectedDisbursementDate(date).withSubmittedOnDate(date).withCollaterals(collaterals).withInArrearsTolerance("0")
.withPrincipalGrace("0").withInterestGrace("0").build(clientID, loanProductID, null);
return LOAN_TRANSACTION_HELPER.getLoanId(loanApplicationJSON);
}