adamsaghy commented on code in PR #3873:
URL: https://github.com/apache/fineract/pull/3873#discussion_r1579211157
##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationLoanRepaymentScheduleTest.java:
##########
@@ -4011,6 +4012,55 @@ public void uc135() {
});
}
+ // UC136: Advanced payment allocation, using auto downpayment with
installment amount in multiples of 1
+ // ADVANCED_PAYMENT_ALLOCATION_STRATEGY
+ // 1. Create a Loan product with Adv. Pment. Alloc.
+ // 2. Submit Loan and approve
+ // 3. Disburse the loan and validate downpayment
+ @Test
+ public void uc136() {
+ AtomicLong createdLoanId = new AtomicLong();
+ runAt("23 March 2024", () -> {
+ // Rounding mode - HALF_DOWN
+
GlobalConfigurationHelper.updateValueForGlobalConfigurationInternal(requestSpec,
responseSpec, "23", 5);
+ createLoanForRoundingMethodValidation();
+
+ // Rounding mode - HALF_EVEN Default
+
GlobalConfigurationHelper.updateValueForGlobalConfigurationInternal(requestSpec,
responseSpec, "23", 6);
+ createLoanForRoundingMethodValidation();
+ });
+ }
+
+ private void createLoanForRoundingMethodValidation() {
+ PostLoanProductsRequest product =
createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
+
.installmentAmountInMultiplesOf(null).numberOfRepayments(3).repaymentEvery(15).enableDownPayment(true)
+
.enableAutoRepaymentForDownPayment(true).disbursedAmountPercentageForDownPayment(BigDecimal.valueOf(25)).minPrincipal(10.0)
+ .installmentAmountInMultiplesOf(1);
+ PostLoanProductsResponse loanProductResponse =
loanProductHelper.createLoanProduct(product);
+ PostLoansRequest applicationRequest =
applyLoanRequest(client.getClientId(), loanProductResponse.getResourceId(), "23
March 2024",
+ 10.0, 4);
+
+ applicationRequest =
applicationRequest.numberOfRepayments(3).loanTermFrequency(45)
+
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY).repaymentEvery(15);
+
+ PostLoansResponse loanResponse =
loanTransactionHelper.applyLoan(applicationRequest);
+
+ loanTransactionHelper.approveLoan(loanResponse.getLoanId(), new
PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(10))
+ .dateFormat(DATETIME_PATTERN).approvedOnDate("23 March
2024").locale("en"));
+
+ loanTransactionHelper.disburseLoan(loanResponse.getLoanId(), new
PostLoansLoanIdRequest().actualDisbursementDate("23 March 2024")
+
.dateFormat(DATETIME_PATTERN).transactionAmount(BigDecimal.valueOf(10.0)).locale("en"));
+
+ // verify schedule
+ verifyRepaymentSchedule(loanResponse.getLoanId(), //
+ installment(10, null, "23 March 2024"), //
+ installment(3, 0, 0, 0, 0.0, true, "23 March 2024", 7), //
Review Comment:
How can the down payment installment be 3 with HALF_DOWN rounding where 10 /
4 = 2.5 ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]