jdailey commented on code in PR #3873:
URL: https://github.com/apache/fineract/pull/3873#discussion_r1574962002


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationLoanRepaymentScheduleTest.java:
##########
@@ -4011,6 +4011,46 @@ 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", () -> {
+            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:
   Are there clear tests for this?  I think we cannot have ambiguous rounding 
results so tests need to capture what is expected @alberto-art3ch .  



-- 
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]

Reply via email to