Skip to content

Commit

Permalink
FINERACT-2081: Fix delinquent data swagger type
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Alberto Hernandez authored and adamsaghy committed Jul 17, 2024
1 parent 6c4932b commit eb06b40
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -640,9 +640,9 @@ private GetLoansLoanIdFeeFrequency() {}
@Schema(example = "0.000000")
public Double totalRepaymentTransactionReversed;
@Schema(example = "0.000000")
public Double totalUnpaidAccruedDueInterest;
public BigDecimal totalUnpaidAccruedDueInterest;
@Schema(example = "0.000000")
public Double totalUnpaidAccruedNotDueInterest;
public BigDecimal totalUnpaidAccruedNotDueInterest;
public Set<GetLoansLoanIdOverdueCharges> overdueCharges;
@Schema(example = "1")
public Long chargeOffReasonId;
Expand Down Expand Up @@ -1011,13 +1011,13 @@ private GetLoansLoanIdDelinquencySummary() {}
@Schema(example = "100.000000")
public Double delinquentAmount;
@Schema(example = "80.000000")
public Double delinquentPrincipal;
public BigDecimal delinquentPrincipal;
@Schema(example = "10.000000")
public Double delinquentInterest;
public BigDecimal delinquentInterest;
@Schema(example = "6.000000")
public Double delinquentFee;
public BigDecimal delinquentFee;
@Schema(example = "4.000000")
public Double delinquentPenalty;
public BigDecimal delinquentPenalty;
@Schema(example = "[2022, 07, 01]")
public LocalDate lastPaymentDate;
@Schema(example = "100.000000")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4720,8 +4720,8 @@ public void uc144() {

// After Disbursement we are expecting no Accrual transactions
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest());
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
});

// Not Due yet
Expand All @@ -4732,14 +4732,14 @@ public void uc144() {
periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("30 January 2024");

GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest());
assertEquals(0.97, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest());
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(new BigDecimal("0.97"), loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());

// Partial interest repayment
addRepaymentForLoan(createdLoanId.get(), 20.50, "30 January 2024");
loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest());
assertEquals(0.05, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest());
assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(new BigDecimal("0.05"), loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
});

// Not Due and Due Interest
Expand All @@ -4749,8 +4749,8 @@ public void uc144() {
periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("20 February 2024");

GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.12, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest());
assertEquals(0.52, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest());
assertEquals(new BigDecimal("0.12"), loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(new BigDecimal("0.52"), loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1508,9 +1508,9 @@ public void testLoanDelinquencyDataWithAmountPerPortions() {
log.info("Loan Delinquency Data {} {}", loanDetails.getDelinquent().getDelinquentPrincipal(),
loanDetails.getDelinquent().getDelinquentInterest());
assertNotNull(loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(305.91, loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(new BigDecimal("305.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertNotNull(loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(250.72, loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(new BigDecimal("250.72"), loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());

// Apply a partial repayment to move only the interest
PostLoansLoanIdTransactionsResponse loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 120f,
Expand All @@ -1521,8 +1521,8 @@ public void testLoanDelinquencyDataWithAmountPerPortions() {
loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(305.91, loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(130.72, loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(new BigDecimal("305.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(new BigDecimal("130.72"), loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());

// Apply a repayment to cover interest and part of the principal
loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 330.72f, loanId.intValue());
Expand All @@ -1532,8 +1532,8 @@ public void testLoanDelinquencyDataWithAmountPerPortions() {
loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(105.91, loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(new BigDecimal("105.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());

// Apply a repayment to cover the remain principal
loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 105.91f, loanId.intValue());
Expand All @@ -1543,8 +1543,8 @@ public void testLoanDelinquencyDataWithAmountPerPortions() {
loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent());
assertNull(loanDetails.getDelinquencyRange());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());

// Undo the last repayment transaction we must to have pending the principal
PostLoansLoanIdTransactionsResponse reverseRepayment = loanTransactionHelper.reverseLoanTransaction(loanId,
Expand All @@ -1554,8 +1554,8 @@ public void testLoanDelinquencyDataWithAmountPerPortions() {
loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(105.91, loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest());
assertEquals(new BigDecimal("105.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());
}

private GetLoanProductsProductIdResponse createLoanProduct(final LoanTransactionHelper loanTransactionHelper,
Expand Down

0 comments on commit eb06b40

Please sign in to comment.