diff --git a/custom/acme/note/service/src/main/java/com/acme/fineract/portfolio/note/service/AcmeNoteWritePlatformService.java b/custom/acme/note/service/src/main/java/com/acme/fineract/portfolio/note/service/AcmeNoteWritePlatformService.java index 14b194f20..80849842f 100644 --- a/custom/acme/note/service/src/main/java/com/acme/fineract/portfolio/note/service/AcmeNoteWritePlatformService.java +++ b/custom/acme/note/service/src/main/java/com/acme/fineract/portfolio/note/service/AcmeNoteWritePlatformService.java @@ -43,8 +43,8 @@ public class AcmeNoteWritePlatformService implements NoteWritePlatformService, I } @Override - public void createLoanTransactionNote(Long loanTransactionId, String note) { - throw new UnsupportedOperationException("createLoanTransactionNote() is not yet implemented."); + public void createLoanNote(Long loanId, String note) { + throw new UnsupportedOperationException("createLoanNote() is not yet implemented."); } @Override diff --git a/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/DateUtils.java b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/DateUtils.java index bdf4957a8..ac6320aff 100644 --- a/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/DateUtils.java +++ b/fineract-core/src/main/java/org/apache/fineract/infrastructure/core/service/DateUtils.java @@ -310,12 +310,6 @@ public final class DateUtils { return isBeforeBusinessDate(localDate); } - public static boolean isDateInRangeFromInclusiveToExclusive(final LocalDate fromInclusive, final LocalDate upToNotInclusive, - final LocalDate target) { - return (DateUtils.isEqual(target, fromInclusive) || DateUtils.isAfter(target, fromInclusive)) - && DateUtils.isBefore(target, upToNotInclusive); - } - public static int compare(LocalDate first, LocalDate second) { return compare(first, second, true); } diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformService.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformService.java index 1d8afbd1f..7ec9177ce 100644 --- a/fineract-core/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformService.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformService.java @@ -26,7 +26,7 @@ public interface NoteWritePlatformService { CommandProcessingResult createNote(JsonCommand command); - void createLoanTransactionNote(Long loanTransactionId, String note); + void createLoanNote(Long loanId, String note); CommandProcessingResult updateNote(JsonCommand command); diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java index ca35080a0..cec77bc30 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/messaging/event/EventCheckHelper.java @@ -420,8 +420,8 @@ public class EventCheckHelper { .getGlobalConfiguration("outstanding-interest-calculation-strategy-for-external-asset-transfer"); if ("PAYABLE_OUTSTANDING_INTEREST".equals(outstandingInterestStrategy.getStringValue())) { Response loanDetails = loansApi.retrieveLoan(loanId, false, "all", null, null).execute(); - totalOutstandingBalanceAmountExpected = loanDetails.body().getSummary().getTotalOutstanding(); - outstandingInterestPortionExpected = loanDetails.body().getSummary().getInterestOutstanding(); + totalOutstandingBalanceAmountExpected = zeroConversion(loanDetails.body().getSummary().getTotalOutstanding()); + outstandingInterestPortionExpected = zeroConversion(loanDetails.body().getSummary().getInterestOutstanding()); } String ownerExternalIdExpected = filtered.getStatus().getValue().equals("BUYBACK") ? null : filtered.getOwner().getExternalId(); diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java index 0c0c2ebfe..2f83359e2 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanDelinquencyStepDef.java @@ -59,6 +59,7 @@ import org.apache.fineract.test.data.LoanStatus; import org.apache.fineract.test.helper.ErrorHelper; import org.apache.fineract.test.helper.ErrorMessageHelper; import org.apache.fineract.test.helper.ErrorResponse; +import org.apache.fineract.test.helper.Utils; import org.apache.fineract.test.messaging.EventAssertion; import org.apache.fineract.test.messaging.event.EventCheckHelper; import org.apache.fineract.test.messaging.event.loan.delinquency.LoanDelinquencyRangeChangeEvent; @@ -538,7 +539,9 @@ public class LoanDelinquencyStepDef extends AbstractStepDef { String actualDelinquencyRangeValue = loanDetails.body().getDelinquencyRange() == null ? "NO_DELINQUENCY" : loanDetails.body().getDelinquencyRange().getClassification(); GetLoansLoanIdDelinquencySummary delinquent = loanDetails.body().getDelinquent(); - List actualValuesList = List.of(actualDelinquencyRangeValue, delinquent.getDelinquentAmount().toString(), + String delinquentAmount = delinquent.getDelinquentAmount() == null ? null + : new Utils.DoubleFormatter(delinquent.getDelinquentAmount().doubleValue()).format(); + List actualValuesList = List.of(actualDelinquencyRangeValue, delinquentAmount, delinquent.getDelinquentDate() == null ? "null" : FORMATTER.format(delinquent.getDelinquentDate()), delinquent.getDelinquentDays().toString(), delinquent.getPastDueDays().toString()); diff --git a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java index 18e49028f..28f234405 100644 --- a/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java +++ b/fineract-e2e-tests-core/src/test/java/org/apache/fineract/test/stepdef/loan/LoanStepDef.java @@ -1121,9 +1121,11 @@ public class LoanStepDef extends AbstractStepDef { ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); GetLoansLoanIdDelinquencySummary delinquent = loanDetailsResponse.body().getDelinquent(); - String lastPaymentAmountActual = new Utils.DoubleFormatter(delinquent.getLastPaymentAmount().doubleValue()).format(); + String lastPaymentAmountActual = delinquent.getLastPaymentAmount() == null ? null + : new Utils.DoubleFormatter(delinquent.getLastPaymentAmount().doubleValue()).format(); String lastPaymentDateActual = FORMATTER.format(delinquent.getLastPaymentDate()); - String lastRepaymentAmountActual = new Utils.DoubleFormatter(delinquent.getLastRepaymentAmount().doubleValue()).format(); + String lastRepaymentAmountActual = delinquent.getLastRepaymentAmount() == null ? null + : new Utils.DoubleFormatter(delinquent.getLastRepaymentAmount().doubleValue()).format(); String lastRepaymentDateActual = FORMATTER.format(delinquent.getLastRepaymentDate()); assertThat(lastPaymentAmountActual) @@ -1163,7 +1165,8 @@ public class LoanStepDef extends AbstractStepDef { String amountEventActual = loanChargePaidByListEvent.get(i).getAmount().setScale(1, RoundingMode.HALF_DOWN).toString(); String nameEventActual = loanChargePaidByListEvent.get(i).getName(); - String amountActual = String.valueOf(loanChargePaidByList.get(i).getAmount()); + String amountActual = loanChargePaidByList.get(i).getAmount() == null ? null + : new Utils.DoubleFormatter(loanChargePaidByList.get(i).getAmount().doubleValue()).format(); String nameActual = loanChargePaidByList.get(i).getName(); String amountExpected = data.get(i + 1).get(0); @@ -2682,9 +2685,11 @@ public class LoanStepDef extends AbstractStepDef { ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse); GetLoansLoanIdDelinquencySummary delinquent = loanDetailsResponse.body().getDelinquent(); - String lastPaymentAmountActual = new Utils.DoubleFormatter(delinquent.getLastPaymentAmount().doubleValue()).format(); + String lastPaymentAmountActual = delinquent.getLastPaymentAmount() == null ? null + : new Utils.DoubleFormatter(delinquent.getLastPaymentAmount().doubleValue()).format(); String lastPaymentDateActual = FORMATTER.format(delinquent.getLastPaymentDate()); - String lastRepaymentAmountActual = new Utils.DoubleFormatter(delinquent.getLastRepaymentAmount().doubleValue()).format(); + String lastRepaymentAmountActual = delinquent.getLastRepaymentAmount() == null ? null + : new Utils.DoubleFormatter(delinquent.getLastRepaymentAmount().doubleValue()).format(); String lastRepaymentDateActual = FORMATTER.format(delinquent.getLastRepaymentDate()); assertThat(lastPaymentAmountActual) @@ -3857,8 +3862,8 @@ public class LoanStepDef extends AbstractStepDef { actualValues.add(emiVariation.getTermType().getValue() == null ? null : emiVariation.getTermType().getValue()); case "Applicable From" -> actualValues.add(emiVariation.getTermVariationApplicableFrom() == null ? null : FORMATTER.format(emiVariation.getTermVariationApplicableFrom())); - case "Decimal Value" -> - actualValues.add(emiVariation.getDecimalValue() == null ? null : new Utils.DoubleFormatter(emiVariation.getDecimalValue().doubleValue()).format()); + case "Decimal Value" -> actualValues.add(emiVariation.getDecimalValue() == null ? null + : new Utils.DoubleFormatter(emiVariation.getDecimalValue().doubleValue()).format()); case "Date Value" -> actualValues.add(emiVariation.getDateValue() == null ? null : FORMATTER.format(emiVariation.getDateValue())); case "Is Specific To Installment" -> actualValues.add(String.valueOf(emiVariation.getIsSpecificToInstallment())); diff --git a/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature b/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature index b5c497490..4fb32bd2a 100644 --- a/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature +++ b/fineract-e2e-tests-runner/src/test/resources/features/LoanCapitalizedIncome.feature @@ -5,7 +5,7 @@ Feature: Capitalized Income Scenario: As a user I want to add capitalized income to a progressive loan after disbursement for multidisbursal loan with downpayment - UC1 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_CAPITALIZED_INCOME | 1 January 2024 | 1000.0 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -13,21 +13,12 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 2 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 0 | 01 January 2024 | 01 January 2024 | 675.0 | 225.0 | 0.0 | 0.0 | 0.0 | 225.0 | 225.0 | 0.0 | 0.0 | 0.0 | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 2 | 30 | 31 January 2024 | | 0.0 | 775.0 | 0.0 | 0.0 | 0.0 | 775.0 | 0.0 | 0.0 | 0.0 | 775.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 0.0 | 0.0 | 0.0 | 1000.0 | 225.0 | 0.0 | 0.0 | 775.0 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 01 January 2024 | Down Payment | 225.0 | 225.0 | 0.0 | 0.0 | 0.0 | 675.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 775.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | @@ -36,7 +27,7 @@ Feature: Capitalized Income Scenario: As a user I want to add capitalized income to a progressive loan after disbursement - UC2 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -44,19 +35,11 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | @@ -75,26 +58,12 @@ Feature: Capitalized Income And Admin successfully disburse the loan on "2 January 2024" with "200" EUR transaction amount When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "3 January 2024" with "200" EUR transaction amount - Then Loan Repayment schedule has 6 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 03 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 835.65 | 164.35 | 5.72 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 2 | 29 | 01 March 2024 | | 670.45 | 165.2 | 4.87 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 3 | 31 | 01 April 2024 | | 504.29 | 166.16 | 3.91 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 4 | 30 | 01 May 2024 | | 337.16 | 167.13 | 2.94 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 5 | 31 | 01 June 2024 | | 169.06 | 168.1 | 1.97 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 6 | 30 | 01 July 2024 | | 0.0 | 169.06 | 0.99 | 0.0 | 0.0 | 170.05 | 0.0 | 0.0 | 0.0 | 170.05 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 20.4 | 0.0 | 0.0 | 1020.4 | 0.0 | 0.0 | 0.0 | 1020.4 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | | 02 January 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 800.0 | false | | 03 January 2024 | Capitalized Income | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "03 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "03 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 200.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 200.0 | @@ -103,7 +72,7 @@ Feature: Capitalized Income Scenario: Verify validation of capitalized income amount with disbursement amount within approved amount for progressive loan - UC4 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -116,7 +85,7 @@ Feature: Capitalized Income Scenario: Verify validation of capitalized income amount with disbursement amount within approved amount for multidisbursal progressive loan - UC5 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_CAPITALIZED_INCOME | 1 January 2024 | 1000.0 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 30 | DAYS | 30 | DAYS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -130,7 +99,7 @@ Feature: Capitalized Income Scenario: Verify validation of capitalized income amount with disbursement amount within approved amount after undo disbursement - UC6 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -138,19 +107,11 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | @@ -159,19 +120,11 @@ Feature: Capitalized Income When Admin sets the business date to "3 January 2024" And Admin successfully disburse the loan on "3 January 2024" with "800" EUR transaction amount And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "3 January 2024" with "200" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 03 January 2024 | | 800.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 03 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 03 February 2024 | | 0.0 | 1000.0 | 5.83 | 0.0 | 0.0 | 1005.83 | 0.0 | 0.0 | 0.0 | 1005.83 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.83 | 0.0 | 0.0 | 1005.83 | 0.0 | 0.0 | 0.0 | 1005.83 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 03 January 2024 | Disbursement | 800.0 | 0.0 | 0.0 | 0.0 | 0.0 | 800.0 | false | | 03 January 2024 | Capitalized Income | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "03 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "03 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 200.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 200.0 | @@ -180,7 +133,7 @@ Feature: Capitalized Income Scenario: Verify capitalized income amount with disbursement amount calculation within approved amount amount for multidisbursal loan after undo disbursement - UC7 When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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 | charge calculation type | charge amount % | | LP2_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_MULTIDISBURSAL_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 6 | MONTHS | 1 | MONTHS | 6 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | LOAN_DISBURSEMENT_CHARGE | 2 | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -189,26 +142,12 @@ Feature: Capitalized Income When Admin sets the business date to "2 January 2024" And Admin successfully disburse the loan on "2 January 2024" with "200" EUR transaction amount And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "200" EUR transaction amount - Then Loan Repayment schedule has 6 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 600.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 835.69 | 164.31 | 5.76 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 2 | 29 | 01 March 2024 | | 670.49 | 165.2 | 4.87 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 3 | 31 | 01 April 2024 | | 504.33 | 166.16 | 3.91 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 4 | 30 | 01 May 2024 | | 337.2 | 167.13 | 2.94 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 5 | 31 | 01 June 2024 | | 169.1 | 168.1 | 1.97 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 6 | 30 | 01 July 2024 | | 0.0 | 169.1 | 0.99 | 0.0 | 0.0 | 170.09 | 0.0 | 0.0 | 0.0 | 170.09 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 20.44 | 0.0 | 0.0 | 1020.44 | 0.0 | 0.0 | 0.0 | 1020.44 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 600.0 | 0.0 | 0.0 | 0.0 | 0.0 | 600.0 | false | | 02 January 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 800.0 | false | | 02 January 2024 | Capitalized Income | 200.0 | 200.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 200.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 200.0 | @@ -216,29 +155,15 @@ Feature: Capitalized Income Then Loan status will be "APPROVED" When Admin sets the business date to "3 January 2024" And Admin successfully disburse the loan on "3 January 2024" with "500" EUR transaction amount - And Admin sets the business date to "4 January 2024" + When Admin sets the business date to "4 January 2024" And Admin successfully disburse the loan on "4 January 2024" with "200" EUR transaction amount And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "4 January 2024" with "300" EUR transaction amount - Then Loan Repayment schedule has 6 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 03 January 2024 | | 500.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 04 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 04 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 03 February 2024 | | 835.67 | 164.33 | 5.74 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 2 | 29 | 03 March 2024 | | 670.47 | 165.2 | 4.87 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 3 | 31 | 03 April 2024 | | 504.31 | 166.16 | 3.91 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 4 | 30 | 03 May 2024 | | 337.18 | 167.13 | 2.94 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 5 | 31 | 03 June 2024 | | 169.08 | 168.1 | 1.97 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - | 6 | 30 | 03 July 2024 | | 0.0 | 169.08 | 0.99 | 0.0 | 0.0 | 170.07 | 0.0 | 0.0 | 0.0 | 170.07 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 20.42 | 0.0 | 0.0 | 1020.42 | 0.0 | 0.0 | 0.0 | 1020.42 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 03 January 2024 | Disbursement | 500.0 | 0.0 | 0.0 | 0.0 | 0.0 | 500.0 | false | | 04 January 2024 | Disbursement | 200.0 | 0.0 | 0.0 | 0.0 | 0.0 | 700.0 | false | | 04 January 2024 | Capitalized Income | 300.0 | 300.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "04 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "04 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 300.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 300.0 | @@ -247,7 +172,7 @@ Feature: Capitalized Income Scenario: As a user I want to add capitalized income to a progressive loan after disbursement and then make a full repayment - amortization in case of loan close event When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -255,49 +180,33 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | - When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "2 January 2024" with 1000.17 EUR transaction amount and system-generated Idempotency key - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 02 January 2024 | 0.0 | 1000.0 | 0.17 | 0.0 | 0.0 | 1000.17 | 1000.17 | 1000.17 | 0.0 | 0.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 0.17 | 0.0 | 0.0 | 1000.17 | 1000.17 | 1000.17 | 0.0 | 0.0 | - And Loan Transactions tab has the following data: + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "2 January 2024" with 900.17 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 02 January 2024 | Repayment | 1000.17| 1000.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | + | 02 January 2024 | Repayment | 900.17 | 900.0 | 0.17 | 0.0 | 0.0 | 100.0 | false | | 02 January 2024 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | | 02 January 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404000 | Interest Income | | 100.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 100.0 | | - And LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent is raised on "02 January 2024" + Then LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent is raised on "02 January 2024" @TestRailId:C3647 Scenario: As a user I want to add capitalized income to a progressive loan after disbursement and then overpay loan - amortization in case of loan close event When Admin sets the business date to "1 January 2024" And Admin creates a client with random data - And Admin creates a fully customized loan with the following data: + When 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 1000 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | And Admin successfully approves the loan on "1 January 2024" with "1000" amount and expected disbursement date on "1 January 2024" @@ -305,43 +214,27 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Transactions tab has the following data: + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | ASSET | 112601 | Loans Receivable | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | - When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "2 January 2024" with 1100 EUR transaction amount and system-generated Idempotency key - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 02 January 2024 | 0.0 | 1000.0 | 0.17 | 0.0 | 0.0 | 1000.17 | 1000.17 | 1000.17 | 0.0 | 0.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 0.17 | 0.0 | 0.0 | 1000.17 | 1000.17 | 1000.17 | 0.0 | 0.0 | - And Loan Transactions tab has the following data: + When Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "2 January 2024" with 1000 EUR transaction amount and system-generated Idempotency key + Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 02 January 2024 | Repayment | 1100.0 | 1000.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | + | 02 January 2024 | Repayment | 1000.0 | 900.0 | 0.17 | 0.0 | 0.0 | 100.0 | false | | 02 January 2024 | Accrual | 0.17 | 0.0 | 0.17 | 0.0 | 0.0 | 0.0 | false | | 02 January 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries: + Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | INCOME | 404000 | Interest Income | | 100.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 100.0 | | - And LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent is raised on "02 January 2024" + Then LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent is raised on "02 January 2024" @TestRailId:C3651 Scenario: As a user I want to add capitalized income to a progressive loan after disbursement and then write off loan - amortization in case of loan close event @@ -355,14 +248,6 @@ Feature: Capitalized Income Then Loan status will be "ACTIVE" When Admin sets the business date to "2 January 2024" And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "2 January 2024" with "100" EUR transaction amount - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 1005.81 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | @@ -373,19 +258,11 @@ Feature: Capitalized Income | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | And Admin does write-off the loan on "02 January 2024" Then Loan status will be "CLOSED_WRITTEN_OFF" - Then Loan Repayment schedule has 1 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 900.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 02 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 02 January 2024 | 0.0 | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 0.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 1000.0 | 5.81 | 0.0 | 0.0 | 1005.81 | 0.0 | 0.0 | 0.0 | 0.0 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 02 January 2024 | Close (as written-off) | 1005.81| 1000.0 | 5.81 | 0.0 | 0.0 | 0.0 | false | + | 02 January 2024 | Close (as written-off) | 905.25 | 900.0 | 5.25 | 0.0 | 0.0 | 100.0 | false | | 02 January 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "02 January 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -404,16 +281,6 @@ Feature: Capitalized Income And Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "01 January 2024" with "50" EUR transaction amount Then Loan status will be "ACTIVE" - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | @@ -424,52 +291,12 @@ Feature: Capitalized Income | ASSET | 112601 | Loans Receivable | 50.0 | | When Admin sets the business date to "02 January 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Admin sets the business date to "01 February 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | When Admin sets the business date to "01 March 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Admin sets the business date to "01 April 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | @@ -584,16 +411,6 @@ Feature: Capitalized Income And Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "01 January 2024" with "50" EUR transaction amount Then Loan status will be "ACTIVE" - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | @@ -604,52 +421,12 @@ Feature: Capitalized Income | ASSET | 112601 | Loans Receivable | 50.0 | | When Admin sets the business date to "02 January 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Admin sets the business date to "01 February 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | When Admin sets the business date to "01 March 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | And Admin sets the business date to "01 April 2024" And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 2 | 29 | 01 March 2024 | | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | 0.0 | 0.0 | 0.0 | 50.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | 0.0 | 0.0 | 0.0 | 150.0 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | @@ -778,16 +555,16 @@ Feature: Capitalized Income And Admin does charge-off the loan with reason "DELINQUENT" on "03 February 2024" Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | - | ASSET | 112601 | Loans Receivable | | 1000.0 | - | ASSET | 112603 | Interest/Fee Receivable | | 4.58 | - | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0| | - | INCOME | 404001 | Interest Income Charge Off | 4.58 | | + | ASSET | 112601 | Loans Receivable | | 900.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 4.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 900.0 | | + | INCOME | 404001 | Interest Income Charge Off | 4.0 | | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 03 February 2024 | Accrual | 4.58 | 0.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | - | 03 February 2024 | Charge-off | 1004.58| 1000.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Accrual | 4.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Charge-off | 904.0 | 900.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | | 03 February 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -820,16 +597,16 @@ Feature: Capitalized Income And Admin does charge-off the loan on "03 February 2024" Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | - | ASSET | 112601 | Loans Receivable | | 1000.0 | - | ASSET | 112603 | Interest/Fee Receivable | | 4.58 | - | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 1000.0| | - | INCOME | 404001 | Interest Income Charge Off | 4.58 | | + | ASSET | 112601 | Loans Receivable | | 900.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 4.0 | + | EXPENSE | 744037 | Credit Loss/Bad Debt-Fraud | 900.0 | | + | INCOME | 404001 | Interest Income Charge Off | 4.0 | | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 03 February 2024 | Accrual | 4.58 | 0.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | - | 03 February 2024 | Charge-off | 1004.58| 1000.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Accrual | 4.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Charge-off | 904.0 | 900.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | | 03 February 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -862,16 +639,16 @@ Feature: Capitalized Income And Admin does charge-off the loan with reason "DELINQUENT" on "03 February 2024" Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | - | ASSET | 112601 | Loans Receivable | | 1000.0 | - | ASSET | 112603 | Interest/Fee Receivable | | 4.58 | - | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0| | - | INCOME | 404001 | Interest Income Charge Off | 4.58 | | + | ASSET | 112601 | Loans Receivable | | 900.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 4.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 900.0 | | + | INCOME | 404001 | Interest Income Charge Off | 4.0 | | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 03 February 2024 | Accrual | 4.58 | 0.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | - | 03 February 2024 | Charge-off | 1004.58| 1000.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Accrual | 4.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Charge-off | 904.0 | 900.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | | 03 February 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -904,16 +681,16 @@ Feature: Capitalized Income And Admin does charge-off the loan with reason "DELINQUENT" on "03 February 2024" Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | - | ASSET | 112601 | Loans Receivable | | 1000.0 | - | ASSET | 112603 | Interest/Fee Receivable | | 4.58 | - | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0| | - | INCOME | 404001 | Interest Income Charge Off | 4.58 | | + | ASSET | 112601 | Loans Receivable | | 900.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 4.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 900.0 | | + | INCOME | 404001 | Interest Income Charge Off | 4.0 | | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 03 February 2024 | Accrual | 4.58 | 0.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | - | 03 February 2024 | Charge-off | 1004.58| 1000.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Accrual | 4.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Charge-off | 904.0 | 900.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | | 03 February 2024 | Capitalized Income Amortization | 100.0 | 0.0 | 100.0 | 0.0 | 0.0 | 0.0 | false | Then Loan Transactions tab has a "CAPITALIZED_INCOME_AMORTIZATION" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | @@ -923,989 +700,23 @@ Feature: Capitalized Income Then Admin does a charge-off undo the loan Then Loan Transactions tab has a "CHARGE_OFF" transaction with date "03 February 2024" which has the following Journal entries: | Type | Account code | Account name | Debit | Credit | - | ASSET | 112601 | Loans Receivable | | 1000.0 | - | ASSET | 112603 | Interest/Fee Receivable | | 4.58 | - | EXPENSE | 744007 | Credit Loss/Bad Debt | 1000.0| | - | INCOME | 404001 | Interest Income Charge Off | 4.58 | | - | ASSET | 112601 | Loans Receivable | 1000.0| | - | ASSET | 112603 | Interest/Fee Receivable | 4.58 | | - | EXPENSE | 744007 | Credit Loss/Bad Debt | | 1000.0 | - | INCOME | 404001 | Interest Income Charge Off | | 4.58 | + | ASSET | 112601 | Loans Receivable | | 900.0 | + | ASSET | 112603 | Interest/Fee Receivable | | 4.0 | + | EXPENSE | 744007 | Credit Loss/Bad Debt | 900.0 | | + | INCOME | 404001 | Interest Income Charge Off | 4.0 | | + | ASSET | 112601 | Loans Receivable | 900.0 | | + | ASSET | 112603 | Interest/Fee Receivable | 4.0 | | + | EXPENSE | 744007 | Credit Loss/Bad Debt | | 900.0 | + | INCOME | 404001 | Interest Income Charge Off | | 4.0 | Then Loan Transactions tab has the following data: | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | | 01 January 2024 | Disbursement | 900.0 | 0.0 | 0.0 | 0.0 | 0.0 | 900.0 | false | | 02 January 2024 | Capitalized Income | 100.0 | 100.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | - | 03 February 2024 | Accrual | 4.58 | 0.0 | 4.58 | 0.0 | 0.0 | 0.0 | false | - | 03 February 2024 | Charge-off | 1004.58| 1000.0 | 4.58 | 0.0 | 0.0 | 0.0 | true | + | 03 February 2024 | Accrual | 4.0 | 0.0 | 4.0 | 0.0 | 0.0 | 0.0 | false | + | 03 February 2024 | Charge-off | 904.0 | 900.0 | 4.0 | 0.0 | 0.0 | 0.0 | true | Then Reversed loan capitalized income amortization transaction has the following Journal entries: | Type | Account code | Account name | Debit | Credit | | EXPENSE | 744007 | Credit Loss/Bad Debt | | 100.0 | | LIABILITY | 145024 | Deferred Capitalized Income | 100.0 | | | EXPENSE | 744007 | Credit Loss/Bad Debt | 100.0 | | | LIABILITY | 145024 | Deferred Capitalized Income | | 100.0 | - - @TestRailId:C3673 - Scenario: Verify capitalized income: repayment schedule - UC1: Simple loan - full payment - When Admin sets the business date to "01 January 2024" - 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 200 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "01 January 2024" with "200" amount and expected disbursement date on "01 January 2024" - And Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount - And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "01 January 2024" with "50" EUR transaction amount - Then Loan status will be "ACTIVE" - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "01 January 2024" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | - | ASSET | 112601 | Loans Receivable | 50.0 | | - When Admin sets the business date to "02 January 2024" - And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 0.0 | 0.0 | 0.0 | 151.75 | -# --- First repayment --- - When Admin sets the business date to "01 February 2024" - And Admin runs inline COB job for Loan - And Customer makes "AUTOPAY" repayment on "01 February 2024" with 50.58 EUR transaction amount - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 50.58 | 0.0 | 0.0 | 101.17 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | -# --- Second repayment --- - When Admin sets the business date to "01 March 2024" - And Admin runs inline COB job for Loan - And Customer makes "AUTOPAY" repayment on "01 March 2024" with 50.58 EUR transaction amount - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | 01 March 2024 | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 101.16 | 0.0 | 0.0 | 50.59 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | - | 01 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Repayment | 50.58 | 49.99 | 0.59 | 0.0 | 0.0 | 50.3 | false | false | -# --- Third repayment --- - And Admin sets the business date to "01 April 2024" - And Admin runs inline COB job for Loan - And Customer makes "AUTOPAY" repayment on "01 April 2024" with 50.59 EUR transaction amount - Then Loan status will be "CLOSED_OBLIGATIONS_MET" - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | 01 March 2024 | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 3 | 31 | 01 April 2024 | 01 April 2024 | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 50.59 | 0.0 | 0.0 | 0.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 151.75 | 0.0 | 0.0 | 0.0 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | - | 01 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - - | 01 March 2024 | Repayment | 50.58 | 49.99 | 0.59 | 0.0 | 0.0 | 50.3 | false | false | - | 01 March 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 02 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 03 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 04 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 05 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 06 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 07 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 08 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 09 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 10 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 12 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 13 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 14 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 15 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 16 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 17 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 18 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 19 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 20 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 21 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 22 March 2024 | Capitalized Income Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false | false | - | 23 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 23 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 24 March 2024 | Capitalized Income Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false | false | - | 25 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 25 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 26 March 2024 | Capitalized Income Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false | false | - | 27 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 27 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 28 March 2024 | Capitalized Income Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false | false | - | 29 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 29 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 March 2024 | Capitalized Income Amortization | 0.54 | 0.0 | 0.54 | 0.0 | 0.0 | 0.0 | false | false | - | 31 March 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - | 31 March 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 April 2024 | Repayment | 50.59 | 50.3 | 0.29 | 0.0 | 0.0 | 0.0 | false | false | - | 01 April 2024 | Accrual | 0.01 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | false | false | - - @TestRailId:C3674 - Scenario: Verify capitalized income: repayment schedule - UC2: loan - early payoff - When Admin sets the business date to "01 January 2024" - 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 200 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "01 January 2024" with "200" amount and expected disbursement date on "01 January 2024" - And Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount - And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "01 January 2024" with "50" EUR transaction amount - Then Loan status will be "ACTIVE" - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "01 January 2024" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | - | ASSET | 112601 | Loans Receivable | 50.0 | | - When Admin sets the business date to "02 January 2024" - And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 0.0 | 0.0 | 0.0 | 151.75 | -# --- First repayment --- - When Admin sets the business date to "01 February 2024" - And Admin runs inline COB job for Loan - And Customer makes "AUTOPAY" repayment on "01 February 2024" with 50.58 EUR transaction amount - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 50.58 | 0.0 | 0.0 | 101.17 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | -# --- Early pay-off --- - When Admin sets the business date to "01 March 2024" - And Admin runs inline COB job for Loan - And Loan Pay-off is made on "01 March 2024" - Then Loan status will be "CLOSED_OBLIGATIONS_MET" - And Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | 01 March 2024 | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 3 | 31 | 01 April 2024 | 01 March 2024 | 0.0 | 50.3 | 0.0 | 0.0 | 0.0 | 50.3 | 50.3 | 50.3 | 0.0 | 0.0 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.46 | 0.0 | 0.0 | 151.46 | 151.46 | 50.3 | 0.0 | 0.0 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | - | 01 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Repayment | 100.88 | 100.29 | 0.59 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Capitalized Income Amortization | 17.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | false | false | - - @TestRailId:C3675 - Scenario: Verify capitalized income: repayment schedule - UC3: loan - charge-off - When Admin sets the business date to "01 January 2024" - 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_ADV_PYMNT_INTEREST_DAILY_EMI_360_30_INTEREST_RECALC_DAILY_CAPITALIZED_INCOME | 01 January 2024 | 200 | 7 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION | - And Admin successfully approves the loan on "01 January 2024" with "200" amount and expected disbursement date on "01 January 2024" - And Admin successfully disburse the loan on "01 January 2024" with "100" EUR transaction amount - And Admin adds capitalized income with "AUTOPAY" payment type to the loan on "01 January 2024" with "50" EUR transaction amount - Then Loan status will be "ACTIVE" - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - And Loan Transactions tab has a "CAPITALIZED_INCOME" transaction with date "01 January 2024" which has the following Journal entries: - | Type | Account code | Account name | Debit | Credit | - | LIABILITY | 145024 | Deferred Capitalized Income | | 50.0 | - | ASSET | 112601 | Loans Receivable | 50.0 | | - When Admin sets the business date to "02 January 2024" - And Admin runs inline COB job for Loan - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 0.0 | 0.0 | 0.0 | 151.75 | -# --- First repayment --- - When Admin sets the business date to "01 February 2024" - And Admin runs inline COB job for Loan - And Customer makes "AUTOPAY" repayment on "01 February 2024" with 50.58 EUR transaction amount - Then Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 50.58 | 0.0 | 0.0 | 101.17 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | -# --- Charge off --- - When Admin sets the business date to "01 March 2024" - And Admin runs inline COB job for Loan - And Admin does charge-off the loan on "01 March 2024" - Then Loan status will be "ACTIVE" - And Loan Repayment schedule has 3 periods, with the following data for periods: - | Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | | | 01 January 2024 | | 50.0 | | | 0.0 | | 0.0 | 0.0 | | | | - | 1 | 31 | 01 February 2024 | 01 February 2024 | 100.29 | 49.71 | 0.87 | 0.0 | 0.0 | 50.58 | 50.58 | 0.0 | 0.0 | 0.0 | - | 2 | 29 | 01 March 2024 | | 50.3 | 49.99 | 0.59 | 0.0 | 0.0 | 50.58 | 0.0 | 0.0 | 0.0 | 50.58 | - | 3 | 31 | 01 April 2024 | | 0.0 | 50.3 | 0.29 | 0.0 | 0.0 | 50.59 | 0.0 | 0.0 | 0.0 | 50.59 | - And Loan Repayment schedule has the following data in Total row: - | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding | - | 150.0 | 1.75 | 0.0 | 0.0 | 151.75 | 50.58 | 0.0 | 0.0 | 101.17 | - And Loan Transactions tab has the following data: - | Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed | - | 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false | - | 01 January 2024 | Capitalized Income | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 150.0 | false | false | - | 01 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 02 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 03 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 05 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 06 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 07 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 08 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 09 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 11 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 12 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 13 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 14 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 15 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 17 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 18 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 19 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 20 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 22 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 23 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 24 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 25 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 26 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 28 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 29 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 30 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 31 January 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - - | 01 February 2024 | Repayment | 50.58 | 49.71 | 0.87 | 0.0 | 0.0 | 100.29 | false | false | - | 01 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 01 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 02 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 03 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 04 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 05 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 06 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 07 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 08 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 09 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 10 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 11 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 12 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 13 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 14 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 15 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 16 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 17 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 18 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 19 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 20 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 21 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 22 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 23 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 24 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 25 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 26 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 27 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 28 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Accrual | 0.02 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | false | false | - | 29 February 2024 | Capitalized Income Amortization | 0.55 | 0.0 | 0.55 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Accrual | 0.03 | 0.0 | 0.03 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Charge-off | 101.17 | 100.29 | 0.88 | 0.0 | 0.0 | 0.0 | false | false | - | 01 March 2024 | Capitalized Income Amortization | 17.0 | 0.0 | 17.0 | 0.0 | 0.0 | 0.0 | false | false | diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java index 32c175deb..fdcd5b02d 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/DisbursementData.java @@ -30,7 +30,7 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanSchedul */ @RequiredArgsConstructor @Getter -public final class DisbursementData implements LoanPrincipalRelatedDataHolder, Comparable { +public final class DisbursementData implements Comparable { private final Long id; private final LocalDate expectedDisbursementDate; @@ -102,7 +102,8 @@ public final class DisbursementData implements LoanPrincipalRelatedDataHolder, C private boolean occursOnDayFromAndIncludingAndUpTo(final LocalDate fromInclusive, final LocalDate upToNotInclusive, final LocalDate target) { - return DateUtils.isDateInRangeFromInclusiveToExclusive(fromInclusive, upToNotInclusive, target); + return (DateUtils.isEqual(target, fromInclusive) || DateUtils.isAfter(target, fromInclusive)) + && DateUtils.isBefore(target, upToNotInclusive); } public BigDecimal getWaivedChargeAmount() { diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanSummaryData.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanSummaryData.java index a359b2749..b1e147a5d 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanSummaryData.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanSummaryData.java @@ -34,8 +34,6 @@ import org.apache.fineract.organisation.monetary.data.CurrencyData; public class LoanSummaryData { private final CurrencyData currency; - private final BigDecimal totalPrincipal; - private final BigDecimal totalPrincipalFromCapitalizedIncome; private final BigDecimal principalDisbursed; private final BigDecimal principalAdjustments; private final BigDecimal principalPaid; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummary.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummary.java index 0b76608c4..9dcc97934 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummary.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanSummary.java @@ -38,12 +38,6 @@ import org.apache.fineract.organisation.monetary.domain.Money; public class LoanSummary { // derived totals fields - @Column(name = "total_principal_derived", scale = 6, precision = 19) - private BigDecimal totalPrincipal; - - @Column(name = "capitalized_income_derived", scale = 6, precision = 19) - private BigDecimal totalPrincipalFromCapitalizedIncome; - @Column(name = "principal_disbursed_derived", scale = 6, precision = 19) private BigDecimal totalPrincipalDisbursed; @@ -172,8 +166,6 @@ public class LoanSummary { this.totalPenaltyChargesWaived = BigDecimal.ZERO; this.totalPenaltyChargesWrittenOff = BigDecimal.ZERO; this.totalPrincipalAdjustments = BigDecimal.ZERO; - this.totalPrincipal = BigDecimal.ZERO; - this.totalPrincipalFromCapitalizedIncome = BigDecimal.ZERO; this.totalPrincipalDisbursed = BigDecimal.ZERO; this.totalPrincipalOutstanding = BigDecimal.ZERO; this.totalPrincipalRepaid = BigDecimal.ZERO; @@ -184,22 +176,17 @@ public class LoanSummary { } public void updateSummary(final MonetaryCurrency currency, final Money principal, - final List repaymentScheduleInstallments, Set charges, - List capitalizedIncomeTransactions) { - final BigDecimal principalFromCapitalizedIncome = capitalizedIncomeTransactions.stream().filter(LoanTransaction::isNotReversed) - .map(LoanTransaction::getPrincipalPortion).reduce(BigDecimal.ZERO, BigDecimal::add); + final List repaymentScheduleInstallments, Set charges) { this.totalPrincipalDisbursed = principal.getAmount(); - this.totalPrincipalFromCapitalizedIncome = principalFromCapitalizedIncome; - this.totalPrincipal = principal.plus(principalFromCapitalizedIncome).getAmount(); this.totalPrincipalAdjustments = calculateTotalPrincipalAdjusted(repaymentScheduleInstallments, currency).getAmount(); this.totalFeeAdjustments = calculateTotalFeeAdjusted(repaymentScheduleInstallments, currency).getAmount(); this.totalPenaltyAdjustments = calculateTotalPenaltyAdjusted(repaymentScheduleInstallments, currency).getAmount(); this.totalPrincipalRepaid = calculateTotalPrincipalRepaid(repaymentScheduleInstallments, currency).getAmount(); this.totalPrincipalWrittenOff = calculateTotalPrincipalWrittenOff(repaymentScheduleInstallments, currency).getAmount(); - this.totalPrincipalOutstanding = principal.plus(principalFromCapitalizedIncome).plus(this.totalPrincipalAdjustments) - .minus(this.totalPrincipalRepaid).minus(this.totalPrincipalWrittenOff).getAmount(); + this.totalPrincipalOutstanding = principal.plus(this.totalPrincipalAdjustments).minus(this.totalPrincipalRepaid) + .minus(this.totalPrincipalWrittenOff).getAmount(); final Money totalInterestCharged = calculateTotalInterestCharged(repaymentScheduleInstallments, currency); this.totalInterestCharged = totalInterestCharged.getAmount(); @@ -238,7 +225,7 @@ public class LoanSummary { this.totalPenaltyChargesOutstanding = totalPenaltyChargesCharged.minus(this.totalPenaltyChargesRepaid) .minus(this.totalPenaltyChargesWaived).minus(this.totalPenaltyChargesWrittenOff).getAmount(); - final Money totalExpectedRepayment = Money.of(currency, this.totalPrincipal).plus(this.totalInterestCharged) + final Money totalExpectedRepayment = Money.of(currency, this.totalPrincipalDisbursed).plus(this.totalInterestCharged) .plus(this.totalFeeChargesCharged).plus(this.totalPenaltyChargesCharged); this.totalExpectedRepayment = totalExpectedRepayment.getAmount(); diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRepaymentPeriodData.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRepaymentPeriodData.java deleted file mode 100644 index f5c734841..000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRepaymentPeriodData.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.fineract.portfolio.loanaccount.domain; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDate; -import lombok.EqualsAndHashCode; -import lombok.Getter; -import org.apache.fineract.portfolio.loanaccount.data.LoanPrincipalRelatedDataHolder; - -/** - * Immutable data object representing a subset of loan transaction data. - */ -@Getter -@EqualsAndHashCode -public class LoanTransactionRepaymentPeriodData implements LoanPrincipalRelatedDataHolder, Serializable { - - private final Long transactionId; - private final Long loanId; - private final LocalDate date; - private final boolean reversed; - private final BigDecimal amount; - private final BigDecimal unrecognizedAmount; - private final BigDecimal feeChargesPortion; - - public LoanTransactionRepaymentPeriodData(Long transactionId, Long loanId, LocalDate date, boolean reversed, BigDecimal amount, - BigDecimal unrecognizedAmount, BigDecimal feeChargesPortion) { - this.transactionId = transactionId; - this.loanId = loanId; - this.date = date; - this.reversed = reversed; - this.amount = amount; - this.unrecognizedAmount = unrecognizedAmount; - this.feeChargesPortion = feeChargesPortion; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanRefundValidator.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanRefundValidator.java index 79d09ae0c..25d9f030c 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanRefundValidator.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/serialization/LoanRefundValidator.java @@ -104,10 +104,7 @@ public final class LoanRefundValidator { if (loan.getLoanProduct().isMultiDisburseLoan() && adjustedTransaction == null) { final BigDecimal totalDisbursed = loan.getDisbursedAmount(); final BigDecimal totalPrincipalAdjusted = loan.getSummary().getTotalPrincipalAdjustments(); - final BigDecimal totalPrincipalFromCapitalizedIncome = loan.getLoanTransactions(LoanTransaction::isCapitalizedIncome).stream() - .filter(LoanTransaction::isNotReversed).map(LoanTransaction::getPrincipalPortion) - .reduce(BigDecimal.ZERO, BigDecimal::add); - final BigDecimal totalPrincipalCredited = totalDisbursed.add(totalPrincipalAdjusted).add(totalPrincipalFromCapitalizedIncome); + final BigDecimal totalPrincipalCredited = totalDisbursed.add(totalPrincipalAdjusted); if (totalPrincipalCredited.compareTo(loan.getSummary().getTotalPrincipalRepaid()) < 0) { final String errorMessage = "The transaction amount cannot exceed threshold."; throw new InvalidLoanStateTransitionException("transaction", "amount.exceeds.threshold", errorMessage); diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanBalanceService.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanBalanceService.java index 03c5e7066..cb69a73eb 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanBalanceService.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanBalanceService.java @@ -97,8 +97,7 @@ public class LoanBalanceService { loan.setTotalRecovered(recoveredAmount.getAmountDefaultedToNullIfZero()); final Money principal = loan.getLoanRepaymentScheduleDetail().getPrincipal(); - List capitalizedIncomeTransactions = loan.getLoanTransactions(LoanTransaction::isCapitalizedIncome); - loan.getSummary().updateSummary(loan.getCurrency(), principal, loan.getRepaymentScheduleInstallments(), loan.getLoanCharges(), capitalizedIncomeTransactions); + loan.getSummary().updateSummary(loan.getCurrency(), principal, loan.getRepaymentScheduleInstallments(), loan.getLoanCharges()); loan.updateLoanOutstandingBalances(); } } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java index 595316f42..c7cd77ae7 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanDownPaymentHandlerServiceImpl.java @@ -173,10 +173,7 @@ public class LoanDownPaymentHandlerServiceImpl implements LoanDownPaymentHandler if (loan.getLoanProduct().isMultiDisburseLoan()) { final BigDecimal totalDisbursed = loan.getDisbursedAmount(); final BigDecimal totalPrincipalAdjusted = loan.getSummary().getTotalPrincipalAdjustments(); - final BigDecimal totalPrincipalFromCapitalizedIncome = loan.getLoanTransactions(LoanTransaction::isCapitalizedIncome).stream() - .filter(LoanTransaction::isNotReversed).map(LoanTransaction::getPrincipalPortion) - .reduce(BigDecimal.ZERO, BigDecimal::add); - final BigDecimal totalPrincipalCredited = totalDisbursed.add(totalPrincipalAdjusted).add(totalPrincipalFromCapitalizedIncome); + final BigDecimal totalPrincipalCredited = totalDisbursed.add(totalPrincipalAdjusted); if (totalPrincipalCredited.compareTo(loan.getSummary().getTotalPrincipalRepaid()) < 0 && loan.repaymentScheduleDetail().getPrincipal().minus(totalDisbursed).isGreaterThanZero()) { final String errorMessage = "The transaction amount cannot exceed threshold."; diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java index ed2d7176a..cdff9421b 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformService.java @@ -37,7 +37,6 @@ import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData; import org.apache.fineract.portfolio.loanaccount.data.PaidInAdvanceData; import org.apache.fineract.portfolio.loanaccount.data.RepaymentScheduleRelatedLoanData; import org.apache.fineract.portfolio.loanaccount.domain.Loan; -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepaymentPeriodData; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanScheduleData; import org.apache.fineract.portfolio.loanaccount.loanschedule.data.OverdueLoanScheduleData; @@ -51,8 +50,7 @@ public interface LoanReadPlatformService { LoanAccountData fetchRepaymentScheduleData(LoanAccountData accountData); LoanScheduleData retrieveRepaymentSchedule(Long loanId, RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData, - Collection disbursementData, Collection capitalizedIncomeData, - boolean isInterestRecalculationEnabled, LoanScheduleType loanScheduleType); + Collection disbursementData, boolean isInterestRecalculationEnabled, LoanScheduleType loanScheduleType); Collection retrieveLoanTransactions(Long loanId); diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java index cfbbe223a..d4cbfcd79 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/transactionprocessor/impl/AdvancedPaymentScheduleTransactionProcessor.java @@ -344,7 +344,6 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep case REAMORTIZE -> handleReAmortization(loanTransaction, ctx); case REAGE -> handleReAge(loanTransaction, ctx); case ACCRUAL_ACTIVITY -> calculateAccrualActivity(loanTransaction, ctx); - case CAPITALIZED_INCOME -> handleCapitalizedIncome(loanTransaction, ctx); // TODO: Cover rest of the transaction types default -> log.warn("Unhandled transaction processing for transaction type: {}", loanTransaction.getTypeOf()); } @@ -1200,7 +1199,18 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep emiCalculator.addDisbursement(model, transactionDate, amortizableAmount); disbursementTransaction.resetDerivedComponents(); - recalculateRepaymentPeriodsWithEMICalculation(amortizableAmount, model, installments, transactionDate, currency); + if (amortizableAmount.isGreaterThanZero()) { + model.repaymentPeriods().forEach(rm -> { + LoanRepaymentScheduleInstallment installment = installments.stream().filter( + ri -> ri.getDueDate().equals(rm.getDueDate()) && !ri.isDownPayment() && !ri.getDueDate().isBefore(transactionDate)) + .findFirst().orElse(null); + if (installment != null) { + installment.updatePrincipal(rm.getDuePrincipal().getAmount()); + installment.updateInterestCharged(rm.getDueInterest().getAmount()); + installment.updateObligationsMet(currency, transactionDate); + } + }); + } allocateOverpayment(disbursementTransaction, transactionCtx); } @@ -1212,6 +1222,7 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep List candidateRepaymentInstallments = installments.stream().filter( i -> i.getDueDate().isAfter(disbursementTransaction.getTransactionDate()) && !i.isDownPayment() && !i.isAdditional()) .toList(); + int noCandidateRepaymentInstallments = candidateRepaymentInstallments.size(); LoanProductRelatedDetail loanProductRelatedDetail = disbursementTransaction.getLoan().getLoanRepaymentScheduleDetail(); Integer installmentAmountInMultiplesOf = disbursementTransaction.getLoan().getLoanProduct().getInstallmentAmountInMultiplesOf(); Money downPaymentAmount = Money.zero(currency); @@ -1229,73 +1240,7 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep Money amortizableAmount = disbursementTransaction.getAmount(currency).minus(downPaymentAmount); - recalculateRepaymentInstallmentsWithoutEMICalculation(disbursementTransaction, amortizableAmount, candidateRepaymentInstallments, - currency, installmentAmountInMultiplesOf); - allocateOverpayment(disbursementTransaction, transactionCtx); - } - - private void handleCapitalizedIncome(LoanTransaction capitalizedIncomeTransaction, TransactionCtx transactionCtx) { - if (capitalizedIncomeTransaction.getLoan().isInterestBearing()) { - handleCapitalizedIncomeWithEMICalculator(capitalizedIncomeTransaction, transactionCtx); - } else { - handleCapitalizedIncomeWithoutEMICalculator(capitalizedIncomeTransaction, transactionCtx); - } - } - - private void handleCapitalizedIncomeWithEMICalculator(LoanTransaction capitalizedIncomeTransaction, TransactionCtx transactionCtx) { - ProgressiveLoanInterestScheduleModel model; - if (!(transactionCtx instanceof ProgressiveTransactionCtx) - || (model = ((ProgressiveTransactionCtx) transactionCtx).getModel()) == null) { - throw new IllegalStateException("TransactionCtx has no model"); - } - List installments = transactionCtx.getInstallments(); - LocalDate transactionDate = capitalizedIncomeTransaction.getTransactionDate(); - MonetaryCurrency currency = transactionCtx.getCurrency(); - - Money amortizableAmount = capitalizedIncomeTransaction.getAmount(currency); - emiCalculator.addCapitalizedIncome(model, transactionDate, amortizableAmount); - - recalculateRepaymentPeriodsWithEMICalculation(amortizableAmount, model, installments, transactionDate, currency); - allocateOverpayment(capitalizedIncomeTransaction, transactionCtx); - } - - private void handleCapitalizedIncomeWithoutEMICalculator(LoanTransaction capitalizedIncomeTransaction, TransactionCtx transactionCtx) { - MonetaryCurrency currency = transactionCtx.getCurrency(); - List installments = transactionCtx.getInstallments(); - List candidateRepaymentInstallments = installments.stream().filter( - i -> i.getDueDate().isAfter(capitalizedIncomeTransaction.getTransactionDate()) && !i.isDownPayment() && !i.isAdditional()) - .toList(); - Integer installmentAmountInMultiplesOf = capitalizedIncomeTransaction.getLoan().getLoanProduct() - .getInstallmentAmountInMultiplesOf(); - - Money amortizableAmount = capitalizedIncomeTransaction.getAmount(currency); - - recalculateRepaymentInstallmentsWithoutEMICalculation(capitalizedIncomeTransaction, amortizableAmount, - candidateRepaymentInstallments, currency, installmentAmountInMultiplesOf); - allocateOverpayment(capitalizedIncomeTransaction, transactionCtx); - } - - private void recalculateRepaymentPeriodsWithEMICalculation(Money amortizableAmount, ProgressiveLoanInterestScheduleModel model, - List installments, LocalDate transactionDate, MonetaryCurrency currency) { if (amortizableAmount.isGreaterThanZero()) { - model.repaymentPeriods().forEach(rm -> { - LoanRepaymentScheduleInstallment installment = installments.stream().filter( - ri -> ri.getDueDate().equals(rm.getDueDate()) && !ri.isDownPayment() && !ri.getDueDate().isBefore(transactionDate)) - .findFirst().orElse(null); - if (installment != null) { - installment.updatePrincipal(rm.getDuePrincipal().getAmount()); - installment.updateInterestCharged(rm.getDueInterest().getAmount()); - installment.updateObligationsMet(currency, transactionDate); - } - }); - } - } - - private void recalculateRepaymentInstallmentsWithoutEMICalculation(LoanTransaction loanTransaction, Money amortizableAmount, - List candidateRepaymentInstallments, MonetaryCurrency currency, - Integer installmentAmountInMultiplesOf) { - if (amortizableAmount.isGreaterThanZero()) { - int noCandidateRepaymentInstallments = candidateRepaymentInstallments.size(); Money increasePrincipalBy = amortizableAmount.dividedBy(noCandidateRepaymentInstallments, MoneyHelper.getMathContext()); MoneyHolder moneyHolder = new MoneyHolder(amortizableAmount); @@ -1307,12 +1252,14 @@ public class AdvancedPaymentScheduleTransactionProcessor extends AbstractLoanRep } i.updatePrincipal(newPrincipal.getAmount()); moneyHolder.setMoneyObject(moneyHolder.getMoneyObject().minus(newPrincipal).plus(previousPrincipal)); - i.updateObligationsMet(currency, loanTransaction.getTransactionDate()); + i.updateObligationsMet(currency, disbursementTransaction.getTransactionDate()); }); // Hence the rounding, we might need to amend the last installment amount - candidateRepaymentInstallments.get(noCandidateRepaymentInstallments - 1).addToPrincipal(loanTransaction.getTransactionDate(), - moneyHolder.getMoneyObject()); + candidateRepaymentInstallments.get(noCandidateRepaymentInstallments - 1) + .addToPrincipal(disbursementTransaction.getTransactionDate(), moneyHolder.getMoneyObject()); } + + allocateOverpayment(disbursementTransaction, transactionCtx); } private void allocateOverpayment(LoanTransaction loanTransaction, TransactionCtx transactionCtx) { diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/repository/LoanCapitalizedIncomeBalanceRepository.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/repository/LoanCapitalizedIncomeBalanceRepository.java index f0185b4e4..b1ac6238c 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/repository/LoanCapitalizedIncomeBalanceRepository.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/repository/LoanCapitalizedIncomeBalanceRepository.java @@ -20,20 +20,13 @@ package org.apache.fineract.portfolio.loanaccount.repository; import java.util.List; import org.apache.fineract.portfolio.loanaccount.domain.LoanCapitalizedIncomeBalance; -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepaymentPeriodData; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Query; public interface LoanCapitalizedIncomeBalanceRepository extends JpaRepository, JpaSpecificationExecutor { - String FIND_BALANCE_REPAYMENT_SCHEDULE_DATA = "SELECT new org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepaymentPeriodData(lcib.loanTransaction.id, lcib.loan.id, lcib.loanTransaction.dateOf, lcib.loanTransaction.reversed, lcib.amount, lcib.unrecognizedAmount, lcib.loanTransaction.feeChargesPortion) FROM LoanCapitalizedIncomeBalance lcib "; - List findAllByLoanId(Long loanId); LoanCapitalizedIncomeBalance findByLoanIdAndLoanTransactionId(Long loanId, Long transactionId); - - @Query(FIND_BALANCE_REPAYMENT_SCHEDULE_DATA + " WHERE lcib.loan.id = :loanId") - List findRepaymentPeriodDataByLoanId(Long loanId); } diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CapitalizedIncomeWritePlatformServiceImpl.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CapitalizedIncomeWritePlatformServiceImpl.java index b44138853..5c09f015f 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CapitalizedIncomeWritePlatformServiceImpl.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CapitalizedIncomeWritePlatformServiceImpl.java @@ -30,7 +30,6 @@ import org.apache.fineract.infrastructure.core.api.JsonCommand; import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder; import org.apache.fineract.infrastructure.core.domain.ExternalId; -import org.apache.fineract.infrastructure.core.service.DateUtils; import org.apache.fineract.infrastructure.core.service.ExternalIdFactory; import org.apache.fineract.organisation.monetary.domain.Money; import org.apache.fineract.portfolio.loanaccount.domain.Loan; @@ -55,7 +54,6 @@ public class CapitalizedIncomeWritePlatformServiceImpl implements CapitalizedInc private final NoteWritePlatformService noteWritePlatformService; private final ExternalIdFactory externalIdFactory; private final LoanCapitalizedIncomeBalanceRepository capitalizedIncomeBalanceRepository; - private final ReprocessLoanTransactionsService reprocessLoanTransactionsService; @Transactional @Override @@ -76,10 +74,9 @@ public class CapitalizedIncomeWritePlatformServiceImpl implements CapitalizedInc final Money capitalizedIncomeAmount = calculateCapitalizedIncomeAmount(loan, transactionAmount); final LoanTransaction capitalizedIncomeTransaction = LoanTransaction.capitalizedIncome(loan, capitalizedIncomeAmount, paymentDetail, transactionDate, txnExternalId); + // TODO: Transaction reverse-replay + loan repayment schedule update (follow-up story) // Update loan with capitalized income loan.addLoanTransaction(capitalizedIncomeTransaction); - // Recalculate loan transactions - recalculateLoanTransactions(loan, transactionDate, capitalizedIncomeTransaction); // Create capitalized income balances createCapitalizedIncomeBalance(capitalizedIncomeTransaction); // Save and flush (PK is set) @@ -91,7 +88,7 @@ public class CapitalizedIncomeWritePlatformServiceImpl implements CapitalizedInc // Create a note if provided final String noteText = command.stringValueOfParameterNamed("note"); if (noteText != null && !noteText.isEmpty()) { - noteWritePlatformService.createLoanTransactionNote(capitalizedIncomeTransaction.getId(), noteText); + noteWritePlatformService.createLoanNote(loanId, noteText); } // Post journal entries journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); @@ -102,14 +99,6 @@ public class CapitalizedIncomeWritePlatformServiceImpl implements CapitalizedInc .build(); } - private void recalculateLoanTransactions(Loan loan, LocalDate transactionDate, LoanTransaction capitalizedIncomeTransaction) { - if (loan.isInterestBearingAndInterestRecalculationEnabled() || DateUtils.isBeforeBusinessDate(transactionDate)) { - reprocessLoanTransactionsService.reprocessTransactions(loan); - } else { - reprocessLoanTransactionsService.processLatestTransaction(capitalizedIncomeTransaction, loan); - } - } - @Override public void resetBalance(final Long loanId) { capitalizedIncomeBalanceRepository diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/ProgressiveLoanAccountConfiguration.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/ProgressiveLoanAccountConfiguration.java index 8a7282b62..cf0ef76b2 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/ProgressiveLoanAccountConfiguration.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/starter/ProgressiveLoanAccountConfiguration.java @@ -30,7 +30,6 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanAssembler; import org.apache.fineract.portfolio.loanaccount.service.LoanJournalEntryPoster; import org.apache.fineract.portfolio.loanaccount.service.ProgressiveLoanTransactionValidator; import org.apache.fineract.portfolio.loanaccount.service.ProgressiveLoanTransactionValidatorImpl; -import org.apache.fineract.portfolio.loanaccount.service.ReprocessLoanTransactionsService; import org.apache.fineract.portfolio.note.service.NoteWritePlatformService; import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; @@ -46,11 +45,10 @@ public class ProgressiveLoanAccountConfiguration { LoanAssembler loanAssembler, LoanTransactionRepository loanTransactionRepository, PaymentDetailWritePlatformService paymentDetailWritePlatformService, LoanJournalEntryPoster journalEntryPoster, NoteWritePlatformService noteWritePlatformService, ExternalIdFactory externalIdFactory, - LoanCapitalizedIncomeBalanceRepository capitalizedIncomeBalanceRepository, - ReprocessLoanTransactionsService reprocessLoanTransactionsService) { + LoanCapitalizedIncomeBalanceRepository capitalizedIncomeBalanceRepository) { return new CapitalizedIncomeWritePlatformServiceImpl(loanTransactionValidator, loanAssembler, loanTransactionRepository, paymentDetailWritePlatformService, journalEntryPoster, noteWritePlatformService, externalIdFactory, - capitalizedIncomeBalanceRepository, reprocessLoanTransactionsService); + capitalizedIncomeBalanceRepository); } @Bean diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/EMICalculator.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/EMICalculator.java index 0991245b5..44aa869d2 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/EMICalculator.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/EMICalculator.java @@ -65,12 +65,6 @@ public interface EMICalculator { */ void addDisbursement(ProgressiveLoanInterestScheduleModel scheduleModel, LocalDate disbursementDueDate, Money disbursedAmount); - /** - * Applies the capitalized income transaction on the interest model. This method recalculates the EMI amounts from - * the action date. - */ - void addCapitalizedIncome(ProgressiveLoanInterestScheduleModel scheduleModel, LocalDate transactionDueDate, Money transactionAmount); - /** * Applies the interest rate change on the interest model. This method recalculates the EMI amounts from the action * date. diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java index c1ebc18ed..0a5d5d991 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/ProgressiveEMICalculator.java @@ -119,7 +119,7 @@ public final class ProgressiveEMICalculator implements EMICalculator { private void addDisbursement(final ProgressiveLoanInterestScheduleModel scheduleModel, final EmiChangeOperation operation) { scheduleModel .changeOutstandingBalanceAndUpdateInterestPeriods(operation.getSubmittedOnDate(), operation.getAmount(), - scheduleModel.zero(), scheduleModel.zero()) + scheduleModel.zero()) .ifPresent((repaymentPeriod) -> calculateEMIValueAndRateFactors( getEffectiveRepaymentDueDate(scheduleModel, repaymentPeriod, operation.getSubmittedOnDate()), scheduleModel, operation)); @@ -140,24 +140,6 @@ public final class ProgressiveEMICalculator implements EMICalculator { return changedRepaymentPeriod.getDueDate(); } - /** - * Add capitalized income to Interest Period - */ - @Override - public void addCapitalizedIncome(final ProgressiveLoanInterestScheduleModel scheduleModel, final LocalDate transactionDueDate, - final Money transactionAmount) { - addCapitalizedIncome(scheduleModel, EmiChangeOperation.capitalizedIncome(transactionDueDate, transactionAmount)); - } - - private void addCapitalizedIncome(final ProgressiveLoanInterestScheduleModel scheduleModel, final EmiChangeOperation operation) { - scheduleModel.changeOutstandingBalanceAndUpdateInterestPeriods(operation.getSubmittedOnDate(), scheduleModel.zero(), - scheduleModel.zero(), operation.getAmount()).ifPresent((repaymentPeriod) -> { - calculateEMIValueAndRateFactors( - getEffectiveRepaymentDueDate(scheduleModel, repaymentPeriod, operation.getSubmittedOnDate()), scheduleModel, - operation); - }); - } - @Override public void changeInterestRate(final ProgressiveLoanInterestScheduleModel scheduleModel, final LocalDate newInterestSubmittedOnDate, final BigDecimal newInterestRate) { @@ -169,7 +151,7 @@ public final class ProgressiveEMICalculator implements EMICalculator { scheduleModel.addInterestRate(interestRateChangeEffectiveDate, operation.getInterestRate()); scheduleModel .changeOutstandingBalanceAndUpdateInterestPeriods(interestRateChangeEffectiveDate, scheduleModel.zero(), - scheduleModel.zero(), scheduleModel.zero()) + scheduleModel.zero()) .ifPresent(repaymentPeriod -> calculateEMIValueAndRateFactors( getEffectiveRepaymentDueDate(scheduleModel, repaymentPeriod, interestRateChangeEffectiveDate), scheduleModel, operation)); @@ -178,8 +160,8 @@ public final class ProgressiveEMICalculator implements EMICalculator { @Override public void addBalanceCorrection(ProgressiveLoanInterestScheduleModel scheduleModel, LocalDate balanceCorrectionDate, Money balanceCorrectionAmount) { - scheduleModel.changeOutstandingBalanceAndUpdateInterestPeriods(balanceCorrectionDate, scheduleModel.zero(), balanceCorrectionAmount, - scheduleModel.zero()).ifPresent(repaymentPeriod -> { + scheduleModel.changeOutstandingBalanceAndUpdateInterestPeriods(balanceCorrectionDate, scheduleModel.zero(), balanceCorrectionAmount) + .ifPresent(repaymentPeriod -> { calculateRateFactorForRepaymentPeriod(repaymentPeriod, scheduleModel); calculateOutstandingBalance(scheduleModel); calculateLastUnpaidRepaymentPeriodEMI(scheduleModel); @@ -255,7 +237,7 @@ public final class ProgressiveEMICalculator implements EMICalculator { private void addCredit(ProgressiveLoanInterestScheduleModel scheduleModel, LocalDate transactionDate, Money creditedPrincipalAmount, Money creditedInterestAmount) { - scheduleModel.changeOutstandingBalanceAndUpdateInterestPeriods(transactionDate, scheduleModel.zero(), creditedPrincipalAmount, scheduleModel.zero()) + scheduleModel.changeOutstandingBalanceAndUpdateInterestPeriods(transactionDate, scheduleModel.zero(), creditedPrincipalAmount) .ifPresent(repaymentPeriod -> { addCreditedAmountsToInterestPeriod(scheduleModel, transactionDate, creditedPrincipalAmount, creditedInterestAmount); calculateRateFactorForRepaymentPeriod(repaymentPeriod, scheduleModel); @@ -460,11 +442,8 @@ public final class ProgressiveEMICalculator implements EMICalculator { .flatMap(rp -> rp.getInterestPeriods().stream().map(InterestPeriod::getDisbursementAmount)) .reduce(scheduleModel.zero(), (m1, m2) -> m1.plus(m2, mc)) // 100 .plus(scheduleModel.getTotalCreditedPrincipal(), mc); // - Money totalCapitalizedIncome = scheduleModel.repaymentPeriods().stream() - .flatMap(rp -> rp.getInterestPeriods().stream().map(InterestPeriod::getCapitalizedIncomePrincipal)) - .reduce(scheduleModel.zero(), (m1, m2) -> m1.plus(m2, mc)); // 100 - Money diff = totalDisbursedAmount.plus(totalCapitalizedIncome, mc).plus(totalDueInterest, mc).minus(totalEMI, mc); + Money diff = totalDisbursedAmount.plus(totalDueInterest, mc).minus(totalEMI, mc); Optional findLastUnpaidRepaymentPeriod = scheduleModel.repaymentPeriods().stream().filter(rp -> !rp.isFullyPaid()) .reduce((first, second) -> second); findLastUnpaidRepaymentPeriod.ifPresent(repaymentPeriod -> { @@ -830,9 +809,7 @@ public final class ProgressiveEMICalculator implements EMICalculator { return; } final ProgressiveLoanInterestScheduleModel scheduleModelCopy = scheduleModel.copyWithoutPaidAmounts(); - addDisbursement(scheduleModelCopy, operation.withZeroAmount()); - addCapitalizedIncome(scheduleModelCopy, operation.withZeroAmount()); final LocalDate firstDueDate = repaymentPeriods.get(0).getDueDate(); scheduleModel.copyPeriodsFrom(firstDueDate, scheduleModelCopy.repaymentPeriods(), (newRepaymentPeriod, actualRepaymentPeriod) -> { diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/EmiChangeOperation.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/EmiChangeOperation.java index 1f0768a1f..675cc6b37 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/EmiChangeOperation.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/EmiChangeOperation.java @@ -31,8 +31,7 @@ public class EmiChangeOperation { public enum Action { // DISBURSEMENT, // - INTEREST_RATE_CHANGE, // - CAPITALIZED_INCOME // + INTEREST_RATE_CHANGE // } private final Action action; @@ -49,12 +48,8 @@ public class EmiChangeOperation { return new EmiChangeOperation(EmiChangeOperation.Action.INTEREST_RATE_CHANGE, newInterestSubmittedOnDate, null, newInterestRate); } - public static EmiChangeOperation capitalizedIncome(final LocalDate transactionDueDate, final Money transactionAmount) { - return new EmiChangeOperation(Action.CAPITALIZED_INCOME, transactionDueDate, transactionAmount, null); - } - public EmiChangeOperation withZeroAmount() { - if (action == Action.DISBURSEMENT || action == Action.CAPITALIZED_INCOME) { + if (action == Action.DISBURSEMENT) { return new EmiChangeOperation(action, submittedOnDate, amount.zero(), null); } return null; diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java index cafacef68..436a9d133 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/InterestPeriod.java @@ -62,8 +62,6 @@ public class InterestPeriod implements Comparable { private Money balanceCorrectionAmount; private Money outstandingLoanBalance; - private Money capitalizedIncomePrincipal; - @JsonExclude private final MathContext mc; private final boolean isPaused; @@ -72,38 +70,38 @@ public class InterestPeriod implements Comparable { return new InterestPeriod(repaymentPeriod, interestPeriod.getFromDate(), interestPeriod.getDueDate(), interestPeriod.getRateFactor(), interestPeriod.getRateFactorTillPeriodDueDate(), interestPeriod.getCreditedPrincipal(), interestPeriod.getCreditedInterest(), interestPeriod.getDisbursementAmount(), interestPeriod.getBalanceCorrectionAmount(), - interestPeriod.getOutstandingLoanBalance(), interestPeriod.getCapitalizedIncomePrincipal(), mc, interestPeriod.isPaused()); + interestPeriod.getOutstandingLoanBalance(), mc, interestPeriod.isPaused()); } public static InterestPeriod empty(@NotNull RepaymentPeriod repaymentPeriod, MathContext mc) { - return new InterestPeriod(repaymentPeriod, null, null, null, null, null, null, null, null, null, null, mc, false); + return new InterestPeriod(repaymentPeriod, null, null, null, null, null, null, null, null, null, mc, false); } public static InterestPeriod copy(@NotNull RepaymentPeriod repaymentPeriod, @NotNull InterestPeriod interestPeriod) { return new InterestPeriod(repaymentPeriod, interestPeriod.getFromDate(), interestPeriod.getDueDate(), interestPeriod.getRateFactor(), interestPeriod.getRateFactorTillPeriodDueDate(), interestPeriod.getCreditedPrincipal(), interestPeriod.getCreditedInterest(), interestPeriod.getDisbursementAmount(), interestPeriod.getBalanceCorrectionAmount(), - interestPeriod.getOutstandingLoanBalance(), interestPeriod.getCapitalizedIncomePrincipal(), interestPeriod.getMc(), interestPeriod.isPaused()); + interestPeriod.getOutstandingLoanBalance(), interestPeriod.getMc(), interestPeriod.isPaused()); } public static InterestPeriod withEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate, LocalDate dueDate) { final Money zero = repaymentPeriod.getEmi().zero(); - return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero, + return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero.getMc(), false); } public static InterestPeriod withEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate, LocalDate dueDate, boolean isPaused) { final Money zero = repaymentPeriod.getEmi().zero(); - return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero, + return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero.getMc(), isPaused); } public static InterestPeriod withPausedAndEmptyAmounts(@NotNull RepaymentPeriod repaymentPeriod, @NotNull LocalDate fromDate, LocalDate dueDate) { final Money zero = repaymentPeriod.getEmi().zero(); - return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero, + return new InterestPeriod(repaymentPeriod, fromDate, dueDate, BigDecimal.ZERO, BigDecimal.ZERO, zero, zero, zero, zero, zero, zero.getMc(), true); } @@ -128,10 +126,6 @@ public class InterestPeriod implements Comparable { this.creditedInterest = MathUtil.plus(this.creditedInterest, creditedInterest, mc); } - public void addCapitalizedIncomePrincipalAmount(final Money capitalizedIncomePrincipal) { - this.capitalizedIncomePrincipal = MathUtil.plus(this.capitalizedIncomePrincipal, capitalizedIncomePrincipal, mc); - } - public BigDecimal getCalculatedDueInterest() { if (isPaused) { return creditedInterest.getAmount(); @@ -162,7 +156,6 @@ public class InterestPeriod implements Comparable { InterestPeriod previousInterestPeriod = previousRepaymentPeriod.get().getLastInterestPeriod(); this.outstandingLoanBalance = MathUtil.negativeToZero(previousInterestPeriod.getOutstandingLoanBalance()// .plus(previousInterestPeriod.getDisbursementAmount(), mc)// - .plus(previousInterestPeriod.getCapitalizedIncomePrincipal(), mc)// .plus(previousInterestPeriod.getBalanceCorrectionAmount(), mc)// .minus(previousRepaymentPeriod.get().getDuePrincipal(), mc)// .plus(previousRepaymentPeriod.get().getPaidPrincipal(), mc), mc);// @@ -172,7 +165,6 @@ public class InterestPeriod implements Comparable { InterestPeriod previousInterestPeriod = getRepaymentPeriod().getInterestPeriods().get(index - 1); this.outstandingLoanBalance = MathUtil.negativeToZero(previousInterestPeriod.getOutstandingLoanBalance() // .plus(previousInterestPeriod.getBalanceCorrectionAmount(), mc) // - .plus(previousInterestPeriod.getCapitalizedIncomePrincipal(), mc) // .plus(previousInterestPeriod.getDisbursementAmount(), mc)); // } } @@ -181,7 +173,7 @@ public class InterestPeriod implements Comparable { * Include principal like amounts (all disbursement amount + credited principal) */ public Money getCreditedAmounts() { - return getDisbursementAmount().plus(getCreditedPrincipal(), mc).plus(getCapitalizedIncomePrincipal(), mc); + return getDisbursementAmount().plus(getCreditedPrincipal(), mc); } public boolean isFirstInterestPeriod() { diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java index 38cde0ba2..beb3a126d 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/ProgressiveLoanInterestScheduleModel.java @@ -175,10 +175,9 @@ public class ProgressiveLoanInterestScheduleModel { } public Optional changeOutstandingBalanceAndUpdateInterestPeriods(final LocalDate balanceChangeDate, - final Money disbursedAmount, final Money correctionAmount, final Money capitalizedIncomePrincipal) { + final Money disbursedAmount, final Money correctionAmount) { return findRepaymentPeriodForBalanceChange(balanceChangeDate).stream()// - .peek(updateInterestPeriodOnRepaymentPeriod(balanceChangeDate, disbursedAmount, correctionAmount, - capitalizedIncomePrincipal))// + .peek(updateInterestPeriodOnRepaymentPeriod(balanceChangeDate, disbursedAmount, correctionAmount))// .findFirst();// } @@ -215,7 +214,7 @@ public class ProgressiveLoanInterestScheduleModel { } private Consumer updateInterestPeriodOnRepaymentPeriod(final LocalDate balanceChangeDate, final Money disbursedAmount, - final Money correctionAmount, final Money capitalizedIncomePrincipal) { + final Money correctionAmount) { return repaymentPeriod -> { final boolean isChangeOnMaturityDate = isLastRepaymentPeriod(repaymentPeriod) && balanceChangeDate.isEqual(repaymentPeriod.getDueDate()); @@ -223,10 +222,9 @@ public class ProgressiveLoanInterestScheduleModel { isChangeOnMaturityDate); if (interestPeriodOptional.isPresent()) { interestPeriodOptional.get().addDisbursementAmount(disbursedAmount); - interestPeriodOptional.get().addCapitalizedIncomePrincipalAmount(capitalizedIncomePrincipal); interestPeriodOptional.get().addBalanceCorrectionAmount(correctionAmount); } else { - insertInterestPeriod(repaymentPeriod, balanceChangeDate, disbursedAmount, correctionAmount, capitalizedIncomePrincipal); + insertInterestPeriod(repaymentPeriod, balanceChangeDate, disbursedAmount, correctionAmount); } }; } @@ -248,7 +246,7 @@ public class ProgressiveLoanInterestScheduleModel { } void insertInterestPeriod(final RepaymentPeriod repaymentPeriod, final LocalDate balanceChangeDate, final Money disbursedAmount, - final Money correctionAmount, Money capitalizedIncomePrincipal) { + final Money correctionAmount) { final InterestPeriod previousInterestPeriod = findPreviousInterestPeriod(repaymentPeriod, balanceChangeDate); final LocalDate originalDueDate = previousInterestPeriod.getDueDate(); final LocalDate newDueDate = calculateNewDueDate(previousInterestPeriod, balanceChangeDate); @@ -256,7 +254,6 @@ public class ProgressiveLoanInterestScheduleModel { previousInterestPeriod.setDueDate(newDueDate); previousInterestPeriod.addDisbursementAmount(disbursedAmount); - previousInterestPeriod.addCapitalizedIncomePrincipalAmount(capitalizedIncomePrincipal); previousInterestPeriod.addBalanceCorrectionAmount(correctionAmount); final InterestPeriod interestPeriod = InterestPeriod.withEmptyAmounts(repaymentPeriod, newDueDate, originalDueDate, isPaused); diff --git a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java index 6382e361c..2564dc1b9 100644 --- a/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java +++ b/fineract-progressive-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/calc/data/RepaymentPeriod.java @@ -225,17 +225,6 @@ public final class RepaymentPeriod { .reduce(getZero(mc), (value, previous) -> value.plus(previous, mc)), mc); // } - /** - * Sum of capitalized income principals - * - * @return - */ - public Money getCapitalizedIncomePrincipal() { - return MathUtil.negativeToZero(interestPeriods.stream() // - .map(InterestPeriod::getCapitalizedIncomePrincipal) // - .reduce(getZero(mc), (value, previous) -> value.plus(previous, mc)), mc); // - } - /** * Gives back due principal + credited principal or paid principal * @@ -289,7 +278,6 @@ public final class RepaymentPeriod { InterestPeriod lastInterestPeriod = getInterestPeriods().get(getInterestPeriods().size() - 1); Money calculatedOutStandingLoanBalance = lastInterestPeriod.getOutstandingLoanBalance() // .plus(lastInterestPeriod.getBalanceCorrectionAmount(), mc) // - .plus(lastInterestPeriod.getCapitalizedIncomePrincipal(), mc) // .plus(lastInterestPeriod.getDisbursementAmount(), mc) // .minus(getDuePrincipal(), mc)// .plus(getPaidPrincipal(), mc);// @@ -317,10 +305,7 @@ public final class RepaymentPeriod { Money totalDisbursedAmount = getInterestPeriods().stream() // .map(InterestPeriod::getDisbursementAmount) // .reduce(getZero(mc), (m1, m2) -> m1.plus(m2, mc)); // - Money totalCapitalizedIncomeAmount = getInterestPeriods().stream() // - .map(InterestPeriod::getCapitalizedIncomePrincipal) // - .reduce(getZero(mc), (m1, m2) -> m1.plus(m2, mc)); // - return initialBalance.add(totalDisbursedAmount, mc).add(totalCapitalizedIncomeAmount, mc); + return initialBalance.add(totalDisbursedAmount, mc); } private Money getZero(MathContext mc) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java index ec811858a..a061ce97d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/bulkimport/importhandler/loan/LoanImportHandler.java @@ -464,7 +464,6 @@ public class LoanImportHandler implements ImportHandler { JsonObject loanRepaymentJsonob = gsonBuilder.create().toJsonTree(loanRepayments.get(rowIndex)).getAsJsonObject(); loanRepaymentJsonob.remove("manuallyReversed"); loanRepaymentJsonob.remove("numberOfRepayments"); - loanRepaymentJsonob.remove("reversed"); String payload = loanRepaymentJsonob.toString(); final CommandWrapper commandRequest = new CommandWrapperBuilder() // .loanRepaymentTransaction(result.getLoanId()) // diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java index 28fcb876e..295142664 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResource.java @@ -139,7 +139,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanCapitalizedIncomeTyp import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus; import org.apache.fineract.portfolio.loanaccount.domain.LoanSummaryBalancesRepository; import org.apache.fineract.portfolio.loanaccount.domain.LoanTermVariationType; -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepaymentPeriodData; import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException; import org.apache.fineract.portfolio.loanaccount.exception.LoanTemplateTypeRequiredException; import org.apache.fineract.portfolio.loanaccount.exception.NotSupportedLoanTemplateTypeException; @@ -151,7 +150,6 @@ import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanSchedul import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.apache.fineract.portfolio.loanaccount.loanschedule.service.LoanScheduleCalculationPlatformService; import org.apache.fineract.portfolio.loanaccount.loanschedule.service.LoanScheduleHistoryReadPlatformService; -import org.apache.fineract.portfolio.loanaccount.repository.LoanCapitalizedIncomeBalanceRepository; import org.apache.fineract.portfolio.loanaccount.rescheduleloan.domain.LoanTermVariationsRepository; import org.apache.fineract.portfolio.loanaccount.service.GLIMAccountInfoReadPlatformService; import org.apache.fineract.portfolio.loanaccount.service.LoanChargeReadPlatformService; @@ -299,7 +297,6 @@ public class LoansApiResource { private final ClientReadPlatformService clientReadPlatformService; private final LoanTermVariationsRepository loanTermVariationsRepository; private final LoanSummaryProviderDelegate loanSummaryProviderDelegate; - private final LoanCapitalizedIncomeBalanceRepository loanCapitalizedIncomeBalanceRepository; /* * This template API is used for loan approval, ideally this should be invoked on loan that are pending for @@ -501,13 +498,11 @@ public class LoansApiResource { loanBasicDetails.getPageItems().forEach(i -> { if (i.getSummary() != null) { Collection disbursementData = this.loanReadPlatformService.retrieveLoanDisbursementDetails(i.getId()); - List capitalizedIncomeData = this.loanCapitalizedIncomeBalanceRepository - .findRepaymentPeriodDataByLoanId(i.getId()); final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData = new RepaymentScheduleRelatedLoanData( i.getTimeline().getExpectedDisbursementDate(), i.getTimeline().getActualDisbursementDate(), i.getCurrency(), i.getPrincipal(), i.getInArrearsTolerance(), i.getFeeChargesAtDisbursementCharged()); final LoanScheduleData repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(i.getId(), - repaymentScheduleRelatedData, disbursementData, capitalizedIncomeData, i.isInterestRecalculationEnabled(), + repaymentScheduleRelatedData, disbursementData, i.isInterestRecalculationEnabled(), LoanScheduleType.fromEnumOptionData(i.getLoanScheduleType())); LoanSummaryDataProvider loanSummaryDataProvider = loanSummaryProviderDelegate .resolveLoanSummaryDataProvider(i.getTransactionProcessingStrategyCode()); @@ -986,15 +981,13 @@ public class LoansApiResource { if (associationParameters.contains(DataTableApiConstant.repaymentScheduleAssociateParamName)) { mandatoryResponseParameters.add(DataTableApiConstant.repaymentScheduleAssociateParamName); - List capitalizedIncomeData = this.loanCapitalizedIncomeBalanceRepository - .findRepaymentPeriodDataByLoanId(resolvedLoanId); final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedData = new RepaymentScheduleRelatedLoanData( loanBasicDetails.getTimeline().getExpectedDisbursementDate(), loanBasicDetails.getTimeline().getActualDisbursementDate(), loanBasicDetails.getCurrency(), loanBasicDetails.getPrincipal(), loanBasicDetails.getInArrearsTolerance(), loanBasicDetails.getFeeChargesAtDisbursementCharged()); repaymentSchedule = this.loanReadPlatformService.retrieveRepaymentSchedule(resolvedLoanId, repaymentScheduleRelatedData, - disbursementData, capitalizedIncomeData, loanBasicDetails.isInterestRecalculationEnabled(), + disbursementData, loanBasicDetails.isInterestRecalculationEnabled(), LoanScheduleType.fromEnumOptionData(loanBasicDetails.getLoanScheduleType())); if (associationParameters.contains(DataTableApiConstant.futureScheduleAssociateParamName) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java index 98ad1fcfe..5f9086191 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoansApiResourceSwagger.java @@ -517,11 +517,7 @@ final class LoansApiResourceSwagger { public GetLoansLoanIdCurrency currency; @Schema(example = "1000000.000000") - public BigDecimal totalPrincipal; - @Schema(example = "1000000.000000") public BigDecimal principalDisbursed; - @Schema(example = "1000000.000000") - public BigDecimal totalPrincipalFromCapitalizedIncome; @Schema(example = "0.000000") public BigDecimal principalPaid; @Schema(example = "0.00") diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CommonLoanSummaryDataProvider.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CommonLoanSummaryDataProvider.java index 1879abf00..bc8a9ef15 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CommonLoanSummaryDataProvider.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/CommonLoanSummaryDataProvider.java @@ -97,8 +97,7 @@ public abstract class CommonLoanSummaryDataProvider implements LoanSummaryDataPr } return LoanSummaryData.builder().currency(defaultSummaryData.getCurrency()) - .principalDisbursed(defaultSummaryData.getPrincipalDisbursed()).totalPrincipal(defaultSummaryData.getTotalPrincipal()) - .totalPrincipalFromCapitalizedIncome(defaultSummaryData.getTotalPrincipalFromCapitalizedIncome()) + .principalDisbursed(defaultSummaryData.getPrincipalDisbursed()) .principalAdjustments(defaultSummaryData.getPrincipalAdjustments()).principalPaid(defaultSummaryData.getPrincipalPaid()) .principalWrittenOff(defaultSummaryData.getPrincipalWrittenOff()) .principalOutstanding(defaultSummaryData.getPrincipalOutstanding()) diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanCapitalizedIncomeAmortizationProcessingServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanCapitalizedIncomeAmortizationProcessingServiceImpl.java index b5e3bea47..040ff7f52 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanCapitalizedIncomeAmortizationProcessingServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanCapitalizedIncomeAmortizationProcessingServiceImpl.java @@ -21,12 +21,10 @@ package org.apache.fineract.portfolio.loanaccount.service; import java.math.BigDecimal; import java.time.LocalDate; import java.util.List; -import java.util.Optional; import lombok.RequiredArgsConstructor; import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService; import org.apache.fineract.infrastructure.core.domain.ExternalId; import org.apache.fineract.infrastructure.core.service.DateUtils; -import org.apache.fineract.infrastructure.core.service.MathUtil; import org.apache.fineract.infrastructure.event.business.domain.loan.LoanAdjustTransactionBusinessEvent; import org.apache.fineract.infrastructure.event.business.domain.loan.transaction.LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent; import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService; @@ -53,10 +51,9 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L @Transactional public void processCapitalizedIncomeAmortizationOnLoanClosure(@NotNull final Loan loan) { final LocalDate transactionDate = getFinalCapitalizedIncomeAmortizationTransactionDate(loan); - final Optional amortizationTransaction = createCapitalizedIncomeAmortizationTransaction(loan, transactionDate, - false); - amortizationTransaction.ifPresent(loanTransaction -> businessEventNotifierService - .notifyPostBusinessEvent(new LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(loanTransaction))); + final LoanTransaction amortizationTransaction = createCapitalizedIncomeAmortizationTransaction(loan, transactionDate, false); + businessEventNotifierService + .notifyPostBusinessEvent(new LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(amortizationTransaction)); } @Override @@ -70,16 +67,13 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L transactionDate = DateUtils.getBusinessLocalDate(); } - final Optional amortizationTransaction = createCapitalizedIncomeAmortizationTransaction(loan, transactionDate, - true); - if (amortizationTransaction.isPresent()) { - journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); - businessEventNotifierService.notifyPostBusinessEvent( - new LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(amortizationTransaction.get())); - } + final LoanTransaction amortizationTransaction = createCapitalizedIncomeAmortizationTransaction(loan, transactionDate, true); + journalEntryPoster.postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); + businessEventNotifierService + .notifyPostBusinessEvent(new LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(amortizationTransaction)); } - private Optional createCapitalizedIncomeAmortizationTransaction(final Loan loan, final LocalDate transactionDate, + private LoanTransaction createCapitalizedIncomeAmortizationTransaction(final Loan loan, final LocalDate transactionDate, final boolean isChargeOff) { ExternalId externalId = ExternalId.empty(); BigDecimal totalUnrecognizedAmount = BigDecimal.ZERO; @@ -98,17 +92,13 @@ public class LoanCapitalizedIncomeAmortizationProcessingServiceImpl implements L balance.setUnrecognizedAmount(BigDecimal.ZERO); } - if (MathUtil.isLessThanOrEqualZero(totalUnrecognizedAmount)) { - return Optional.empty(); - } - final LoanTransaction amortizationTransaction = LoanTransaction.capitalizedIncomeAmortization(loan, loan.getOffice(), transactionDate, totalUnrecognizedAmount, externalId); loan.addLoanTransaction(amortizationTransaction); loanTransactionRepository.saveAndFlush(amortizationTransaction); - return Optional.of(amortizationTransaction); + return amortizationTransaction; } @Override diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index dbde91dd9..ca2154bda 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -98,7 +98,6 @@ import org.apache.fineract.portfolio.loanaccount.data.LoanApprovalData; import org.apache.fineract.portfolio.loanaccount.data.LoanChargePaidByData; import org.apache.fineract.portfolio.loanaccount.data.LoanInterestRecalculationData; import org.apache.fineract.portfolio.loanaccount.data.LoanRepaymentScheduleInstallmentData; -import org.apache.fineract.portfolio.loanaccount.data.LoanSchedulePeriodDataWrapper; import org.apache.fineract.portfolio.loanaccount.data.LoanStatusEnumData; import org.apache.fineract.portfolio.loanaccount.data.LoanSummaryData; import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData; @@ -119,7 +118,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanRepositoryWrapper; import org.apache.fineract.portfolio.loanaccount.domain.LoanStatus; import org.apache.fineract.portfolio.loanaccount.domain.LoanSubStatus; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction; -import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepaymentPeriodData; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository; import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionType; import org.apache.fineract.portfolio.loanaccount.exception.LoanNotFoundException; @@ -251,10 +249,8 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa accountData.getFeeChargesAtDisbursementCharged()); final Collection disbursementData = retrieveLoanDisbursementDetails(accountData.getId()); - List capitalizedIncomeData = loanCapitalizedIncomeBalanceRepository - .findRepaymentPeriodDataByLoanId(accountData.getId()); final LoanScheduleData repaymentSchedule = retrieveRepaymentSchedule(accountData.getId(), repaymentScheduleRelatedData, - disbursementData, capitalizedIncomeData, accountData.isInterestRecalculationEnabled(), + disbursementData, accountData.isInterestRecalculationEnabled(), LoanScheduleType.fromEnumOptionData(accountData.getLoanScheduleType())); accountData.setRepaymentSchedule(repaymentSchedule); return accountData; @@ -263,15 +259,13 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa @Override public LoanScheduleData retrieveRepaymentSchedule(final Long loanId, final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, Collection disbursementData, - Collection capitalizedIncomeData, boolean isInterestRecalculationEnabled, - LoanScheduleType loanScheduleType) { + boolean isInterestRecalculationEnabled, LoanScheduleType loanScheduleType) { try { this.context.authenticatedUser(); final LoanScheduleResultSetExtractor fullResultsetExtractor = new LoanScheduleResultSetExtractor( - repaymentScheduleRelatedLoanData, disbursementData, capitalizedIncomeData, isInterestRecalculationEnabled, - loanScheduleType); + repaymentScheduleRelatedLoanData, disbursementData, isInterestRecalculationEnabled, loanScheduleType); final String sql = "select " + fullResultsetExtractor.schema() + " where ls.loan_id = ? order by ls.loan_id, ls.installment"; return this.jdbcTemplate.query(sql, fullResultsetExtractor, loanId); // NOSONAR @@ -755,7 +749,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa + " l.expected_disbursedon_date as expectedDisbursementDate, l.disbursedon_date as actualDisbursementDate, dbu.username as disbursedByUsername, dbu.firstname as disbursedByFirstname, dbu.lastname as disbursedByLastname," + " l.closedon_date as closedOnDate, cbu.username as closedByUsername, cbu.firstname as closedByFirstname, cbu.lastname as closedByLastname, l.writtenoffon_date as writtenOffOnDate, " + " l.expected_firstrepaymenton_date as expectedFirstRepaymentOnDate, l.interest_calculated_from_date as interestChargedFromDate, l.maturedon_date as actualMaturityDate, l.expected_maturedon_date as expectedMaturityDate, " - + " l.principal_amount_proposed as proposedPrincipal, l.principal_amount as principal, l.total_principal_derived as totalPrincipal, l.approved_principal as approvedPrincipal, l.net_disbursal_amount as netDisbursalAmount, l.arrearstolerance_amount as inArrearsTolerance, l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery," + + " l.principal_amount_proposed as proposedPrincipal, l.principal_amount as principal, l.approved_principal as approvedPrincipal, l.net_disbursal_amount as netDisbursalAmount, l.arrearstolerance_amount as inArrearsTolerance, l.number_of_repayments as numberOfRepayments, l.repay_every as repaymentEvery," + " l.grace_on_principal_periods as graceOnPrincipalPayment, l.recurring_moratorium_principal_periods as recurringMoratoriumOnPrincipalPeriods, l.grace_on_interest_periods as graceOnInterestPayment, l.grace_interest_free_periods as graceOnInterestCharged,l.grace_on_arrears_ageing as graceOnArrearsAgeing," + " l.nominal_interest_rate_per_period as interestRatePerPeriod, l.annual_nominal_interest_rate as annualInterestRate, " + " l.repayment_period_frequency_enum as repaymentFrequencyType, l.interest_period_frequency_enum as interestRateFrequencyType, " @@ -770,7 +764,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa + sqlGenerator.escape("name") + " as currencyName, rc.display_symbol as currencyDisplaySymbol, rc.internationalized_name_code as currencyNameCode, " + " l.loan_officer_id as loanOfficerId, s.display_name as loanOfficerName, " - + " l.principal_disbursed_derived as principalDisbursed, l.capitalized_income_derived as totalPrincipalFromCapitalizedIncome, l.principal_repaid_derived as principalPaid," + + " l.principal_disbursed_derived as principalDisbursed, l.principal_repaid_derived as principalPaid," + " l.principal_adjustments_derived as principalAdjustments, l.principal_writtenoff_derived as principalWrittenOff," + " l.fee_adjustments_derived as feeAdjustments, l.penalty_adjustments_derived as penaltyAdjustments," + " l.principal_outstanding_derived as principalOutstanding, l.interest_charged_derived as interestCharged," @@ -1029,9 +1023,6 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa // loan summary final BigDecimal principalDisbursed = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalDisbursed"); - final BigDecimal totalPrincipal = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "totalPrincipal"); - final BigDecimal totalPrincipalFromCapitalizedIncome = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, - "totalPrincipalFromCapitalizedIncome"); final BigDecimal principalAdjustments = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalAdjustments"); final BigDecimal principalPaid = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalPaid"); final BigDecimal principalWrittenOff = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalWrittenOff"); @@ -1075,7 +1066,6 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa inArrears = (overdueSinceDate != null); loanSummary = LoanSummaryData.builder().currency(currencyData).principalDisbursed(principalDisbursed) - .totalPrincipal(totalPrincipal).totalPrincipalFromCapitalizedIncome(totalPrincipalFromCapitalizedIncome) .principalAdjustments(principalAdjustments).principalPaid(principalPaid).principalWrittenOff(principalWrittenOff) .principalOutstanding(principalOutstanding).principalOverdue(principalOverdue).interestCharged(interestCharged) .interestPaid(interestPaid).interestWaived(interestWaived).interestWrittenOff(interestWrittenOff) @@ -1281,18 +1271,15 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa private final DisbursementData disbursement; private final BigDecimal totalFeeChargesDueAtDisbursement; private final Collection disbursementData; - private final Collection capitalizedIncomeData; private final LoanScheduleType loanScheduleType; private LocalDate lastDueDate; private BigDecimal outstandingLoanPrincipalBalance; private boolean excludePastUnDisbursed; LoanScheduleResultSetExtractor(final RepaymentScheduleRelatedLoanData repaymentScheduleRelatedLoanData, - Collection disbursementData, Collection capitalizedIncomeData, - boolean isInterestRecalculationEnabled, LoanScheduleType loanScheduleType) { + Collection disbursementData, boolean isInterestRecalculationEnabled, LoanScheduleType loanScheduleType) { this.currency = repaymentScheduleRelatedLoanData.getCurrency(); this.disbursement = repaymentScheduleRelatedLoanData.disbursementData(); - this.capitalizedIncomeData = capitalizedIncomeData; this.totalFeeChargesDueAtDisbursement = repaymentScheduleRelatedLoanData.getTotalFeeChargesAtDisbursement(); this.lastDueDate = this.disbursement.disbursementDate(); this.outstandingLoanPrincipalBalance = this.disbursement.getPrincipal(); @@ -1372,15 +1359,10 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa final LocalDate dueDate = JdbcSupport.getLocalDate(rs, "dueDate"); final LocalDate obligationsMetOnDate = JdbcSupport.getLocalDate(rs, "obligationsMetOnDate"); final boolean complete = rs.getBoolean("complete"); + BigDecimal disbursedAmount = BigDecimal.ZERO; - List combinedDataList = new ArrayList<>(); - combinedDataList.addAll( - collectEligibleDisbursementData(loanScheduleType, disbursementData, fromDate, dueDate, disbursementPeriodIds)); - combinedDataList.addAll(collectEligibleCapitalizedIncomeData(fromDate, dueDate, disbursementPeriodIds)); - combinedDataList.sort(this::sortPeriodDataHolders); - fillLoanSchedulePeriodData(periods, combinedDataList, disbursementChargeAmount, waivedChargeAmount); - - BigDecimal disbursedAmount = calculateDisbursedAmount(combinedDataList); + disbursedAmount = processDisbursementData(loanScheduleType, disbursementData, fromDate, dueDate, disbursementPeriodIds, + disbursementChargeAmount, waivedChargeAmount, periods); // Add the Charge back or Credits to the initial amount to avoid negative balance final BigDecimal principalCredits = JdbcSupport.getBigDecimalDefaultToZeroIfNull(rs, "principalCredits"); @@ -1491,82 +1473,26 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa totalPaidLate.getAmount(), totalOutstanding.getAmount(), totalCredits.getAmount()); } - private List collectEligibleDisbursementData(LoanScheduleType loanScheduleType, - Collection disbursementData, LocalDate fromDate, LocalDate dueDate, Set disbursementPeriodIds) { - List disbursementDataList = new ArrayList<>(); - // Collect eligible disbursement data + private BigDecimal processDisbursementData(LoanScheduleType loanScheduleType, Collection disbursementData, + LocalDate fromDate, LocalDate dueDate, Set disbursementPeriodIds, BigDecimal disbursementChargeAmount, + BigDecimal waivedChargeAmount, List periods) { + BigDecimal disbursedAmount = BigDecimal.ZERO; for (final DisbursementData data : disbursementData) { boolean isDueForDisbursement = data.isDueForDisbursement(loanScheduleType, fromDate, dueDate); - boolean isEligible = ((fromDate.equals(this.disbursement.disbursementDate()) && data.disbursementDate().equals(fromDate)) + if (((fromDate.equals(this.disbursement.disbursementDate()) && data.disbursementDate().equals(fromDate)) || (fromDate.equals(dueDate) && data.disbursementDate().equals(fromDate)) || canAddDisbursementData(data, isDueForDisbursement, excludePastUnDisbursed)) - && !disbursementPeriodIds.contains(data.getId()); - - if (isEligible) { - disbursementDataList.add(new LoanSchedulePeriodDataWrapper(data, data.disbursementDate(), true)); + && !disbursementPeriodIds.contains(data.getId())) { + disbursedAmount = disbursedAmount.add(data.getPrincipal()); + LoanSchedulePeriodData periodData = createLoanSchedulePeriodData(data, disbursementChargeAmount, waivedChargeAmount); + periods.add(periodData); + this.outstandingLoanPrincipalBalance = this.outstandingLoanPrincipalBalance.add(periodData.getPrincipalDisbursed()); disbursementPeriodIds.add(data.getId()); } } - return disbursementDataList; - } - - private List collectEligibleCapitalizedIncomeData(LocalDate fromDate, LocalDate dueDate, - Set disbursementPeriodIds) { - List capitalizedIncomeDataList = new ArrayList<>(); - // Collect eligible capitalized income data - for (LoanTransactionRepaymentPeriodData data : capitalizedIncomeData) { - boolean isEligible = canAddCapitalizedIncomeData(data, fromDate, dueDate) - && !disbursementPeriodIds.contains(data.getTransactionId()); - - if (isEligible) { - capitalizedIncomeDataList.add(new LoanSchedulePeriodDataWrapper(data, data.getDate(), false)); - disbursementPeriodIds.add(data.getTransactionId()); - } - } - return capitalizedIncomeDataList; - } - - private void fillLoanSchedulePeriodData(List periods, List combinedDataList, - BigDecimal disbursementChargeAmount, BigDecimal waivedChargeAmount) { - // Process all collected data in chronological order - for (LoanSchedulePeriodDataWrapper dataItem : combinedDataList) { - LoanSchedulePeriodData periodData; - if (dataItem.isDisbursement()) { - // Process disbursement data - DisbursementData data = (DisbursementData) dataItem.getData(); - periodData = createLoanSchedulePeriodData(data, disbursementChargeAmount, waivedChargeAmount); - } else { - // Process capitalized income data - LoanTransactionRepaymentPeriodData data = (LoanTransactionRepaymentPeriodData) dataItem.getData(); - periodData = createLoanSchedulePeriodData(data); - } - - // Common processing for both data types - periods.add(periodData); - this.outstandingLoanPrincipalBalance = this.outstandingLoanPrincipalBalance.add(periodData.getPrincipalDisbursed()); - } - } - - private BigDecimal calculateDisbursedAmount(List combinedDataList) { - BigDecimal disbursedAmount = BigDecimal.ZERO; - for (LoanSchedulePeriodDataWrapper dataItem : combinedDataList) { - if (dataItem.isDisbursement()) { - DisbursementData data = (DisbursementData) dataItem.getData(); - disbursedAmount = disbursedAmount.add(data.getPrincipal()); - } - } return disbursedAmount; } - private int sortPeriodDataHolders(LoanSchedulePeriodDataWrapper item1, LoanSchedulePeriodDataWrapper item2) { - int dateComparison = item1.getDate().compareTo(item2.getDate()); - if (dateComparison == 0 && item1.isDisbursement() != item2.isDisbursement()) { - // If dates are equal, prioritize disbursement data - return item1.isDisbursement() ? -1 : 1; - } - return dateComparison; - } - private LoanSchedulePeriodData createLoanSchedulePeriodData(final DisbursementData data, BigDecimal disbursementChargeAmount, BigDecimal waivedChargeAmount) { BigDecimal chargeAmount = data.getChargeAmount() == null ? disbursementChargeAmount @@ -1575,20 +1501,11 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa data.isDisbursed()); } - private LoanSchedulePeriodData createLoanSchedulePeriodData(final LoanTransactionRepaymentPeriodData data) { - BigDecimal feeCharges = Objects.isNull(data.getFeeChargesPortion()) ? BigDecimal.ZERO : data.getFeeChargesPortion(); - return LoanSchedulePeriodData.disbursementOnlyPeriod(data.getDate(), data.getAmount(), feeCharges, !data.isReversed()); - } - private boolean canAddDisbursementData(DisbursementData data, boolean isDueForDisbursement, boolean excludePastUnDisbursed) { return (!excludePastUnDisbursed || data.isDisbursed() || !DateUtils.isBeforeBusinessDate(data.disbursementDate())) && isDueForDisbursement; } - private boolean canAddCapitalizedIncomeData(LoanTransactionRepaymentPeriodData data, LocalDate fromDate, LocalDate dueDate) { - return !data.isReversed() && DateUtils.isDateInRangeFromInclusiveToExclusive(fromDate, dueDate, data.getDate()); - } - } private static final class LoanTransactionsMapper implements RowMapper { @@ -2251,7 +2168,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.REPAYMENT); final Collection paymentTypeOptions = this.paymentTypeReadPlatformService.retrieveAllPaymentTypes(); final BigDecimal outstandingLoanBalance = loanRepaymentScheduleInstallment.getPrincipalOutstanding(currency).getAmount(); - final Boolean isManuallyReversed = false; + final Boolean isReversed = false; final Money outStandingAmount = loanRepaymentScheduleInstallment.getTotalOutstanding(currency); @@ -2261,8 +2178,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService, Loa loanRepaymentScheduleInstallment.getInterestOutstanding(currency).getAmount(), loanRepaymentScheduleInstallment.getFeeChargesOutstanding(currency).getAmount(), loanRepaymentScheduleInstallment.getPenaltyChargesOutstanding(currency).getAmount(), null, unrecognizedIncomePortion, - paymentTypeOptions, ExternalId.empty(), null, null, outstandingLoanBalance, isManuallyReversed, loanId, - loan.getExternalId()); + paymentTypeOptions, ExternalId.empty(), null, null, outstandingLoanBalance, isReversed, loanId, loan.getExternalId()); } private static final class CurrencyMapper implements RowMapper { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/adjustment/LoanAdjustmentServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/adjustment/LoanAdjustmentServiceImpl.java index dabf4eae2..9b00b712a 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/adjustment/LoanAdjustmentServiceImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/adjustment/LoanAdjustmentServiceImpl.java @@ -64,7 +64,6 @@ import org.apache.fineract.portfolio.loanaccount.service.LoanBalanceService; import org.apache.fineract.portfolio.loanaccount.service.LoanDownPaymentHandlerService; import org.apache.fineract.portfolio.loanaccount.service.LoanJournalEntryPoster; import org.apache.fineract.portfolio.loanaccount.service.LoanUtilService; -import org.apache.fineract.portfolio.loanaccount.service.ReprocessLoanTransactionsService; import org.apache.fineract.portfolio.note.domain.Note; import org.apache.fineract.portfolio.note.domain.NoteRepository; import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail; @@ -94,7 +93,6 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService { private final LoanChargeValidator loanChargeValidator; private final LoanJournalEntryPoster journalEntryPoster; private final LoanBalanceService loanBalanceService; - private final ReprocessLoanTransactionsService reprocessLoanTransactionsService; @Override public CommandProcessingResult adjustLoanTransaction(Loan loan, LoanTransaction transactionToAdjust, LoanAdjustmentParameter parameter, @@ -247,9 +245,8 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService { transactionForAdjustment.getTransactionDate()); if (!transactionForAdjustment.isAccrualRelated() && transactionForAdjustment.isNotRepaymentLikeType() - && transactionForAdjustment.isNotWaiver() && transactionForAdjustment.isNotCreditBalanceRefund() - && !transactionForAdjustment.isCapitalizedIncome()) { - final String errorMessage = "Only (non-reversed) transactions of type repayment, waiver, capitalized income, accrual or credit balance refund can be adjusted."; + && transactionForAdjustment.isNotWaiver() && transactionForAdjustment.isNotCreditBalanceRefund()) { + final String errorMessage = "Only (non-reversed) transactions of type repayment, waiver, accrual or credit balance refund can be adjusted."; throw new InvalidLoanTransactionTypeException("transaction", "adjustment.is.only.allowed.to.repayment.or.waiver.or.creditbalancerefund.transactions", errorMessage); } @@ -288,10 +285,6 @@ public class LoanAdjustmentServiceImpl implements LoanAdjustmentService { loanDownPaymentHandlerService.handleRepaymentOrRecoveryOrWaiverTransaction(loan, newTransactionDetail, transactionForAdjustment, scheduleGeneratorDTO); } - - if (transactionForAdjustment.getTypeOf().equals(LoanTransactionType.CAPITALIZED_INCOME)) { - reprocessLoanTransactionsService.reprocessTransactions(loan); - } } private Loan saveAndFlushLoanWithDataIntegrityViolationChecks(final Loan loan) { diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java index 44500747e..5d50d8197 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java @@ -204,13 +204,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf } @Override - public void createLoanTransactionNote(final Long loanTransactionId, final String note) { - final LoanTransaction loanTransaction = this.loanTransactionRepository.findById(loanTransactionId) - .orElseThrow(() -> new LoanTransactionNotFoundException(loanTransactionId)); - - final Loan loan = loanTransaction.getLoan(); - - final Note newNote = Note.loanTransactionNote(loan, loanTransaction, note); + public void createLoanNote(final Long loanId, final String note) { + final Loan loan = this.loanRepository.findOneWithNotFoundDetection(loanId); + final Note newNote = Note.loanNote(loan, note); this.noteRepository.save(newNote); } diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index af37175c5..61fb03607 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -196,5 +196,4 @@ - diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0178_add_principal_from_capitalized_income_to_loan_summary.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0178_add_principal_from_capitalized_income_to_loan_summary.xml deleted file mode 100644 index 626d536bb..000000000 --- a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0178_add_principal_from_capitalized_income_to_loan_summary.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationWaiveLoanCharges.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationWaiveLoanCharges.java index 00b574b35..581451692 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationWaiveLoanCharges.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/AdvancedPaymentAllocationWaiveLoanCharges.java @@ -31,6 +31,7 @@ import org.apache.fineract.client.models.PostLoanProductsRequest; import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoansLoanIdChargesChargeIdRequest; import org.apache.fineract.integrationtests.common.ClientHelper; +import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.integrationtests.common.loans.LoanTestLifecycleExtension; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; @@ -72,7 +73,7 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati Assertions.assertNotNull(waiveTransaction.getLoanChargePaidByList()); Assertions.assertEquals(1, waiveTransaction.getLoanChargePaidByList().size()); Assertions.assertEquals(loanChargeId, waiveTransaction.getLoanChargePaidByList().get(0).getChargeId()); - Assertions.assertEquals(50.0, waiveTransaction.getLoanChargePaidByList().get(0).getAmount()); + Assertions.assertEquals(50.0, Utils.getDoubleValue(waiveTransaction.getLoanChargePaidByList().get(0).getAmount())); }); } @@ -105,7 +106,7 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati Assertions.assertNotNull(waiveTransaction.getLoanChargePaidByList()); Assertions.assertEquals(1, waiveTransaction.getLoanChargePaidByList().size()); Assertions.assertEquals(loanChargeId, waiveTransaction.getLoanChargePaidByList().get(0).getChargeId()); - Assertions.assertEquals(50.0, waiveTransaction.getLoanChargePaidByList().get(0).getAmount()); + Assertions.assertEquals(50.0, Utils.getDoubleValue(waiveTransaction.getLoanChargePaidByList().get(0).getAmount())); }); } @@ -143,7 +144,7 @@ public class AdvancedPaymentAllocationWaiveLoanCharges extends BaseLoanIntegrati Assertions.assertNotNull(waiveTransaction.getLoanChargePaidByList()); Assertions.assertEquals(1, waiveTransaction.getLoanChargePaidByList().size()); Assertions.assertEquals(loanChargeId, waiveTransaction.getLoanChargePaidByList().get(0).getChargeId()); - Assertions.assertEquals(50.0, waiveTransaction.getLoanChargePaidByList().get(0).getAmount()); + Assertions.assertEquals(50.0, Utils.getDoubleValue(waiveTransaction.getLoanChargePaidByList().get(0).getAmount())); addRepaymentForLoan(loanId, 200.0, "03 January 2023"); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java index c247950a8..970a19533 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ClientLoanIntegrationTest.java @@ -5435,9 +5435,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdTransactions replayedTransaction = loanDetails.getTransactions().stream() .filter(t -> externalId.equals(t.getExternalId())).findFirst().get(); - assertEquals(10.0, replayedTransaction.getAmount()); - assertEquals(5.0, replayedTransaction.getPenaltyChargesPortion()); - assertEquals(5.0, replayedTransaction.getPrincipalPortion()); + assertEquals(10.0, Utils.getDoubleValue(replayedTransaction.getAmount())); + assertEquals(5.0, Utils.getDoubleValue(replayedTransaction.getPenaltyChargesPortion())); + assertEquals(5.0, Utils.getDoubleValue(replayedTransaction.getPrincipalPortion())); assertEquals("loanTransactionType.chargeAdjustment", replayedTransaction.getType().getCode()); assertEquals(externalId, replayedTransaction.getExternalId()); @@ -5549,10 +5549,10 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); List loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); LocalDate targetDate = LocalDate.of(2022, 9, 7); final String penaltyCharge1AddedDate = DATE_TIME_FORMATTER.format(targetDate); @@ -5564,9 +5564,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); List transactions = loanDetails.getTransactions(); - assertEquals(10.0, transactions.get(1).getAmount()); + assertEquals(10.0, Utils.getDoubleValue(transactions.get(1).getAmount())); assertTrue(transactions.get(1).getType().getAccrual()); - assertEquals(10.0, transactions.get(1).getPenaltyChargesPortion()); + assertEquals(10.0, Utils.getDoubleValue(transactions.get(1).getPenaltyChargesPortion())); Long accrualTransactionId = transactions.get(1).getId(); List journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + accrualTransactionId); @@ -5579,15 +5579,15 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(1010.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(1010.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(1010.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(1010.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); GetLoansLoanIdSummary loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(10.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(1010.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(1010.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); String externalId = UUID.randomUUID().toString(); PostLoansLoanIdChargesChargeIdResponse chargeAdjustmentResponse = LOAN_TRANSACTION_HELPER.chargeAdjustment((long) loanID, @@ -5597,23 +5597,23 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(1010.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); - assertEquals(10.0, loanSchedulePeriods.get(1).getTotalPaidForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(1010.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalPaidForPeriod())); loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(0.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(10.0, loanSummary.getPenaltyChargesPaid()); - assertEquals(1000.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesPaid())); + assertEquals(1000.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); transactions = loanDetails.getTransactions(); - assertEquals(10.0, transactions.get(2).getAmount()); + assertEquals(10.0, Utils.getDoubleValue(transactions.get(2).getAmount())); assertTrue(transactions.get(2).getType().getChargeAdjustment()); - assertEquals(10.0, transactions.get(2).getPenaltyChargesPortion()); + assertEquals(10.0, Utils.getDoubleValue(transactions.get(2).getPenaltyChargesPortion())); Long chargeAdjustmentTransactionId = transactions.get(2).getId(); journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + chargeAdjustmentTransactionId); @@ -5654,9 +5654,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); transactions = loanDetails.getTransactions(); - assertEquals(3.0, transactions.get(2).getAmount()); + assertEquals(3.0, Utils.getDoubleValue(transactions.get(2).getAmount())); assertTrue(transactions.get(2).getType().getAccrual()); - assertEquals(3.0, transactions.get(2).getFeeChargesPortion()); + assertEquals(3.0, Utils.getDoubleValue(transactions.get(2).getFeeChargesPortion())); assertTrue(StringUtils.isNotBlank(transactions.get(2).getExternalId())); accrualTransactionId = transactions.get(2).getId(); @@ -5670,19 +5670,19 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesDue()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesOutstanding()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesDue())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesOutstanding())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(10.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(3.0, loanSummary.getFeeChargesCharged()); - assertEquals(3.0, loanSummary.getFeeChargesOutstanding()); - assertEquals(1013.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesCharged())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesOutstanding())); + assertEquals(1013.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); LOAN_TRANSACTION_HELPER.makeLoanRepayment((long) loanID, new PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN) .transactionDate("11 September 2022").locale("en").transactionAmount(5.0)); @@ -5695,37 +5695,37 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(7.0, loanSchedulePeriods.get(1).getPenaltyChargesPaid()); - assertEquals(3.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesDue()); - assertEquals(0.0, loanSchedulePeriods.get(1).getFeeChargesPaid()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getPrincipalDue()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPrincipalPaid()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getPrincipalOutstanding()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(1006.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); - assertEquals(7.0, loanSchedulePeriods.get(1).getTotalPaidForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(7.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesPaid())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesPaid())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalOutstanding())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(1006.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); + assertEquals(7.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalPaidForPeriod())); loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(3.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(7.0, loanSummary.getPenaltyChargesPaid()); - assertEquals(3.0, loanSummary.getFeeChargesCharged()); - assertEquals(3.0, loanSummary.getFeeChargesOutstanding()); - assertEquals(0.0, loanSummary.getFeeChargesPaid()); - assertEquals(1000.0, loanSummary.getPrincipalOutstanding()); - assertEquals(0.0, loanSummary.getPrincipalPaid()); - assertEquals(7.0, loanSummary.getTotalRepayment()); - assertEquals(1006.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(7.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesPaid())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesCharged())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getFeeChargesPaid())); + assertEquals(1000.0, Utils.getDoubleValue(loanSummary.getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getPrincipalPaid())); + assertEquals(7.0, Utils.getDoubleValue(loanSummary.getTotalRepayment())); + assertEquals(1006.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); transactions = loanDetails.getTransactions(); - assertEquals(2.0, transactions.get(5).getAmount()); + assertEquals(2.0, Utils.getDoubleValue(transactions.get(5).getAmount())); assertTrue(transactions.get(4).getType().getChargeAdjustment()); - assertEquals(2.0, transactions.get(5).getPenaltyChargesPortion()); - assertEquals(0.0, transactions.get(5).getFeeChargesPortion()); - assertEquals(0.0, transactions.get(5).getPrincipalPortion()); + assertEquals(2.0, Utils.getDoubleValue(transactions.get(5).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(5).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(5).getPrincipalPortion())); chargeAdjustmentTransactionId = transactions.get(5).getId(); journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + chargeAdjustmentTransactionId); @@ -5744,37 +5744,37 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesDue()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getPrincipalDue()); - assertEquals(1.0, loanSchedulePeriods.get(1).getPrincipalPaid()); - assertEquals(999.0, loanSchedulePeriods.get(1).getPrincipalOutstanding()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(999.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); - assertEquals(14.0, loanSchedulePeriods.get(1).getTotalPaidForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesDue())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalDue())); + assertEquals(1.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalPaid())); + assertEquals(999.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalOutstanding())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(999.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); + assertEquals(14.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalPaidForPeriod())); loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(0.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(10.0, loanSummary.getPenaltyChargesPaid()); - assertEquals(3.0, loanSummary.getFeeChargesCharged()); - assertEquals(0.0, loanSummary.getFeeChargesOutstanding()); - assertEquals(3.0, loanSummary.getFeeChargesPaid()); - assertEquals(999.0, loanSummary.getPrincipalOutstanding()); - assertEquals(1.0, loanSummary.getPrincipalPaid()); - assertEquals(14.0, loanSummary.getTotalRepayment()); - assertEquals(999.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesPaid())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesCharged())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getFeeChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesPaid())); + assertEquals(999.0, Utils.getDoubleValue(loanSummary.getPrincipalOutstanding())); + assertEquals(1.0, Utils.getDoubleValue(loanSummary.getPrincipalPaid())); + assertEquals(14.0, Utils.getDoubleValue(loanSummary.getTotalRepayment())); + assertEquals(999.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); transactions = loanDetails.getTransactions(); - assertEquals(7.0, transactions.get(6).getAmount()); + assertEquals(7.0, Utils.getDoubleValue(transactions.get(6).getAmount())); assertTrue(transactions.get(6).getType().getChargeAdjustment()); - assertEquals(3.0, transactions.get(6).getPenaltyChargesPortion()); - assertEquals(3.0, transactions.get(6).getFeeChargesPortion()); - assertEquals(1.0, transactions.get(6).getPrincipalPortion()); + assertEquals(3.0, Utils.getDoubleValue(transactions.get(6).getPenaltyChargesPortion())); + assertEquals(3.0, Utils.getDoubleValue(transactions.get(6).getFeeChargesPortion())); + assertEquals(1.0, Utils.getDoubleValue(transactions.get(6).getPrincipalPortion())); chargeAdjustmentTransactionId = transactions.get(6).getId(); journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + chargeAdjustmentTransactionId); @@ -5810,37 +5810,37 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanSchedulePeriods = loanDetails.getRepaymentSchedule().getPeriods(); assertEquals(2, loanSchedulePeriods.size()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesDue()); - assertEquals(10.0, loanSchedulePeriods.get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPenaltyChargesOutstanding()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesDue()); - assertEquals(3.0, loanSchedulePeriods.get(1).getFeeChargesPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getPrincipalDue()); - assertEquals(1000.0, loanSchedulePeriods.get(1).getPrincipalPaid()); - assertEquals(0.0, loanSchedulePeriods.get(1).getPrincipalOutstanding()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalDueForPeriod()); - assertEquals(0.0, loanSchedulePeriods.get(1).getTotalOutstandingForPeriod()); - assertEquals(1013.0, loanSchedulePeriods.get(1).getTotalPaidForPeriod()); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPenaltyChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesDue())); + assertEquals(3.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getPrincipalOutstanding())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalDueForPeriod())); + assertEquals(0.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalOutstandingForPeriod())); + assertEquals(1013.0, Utils.getDoubleValue(loanSchedulePeriods.get(1).getTotalPaidForPeriod())); loanSummary = loanDetails.getSummary(); - assertEquals(10.0, loanSummary.getPenaltyChargesCharged()); - assertEquals(0.0, loanSummary.getPenaltyChargesOutstanding()); - assertEquals(10.0, loanSummary.getPenaltyChargesPaid()); - assertEquals(3.0, loanSummary.getFeeChargesCharged()); - assertEquals(0.0, loanSummary.getFeeChargesOutstanding()); - assertEquals(3.0, loanSummary.getFeeChargesPaid()); - assertEquals(0.0, loanSummary.getPrincipalOutstanding()); - assertEquals(1000.0, loanSummary.getPrincipalPaid()); - assertEquals(1013.0, loanSummary.getTotalRepayment()); - assertEquals(0.0, loanSummary.getTotalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesCharged())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(loanSummary.getPenaltyChargesPaid())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesCharged())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getFeeChargesOutstanding())); + assertEquals(3.0, Utils.getDoubleValue(loanSummary.getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getPrincipalOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(loanSummary.getPrincipalPaid())); + assertEquals(1013.0, Utils.getDoubleValue(loanSummary.getTotalRepayment())); + assertEquals(0.0, Utils.getDoubleValue(loanSummary.getTotalOutstanding())); transactions = loanDetails.getTransactions(); - assertEquals(1.0, transactions.get(8).getAmount()); + assertEquals(1.0, Utils.getDoubleValue(transactions.get(8).getAmount())); assertTrue(transactions.get(8).getType().getChargeAdjustment()); - assertEquals(0.0, transactions.get(8).getPenaltyChargesPortion()); - assertEquals(0.0, transactions.get(8).getFeeChargesPortion()); - assertEquals(1.0, transactions.get(8).getPrincipalPortion()); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(8).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(8).getFeeChargesPortion())); + assertEquals(1.0, Utils.getDoubleValue(transactions.get(8).getPrincipalPortion())); chargeAdjustmentTransactionId = transactions.get(8).getId(); journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + chargeAdjustmentTransactionId); @@ -5860,12 +5860,12 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); transactions = loanDetails.getTransactions(); - assertEquals(1.0, transactions.get(9).getAmount()); + assertEquals(1.0, Utils.getDoubleValue(transactions.get(9).getAmount())); assertTrue(transactions.get(9).getType().getChargeAdjustment()); - assertEquals(0.0, transactions.get(9).getPenaltyChargesPortion()); - assertEquals(0.0, transactions.get(9).getFeeChargesPortion()); - assertEquals(0.0, transactions.get(9).getPrincipalPortion()); - assertEquals(1.0, transactions.get(9).getOverpaymentPortion()); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(9).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(9).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(transactions.get(9).getPrincipalPortion())); + assertEquals(1.0, Utils.getDoubleValue(transactions.get(9).getOverpaymentPortion())); chargeAdjustmentTransactionId = transactions.get(9).getId(); journalEntries = JOURNAL_ENTRY_HELPER.getJournalEntriesByTransactionId("L" + chargeAdjustmentTransactionId); @@ -6227,7 +6227,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(2000.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(2000.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); assertFalse(loanDetails.getChargedOff()); assertNull(loanDetails.getSummary().getChargeOffReasonId()); assertNull(loanDetails.getSummary().getChargeOffReason()); @@ -6253,7 +6253,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(2003.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(2003.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); assertTrue(loanDetails.getChargedOff()); assertEquals((long) chargeOffReasonId, loanDetails.getSummary().getChargeOffReasonId()); assertEquals(randomText, loanDetails.getSummary().getChargeOffReason()); @@ -6264,9 +6264,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdTransactions chargeOffTransaction = loanDetails.getTransactions().get(loanDetails.getTransactions().size() - 1); - assertEquals(2003.0, chargeOffTransaction.getAmount()); - assertEquals(2000.0, chargeOffTransaction.getPrincipalPortion()); - assertEquals(3.0, chargeOffTransaction.getPenaltyChargesPortion()); + assertEquals(2003.0, Utils.getDoubleValue(chargeOffTransaction.getAmount())); + assertEquals(2000.0, Utils.getDoubleValue(chargeOffTransaction.getPrincipalPortion())); + assertEquals(3.0, Utils.getDoubleValue(chargeOffTransaction.getPenaltyChargesPortion())); exception = assertThrows(CallFailedRuntimeException.class, () -> { errorLoanTransactionHelper.chargeOffLoan((long) loanID, @@ -6333,8 +6333,8 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); chargeOffTransaction = loanDetails.getTransactions().get(loanDetails.getTransactions().size() - 1); - assertEquals(1998.0, chargeOffTransaction.getAmount()); - assertEquals(1998.0, chargeOffTransaction.getPrincipalPortion()); + assertEquals(1998.0, Utils.getDoubleValue(chargeOffTransaction.getAmount())); + assertEquals(1998.0, Utils.getDoubleValue(chargeOffTransaction.getPrincipalPortion())); LOAN_TRANSACTION_HELPER.makeLoanRepayment((long) loanID, new PostLoansLoanIdTransactionsRequest().dateFormat(DATETIME_PATTERN) .transactionDate("07 September 2022").locale("en").transactionAmount(5.0)); @@ -6531,23 +6531,23 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(300.0, loanDetails.getTotalOverpaid()); + assertEquals(300.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(3).getDate()); - assertEquals(390.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(90.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); - assertEquals(300.0, loanDetails.getTransactions().get(4).getOverpaymentPortion()); + assertEquals(390.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(90.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); + assertEquals(300.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(4).getDate()); LOAN_TRANSACTION_HELPER.reverseLoanTransaction((long) loanID, loanDetails.getTransactions().get(2).getId(), @@ -6556,24 +6556,24 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(290.0, loanDetails.getTotalOverpaid()); + assertEquals(290.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); assertTrue(loanDetails.getTransactions().get(2).getManuallyReversed()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(3).getDate()); - assertEquals(390.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(100.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); - assertEquals(290.0, loanDetails.getTransactions().get(4).getOverpaymentPortion()); + assertEquals(390.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); + assertEquals(290.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(4).getDate()); LOAN_TRANSACTION_HELPER.reverseLoanTransaction((long) loanID, loanDetails.getTransactions().get(1).getId(), @@ -6582,53 +6582,53 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(210.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(210.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); assertTrue(loanDetails.getTransactions().get(2).getManuallyReversed()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(10.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); assertTrue(loanDetails.getTransactions().get(2).getManuallyReversed()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(400.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(3).getDate()); - assertEquals(390.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(390.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); + assertEquals(390.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(390.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(4).getDate()); LOAN_TRANSACTION_HELPER.makeRepayment("04 September 2022", Float.parseFloat("500"), loanID); loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(290.0, loanDetails.getTotalOverpaid()); + assertEquals(290.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); assertTrue(loanDetails.getTransactions().get(1).getManuallyReversed()); - assertEquals(500.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(2).getDate()); - assertEquals(10.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(10.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(3).getDate()); assertTrue(loanDetails.getTransactions().get(3).getManuallyReversed()); - assertEquals(400.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(400.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(400.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(4).getDate()); - assertEquals(390.0, loanDetails.getTransactions().get(5).getAmount()); - assertEquals(100.0, loanDetails.getTransactions().get(5).getPrincipalPortion()); - assertEquals(290.0, loanDetails.getTransactions().get(5).getOverpaymentPortion()); + assertEquals(390.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getPrincipalPortion())); + assertEquals(290.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(5).getDate()); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_AUTO_GENERATED_EXTERNAL_ID, @@ -6672,7 +6672,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { LOAN_TRANSACTION_HELPER.makeRepayment("05 September 2022", Float.parseFloat("1100"), loanID); GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(200.0, loanDetails.getTotalOverpaid()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); assertTrue(loanDetails.getStatus().getOverpaid()); LOAN_TRANSACTION_HELPER.makeCreditBalanceRefund((long) loanID, new PostLoansLoanIdTransactionsRequest().transactionAmount(200.0) @@ -6682,21 +6682,21 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { assertTrue(loanDetails.getStatus().getClosedObligationsMet()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(1000, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); - assertEquals(100.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(100.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); - assertEquals(900.0, loanDetails.getTransactions().get(1).getOutstandingLoanBalance()); - assertEquals(1100.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(900.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(200.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); + assertEquals(900.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOutstandingLoanBalance())); + assertEquals(1100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(900.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getOverpaymentPortion()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 10, 10), loanDetails.getTransactions().get(3).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(1L, loanDetails.getTransactions().get(3).getPaymentDetailData().getPaymentType().getId()); GetJournalEntriesTransactionIdResponse journalEntriesForTransaction = JOURNAL_ENTRY_HELPER .getJournalEntries("L" + loanDetails.getTransactions().get(3).getId()); @@ -6716,34 +6716,34 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(100.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(100.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); assertTrue(loanDetails.getTransactions().get(1).getManuallyReversed()); - assertEquals(1100.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(1000.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(100.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); + assertEquals(1100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); assertEquals(1, loanDetails.getTransactions().get(2).getTransactionRelations().size()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(100.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); - assertEquals(100.0, loanDetails.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(100.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(LocalDate.of(2022, 10, 10), loanDetails.getTransactions().get(3).getDate()); assertEquals(1, loanDetails.getTransactions().get(3).getTransactionRelations().size()); assertTrue(loanDetails.getStatus().getActive()); assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(1000, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); assertTrue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); - assertEquals(200, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); assertFalse(loanDetails.getRepaymentSchedule().getPeriods().get(2).getComplete()); - assertEquals(100.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(100.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); journalEntriesForTransaction = JOURNAL_ENTRY_HELPER.getJournalEntries("L" + loanDetails.getTransactions().get(3).getId()); journalItems = journalEntriesForTransaction.getPageItems(); @@ -6808,7 +6808,7 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { LOAN_TRANSACTION_HELPER.makeRepayment("05 September 2022", Float.parseFloat("700"), loanID); GetLoansLoanIdResponse loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(200.0, loanDetails.getTotalOverpaid()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); assertTrue(loanDetails.getStatus().getOverpaid()); LOAN_TRANSACTION_HELPER.makeCreditBalanceRefund((long) loanID, new PostLoansLoanIdTransactionsRequest().transactionAmount(200.0) @@ -6824,33 +6824,33 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { assertTrue(loanDetails.getStatus().getClosedObligationsMet()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(1000, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOutstandingLoanBalance())); - assertEquals(700.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(200.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); - assertEquals(200.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getOverpaymentPortion()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(3).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); - assertEquals(500.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(4).getOverpaymentPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(4).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOutstandingLoanBalance())); - assertEquals(500.0, loanDetails.getTransactions().get(5).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(5).getOverpaymentPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 8), loanDetails.getTransactions().get(5).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(5).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getOutstandingLoanBalance())); LOAN_TRANSACTION_HELPER.reverseLoanTransaction(loanDetails.getId(), loanDetails.getTransactions().get(2).getId(), new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN).transactionAmount(0.0) @@ -6858,43 +6858,43 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { loanDetails = LOAN_TRANSACTION_HELPER.getLoanDetails((long) loanID); - assertEquals(500.0, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 4), loanDetails.getTransactions().get(1).getDate()); - assertEquals(500.0, loanDetails.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOutstandingLoanBalance())); - assertEquals(700.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(200.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); assertEquals(LocalDate.of(2022, 9, 5), loanDetails.getTransactions().get(2).getDate()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); assertTrue(loanDetails.getTransactions().get(2).getManuallyReversed()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(200.0, loanDetails.getTransactions().get(3).getPrincipalPortion()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 6), loanDetails.getTransactions().get(3).getDate()); - assertEquals(700.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(1, loanDetails.getTransactions().get(3).getTransactionRelations().size()); - assertEquals(500.0, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getTransactions().get(4).getDate()); - assertEquals(200.0, loanDetails.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOutstandingLoanBalance())); assertEquals(1, loanDetails.getTransactions().get(4).getTransactionRelations().size()); - assertEquals(500.0, loanDetails.getTransactions().get(5).getAmount()); - assertEquals(500.0, loanDetails.getTransactions().get(5).getPrincipalPortion()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getPrincipalPortion())); assertEquals(LocalDate.of(2022, 9, 8), loanDetails.getTransactions().get(5).getDate()); - assertEquals(700.0, loanDetails.getTransactions().get(5).getOutstandingLoanBalance()); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getTransactions().get(5).getOutstandingLoanBalance())); assertEquals(1, loanDetails.getTransactions().get(5).getTransactionRelations().size()); assertTrue(loanDetails.getStatus().getActive()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(1700, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); + assertEquals(1700.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); assertFalse(loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(700.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_AUTO_GENERATED_EXTERNAL_ID, @@ -6961,9 +6961,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { GetLoansLoanIdTransactions lastAccrualTransaction = loanDetails.getTransactions().stream() .filter(t -> Boolean.TRUE.equals(t.getType().getAccrual())).findFirst().get(); - assertEquals(15, lastAccrualTransaction.getAmount()); - assertEquals(5, lastAccrualTransaction.getPenaltyChargesPortion()); - assertEquals(10, lastAccrualTransaction.getFeeChargesPortion()); + assertEquals(15.0, Utils.getDoubleValue(lastAccrualTransaction.getAmount())); + assertEquals(5.0, Utils.getDoubleValue(lastAccrualTransaction.getPenaltyChargesPortion())); + assertEquals(10.0, Utils.getDoubleValue(lastAccrualTransaction.getFeeChargesPortion())); GetLoansLoanIdTransactionsTransactionIdResponse accrualTransactionDetails = LOAN_TRANSACTION_HELPER .getLoanTransactionDetails((long) loanID, lastAccrualTransaction.getId()); @@ -6971,9 +6971,9 @@ public class ClientLoanIntegrationTest extends BaseLoanIntegrationTest { assertEquals(2, accrualTransactionDetails.getLoanChargePaidByList().size()); accrualTransactionDetails.getLoanChargePaidByList().forEach(loanCharge -> { if (loanCharge.getChargeId().equals((long) penalty1LoanChargeId)) { - assertEquals(5, loanCharge.getAmount()); + assertEquals(5.0, Utils.getDoubleValue(loanCharge.getAmount())); } else { - assertEquals(10, loanCharge.getAmount()); + assertEquals(10.0, Utils.getDoubleValue(loanCharge.getAmount())); } }); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java index 08d5ad5ce..90d65f440 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DelinquencyBucketsIntegrationTest.java @@ -1269,7 +1269,7 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest { getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId); loanTransactionHelper.printDelinquencyData(getLoansLoanIdResponse); delinquent = getLoansLoanIdResponse.getDelinquent(); - assertEquals(amount, delinquent.getDelinquentAmount()); + assertEquals(amount, Utils.getDoubleValue(delinquent.getDelinquentAmount())); assertEquals(LocalDate.parse(date, dateTimeFormatter), delinquent.getDelinquentDate()); assertEquals(delinquentDays, delinquent.getDelinquentDays()); } @@ -1344,7 +1344,7 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest { getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId); loanTransactionHelper.printDelinquencyData(getLoansLoanIdResponse); GetLoansLoanIdDelinquencySummary delinquent = getLoansLoanIdResponse.getDelinquent(); - assertEquals(2049.99, delinquent.getDelinquentAmount()); + assertEquals(2049.99, Utils.getDoubleValue(delinquent.getDelinquentAmount())); assertEquals(LocalDate.of(2012, 2, 1), delinquent.getDelinquentDate()); assertEquals(31, delinquent.getDelinquentDays()); assertEquals(2, delinquent.getInstallmentLevelDelinquency().size()); @@ -1395,7 +1395,7 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest { assertNotNull(getLoansLoanIdResponse); assertNotNull(getLoansLoanIdResponse.getDelinquent()); assertEquals(0, getLoansLoanIdResponse.getDelinquent().getDelinquentDays()); - assertEquals(0, getLoansLoanIdResponse.getDelinquent().getDelinquentAmount()); + assertEquals(0.0, Utils.getDoubleValue(getLoansLoanIdResponse.getDelinquent().getDelinquentAmount())); // Loan Disbursement disburseLoanAccount(loanTransactionHelper, loanId, operationDate); @@ -1404,7 +1404,7 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest { assertNotNull(getLoansLoanIdResponse); assertNotNull(getLoansLoanIdResponse.getDelinquent()); assertNotEquals(0, getLoansLoanIdResponse.getDelinquent().getDelinquentDays()); - assertNotEquals(0, getLoansLoanIdResponse.getDelinquent().getDelinquentAmount()); + assertNotEquals(0, Utils.getDoubleValue(getLoansLoanIdResponse.getDelinquent().getDelinquentAmount())); } @Test @@ -1459,7 +1459,7 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest { assertNotNull(getLoansLoanIdResponse); assertNotNull(delinquent); assertEquals(0, delinquent.getDelinquentDays()); - assertEquals(0, delinquent.getDelinquentAmount()); + assertEquals(0.0, Utils.getDoubleValue(delinquent.getDelinquentAmount())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DueDateRespectiveLoanRepaymentScheduleTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DueDateRespectiveLoanRepaymentScheduleTest.java index 200c02ebc..75ce6a37d 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/DueDateRespectiveLoanRepaymentScheduleTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/DueDateRespectiveLoanRepaymentScheduleTest.java @@ -140,49 +140,49 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(50.0, response.getSummary().getTotalOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(950.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(50.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(950.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(500.0, response.getTransactions().get(1).getAmount()); - assertEquals(500.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(500.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(secondRepaymentId, response.getTransactions().get(2).getId().intValue()); assertNull(response.getTransactions().get(2).getReversedOnDate()); assertTrue(response.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(2).getType().getRepayment()); - assertEquals(450.0, response.getTransactions().get(2).getAmount()); - assertEquals(450.0, response.getTransactions().get(2).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(50.0, response.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(450.0, Utils.getDoubleValue(response.getTransactions().get(2).getAmount())); + assertEquals(450.0, Utils.getDoubleValue(response.getTransactions().get(2).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(2).getOutstandingLoanBalance())); assertEquals(thirdRepaymentId, response.getTransactions().get(3).getId().intValue()); assertNull(response.getTransactions().get(3).getReversedOnDate()); assertTrue(response.getTransactions().get(3).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(3).getType().getRepayment()); - assertEquals(50.0, response.getTransactions().get(3).getAmount()); - assertEquals(0.0, response.getTransactions().get(3).getPrincipalPortion()); - assertEquals(50.0, response.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(3).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(50.0, response.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(3).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getPrincipalPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(3).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(3).getLoanChargePaidByList().size()); @@ -257,52 +257,52 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(360.0, response.getSummary().getTotalOutstanding()); - assertEquals(360.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(650.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(350.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(360.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(360.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(650.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(350.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(500.0, response.getTransactions().get(1).getAmount()); - assertEquals(500.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(500.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(secondRepaymentId, response.getTransactions().get(2).getId().intValue()); assertNull(response.getTransactions().get(2).getReversedOnDate()); assertTrue(response.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(2).getType().getRepayment()); - assertEquals(100.0, response.getTransactions().get(2).getAmount()); - assertEquals(100.0, response.getTransactions().get(2).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(400.0, response.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(100.0, Utils.getDoubleValue(response.getTransactions().get(2).getAmount())); + assertEquals(100.0, Utils.getDoubleValue(response.getTransactions().get(2).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(400.0, Utils.getDoubleValue(response.getTransactions().get(2).getOutstandingLoanBalance())); assertEquals(thirdRepaymentId, response.getTransactions().get(3).getId().intValue()); assertNull(response.getTransactions().get(3).getReversedOnDate()); assertTrue(response.getTransactions().get(3).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(3).getType().getRepayment()); - assertEquals(100.0, response.getTransactions().get(3).getAmount()); - assertEquals(50.0, response.getTransactions().get(3).getPrincipalPortion()); - assertEquals(50.0, response.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(3).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(350.0, response.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(100.0, Utils.getDoubleValue(response.getTransactions().get(3).getAmount())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(3).getPrincipalPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(350.0, Utils.getDoubleValue(response.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(3).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(3).getLoanChargePaidByList().size()); } finally { @@ -361,30 +361,30 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(0.0, response.getSummary().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getClosedObligationsMet()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(500.0, response.getTransactions().get(1).getAmount()); - assertEquals(500.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(500.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); int repaymentOrderNo; int accrualOrderNo; @@ -400,13 +400,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertNull(response.getTransactions().get(accrualOrderNo).getReversedOnDate()); assertTrue(response.getTransactions().get(accrualOrderNo).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(accrualOrderNo).getType().getAccrual()); - assertEquals(50.0, response.getTransactions().get(accrualOrderNo).getAmount()); - assertEquals(0.0, response.getTransactions().get(accrualOrderNo).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(accrualOrderNo).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(accrualOrderNo).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(accrualOrderNo).getInterestPortion()); - assertEquals(50.0, response.getTransactions().get(accrualOrderNo).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(accrualOrderNo).getOutstandingLoanBalance()); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getInterestPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(accrualOrderNo).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(accrualOrderNo).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(accrualOrderNo).getLoanChargePaidByList().size()); @@ -415,13 +415,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertNull(response.getTransactions().get(repaymentOrderNo).getReversedOnDate()); assertTrue(response.getTransactions().get(repaymentOrderNo).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(repaymentOrderNo).getType().getRepayment()); - assertEquals(550.0, response.getTransactions().get(repaymentOrderNo).getAmount()); - assertEquals(500.0, response.getTransactions().get(repaymentOrderNo).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(repaymentOrderNo).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(repaymentOrderNo).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(repaymentOrderNo).getInterestPortion()); - assertEquals(50.0, response.getTransactions().get(repaymentOrderNo).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(repaymentOrderNo).getOutstandingLoanBalance()); + assertEquals(550.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getAmount())); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getInterestPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(repaymentOrderNo).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(repaymentOrderNo).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(repaymentOrderNo).getLoanChargePaidByList().size()); @@ -479,39 +479,39 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(550.0, response.getSummary().getTotalOutstanding()); - assertEquals(550.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(116.67, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(216.66, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(550.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(550.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(116.67, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(216.66, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(500.0, response.getTransactions().get(1).getAmount()); - assertEquals(450.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(50.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(550.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(450.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(550.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -570,39 +570,39 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(550.0, response.getSummary().getTotalOutstanding()); - assertEquals(550.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(116.67, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(216.66, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(550.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(550.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(116.67, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(216.66, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(500.0, response.getTransactions().get(1).getAmount()); - assertEquals(450.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(50.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(550.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(500.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(450.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(50.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(550.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -614,36 +614,36 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat int repaymentOrderNo; int accrualOrderNo; - assertEquals(0.0, response.getSummary().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(50.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(333.33, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesOutstanding()); - assertEquals(333.34, response.getRepaymentSchedule().getPeriods().get(3).getPrincipalDue()); - assertEquals(333.34, response.getRepaymentSchedule().getPeriods().get(3).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(3).getPrincipalOutstanding()); - assertEquals(100.0, response.getTotalOverpaid()); + assertEquals(0.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(50.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(333.33, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getFeeChargesOutstanding())); + assertEquals(333.34, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPrincipalDue())); + assertEquals(333.34, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(3).getPrincipalOutstanding())); + assertEquals(100.0, Utils.getDoubleValue(response.getTotalOverpaid())); assertTrue(response.getStatus().getOverpaid()); int secondRepaymentIndex; @@ -658,13 +658,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertNull(response.getTransactions().get(secondRepaymentIndex).getReversedOnDate()); assertTrue(response.getTransactions().get(secondRepaymentIndex).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(secondRepaymentIndex).getType().getRepayment()); - assertEquals(650.0, response.getTransactions().get(secondRepaymentIndex).getAmount()); - assertEquals(550.0, response.getTransactions().get(secondRepaymentIndex).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(secondRepaymentIndex).getPenaltyChargesPortion()); - assertEquals(100.0, response.getTransactions().get(secondRepaymentIndex).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(secondRepaymentIndex).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(secondRepaymentIndex).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(secondRepaymentIndex).getOutstandingLoanBalance()); + assertEquals(650.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getAmount())); + assertEquals(550.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getPenaltyChargesPortion())); + assertEquals(100.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(secondRepaymentIndex).getFeeChargesPortion())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, @@ -719,27 +719,27 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(10.0, response.getSummary().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -794,27 +794,27 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(0.0, response.getSummary().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getClosedObligationsMet()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1000.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(0, response.getTransactions().get(1).getLoanChargePaidByList().size()); PostLoansLoanIdTransactionsResponse reverseRepayment = loanTransactionHelper.reverseLoanTransaction((long) loanID, @@ -825,14 +825,14 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .date("2023.01.31").dateFormat("yyyy.MM.dd").locale("en")); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(1000.0, response.getSummary().getTotalOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1000.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); @@ -840,13 +840,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertTrue(response.getTransactions().get(1).getManuallyReversed()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1000.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(0, response.getTransactions().get(1).getLoanChargePaidByList().size()); Integer firstChargeId = loanTransactionHelper.addChargesForLoan(loanID, @@ -855,27 +855,27 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(5.0, response.getSummary().getTotalOutstanding()); - assertEquals(5.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(995.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(5.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(5.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(995.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(secondRepayment, response.getTransactions().get(2).getId().intValue()); assertNull(response.getTransactions().get(2).getReversedOnDate()); assertTrue(response.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(2).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(2).getAmount()); - assertEquals(995.0, response.getTransactions().get(2).getPrincipalPortion()); - assertEquals(15.0, response.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(5.0, response.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(2).getAmount())); + assertEquals(995.0, Utils.getDoubleValue(response.getTransactions().get(2).getPrincipalPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(5.0, Utils.getDoubleValue(response.getTransactions().get(2).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(2).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(2).getLoanChargePaidByList().size()); @@ -947,27 +947,27 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .makeRepayment("10 February 2023", Float.parseFloat("1010.00"), loanID).get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(10.0, response.getSummary().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -982,17 +982,17 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .date("2023.03.01").dateFormat("yyyy.MM.dd").locale("en")); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(1035.0, response.getSummary().getTotalOutstanding()); - assertEquals(1035.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1035.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(1035.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); @@ -1000,13 +1000,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertTrue(response.getTransactions().get(1).getManuallyReversed()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -1014,30 +1014,30 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(1020.0, response.getSummary().getTotalOutstanding()); - assertEquals(1020.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1020.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(1020.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(secondRepayment, response.getTransactions().get(2).getId().intValue()); assertNull(response.getTransactions().get(2).getReversedOnDate()); assertTrue(response.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(2).getType().getRepayment()); - assertEquals(15.0, response.getTransactions().get(2).getAmount()); - assertEquals(0.0, response.getTransactions().get(2).getPrincipalPortion()); - assertEquals(15.0, response.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(1000.0, response.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(2).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getPrincipalPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(2).getOutstandingLoanBalance())); assertEquals(secondChargeId, response.getTransactions().get(2).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(2).getLoanChargePaidByList().size()); @@ -1045,60 +1045,60 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(20.0, response.getSummary().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(20.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(thirdRepayment, response.getTransactions().get(3).getId().intValue()); assertNull(response.getTransactions().get(3).getReversedOnDate()); assertTrue(response.getTransactions().get(3).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(3).getType().getRepayment()); - assertEquals(1000.0, response.getTransactions().get(3).getAmount()); - assertEquals(1000.0, response.getTransactions().get(3).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(3).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(3).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(3).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(0, response.getTransactions().get(3).getLoanChargePaidByList().size()); Integer forthRepayment = (Integer) loanTransactionHelper.makeRepayment("01 March 2023", Float.parseFloat("10.00"), loanID) .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(10.0, response.getSummary().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(forthRepayment, response.getTransactions().get(4).getId().intValue()); assertNull(response.getTransactions().get(4).getReversedOnDate()); assertTrue(response.getTransactions().get(4).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(4).getType().getRepayment()); - assertEquals(10.0, response.getTransactions().get(4).getAmount()); - assertEquals(0.0, response.getTransactions().get(4).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(4).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(4).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(4).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(4).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(4).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(4).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(4).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(4).getLoanChargePaidByList().size()); @@ -1173,27 +1173,27 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .makeRepayment("10 February 2023", Float.parseFloat("1010.00"), loanID).get("resourceId"); GetLoansLoanIdResponse response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(10.0, response.getSummary().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); assertNull(response.getTransactions().get(1).getReversedOnDate()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -1208,17 +1208,17 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .date("2023.03.01").dateFormat("yyyy.MM.dd").locale("en")); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(1035.0, response.getSummary().getTotalOutstanding()); - assertEquals(1035.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1035.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(1035.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(firstRepaymentId, response.getTransactions().get(1).getId().intValue()); @@ -1226,13 +1226,13 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertTrue(response.getTransactions().get(1).getManuallyReversed()); assertTrue(response.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(1).getType().getRepayment()); - assertEquals(1010.0, response.getTransactions().get(1).getAmount()); - assertEquals(1000.0, response.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(1).getInterestPortion()); - assertEquals(10.0, response.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(1010.0, Utils.getDoubleValue(response.getTransactions().get(1).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getInterestPortion())); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(1).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(1).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(1).getLoanChargePaidByList().size()); @@ -1240,30 +1240,30 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(5.0, response.getSummary().getTotalOutstanding()); - assertEquals(5.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(5.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(5.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); assertEquals(secondRepayment, response.getTransactions().get(2).getId().intValue()); assertNull(response.getTransactions().get(2).getReversedOnDate()); assertTrue(response.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(2).getType().getRepayment()); - assertEquals(1030.0, response.getTransactions().get(2).getAmount()); - assertEquals(1000.0, response.getTransactions().get(2).getPrincipalPortion()); - assertEquals(15.0, response.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(2).getInterestPortion()); - assertEquals(15.0, response.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(1030.0, Utils.getDoubleValue(response.getTransactions().get(2).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(2).getPrincipalPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getInterestPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(2).getOutstandingLoanBalance())); if (secondChargeId.equals(response.getTransactions().get(2).getLoanChargePaidByList().get(0).getChargeId().intValue())) { assertEquals(secondChargeId, response.getTransactions().get(2).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(firstChargeId, response.getTransactions().get(2).getLoanChargePaidByList().get(1).getChargeId().intValue()); @@ -1290,40 +1290,40 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(1035.0, response.getSummary().getTotalOutstanding()); - assertEquals(1035.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(1035.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(1035.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); assertEquals(thirdRepayment, response.getTransactions().get(3).getId().intValue()); assertNull(response.getTransactions().get(3).getReversedOnDate()); assertTrue(response.getTransactions().get(3).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(3).getType().getRepayment()); - assertEquals(15.0, response.getTransactions().get(3).getAmount()); - assertEquals(0.0, response.getTransactions().get(3).getPrincipalPortion()); - assertEquals(15.0, response.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(3).getInterestPortion()); - assertEquals(0.0, response.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(1000.0, response.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(3).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getPrincipalPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(3).getOutstandingLoanBalance())); assertEquals(secondChargeId, response.getTransactions().get(3).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(3).getLoanChargePaidByList().size()); @@ -1331,40 +1331,40 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(20.0, response.getSummary().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(5.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(20.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); assertEquals(forthRepayment, response.getTransactions().get(4).getId().intValue()); assertNull(response.getTransactions().get(4).getReversedOnDate()); assertTrue(response.getTransactions().get(4).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(4).getType().getRepayment()); - assertEquals(1015.0, response.getTransactions().get(4).getAmount()); - assertEquals(1000.0, response.getTransactions().get(4).getPrincipalPortion()); - assertEquals(0.0, response.getTransactions().get(4).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(4).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(4).getInterestPortion()); - assertEquals(15.0, response.getTransactions().get(4).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(1015.0, Utils.getDoubleValue(response.getTransactions().get(4).getAmount())); + assertEquals(1000.0, Utils.getDoubleValue(response.getTransactions().get(4).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getInterestPortion())); + assertEquals(15.0, Utils.getDoubleValue(response.getTransactions().get(4).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(4).getOutstandingLoanBalance())); assertEquals(firstChargeId, response.getTransactions().get(4).getLoanChargePaidByList().get(0).getChargeId().intValue()); assertEquals(1, response.getTransactions().get(4).getLoanChargePaidByList().size()); @@ -1372,40 +1372,40 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .get("resourceId"); response = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(10.0, response.getSummary().getTotalOutstanding()); - assertEquals(10.0, response.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(20.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(1000.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(10.0, Utils.getDoubleValue(response.getSummary().getTotalOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(20.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(1000.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(response.getStatus().getActive()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(15.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(5.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid()); - assertEquals(10.0, response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid()); - assertEquals(0.0, response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(15.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(5.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesPaid())); + assertEquals(10.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(response.getRepaymentSchedule().getPeriods().get(2).getPrincipalOutstanding())); assertEquals(fifthRepayment, response.getTransactions().get(5).getId().intValue()); assertNull(response.getTransactions().get(5).getReversedOnDate()); assertTrue(response.getTransactions().get(5).getTransactionRelations().isEmpty()); assertTrue(response.getTransactions().get(5).getType().getRepayment()); - assertEquals(10.0, response.getTransactions().get(5).getAmount()); - assertEquals(0.0, response.getTransactions().get(5).getPrincipalPortion()); - assertEquals(5.0, response.getTransactions().get(5).getPenaltyChargesPortion()); - assertEquals(0.0, response.getTransactions().get(5).getOverpaymentPortion()); - assertEquals(0.0, response.getTransactions().get(5).getInterestPortion()); - assertEquals(5.0, response.getTransactions().get(5).getFeeChargesPortion()); - assertEquals(0.0, response.getTransactions().get(5).getOutstandingLoanBalance()); + assertEquals(10.0, Utils.getDoubleValue(response.getTransactions().get(5).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(5).getPrincipalPortion())); + assertEquals(5.0, Utils.getDoubleValue(response.getTransactions().get(5).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(5).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(5).getInterestPortion())); + assertEquals(5.0, Utils.getDoubleValue(response.getTransactions().get(5).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(response.getTransactions().get(5).getOutstandingLoanBalance())); if (firstChargeId.equals(response.getTransactions().get(5).getLoanChargePaidByList().get(0).getChargeId().intValue())) { assertEquals(thirdChargeId, response.getTransactions().get(5).getLoanChargePaidByList().get(1).getChargeId().intValue()); } else { @@ -1485,40 +1485,40 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat inlineLoanCOBHelper.executeInlineCOB(List.of(loanID.longValue())); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(131.6, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(131.6, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(131.6, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(131.6, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(0).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(0).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(0).getType().getDisbursement()); - assertEquals(127.95, loanDetails.getTransactions().get(0).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getInterestPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getFeeChargesPortion()); - assertEquals(127.95, loanDetails.getTransactions().get(0).getOutstandingLoanBalance()); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getFeeChargesPortion())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getOutstandingLoanBalance())); assertNull(loanDetails.getTransactions().get(1).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(1).getType().getAccrual()); - assertEquals(3.65, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getInterestPortion()); - assertEquals(3.65, loanDetails.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getInterestPortion())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOutstandingLoanBalance())); businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BusinessDateType.BUSINESS_DATE.getName()) .date("2023.06.17").dateFormat("yyyy.MM.dd").locale("en")); @@ -1527,45 +1527,45 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .transactionAmount(125.0)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(6.6, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(6.6, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(125.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(6.6, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(6.6, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(2).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(2).getType().getMerchantIssuedRefund()); - assertEquals(125.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(125.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(2.95, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); PostLoansLoanIdChargesChargeIdResponse chargeAdjustmentResponse = this.loanTransactionHelper.chargeAdjustment((long) loanID, (long) penalty1LoanChargeId, new PostLoansLoanIdChargesChargeIdRequest().amount(3.65)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(2.95, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.70, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.70, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(3).getReversedOnDate()); @@ -1573,42 +1573,42 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertEquals((long) penalty1LoanChargeId, loanDetails.getTransactions().get(3).getTransactionRelations().iterator().next().getToLoanCharge()); assertTrue(loanDetails.getTransactions().get(3).getType().getChargeAdjustment()); - assertEquals(3.65, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(2.95, loanDetails.getTransactions().get(3).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getInterestPortion()); - assertEquals(0.7, loanDetails.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getInterestPortion())); + assertEquals(0.7, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); PostLoansLoanIdTransactionsResponse merchantIssuedRefund2 = loanTransactionHelper.makeMerchantIssuedRefund(Long.valueOf(loanID), new PostLoansLoanIdTransactionsRequest().locale("en").dateFormat("dd MMMM yyyy").transactionDate("17 June 2023") .transactionAmount(2.95)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(0.0, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getClosedObligationsMet()); assertNull(loanDetails.getTransactions().get(4).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(4).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(4).getType().getMerchantIssuedRefund()); - assertEquals(2.95, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getInterestPortion()); - assertEquals(2.95, loanDetails.getTransactions().get(4).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getInterestPortion())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOutstandingLoanBalance())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, @@ -1683,40 +1683,40 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat inlineLoanCOBHelper.executeInlineCOB(List.of(loanID.longValue())); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(131.6, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(131.6, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(131.6, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(131.6, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(0).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(0).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(0).getType().getDisbursement()); - assertEquals(127.95, loanDetails.getTransactions().get(0).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getInterestPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(0).getFeeChargesPortion()); - assertEquals(127.95, loanDetails.getTransactions().get(0).getOutstandingLoanBalance()); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getFeeChargesPortion())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getTransactions().get(0).getOutstandingLoanBalance())); assertNull(loanDetails.getTransactions().get(1).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(1).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(1).getType().getAccrual()); - assertEquals(3.65, loanDetails.getTransactions().get(1).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getInterestPortion()); - assertEquals(3.65, loanDetails.getTransactions().get(1).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(1).getOutstandingLoanBalance()); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getInterestPortion())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(1).getOutstandingLoanBalance())); businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BusinessDateType.BUSINESS_DATE.getName()) .date("2023.06.17").dateFormat("yyyy.MM.dd").locale("en")); @@ -1726,45 +1726,45 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat .transactionAmount(125.0)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(6.6, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(6.6, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(125.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(6.6, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(6.6, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(2).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(2).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(2).getType().getMerchantIssuedRefund()); - assertEquals(125.0, loanDetails.getTransactions().get(2).getAmount()); - assertEquals(125.0, loanDetails.getTransactions().get(2).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getInterestPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(2).getFeeChargesPortion()); - assertEquals(2.95, loanDetails.getTransactions().get(2).getOutstandingLoanBalance()); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getAmount())); + assertEquals(125.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getInterestPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getFeeChargesPortion())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(2).getOutstandingLoanBalance())); PostLoansLoanIdChargesChargeIdResponse chargeAdjustmentResponse = this.loanTransactionHelper.chargeAdjustment((long) loanID, (long) penalty1LoanChargeId, new PostLoansLoanIdChargesChargeIdRequest().amount(3.65)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(2.95, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(0.70, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(2.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(0.70, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getActive()); assertNull(loanDetails.getTransactions().get(3).getReversedOnDate()); @@ -1772,42 +1772,42 @@ public class DueDateRespectiveLoanRepaymentScheduleTest extends BaseLoanIntegrat assertEquals((long) penalty1LoanChargeId, loanDetails.getTransactions().get(3).getTransactionRelations().iterator().next().getToLoanCharge()); assertTrue(loanDetails.getTransactions().get(3).getType().getChargeAdjustment()); - assertEquals(3.65, loanDetails.getTransactions().get(3).getAmount()); - assertEquals(2.95, loanDetails.getTransactions().get(3).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getInterestPortion()); - assertEquals(0.7, loanDetails.getTransactions().get(3).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(3).getOutstandingLoanBalance()); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getAmount())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getInterestPortion())); + assertEquals(0.7, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(3).getOutstandingLoanBalance())); PostLoansLoanIdTransactionsResponse merchantIssuedRefund2 = loanTransactionHelper.makeMerchantIssuedRefund(Long.valueOf(loanID), new PostLoansLoanIdTransactionsRequest().locale("en").dateFormat("dd MMMM yyyy").transactionDate("17 June 2023") .transactionAmount(2.95)); loanDetails = loanTransactionHelper.getLoanDetails((long) loanID); - assertEquals(0.0, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue()); - assertEquals(3.65, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue()); - assertEquals(127.95, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesDue())); + assertEquals(3.65, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesDue())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalDue())); + assertEquals(127.95, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalPaid())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); assertTrue(loanDetails.getStatus().getClosedObligationsMet()); assertNull(loanDetails.getTransactions().get(4).getReversedOnDate()); assertTrue(loanDetails.getTransactions().get(4).getTransactionRelations().isEmpty()); assertTrue(loanDetails.getTransactions().get(4).getType().getMerchantIssuedRefund()); - assertEquals(2.95, loanDetails.getTransactions().get(4).getAmount()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getPrincipalPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getPenaltyChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getOverpaymentPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getInterestPortion()); - assertEquals(2.95, loanDetails.getTransactions().get(4).getFeeChargesPortion()); - assertEquals(0.0, loanDetails.getTransactions().get(4).getOutstandingLoanBalance()); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getAmount())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPrincipalPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getPenaltyChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOverpaymentPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getInterestPortion())); + assertEquals(2.95, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getFeeChargesPortion())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getTransactions().get(4).getOutstandingLoanBalance())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, new PutGlobalConfigurationsRequest().enabled(false)); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ExternalIdSupportIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ExternalIdSupportIntegrationTest.java index 760edcb1f..a850e72bb 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/ExternalIdSupportIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/ExternalIdSupportIntegrationTest.java @@ -875,8 +875,8 @@ public class ExternalIdSupportIntegrationTest extends BaseLoanIntegrationTest { GetLoansApprovalTemplateResponse loanApprovalResult = this.loanTransactionHelper.getLoanApprovalTemplate(loanExternalIdStr); assertEquals(actualDate, loanApprovalResult.getApprovalDate()); - assertEquals(1000.0, loanApprovalResult.getApprovalAmount()); - assertEquals(1000.0, loanApprovalResult.getNetDisbursalAmount()); + assertEquals(1000.0, Utils.getDoubleValue(loanApprovalResult.getApprovalAmount())); + assertEquals(1000.0, Utils.getDoubleValue(loanApprovalResult.getNetDisbursalAmount())); assertNotNull(loanApprovalResult.getCurrency()); assertNotNull(loanApprovalResult.getCurrency().getCode()); assertEquals("USD", loanApprovalResult.getCurrency().getCode()); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountArrearsAgeingCOBBusinessStepTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountArrearsAgeingCOBBusinessStepTest.java index bfe675fd5..47d041803 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountArrearsAgeingCOBBusinessStepTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountArrearsAgeingCOBBusinessStepTest.java @@ -129,16 +129,16 @@ public class LoanAccountArrearsAgeingCOBBusinessStepTest extends BaseLoanIntegra GetLoansLoanIdSummary loan1Summary = loan1Details.getSummary(); assertNotNull(loan1Summary); assertNotNull(loan1Summary.getOverdueSinceDate()); - assertEquals(loan1Summary.getPrincipalOverdue(), 1000.00); - assertEquals(loan1Summary.getTotalOverdue(), 1000.00); + assertEquals(1000.00, Utils.getDoubleValue(loan1Summary.getPrincipalOverdue())); + assertEquals(1000.00, Utils.getDoubleValue(loan1Summary.getTotalOverdue())); // Retrieve Loan 2 with loanId GetLoansLoanIdResponse loan2Details = loanTransactionHelper.getLoanDetails((long) loanId_2); GetLoansLoanIdSummary loan2Summary = loan2Details.getSummary(); assertNotNull(loan2Summary); assertNotNull(loan2Summary.getOverdueSinceDate()); - assertEquals(loan2Summary.getPrincipalOverdue(), 1000.00); - assertEquals(loan2Summary.getTotalOverdue(), 1000.00); + assertEquals(1000.00, Utils.getDoubleValue(loan2Summary.getPrincipalOverdue())); + assertEquals(1000.00, Utils.getDoubleValue(loan2Summary.getTotalOverdue())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, new PutGlobalConfigurationsRequest().enabled(false)); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountBackdatedDisbursementTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountBackdatedDisbursementTest.java index 41d7767dd..ae62b3a6d 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountBackdatedDisbursementTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountBackdatedDisbursementTest.java @@ -115,31 +115,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // verify schedule is according to expected disbursement date assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) businessDate = LocalDate.of(2023, 3, 7); @@ -155,31 +159,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // first installment down payment repayment assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // make repayment on 7 March to pay down payment installment final PostLoansLoanIdTransactionsResponse repaymentTransaction_1 = loanTransactionHelper.makeLoanRepayment(loanExternalIdStr, @@ -192,35 +200,39 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(375.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(375.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment down payment repayment // check down payment installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // set business date @@ -240,44 +252,49 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(875.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(875.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment down payment repayment for 5 March disbursal // check down payment installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment down payment repayment for 7 March disbursal assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(3).getComplete()); // third installment [5 March 2023 - 5 April 2023] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(4).getComplete()); // fourth installment [5 April 2023 - 5 May 2023] assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(5).getPeriod()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(5).getFromDate()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(5).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(5).getComplete()); // fifth installment [5 May 2023 - 5 June 2023] assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().get(6).getPeriod()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(6).getFromDate()); assertEquals(LocalDate.of(2023, 6, 5), loanDetails.getRepaymentSchedule().getPeriods().get(6).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(6).getComplete()); } finally { @@ -339,31 +356,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // verify schedule is according to expected disbursement date assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) @@ -380,31 +401,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // first installment down payment repayment for 7 March disbursal assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment [3 March 2023 - 3 April 2023] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment [3 April 2023 - 3 May 2023] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment [3 May 2023 - 3 June 2023] assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // make repayment on 7 March to pay downpayment insatllment final PostLoansLoanIdTransactionsResponse repaymentTransaction_1 = loanTransactionHelper.makeLoanRepayment(loanExternalIdStr, @@ -421,27 +446,31 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment [3 March 2023 - 3 April 2023] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment [3 April 2023 - 3 May 2023] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment [3 May 2023 - 3 June 2023] assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); businessDate = LocalDate.of(2023, 3, 8); @@ -462,36 +491,41 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment down payment repayment for 7 March disbursal assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(3).getComplete()); // third installment [3 March 2023 - 3 April 2023] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(4).getComplete()); // fourth installment [3 April 2023 - 3 May 2023] assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(5).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(5).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(5).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(5).getComplete()); // fifth installment [3 May 2023 - 3 June 2023] assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().get(6).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(6).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(6).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(6).getComplete()); } finally { @@ -553,31 +587,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // verify schedule is according to expected disbursement date assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) @@ -594,31 +632,35 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // first installment down payment repayment assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // make repayment on 7 March to pay downpayment insatllment final PostLoansLoanIdTransactionsResponse repaymentTransaction_1 = loanTransactionHelper.makeLoanRepayment(loanExternalIdStr, @@ -632,35 +674,39 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes // check down payment installment gets paid - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(375.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(375.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment down payment repayment // check down payment installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // set business date to next repayment due business date businessDate = LocalDate.of(2023, 4, 7); @@ -677,36 +723,40 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails); assertNotNull(loanDetails.getRepaymentSchedule()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(250.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment down payment repayment // check down payment installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(2).getComplete()); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // make backdate disbursement for 5 march with business date 7 April @@ -720,44 +770,49 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify transactions get reprocessed and installments paid accordingly - assertEquals(750.0, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(750.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment down payment repayment for 5 March disbursal // check down payment installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment down payment repayment for 7 March disbursal assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); - assertEquals(125.00, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalPaidForPeriod()); + assertEquals(125.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); + assertEquals(125.00, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(3).getComplete()); // third installment [5 March 2023 - 5 April 2023] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(4).getComplete()); // fourth installment [5 April 2023 - 5 May 2023] assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(5).getPeriod()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(5).getFromDate()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(5).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(5).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(5).getComplete()); // fifth installment [5 May 2023 - 5 June 2023] assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().get(6).getPeriod()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(6).getFromDate()); assertEquals(LocalDate.of(2023, 6, 5), loanDetails.getRepaymentSchedule().getPeriods().get(6).getDueDate()); - assertEquals(250.00, loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod()); + assertEquals(250.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(6).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(6).getComplete()); } finally { @@ -817,30 +872,34 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // verify schedule is according to expected disbursement date assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // fourth installment assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) businessDate = LocalDate.of(2023, 3, 7); BusinessDateHelper.updateBusinessDate(requestSpec, responseSpec, BusinessDateType.BUSINESS_DATE, businessDate); @@ -920,26 +979,29 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // verify schedule is according to expected disbursement date // first installment assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.34, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.34, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) businessDate = LocalDate.of(2023, 3, 7); @@ -955,7 +1017,7 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // disbursement period assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(0).getDueDate()); @@ -964,19 +1026,22 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(166.66, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(166.66, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // make repayment on 7 March to pay installment final PostLoansLoanIdTransactionsResponse repaymentTransaction_1 = loanTransactionHelper.makeLoanRepayment(loanExternalIdStr, @@ -989,29 +1054,32 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(333.33, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // first installment // check installment gets paid assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); + assertEquals(166.67, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalPaidForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getComplete()); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(166.66, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(166.66, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // set business date businessDate = LocalDate.of(2023, 3, 8); @@ -1030,8 +1098,8 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertNotNull(loanDetails.getRepaymentSchedule()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(833.33, loanDetails.getRepaymentSchedule().getTotalOutstanding()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(833.33, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalOutstanding())); // verify disbursement period order assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(0).getDueDate()); @@ -1042,22 +1110,25 @@ public class LoanAccountBackdatedDisbursementTest extends BaseLoanIntegrationTes assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalPaidForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); + assertEquals(166.67, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalPaidForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(2).getComplete()); // second installment assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 5), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(3).getComplete()); // third installment assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 5), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(333.34, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(333.34, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(4).getComplete()); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest.java index 6e778f398..347c1257f 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest.java @@ -169,10 +169,11 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte assertNotNull(loanDetails.getRepaymentSchedule()); assertNotNull(loanDetails.getRepaymentSchedule().getPeriods()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(20.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(10.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(900.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(930.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod()); + assertEquals(20.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(10.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(900.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(930.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod())); }); } @@ -212,10 +213,11 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte assertNotNull(loanDetails.getRepaymentSchedule()); assertNotNull(loanDetails.getRepaymentSchedule().getPeriods()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(930.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(930.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(930.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(930.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod())); }); } @@ -257,10 +259,11 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte assertNotNull(loanDetails.getRepaymentSchedule()); assertNotNull(loanDetails.getRepaymentSchedule().getPeriods()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(930.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(930.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(930.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(930.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod())); }); } @@ -308,10 +311,10 @@ public class LoanAccountChargeReveseReplayWithAdvancedPaymentAllocationTest exte assertNotNull(loanDetails.getRepaymentSchedule()); assertNotNull(loanDetails.getRepaymentSchedule().getPeriods()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding()); - assertEquals(0.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPenaltyChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getFeeChargesOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getPrincipalOutstanding())); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalOutstandingForPeriod())); // adding an extra charge after maturity updateBusinessDate("11 October 2022"); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTest.java index af8b4632d..949f275e2 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTest.java @@ -817,7 +817,7 @@ public class LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTe private void verifyDisbursementPeriod(GetLoansLoanIdRepaymentPeriod period, LocalDate disbursementDate, double disbursedAmount) { assertEquals(disbursementDate, period.getDueDate()); - assertEquals(disbursedAmount, period.getPrincipalLoanBalanceOutstanding()); + assertEquals(disbursedAmount, Utils.getDoubleValue(period.getPrincipalLoanBalanceOutstanding())); } private void verifyPeriodDetails(GetLoansLoanIdRepaymentPeriod period, Integer periodNumber, double periodAmount, @@ -826,14 +826,14 @@ public class LoanAccountPaymentAllocationWithOverlappingDownPaymentInstallmentTe assertEquals(periodNumber, period.getPeriod()); assertEquals(periodFromDate, period.getFromDate()); assertEquals(periodDueDate, period.getDueDate()); - assertEquals(periodAmount, period.getTotalInstallmentAmountForPeriod()); - assertEquals(periodAmountPaid, period.getTotalPaidForPeriod()); - assertEquals(principalPaid, period.getPrincipalPaid()); - assertEquals(outstandingAmount, period.getTotalOutstandingForPeriod()); - assertEquals(feeDue, period.getFeeChargesDue()); - assertEquals(feePaid, period.getFeeChargesPaid()); - assertEquals(penaltyDue, period.getPenaltyChargesDue()); - assertEquals(penaltyPaid, period.getPenaltyChargesPaid()); + assertEquals(periodAmount, Utils.getDoubleValue(period.getTotalInstallmentAmountForPeriod())); + assertEquals(periodAmountPaid, Utils.getDoubleValue(period.getTotalPaidForPeriod())); + assertEquals(principalPaid, Utils.getDoubleValue(period.getPrincipalPaid())); + assertEquals(outstandingAmount, Utils.getDoubleValue(period.getTotalOutstandingForPeriod())); + assertEquals(feeDue, Utils.getDoubleValue(period.getFeeChargesDue())); + assertEquals(feePaid, Utils.getDoubleValue(period.getFeeChargesPaid())); + assertEquals(penaltyDue, Utils.getDoubleValue(period.getPenaltyChargesDue())); + assertEquals(penaltyPaid, Utils.getDoubleValue(period.getPenaltyChargesPaid())); assertEquals(isComplete, period.getComplete()); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountRepaymentCalculationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountRepaymentCalculationTest.java index fdb618b58..599b2497d 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountRepaymentCalculationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanAccountRepaymentCalculationTest.java @@ -416,7 +416,7 @@ public class LoanAccountRepaymentCalculationTest extends BaseLoanIntegrationTest assertEquals(expectedPeriodNumber, period.getPeriod()); assertEquals(expectedPeriodFromDate, period.getFromDate()); assertEquals(expectedPeriodDueDate, period.getDueDate()); - assertEquals(expectedAmount, period.getTotalInstallmentAmountForPeriod()); + assertEquals(expectedAmount, Utils.getDoubleValue(period.getTotalInstallmentAmountForPeriod())); assertEquals(isComplete, period.getComplete()); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java index 8d96e0b5e..be63821c0 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanCapitalizedIncomeTest.java @@ -78,7 +78,7 @@ public class LoanCapitalizedIncomeTest extends BaseLoanIntegrationTest { transaction(100.0, "Disbursement", "01 January 2024"), // transaction(50.0, "Capitalized Income", "01 January 2024"), // transaction(0.55, "Capitalized Income Amortization", "01 January 2024"), // - transaction(0.03, "Accrual", "02 January 2024"), // + transaction(0.02, "Accrual", "02 January 2024"), // transaction(0.55, "Capitalized Income Amortization", "02 January 2024") // ); @@ -89,8 +89,8 @@ public class LoanCapitalizedIncomeTest extends BaseLoanIntegrationTest { journalEntry(50, deferredIncomeLiabilityAccount, "CREDIT"), // journalEntry(0.55, deferredIncomeLiabilityAccount, "DEBIT"), // journalEntry(0.55, feeIncomeAccount, "CREDIT"), // - journalEntry(0.03, interestReceivableAccount, "DEBIT"), // - journalEntry(0.03, interestIncomeAccount, "CREDIT"), // + journalEntry(0.02, interestReceivableAccount, "DEBIT"), // + journalEntry(0.02, interestIncomeAccount, "CREDIT"), // journalEntry(0.55, deferredIncomeLiabilityAccount, "DEBIT"), // journalEntry(0.55, feeIncomeAccount, "CREDIT") // ); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargePaymentWithAdvancedPaymentAllocationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargePaymentWithAdvancedPaymentAllocationTest.java index 9b41b4189..fb489e11c 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargePaymentWithAdvancedPaymentAllocationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargePaymentWithAdvancedPaymentAllocationTest.java @@ -212,24 +212,30 @@ public class LoanChargePaymentWithAdvancedPaymentAllocationTest extends BaseLoan GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails((long) loanId); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(feePortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(penaltyPortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(penaltyPortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(400.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalDueForPeriod()); - assertEquals(400.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(feePortion, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(penaltyPortion, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(penaltyPortion, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(400.0d, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalDueForPeriod())); + assertEquals(400.0d, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 16), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); scheduleJobHelper.executeAndAwaitJob(jobName); loanDetails = loanTransactionHelper.getLoanDetails((long) loanId); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue()); - assertEquals(0.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding()); - assertEquals(penaltyPortion, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue()); - assertEquals(0.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding()); - assertEquals(400.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalDueForPeriod()); - assertEquals(250.0d, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesDue())); + assertEquals(0.0d, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getFeeChargesOutstanding())); + assertEquals(penaltyPortion, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesDue())); + assertEquals(0.0d, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPenaltyChargesOutstanding())); + assertEquals(400.0d, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalDueForPeriod())); + assertEquals(250.0d, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 16), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackOnPaymentTypeRepaymentTransactionsTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackOnPaymentTypeRepaymentTransactionsTest.java index 5933a970a..4ecf5d69c 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackOnPaymentTypeRepaymentTransactionsTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackOnPaymentTypeRepaymentTransactionsTest.java @@ -113,7 +113,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 500.0); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // chargeback on Repayment PostLoansLoanIdTransactionsResponse chargebackTransactionResponse = loanTransactionHelper.chargebackLoanTransaction( @@ -128,7 +128,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 1000.0); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // Goodwill Credit final PostLoansLoanIdTransactionsResponse goodwillCredit_1 = loanTransactionHelper.makeGoodwillCredit((long) loanId, @@ -142,7 +142,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 800.0); + assertEquals(800.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // chargeback on Goodwill Credit Transaction chargebackTransactionResponse = loanTransactionHelper.chargebackLoanTransaction(loanExternalIdStr, goodwillCredit_1.getResourceId(), @@ -166,7 +166,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 700.0); + assertEquals(700.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // chargeback on Payout Refund Transaction chargebackTransactionResponse = loanTransactionHelper.chargebackLoanTransaction(loanExternalIdStr, payoutRefund_1.getResourceId(), @@ -181,7 +181,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 1000.0); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // Merchant Issued Refund @@ -196,7 +196,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 900.0); + assertEquals(900.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // chargeback on Merchant Issued Refund Transaction chargebackTransactionResponse = loanTransactionHelper.chargebackLoanTransaction(loanExternalIdStr, @@ -212,7 +212,7 @@ public class LoanChargebackOnPaymentTypeRepaymentTransactionsTest { assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 1000.0); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackWithCreditAllocationsIntegrationTests.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackWithCreditAllocationsIntegrationTests.java index dfd373df3..14a24c0ee 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackWithCreditAllocationsIntegrationTests.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanChargebackWithCreditAllocationsIntegrationTests.java @@ -35,6 +35,7 @@ import org.apache.fineract.client.models.PostLoansLoanIdResponse; import org.apache.fineract.client.models.PostLoansRequest; import org.apache.fineract.client.models.PostLoansResponse; import org.apache.fineract.integrationtests.common.ClientHelper; +import org.apache.fineract.integrationtests.common.Utils; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleProcessingType; import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType; import org.apache.fineract.portfolio.loanproduct.domain.PaymentAllocationType; @@ -1777,10 +1778,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa GetLoansLoanIdResponse loanResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanId.intValue()); GetLoansLoanIdSummary summary = loanResponse.getSummary(); Assertions.assertNotNull(summary); - Assertions.assertEquals(creditedPrincipal, summary.getPrincipalAdjustments()); - Assertions.assertEquals(creditedFee, summary.getFeeAdjustments()); - Assertions.assertEquals(creditedPenalty, summary.getPenaltyAdjustments()); - Assertions.assertEquals(totalOutstanding, summary.getTotalOutstanding()); + Assertions.assertEquals(creditedPrincipal, Utils.getDoubleValue(summary.getPrincipalAdjustments())); + Assertions.assertEquals(creditedFee, Utils.getDoubleValue(summary.getFeeAdjustments())); + Assertions.assertEquals(creditedPenalty, Utils.getDoubleValue(summary.getPenaltyAdjustments())); + Assertions.assertEquals(totalOutstanding, Utils.getDoubleValue(summary.getTotalOutstanding())); } private Long applyAndApproveLoan(Long clientId, Long loanProductId, int numberOfRepayments) { diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestRefundTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestRefundTest.java index 40e95146d..fa3a9aacc 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestRefundTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanInterestRefundTest.java @@ -1254,7 +1254,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest { Assertions.assertNotNull(loanDetails); Assertions.assertNotNull(loanDetails.getStatus()); Assertions.assertEquals(700, loanDetails.getStatus().getId()); - Assertions.assertEquals(160.16D, loanDetails.getTotalOverpaid()); + Assertions.assertEquals(160.16D, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); }); } @@ -1630,7 +1630,7 @@ public class LoanInterestRefundTest extends BaseLoanIntegrationTest { ); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId); verifyLoanStatus(loanDetails, LoanStatus.OVERPAID); - Assertions.assertEquals(0.36, loanDetails.getTotalOverpaid()); + Assertions.assertEquals(0.36, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); }); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanLastRepaymentDetailsTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanLastRepaymentDetailsTest.java index 793406a81..b56eb8704 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanLastRepaymentDetailsTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanLastRepaymentDetailsTest.java @@ -100,7 +100,7 @@ public class LoanLastRepaymentDetailsTest { assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent().getLastRepaymentAmount()); - assertEquals(loanDetails.getDelinquent().getLastRepaymentAmount(), 500); + assertEquals(500.00, Utils.getDoubleValue(loanDetails.getDelinquent().getLastRepaymentAmount())); assertNotNull(loanDetails.getDelinquent().getLastRepaymentDate()); assertEquals(loanDetails.getDelinquent().getLastRepaymentDate(), lastRepaymentDate_1); @@ -117,7 +117,7 @@ public class LoanLastRepaymentDetailsTest { assertTrue(loanDetails.getStatus().getClosedObligationsMet()); assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent().getLastRepaymentAmount()); - assertEquals(loanDetails.getDelinquent().getLastRepaymentAmount(), 500); + assertEquals(500.00, Utils.getDoubleValue(loanDetails.getDelinquent().getLastRepaymentAmount())); assertNotNull(loanDetails.getDelinquent().getLastRepaymentDate()); assertEquals(loanDetails.getDelinquent().getLastRepaymentDate(), lastRepaymentDate_2); @@ -155,7 +155,7 @@ public class LoanLastRepaymentDetailsTest { assertTrue(loanDetails.getStatus().getActive()); assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent().getLastRepaymentAmount()); - assertEquals(loanDetails.getDelinquent().getLastRepaymentAmount(), 500); + assertEquals(500.00, Utils.getDoubleValue(loanDetails.getDelinquent().getLastRepaymentAmount())); assertNotNull(loanDetails.getDelinquent().getLastRepaymentDate()); assertEquals(loanDetails.getDelinquent().getLastRepaymentDate(), lastRepaymentDate_1); @@ -171,7 +171,7 @@ public class LoanLastRepaymentDetailsTest { assertTrue(loanDetails.getStatus().getOverpaid()); assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent().getLastRepaymentAmount()); - assertEquals(loanDetails.getDelinquent().getLastRepaymentAmount(), 600); + assertEquals(600.00, Utils.getDoubleValue(loanDetails.getDelinquent().getLastRepaymentAmount())); assertNotNull(loanDetails.getDelinquent().getLastRepaymentDate()); assertEquals(loanDetails.getDelinquent().getLastRepaymentDate(), lastRepaymentDate_2); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductRepaymentStartDateConfigurationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductRepaymentStartDateConfigurationTest.java index e99193949..cdd1cede1 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductRepaymentStartDateConfigurationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanProductRepaymentStartDateConfigurationTest.java @@ -170,25 +170,28 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // first period [2023-03-03 to 2023-04-03] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second period [2023-04-03 to 2023-05-03] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third period [2023-05-03 to 2023-06-03] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.34, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.34, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // first disbursement on a future date (7 March 2023) @@ -208,26 +211,29 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed())); // first period [2023-03-03 to 2023-04-03] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second period [2023-04-03 to 2023-05-03] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third period [2023-05-03 to 2023-06-03] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(166.66, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(166.66, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // second disbursement next month (7 April 2023) @@ -248,26 +254,29 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed())); // first period [2023-03-03 to 2023-04-03] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second period [2023-04-03 to 2023-05-03] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // third period [2023-05-03 to 2023-06-03] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 3), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(500.00, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(500.00, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, @@ -327,25 +336,28 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); // first period [2023-03-07 to 2023-04-07] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second period [2023-04-07 to 2023-05-07] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third period [2023-05-07 to 2023-06-07] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.34, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.34, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // first disbursement (7 March 2023) @@ -366,26 +378,29 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(4, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(500.0, loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed())); // first period [2023-03-07 to 2023-04-07] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); // second period [2023-04-07 to 2023-05-07] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(166.67, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(166.67, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // third period [2023-05-07 to 2023-06-07] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(166.66, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(166.66, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // second disbursement next month (7 April 2023) @@ -407,26 +422,29 @@ public class LoanProductRepaymentStartDateConfigurationTest { assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); // verify amounts - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalExpected()); - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed()); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalExpected())); + assertEquals(1000.0, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getTotalPrincipalDisbursed())); // first period [2023-03-07 to 2023-04-07] assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 3, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getFromDate()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); // second period [2023-04-07 to 2023-05-07] assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 4, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getFromDate()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(333.33, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(333.33, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); // third period [2023-05-07 to 2023-06-07] assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 5, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getFromDate()); assertEquals(LocalDate.of(2023, 6, 7), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(333.34, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(333.34, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRepaymentScheduleWithDownPaymentTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRepaymentScheduleWithDownPaymentTest.java index 579f0847d..63f5f1dc8 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRepaymentScheduleWithDownPaymentTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanRepaymentScheduleWithDownPaymentTest.java @@ -160,7 +160,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio .anyMatch(period -> expectedDownPaymentAmount.equals(Utils.getDoubleValue(period.getTotalPaidForPeriod())) // && expectedDownPaymentDueDate.equals(period.getDueDate()))); assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(summary.getTotalOutstanding())); - assertEquals(expectedDownPaymentAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedDownPaymentAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); assertTrue(periods.stream().anyMatch(period -> expectedRepaymentAmount.equals(Utils.getDoubleValue(period.getTotalDueForPeriod())) && expectedRepaymentDueDate.equals(period.getDueDate()))); } @@ -363,30 +363,31 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio LocalDate expectedThirdRepaymentDueDate = LocalDate.of(2022, 12, 3); Double outstandingBalanceOnThirdRepayment = 0.00; - assertEquals(expectedDownPaymentAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedDownPaymentAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); GetLoansLoanIdRepaymentPeriod firstDisbursementPeriod = periods.get(0); assertEquals(expectedDownPaymentDueDate, firstDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnDisbursement, firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnDisbursement, + Utils.getDoubleValue(firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod firstDownPaymentPeriod = periods.get(1); - assertEquals(expectedDownPaymentAmount, firstDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedDownPaymentAmount, Utils.getDoubleValue(firstDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedDownPaymentDueDate, firstDownPaymentPeriod.getDueDate()); GetLoansLoanIdRepaymentPeriod firstRepaymentPeriod = periods.get(2); - assertEquals(expectedRepaymentAmount, firstRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(firstRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstRepaymentDueDate, firstRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnFirstRepayment, firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnFirstRepayment, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondRepaymentPeriod = periods.get(3); - assertEquals(expectedRepaymentAmount, secondRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(secondRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondRepaymentDueDate, secondRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnSecondRepayment, secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnSecondRepayment, Utils.getDoubleValue(secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod thirdRepaymentPeriod = periods.get(4); - assertEquals(expectedRepaymentAmount, thirdRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedThirdRepaymentDueDate, thirdRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnThirdRepayment, thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnThirdRepayment, Utils.getDoubleValue(thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); } @Test @@ -441,38 +442,40 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio Double outstandingBalanceOnThirdRepayment = 0.00; Double expectedTotalRepaymentAmount = expectedFirstDownPaymentAmount + expectedSecondDownPaymentAmount; - assertEquals(expectedTotalRepaymentAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedTotalRepaymentAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); GetLoansLoanIdRepaymentPeriod firstDisbursementPeriod = periods.get(0); assertEquals(expectedFirstDownPaymentDueDate, firstDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, + Utils.getDoubleValue(firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod firstDownPaymentPeriod = periods.get(1); - assertEquals(expectedFirstDownPaymentAmount, firstDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedFirstDownPaymentAmount, Utils.getDoubleValue(firstDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstDownPaymentDueDate, firstDownPaymentPeriod.getDueDate()); GetLoansLoanIdRepaymentPeriod secondDisbursementPeriod = periods.get(2); assertEquals(expectedSecondDownPaymentDueDate, secondDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, + Utils.getDoubleValue(secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondDownPaymentPeriod = periods.get(3); - assertEquals(expectedSecondDownPaymentAmount, secondDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedSecondDownPaymentAmount, Utils.getDoubleValue(secondDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondDownPaymentDueDate, secondDownPaymentPeriod.getDueDate()); GetLoansLoanIdRepaymentPeriod firstRepaymentPeriod = periods.get(4); - assertEquals(expectedRepaymentAmount, firstRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(firstRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstRepaymentDueDate, firstRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnFirstRepayment, firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnFirstRepayment, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondRepaymentPeriod = periods.get(5); - assertEquals(expectedRepaymentAmount, secondRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(secondRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondRepaymentDueDate, secondRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnSecondRepayment, secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnSecondRepayment, Utils.getDoubleValue(secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod thirdRepaymentPeriod = periods.get(6); - assertEquals(expectedRepaymentAmount, thirdRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedThirdRepaymentDueDate, thirdRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnThirdRepayment, thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnThirdRepayment, Utils.getDoubleValue(thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); } @Test @@ -605,39 +608,41 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio Double outstandingBalanceOnThirdRepayment = 0.00; Double expectedTotalRepaymentAmount = expectedFirstDownPaymentAmount + expectedSecondDownPaymentAmount; - assertEquals(expectedTotalRepaymentAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedTotalRepaymentAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); GetLoansLoanIdRepaymentPeriod firstDisbursementPeriod = periods.get(0); assertEquals(expectedFirstDownPaymentDueDate, firstDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, + Utils.getDoubleValue(firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod firstDownPaymentPeriod = periods.get(1); - assertEquals(expectedFirstDownPaymentAmount, firstDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedFirstDownPaymentAmount, Utils.getDoubleValue(firstDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstDownPaymentDueDate, firstDownPaymentPeriod.getDueDate()); GetLoansLoanIdRepaymentPeriod secondDisbursementPeriod = periods.get(2); assertEquals(expectedSecondDownPaymentDueDate, secondDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, + Utils.getDoubleValue(secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondDownPaymentPeriod = periods.get(3); - assertEquals(expectedSecondDownPaymentAmount, secondDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedSecondDownPaymentAmount, Utils.getDoubleValue(secondDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondDownPaymentDueDate, secondDownPaymentPeriod.getDueDate()); GetLoansLoanIdRepaymentPeriod firstRepaymentPeriod = periods.get(4); - assertEquals(expectedRepaymentAmount, firstRepaymentPeriod.getPrincipalDue()); - assertEquals(expectedRepaymentTotalDueWithCharge, firstRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalDue())); + assertEquals(expectedRepaymentTotalDueWithCharge, Utils.getDoubleValue(firstRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstRepaymentDueDate, firstRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnFirstRepayment, firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnFirstRepayment, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondRepaymentPeriod = periods.get(5); - assertEquals(expectedRepaymentAmount, secondRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(secondRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondRepaymentDueDate, secondRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnSecondRepayment, secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnSecondRepayment, Utils.getDoubleValue(secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod thirdRepaymentPeriod = periods.get(6); - assertEquals(expectedRepaymentAmount, thirdRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedThirdRepaymentDueDate, thirdRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnThirdRepayment, thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(outstandingBalanceOnThirdRepayment, Utils.getDoubleValue(thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); } @Test @@ -775,44 +780,46 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio Double outstandingBalanceOnThirdRepayment = 0.00; Double expectedTotalRepaymentAmount = expectedFirstDownPaymentAmount + expectedSecondDownPaymentAmount; - assertEquals(expectedTotalRepaymentAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedTotalRepaymentAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); GetLoansLoanIdRepaymentPeriod firstDisbursementPeriod = periods.get(0); assertEquals(expectedFirstDownPaymentDueDate, firstDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnFirstDisbursement, + Utils.getDoubleValue(firstDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod firstDownPaymentPeriod = periods.get(1); - assertEquals(expectedFirstDownPaymentAmount, firstDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedFirstDownPaymentAmount, Utils.getDoubleValue(firstDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstDownPaymentDueDate, firstDownPaymentPeriod.getDueDate()); - assertEquals(expectedDownPaymentInterest, firstDownPaymentPeriod.getInterestDue()); + assertEquals(expectedDownPaymentInterest, Utils.getDoubleValue(firstDownPaymentPeriod.getInterestDue())); GetLoansLoanIdRepaymentPeriod secondDisbursementPeriod = periods.get(2); assertEquals(expectedSecondDownPaymentDueDate, secondDisbursementPeriod.getDueDate()); - assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding()); + assertEquals(expectedOutstandingLoanBalanceOnSecondDisbursement, + Utils.getDoubleValue(secondDisbursementPeriod.getPrincipalLoanBalanceOutstanding())); GetLoansLoanIdRepaymentPeriod secondDownPaymentPeriod = periods.get(3); - assertEquals(expectedSecondDownPaymentAmount, secondDownPaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedSecondDownPaymentAmount, Utils.getDoubleValue(secondDownPaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondDownPaymentDueDate, secondDownPaymentPeriod.getDueDate()); - assertEquals(expectedDownPaymentInterest, secondDownPaymentPeriod.getInterestDue()); + assertEquals(expectedDownPaymentInterest, Utils.getDoubleValue(secondDownPaymentPeriod.getInterestDue())); GetLoansLoanIdRepaymentPeriod firstRepaymentPeriod = periods.get(4); - assertEquals(expectedRepaymentAmount, firstRepaymentPeriod.getPrincipalDue()); - assertEquals(expectedRepaymentTotalDueWithChargeAndInterest, firstRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmount, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalDue())); + assertEquals(expectedRepaymentTotalDueWithChargeAndInterest, Utils.getDoubleValue(firstRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedFirstRepaymentDueDate, firstRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnFirstRepayment, firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); - assertEquals(expectedRepaymentInterest, firstRepaymentPeriod.getInterestDue()); + assertEquals(outstandingBalanceOnFirstRepayment, Utils.getDoubleValue(firstRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); + assertEquals(expectedRepaymentInterest, Utils.getDoubleValue(firstRepaymentPeriod.getInterestDue())); GetLoansLoanIdRepaymentPeriod secondRepaymentPeriod = periods.get(5); - assertEquals(expectedRepaymentAmountWithInterest, secondRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmountWithInterest, Utils.getDoubleValue(secondRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedSecondRepaymentDueDate, secondRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnSecondRepayment, secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); - assertEquals(expectedRepaymentInterest, secondRepaymentPeriod.getInterestDue()); + assertEquals(outstandingBalanceOnSecondRepayment, Utils.getDoubleValue(secondRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); + assertEquals(expectedRepaymentInterest, Utils.getDoubleValue(secondRepaymentPeriod.getInterestDue())); GetLoansLoanIdRepaymentPeriod thirdRepaymentPeriod = periods.get(6); - assertEquals(expectedRepaymentAmountWithInterest, thirdRepaymentPeriod.getTotalDueForPeriod()); + assertEquals(expectedRepaymentAmountWithInterest, Utils.getDoubleValue(thirdRepaymentPeriod.getTotalDueForPeriod())); assertEquals(expectedThirdRepaymentDueDate, thirdRepaymentPeriod.getDueDate()); - assertEquals(outstandingBalanceOnThirdRepayment, thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding()); - assertEquals(expectedRepaymentInterest, thirdRepaymentPeriod.getInterestDue()); + assertEquals(outstandingBalanceOnThirdRepayment, Utils.getDoubleValue(thirdRepaymentPeriod.getPrincipalLoanBalanceOutstanding())); + assertEquals(expectedRepaymentInterest, Utils.getDoubleValue(thirdRepaymentPeriod.getInterestDue())); } @Test @@ -1059,14 +1066,17 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio // verify installment details assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(0).getDueDate()); - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getPeriods().get(0).getPrincipalLoanBalanceOutstanding()); + assertEquals(1000.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(0).getPrincipalLoanBalanceOutstanding())); assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getDownPaymentPeriod()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPeriod()); assertEquals(LocalDate.of(2023, 4, 2), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(750.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod()); + assertEquals(750.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(2).getDownPaymentPeriod()); // second disbursement @@ -1079,21 +1089,26 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio loanDetails = loanTransactionHelper.getLoanDetails(loanId.longValue()); // verify installment details assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(0).getDueDate()); - assertEquals(1000.0, loanDetails.getRepaymentSchedule().getPeriods().get(0).getPrincipalLoanBalanceOutstanding()); + assertEquals(1000.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(0).getPrincipalLoanBalanceOutstanding())); assertEquals(1, loanDetails.getRepaymentSchedule().getPeriods().get(1).getPeriod()); assertEquals(LocalDate.of(2023, 3, 3), loanDetails.getRepaymentSchedule().getPeriods().get(1).getDueDate()); - assertEquals(250.0, loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod()); + assertEquals(250.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(1).getTotalInstallmentAmountForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(1).getDownPaymentPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(2).getDueDate()); - assertEquals(200.0, loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalLoanBalanceOutstanding()); + assertEquals(200.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(2).getPrincipalLoanBalanceOutstanding())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(2).getDownPaymentPeriod()); assertEquals(2, loanDetails.getRepaymentSchedule().getPeriods().get(3).getPeriod()); assertEquals(LocalDate.of(2023, 3, 5), loanDetails.getRepaymentSchedule().getPeriods().get(3).getDueDate()); - assertEquals(50.0, loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod()); + assertEquals(50.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(3).getTotalInstallmentAmountForPeriod())); assertEquals(true, loanDetails.getRepaymentSchedule().getPeriods().get(3).getDownPaymentPeriod()); assertEquals(3, loanDetails.getRepaymentSchedule().getPeriods().get(4).getPeriod()); assertEquals(LocalDate.of(2023, 4, 2), loanDetails.getRepaymentSchedule().getPeriods().get(4).getDueDate()); - assertEquals(900.0, loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod()); + assertEquals(900.0, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(4).getTotalInstallmentAmountForPeriod())); assertEquals(false, loanDetails.getRepaymentSchedule().getPeriods().get(4).getDownPaymentPeriod()); // verify journal entries for down-payment @@ -1284,7 +1299,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio transaction(800.0, "Repayment", "03 March 2023", 0.0, 750.0, 0.0, 0.0, 0.0, 0.0, 50.0) // ); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(50.0, loanDetails.getTotalOverpaid()); + assertEquals(50.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); // second disbursement disbursementDate = LocalDate.of(2023, 3, 5); @@ -1311,7 +1326,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio transaction(20.0, "Disbursement", "05 March 2023", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 20.0) // ); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(30.0, loanDetails.getTotalOverpaid()); + assertEquals(30.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); loanTransactionHelper.disburseLoan(loanResponse.getResourceId(), new PostLoansLoanIdRequest().actualDisbursementDate("05 March 2023").dateFormat(DATETIME_PATTERN) @@ -1338,8 +1353,8 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getClosedObligationsMet()); - assertEquals(0.0, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(null, loanDetails.getTotalOverpaid()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(null, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); PostLoansLoanIdTransactionsResponse repayment = loanTransactionHelper.makeLoanRepayment(loanResponse.getResourceId(), new PostLoansLoanIdTransactionsRequest().dateFormat("dd MMMM yyyy").transactionDate("05 March 2023").locale("en") @@ -1356,7 +1371,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio transaction(1.0, "Repayment", "05 March 2023", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0) // ); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(1.0, loanDetails.getTotalOverpaid()); + assertEquals(1.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); loanTransactionHelper.disburseLoan(loanResponse.getResourceId(), new PostLoansLoanIdRequest().actualDisbursementDate("05 March 2023").dateFormat(DATETIME_PATTERN) @@ -1387,7 +1402,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(30.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(30.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); loanTransactionHelper.reverseLoanTransaction(repayment.getLoanId(), repayment.getResourceId(), new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN).transactionDate("05 March 2023") @@ -1419,7 +1434,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(31.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(31.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); }); } @@ -1499,7 +1514,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio transaction(800.0, "Repayment", "03 March 2023", 0.0, 750.0, 0.0, 0.0, 0.0, 0.0, 50.0) // ); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(50.0, loanDetails.getTotalOverpaid()); + assertEquals(50.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); // second disbursement disbursementDate = LocalDate.of(2023, 3, 5); @@ -1526,7 +1541,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio transaction(20.0, "Disbursement", "05 March 2023", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0) // ); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(30.0, loanDetails.getTotalOverpaid()); + assertEquals(30.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); loanTransactionHelper.disburseLoan(loanResponse.getResourceId(), new PostLoansLoanIdRequest().actualDisbursementDate("05 March 2023").dateFormat(DATETIME_PATTERN) @@ -1553,8 +1568,8 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getClosedObligationsMet()); - assertEquals(0.0, loanDetails.getSummary().getTotalOutstanding()); - assertEquals(null, loanDetails.getTotalOverpaid()); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); + assertEquals(null, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); loanTransactionHelper.disburseLoan(loanResponse.getResourceId(), new PostLoansLoanIdRequest().actualDisbursementDate("05 March 2023").dateFormat(DATETIME_PATTERN) @@ -1584,7 +1599,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(30.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(30.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); loanTransactionHelper.reverseLoanTransaction(loanResponse.getLoanId(), externalId, new PostLoansLoanIdTransactionsTransactionIdRequest().dateFormat(DATETIME_PATTERN).transactionDate("05 March 2023") @@ -1615,7 +1630,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio ); assertTrue(loanDetails.getStatus().getActive()); - assertEquals(830.0, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(830.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); }); } @@ -1666,7 +1681,7 @@ public class LoanRepaymentScheduleWithDownPaymentTest extends BaseLoanIntegratio .anyMatch(period -> expectedDownPaymentAmount.equals(Utils.getDoubleValue(period.getTotalOutstandingForPeriod())) // && expectedDownPaymentDueDate.equals(period.getDueDate()))); assertEquals(expectedTotalOutstandingAmount, Utils.getDoubleValue(summary.getTotalOutstanding())); - assertEquals(expectedTotalRepaymentTransactionAmount, summary.getTotalRepaymentTransaction()); + assertEquals(expectedTotalRepaymentTransactionAmount, Utils.getDoubleValue(summary.getTotalRepaymentTransaction())); assertTrue(periods.stream() .anyMatch(period -> expectedRepaymentAmount.equals(Utils.getDoubleValue(period.getTotalOutstandingForPeriod())) && expectedRepaymentDueDate.equals(period.getDueDate()))); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSpecificDueDateChargeAfterMaturityTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSpecificDueDateChargeAfterMaturityTest.java index bb7b14e3a..abf0aade4 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSpecificDueDateChargeAfterMaturityTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSpecificDueDateChargeAfterMaturityTest.java @@ -563,31 +563,38 @@ public class LoanSpecificDueDateChargeAfterMaturityTest extends BaseLoanIntegrat private static void validateLoanTransaction(GetLoansLoanIdResponse loanDetails, int index, double transactionAmount, double principalPortion, double overPaidPortion, double loanBalance) { - assertEquals(transactionAmount, loanDetails.getTransactions().get(index).getAmount()); - assertEquals(principalPortion, loanDetails.getTransactions().get(index).getPrincipalPortion()); - assertEquals(overPaidPortion, loanDetails.getTransactions().get(index).getOverpaymentPortion()); - assertEquals(loanBalance, loanDetails.getTransactions().get(index).getOutstandingLoanBalance()); + assertEquals(transactionAmount, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getAmount())); + assertEquals(principalPortion, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getPrincipalPortion())); + assertEquals(overPaidPortion, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getOverpaymentPortion())); + assertEquals(loanBalance, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getOutstandingLoanBalance())); } private static void validateRepaymentPeriod(GetLoansLoanIdResponse loanDetails, int index, double principalDue, double principalPaid, double principalOutstanding, double paidInAdvance, double paidLate) { - assertEquals(principalDue, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalDue()); - assertEquals(principalPaid, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalPaid()); - assertEquals(principalOutstanding, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalOutstanding()); - assertEquals(paidInAdvance, loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidInAdvanceForPeriod()); - assertEquals(paidLate, loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidLateForPeriod()); + assertEquals(principalDue, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalDue())); + assertEquals(principalPaid, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalPaid())); + assertEquals(principalOutstanding, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalOutstanding())); + assertEquals(paidInAdvance, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidInAdvanceForPeriod())); + assertEquals(paidLate, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidLateForPeriod())); } private static void validateRepaymentPeriod(GetLoansLoanIdResponse loanDetails, int index, double principalDue, double principalPaid, double principalOutstanding, double penaltyDue, double penaltyPaid, double penaltyOutstanding, double paidInAdvance, double paidLate) { - assertEquals(principalDue, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalDue()); - assertEquals(principalPaid, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalPaid()); - assertEquals(principalOutstanding, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalOutstanding()); - assertEquals(penaltyDue, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesDue()); - assertEquals(penaltyPaid, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesPaid()); - assertEquals(penaltyOutstanding, loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesOutstanding()); - assertEquals(paidInAdvance, loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidInAdvanceForPeriod()); - assertEquals(paidLate, loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidLateForPeriod()); + assertEquals(principalDue, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalDue())); + assertEquals(principalPaid, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalPaid())); + assertEquals(principalOutstanding, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPrincipalOutstanding())); + assertEquals(penaltyDue, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesDue())); + assertEquals(penaltyPaid, Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesPaid())); + assertEquals(penaltyOutstanding, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getPenaltyChargesOutstanding())); + assertEquals(paidInAdvance, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidInAdvanceForPeriod())); + assertEquals(paidLate, + Utils.getDoubleValue(loanDetails.getRepaymentSchedule().getPeriods().get(index).getTotalPaidLateForPeriod())); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSummaryTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSummaryTest.java index e9b5b6133..19f0e11d0 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSummaryTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanSummaryTest.java @@ -19,9 +19,7 @@ package org.apache.fineract.integrationtests; import java.math.BigDecimal; -import java.math.RoundingMode; import java.util.List; -import org.apache.fineract.client.models.GetLoansLoanIdRepaymentPeriod; import org.apache.fineract.client.models.GetLoansLoanIdResponse; import org.apache.fineract.client.models.PostLoanProductsResponse; import org.apache.fineract.client.models.PostLoansResponse; @@ -250,38 +248,4 @@ public class LoanSummaryTest extends BaseLoanIntegrationTest { }); } - @Test - public void testCapitalizedIncomeExistsInRepaymentScheduleAndModifiesPrincipal() { - runAt("01 March 2023", () -> { - final PostLoanProductsResponse loanProductsResponse = loanProductHelper - .createLoanProduct(create4IProgressiveWithCapitalizedIncome()); - PostLoansResponse postLoansResponse = loanTransactionHelper.applyLoan(applyLP2ProgressiveLoanRequest(clientId, - loanProductsResponse.getResourceId(), "01 March 2023", 10000.00, 12.00, 4, null)); - loanId = postLoansResponse.getLoanId(); - loanTransactionHelper.approveLoan(loanId, approveLoanRequest(10000.00, "01 March 2023")); - disburseLoan(loanId, BigDecimal.valueOf(1000.00), "01 March 2023"); - }); - runAt("02 March 2023", () -> { - loanTransactionHelper.addCapitalizedIncome(loanId, "02 March 2023", 100.00); - }); - - BigDecimal thousand = BigDecimal.valueOf(1000.0); - BigDecimal hundred = BigDecimal.valueOf(100.0); - BigDecimal thousandOneHundred = BigDecimal.valueOf(1100.0); - - GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId); - - Assertions.assertEquals(thousand, loanDetails.getPrincipal().setScale(1, RoundingMode.HALF_UP)); - Assertions.assertEquals(thousand, loanDetails.getSummary().getPrincipalDisbursed().setScale(1, RoundingMode.HALF_UP)); - Assertions.assertEquals(hundred, - loanDetails.getSummary().getTotalPrincipalFromCapitalizedIncome().setScale(1, RoundingMode.HALF_UP)); - Assertions.assertEquals(thousandOneHundred, loanDetails.getSummary().getTotalPrincipal().setScale(1, RoundingMode.HALF_UP)); - Assertions.assertEquals(thousandOneHundred, loanDetails.getSummary().getPrincipalOutstanding().setScale(1, RoundingMode.HALF_UP)); - - List periods = loanDetails.getRepaymentSchedule().getPeriods(); - Assertions.assertEquals(6, periods.size()); - Assertions.assertEquals(thousand, periods.get(0).getPrincipalLoanBalanceOutstanding().setScale(1, RoundingMode.HALF_UP)); - Assertions.assertEquals(hundred, periods.get(1).getPrincipalLoanBalanceOutstanding().setScale(1, RoundingMode.HALF_UP)); - } - } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java index 205f88c0c..dc95bafa8 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionChargebackTest.java @@ -255,7 +255,7 @@ public class LoanTransactionChargebackTest extends BaseLoanIntegrationTest { if (period.getPeriod() != null && period.getPeriod() == 3) { log.info("Period number {} for due date {} and totalDueForPeriod {}", period.getPeriod(), period.getDueDate(), period.getTotalDueForPeriod()); - assertEquals(Double.valueOf("666.67"), period.getTotalDueForPeriod()); + assertEquals(Double.valueOf("666.67"), Utils.getDoubleValue(period.getTotalDueForPeriod())); } } @@ -356,7 +356,7 @@ public class LoanTransactionChargebackTest extends BaseLoanIntegrationTest { if (period.getPeriod() != null && period.getPeriod() == 2) { log.info("Period number {} for due date {} and totalDueForPeriod {}", period.getPeriod(), period.getDueDate(), period.getTotalDueForPeriod()); - assertEquals(Double.valueOf("500.00"), period.getPrincipalDue()); + assertEquals(Double.valueOf("500.00"), Utils.getDoubleValue(period.getPrincipalDue())); } } @@ -385,7 +385,7 @@ public class LoanTransactionChargebackTest extends BaseLoanIntegrationTest { if (period.getPeriod() != null && period.getPeriod() == 2) { log.info("Period number {} for due date {} and totalDueForPeriod {}", period.getPeriod(), period.getDueDate(), period.getTotalDueForPeriod()); - assertEquals(Double.valueOf("800.00"), period.getPrincipalDue()); + assertEquals(Double.valueOf("800.00"), Utils.getDoubleValue(period.getPrincipalDue())); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionFullAmountChargebackForOverpaidLoanTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionFullAmountChargebackForOverpaidLoanTest.java index 1e2eae92b..4d8b72e9a 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionFullAmountChargebackForOverpaidLoanTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionFullAmountChargebackForOverpaidLoanTest.java @@ -121,19 +121,19 @@ public class LoanTransactionFullAmountChargebackForOverpaidLoanTest { // verify loan is overpaid assertNotNull(loanDetails); assertTrue(loanDetails.getStatus().getOverpaid()); - assertEquals(loanDetails.getTotalOverpaid(), 200.0); + assertEquals(200.0, Utils.getDoubleValue(loanDetails.getTotalOverpaid())); // verify loan outstanding assertNotNull(loanDetails.getSummary()); - assertEquals(loanDetails.getSummary().getTotalOutstanding(), 0.0); + assertEquals(0.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); // verify last transaction amount distribution GetLoansLoanIdTransactionsTransactionIdResponse loanTransaction = loanTransactionHelper.getLoanTransaction(loanId, repaymentTransaction_3.getResourceId().intValue()); assertNotNull(loanTransaction); - assertEquals(loanTransaction.getAmount(), 300.0); - assertEquals(loanTransaction.getPrincipalPortion(), 100.0); + assertEquals(300.0, loanTransaction.getAmount()); + assertEquals(100.0, loanTransaction.getPrincipalPortion()); // chargeback for full amount on last repayment for which the amount is 300 and principal is 100 due to // overpayment adjustment @@ -150,15 +150,15 @@ public class LoanTransactionFullAmountChargebackForOverpaidLoanTest { // verify loan outstanding assertNotNull(loanDetailsAfterChargeback.getSummary()); - assertEquals(loanDetailsAfterChargeback.getSummary().getTotalOutstanding(), 100.0); + assertEquals(100.0, Utils.getDoubleValue(loanDetailsAfterChargeback.getSummary().getTotalOutstanding())); // verify chargeback transaction amount distribution GetLoansLoanIdTransactionsTransactionIdResponse chargebackTransaction = loanTransactionHelper.getLoanTransaction(loanId, chargebackTransactionResponse.getResourceId().intValue()); assertNotNull(chargebackTransaction); - assertEquals(chargebackTransaction.getAmount(), 300.0); - assertEquals(chargebackTransaction.getPrincipalPortion(), 100.0); + assertEquals(300.0, chargebackTransaction.getAmount()); + assertEquals(100.0, chargebackTransaction.getPrincipalPortion()); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionInterestPaymentWaiverTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionInterestPaymentWaiverTest.java index 67bc67c61..0de96295b 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionInterestPaymentWaiverTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionInterestPaymentWaiverTest.java @@ -1748,19 +1748,19 @@ public class LoanTransactionInterestPaymentWaiverTest extends BaseLoanIntegratio private static void validateLoanTransaction(GetLoansLoanIdResponse loanDetails, int index, double transactionAmount, double principalPortion, double overPaidPortion, double loanBalance) { - assertEquals(transactionAmount, loanDetails.getTransactions().get(index).getAmount()); - assertEquals(principalPortion, loanDetails.getTransactions().get(index).getPrincipalPortion()); - assertEquals(overPaidPortion, loanDetails.getTransactions().get(index).getOverpaymentPortion()); - assertEquals(loanBalance, loanDetails.getTransactions().get(index).getOutstandingLoanBalance()); + assertEquals(transactionAmount, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getAmount())); + assertEquals(principalPortion, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getPrincipalPortion())); + assertEquals(overPaidPortion, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getOverpaymentPortion())); + assertEquals(loanBalance, Utils.getDoubleValue(loanDetails.getTransactions().get(index).getOutstandingLoanBalance())); } private void validateLoanCharge(GetLoansLoanIdResponse loanDetails, int index, LocalDate dueDate, double charged, double paid, double outstanding) { GetLoansLoanIdLoanChargeData chargeData = loanDetails.getCharges().get(index); assertEquals(dueDate, chargeData.getDueDate()); - assertEquals(charged, chargeData.getAmount()); - assertEquals(paid, chargeData.getAmountPaid()); - assertEquals(outstanding, chargeData.getAmountOutstanding()); + assertEquals(charged, Utils.getDoubleValue(chargeData.getAmount())); + assertEquals(paid, Utils.getDoubleValue(chargeData.getAmountPaid())); + assertEquals(outstanding, Utils.getDoubleValue(chargeData.getAmountOutstanding())); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionReverseReplayTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionReverseReplayTest.java index 89a737582..2b66aaf90 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionReverseReplayTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionReverseReplayTest.java @@ -144,7 +144,7 @@ public class LoanTransactionReverseReplayTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loansLoanIdResponse = loanTransactionHelper.getLoanDetails(loanExternalIdStr); int lastTransactionIndex = loansLoanIdResponse.getTransactions().size() - 1; assertTrue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getType().getAccrual()); - assertEquals(10.0, loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount()); + assertEquals(10.0, Utils.getDoubleValue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount())); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, new PutGlobalConfigurationsRequest().enabled(false)); @@ -193,7 +193,7 @@ public class LoanTransactionReverseReplayTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loansLoanIdResponse = loanTransactionHelper.getLoanDetails(loanExternalIdStr); int lastTransactionIndex = loansLoanIdResponse.getTransactions().size() - 1; assertTrue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getType().getAccrual()); - assertEquals(10.0, loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount()); + assertEquals(10.0, Utils.getDoubleValue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount())); int lastPeriodIndex = loansLoanIdResponse.getRepaymentSchedule().getPeriods().size() - 1; assertEquals(LocalDate.of(2022, 10, 10), loansLoanIdResponse.getRepaymentSchedule().getPeriods().get(lastPeriodIndex).getDueDate()); @@ -286,7 +286,7 @@ public class LoanTransactionReverseReplayTest extends BaseLoanIntegrationTest { GetLoansLoanIdResponse loansLoanIdResponse = loanTransactionHelper.getLoanDetails(loanExternalIdStr); int lastTransactionIndex = loansLoanIdResponse.getTransactions().size() - 1; - assertEquals(500.0, loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount()); + assertEquals(500.0, Utils.getDoubleValue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount())); ArrayList journalEntriesForCBR = journalEntryHelper .getJournalEntriesByTransactionId("L" + cbrTransactionResponse.getResourceId().toString()); @@ -327,7 +327,7 @@ public class LoanTransactionReverseReplayTest extends BaseLoanIntegrationTest { inlineLoanCOBHelper.executeInlineCOB(List.of(loanId.longValue())); loansLoanIdResponse = loanTransactionHelper.getLoanDetails(loanExternalIdStr); lastTransactionIndex = loansLoanIdResponse.getTransactions().size() - 1; - assertEquals(500.0, loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount()); + assertEquals(500.0, Utils.getDoubleValue(loansLoanIdResponse.getTransactions().get(lastTransactionIndex).getAmount())); // replayed CBR transaction GetLoansLoanIdTransactions newCBRTransaction = loansLoanIdResponse.getTransactions().stream() diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionSummaryTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionSummaryTest.java index fab157b09..f379e169d 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionSummaryTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/LoanTransactionSummaryTest.java @@ -180,25 +180,25 @@ public class LoanTransactionSummaryTest { assertNotNull(loanSummary); // repayment - assertEquals(loanSummary.getTotalRepaymentTransaction(), 350.00); + assertEquals(350.00, Utils.getDoubleValue(loanSummary.getTotalRepaymentTransaction())); // repayment reversed - assertEquals(loanSummary.getTotalRepaymentTransactionReversed(), 50.00); + assertEquals(50.00, Utils.getDoubleValue(loanSummary.getTotalRepaymentTransactionReversed())); // merchant refund - assertEquals(loanSummary.getTotalMerchantRefund(), 100.00); + assertEquals(100.00, Utils.getDoubleValue(loanSummary.getTotalMerchantRefund())); // merchant refund reversed - assertEquals(loanSummary.getTotalMerchantRefundReversed(), 50.00); + assertEquals(50.00, Utils.getDoubleValue(loanSummary.getTotalMerchantRefundReversed())); // payout refund - assertEquals(loanSummary.getTotalPayoutRefund(), 100.00); + assertEquals(100.00, Utils.getDoubleValue(loanSummary.getTotalPayoutRefund())); // payout refund reversed - assertEquals(loanSummary.getTotalPayoutRefundReversed(), 50.00); + assertEquals(50.00, Utils.getDoubleValue(loanSummary.getTotalPayoutRefundReversed())); // goodwill credit - assertEquals(loanSummary.getTotalGoodwillCredit(), 100.00); + assertEquals(100.00, Utils.getDoubleValue(loanSummary.getTotalGoodwillCredit())); // goodwill credit reversed - assertEquals(loanSummary.getTotalGoodwillCreditReversed(), 50.00); + assertEquals(50.00, Utils.getDoubleValue(loanSummary.getTotalGoodwillCreditReversed())); // charge adjustment - assertEquals(loanSummary.getTotalChargeAdjustment(), 10.00); + assertEquals(10.00, Utils.getDoubleValue(loanSummary.getTotalChargeAdjustment())); // charge - assertEquals(loanSummary.getTotalChargeback(), 50.00); + assertEquals(50.00, Utils.getDoubleValue(loanSummary.getTotalChargeback())); } @Test @@ -236,10 +236,10 @@ public class LoanTransactionSummaryTest { // Retrieve Loan with loanId GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails((long) loanId); - assertEquals(20.0, loanDetails.getDelinquent().getLastPaymentAmount()); + assertEquals(20.0, Utils.getDoubleValue(loanDetails.getDelinquent().getLastPaymentAmount())); assertEquals(LocalDate.of(2022, 9, 8), loanDetails.getDelinquent().getLastPaymentDate()); - assertEquals(100.0, loanDetails.getDelinquent().getLastRepaymentAmount()); + assertEquals(100.0, Utils.getDoubleValue(loanDetails.getDelinquent().getLastRepaymentAmount())); assertEquals(LocalDate.of(2022, 9, 7), loanDetails.getDelinquent().getLastRepaymentDate()); } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/RefundForActiveLoansWithAdvancedPaymentAllocationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/RefundForActiveLoansWithAdvancedPaymentAllocationTest.java index 7ca43a832..93752ab6e 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/RefundForActiveLoansWithAdvancedPaymentAllocationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/RefundForActiveLoansWithAdvancedPaymentAllocationTest.java @@ -111,8 +111,8 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL new PostLoansLoanIdRequest().actualDisbursementDate("01 January 2023").dateFormat(DATETIME_PATTERN) .transactionAmount(BigDecimal.valueOf(1000.00)).locale("en")); - final float feePortion = 50.0f; - final float penaltyPortion = 100.0f; + final double feePortion = 50.00; + final double penaltyPortion = 100.00; Integer fee = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(feePortion), false)); @@ -141,30 +141,30 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL GetLoansLoanIdRepaymentPeriod thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BusinessDateType.BUSINESS_DATE.getName()) @@ -178,30 +178,30 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(240.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(240.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); loanTransactionHelper.makeRefundByCash("01 March 2023", 15.0f, loanId); @@ -213,32 +213,32 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalDue()); - assertEquals(5.0f, secondRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(5.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalDue())); + assertEquals(5.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(5.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); loanTransactionHelper.makeRefundByCash("01 March 2023", 265.0f, loanId); @@ -250,32 +250,32 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(20.0f, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalDue()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(270.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(20.00, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalDue())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(270.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, @@ -312,8 +312,8 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL new PostLoansLoanIdRequest().actualDisbursementDate("01 January 2023").dateFormat(DATETIME_PATTERN) .transactionAmount(BigDecimal.valueOf(1000.00)).locale("en")); - final float feePortion = 50.0f; - final float penaltyPortion = 100.0f; + final double feePortion = 50.00; + final double penaltyPortion = 100.00; Integer fee = ChargesHelper.createCharges(requestSpec, responseSpec, ChargesHelper .getLoanSpecifiedDueDateJSON(ChargesHelper.CHARGE_CALCULATION_TYPE_FLAT, String.valueOf(feePortion), false)); @@ -342,30 +342,30 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL GetLoansLoanIdRepaymentPeriod thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); businessDateHelper.updateBusinessDate(new BusinessDateRequest().type(BusinessDateType.BUSINESS_DATE.getName()) @@ -379,30 +379,30 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(240.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(240.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); loanTransactionHelper.makeRefundByCash("28 January 2023", 15.0f, loanId); @@ -414,32 +414,32 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalDue()); - assertEquals(5.0f, secondRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(5.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalDue())); + assertEquals(5.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(5.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); // fully unpaying the second installment @@ -452,32 +452,32 @@ public class RefundForActiveLoansWithAdvancedPaymentAllocationTest extends BaseL thirdRepaymentInstallment = loanDetails.getRepaymentSchedule().getPeriods().get(4); assertEquals(5, loanDetails.getRepaymentSchedule().getPeriods().size()); - assertEquals(feePortion, firstRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, firstRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, firstRepaymentInstallment.getPrincipalDue()); - assertEquals(0.0f, firstRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, firstRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(0.0f, firstRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalDue())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(0.00, Utils.getDoubleValue(firstRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 1, 31), firstRepaymentInstallment.getDueDate()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesDue()); - assertEquals(feePortion, secondRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(penaltyPortion, secondRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalDue()); - assertEquals(250.0f, secondRepaymentInstallment.getPrincipalOutstanding()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(400.0f, secondRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesDue())); + assertEquals(feePortion, Utils.getDoubleValue(secondRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(penaltyPortion, Utils.getDoubleValue(secondRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalDue())); + assertEquals(250.00, Utils.getDoubleValue(secondRepaymentInstallment.getPrincipalOutstanding())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(400.00, Utils.getDoubleValue(secondRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 3, 2), secondRepaymentInstallment.getDueDate()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getFeeChargesOutstanding()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesDue()); - assertEquals(0.0f, thirdRepaymentInstallment.getPenaltyChargesOutstanding()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalDueForPeriod()); - assertEquals(250.0f, thirdRepaymentInstallment.getTotalOutstandingForPeriod()); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getFeeChargesOutstanding())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesDue())); + assertEquals(0.00, Utils.getDoubleValue(thirdRepaymentInstallment.getPenaltyChargesOutstanding())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalDueForPeriod())); + assertEquals(250.00, Utils.getDoubleValue(thirdRepaymentInstallment.getTotalOutstandingForPeriod())); assertEquals(LocalDate.of(2023, 4, 1), thirdRepaymentInstallment.getDueDate()); } finally { globalConfigurationHelper.updateGlobalConfiguration(GlobalConfigurationConstants.ENABLE_BUSINESS_DATE, diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java index 4bc891fe9..445b0e80b 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/SchedulerJobsTestResults.java @@ -968,7 +968,7 @@ public class SchedulerJobsTestResults extends IntegrationTest { GetLoansLoanIdResponse getLoansLoanIdResponse = loanTransactionHelper.getLoan(requestSpec, responseSpec, loanID); // First accrual transaction assertTrue(getLoansLoanIdResponse.getTransactions().get(1).getType().getAccrual()); - assertEquals(10.0f, getLoansLoanIdResponse.getTransactions().get(1).getFeeChargesPortion()); + assertEquals(10.00, Utils.getDoubleValue(getLoansLoanIdResponse.getTransactions().get(1).getFeeChargesPortion())); assertEquals(LocalDate.of(2020, 6, 2), getLoansLoanIdResponse.getTransactions().get(1).getDate()); Long transactionId = getLoansLoanIdResponse.getTransactions().get(1).getId(); diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/UndoRepaymentWithDownPaymentIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/UndoRepaymentWithDownPaymentIntegrationTest.java index 78c250144..e584fac46 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/UndoRepaymentWithDownPaymentIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/UndoRepaymentWithDownPaymentIntegrationTest.java @@ -191,7 +191,7 @@ public class UndoRepaymentWithDownPaymentIntegrationTest extends BaseLoanIntegra assertNotNull(postLoansLoanIdTransactionsResponse1); loanDetails = loanTransactionHelper.getLoanDetails(loanId.longValue()); - assertEquals(500, loanDetails.getSummary().getTotalOutstanding()); + assertEquals(500.0, Utils.getDoubleValue(loanDetails.getSummary().getTotalOutstanding())); } private Integer createLoanProductWithPeriodicAccrualAccountingAndAdvancedPaymentAllocationStrategy() { diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java index cbc37afd5..b66700b9d 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/loans/LoanTransactionHelper.java @@ -2793,7 +2793,7 @@ public class LoanTransactionHelper { GetLoansLoanIdSummary getLoansLoanIdSummary = getLoansLoanIdResponse.getSummary(); if (getLoansLoanIdSummary != null) { log.info("Loan with Principal Adjustments {} expected {}", getLoansLoanIdSummary.getPrincipalAdjustments(), amountExpected); - assertEquals(amountExpected, getLoansLoanIdSummary.getPrincipalAdjustments()); + assertEquals(amountExpected, Utils.getDoubleValue(getLoansLoanIdSummary.getPrincipalAdjustments())); } } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java index 2bc198fc9..56bd39dce 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/common/products/DelinquencyBucketsHelper.java @@ -183,7 +183,7 @@ public class DelinquencyBucketsHelper { log.info("Loan Delinquency Data in Days {} and Amount {}", getCollectionData.getPastDueDays(), getCollectionData.getDelinquentAmount()); assertEquals(pastDueDays, getCollectionData.getPastDueDays(), "Past due days"); - assertEquals(amountExpected, getCollectionData.getDelinquentAmount(), "Amount expected"); + assertEquals(amountExpected, Utils.getDoubleValue(getCollectionData.getDelinquentAmount()), "Amount expected"); } else { log.info("Loan Delinquency Data is null"); }