adamsaghy commented on code in PR #2519:
URL: https://github.com/apache/fineract/pull/2519#discussion_r976091880


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/LoanApplicationTerms.java:
##########
@@ -1702,6 +1588,18 @@ public Money getTotalDisbursedAmount() {
         return disbursedAmount;
     }
 
+    public Money getTotalMultiDisbursedAmount() {
+        Money disbursedAmount = Money.zero(getCurrency());
+        if (isMultiDisburseLoan()) {
+            for (DisbursementData disbursement : getDisbursementDatas()) {
+                disbursedAmount = 
disbursedAmount.plus(disbursement.getPrincipal());

Review Comment:
   @josehernandezfintecheandomx Do we need to consider here the "not yet" 
disbursement details as well?
   Many other places the disbursement details are filtered by whether they got 
already disbursed or it is just expected yet (actualDisbursementDate = null). 
What do you think?



##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanDisbursementDetailsIntegrationTest.java:
##########
@@ -483,4 +473,24 @@ private HashMap<String, String> collaterals(Integer 
collateralId, BigDecimal qua
         return collateral;
     }
 
+    public void 
evaluateEqualInstallmentsForRepaymentSchedule(GetLoansLoanIdRepaymentSchedule 
getLoanRepaymentSchedule, Double limit) {
+        Double totalOutstandingForPeriod = 0.0;
+        Double totalInstallmentAmountForPeriod = 0.0;
+        if (getLoanRepaymentSchedule != null) {
+            log.info("Loan with {} periods", 
getLoanRepaymentSchedule.getPeriods().size());
+            for (GetLoansLoanIdRepaymentPeriod period : 
getLoanRepaymentSchedule.getPeriods()) {
+                if (period.getPeriod() != null) {
+                    log.info("Period number {} for due date {} and outstanding 
{} {}", period.getPeriod(), period.getDueDate(),
+                            period.getTotalOutstandingForPeriod(), 
period.getTotalInstallmentAmountForPeriod());
+                    if (period.getPeriod() == 1) {
+                        totalOutstandingForPeriod = 
period.getTotalOutstandingForPeriod();
+                        totalInstallmentAmountForPeriod = 
period.getTotalInstallmentAmountForPeriod();
+                    } else {
+                        
assertTrue(Math.abs(period.getTotalOutstandingForPeriod() - 
totalOutstandingForPeriod) <= limit);

Review Comment:
   @josehernandezfintecheandomx Can you help me to understand why do we need 
"limit" to be introduced? In my understanding if we are testing whether the 
instalment amounts are equal or not... if there is any fractions still it 
should remains +-1, no?



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