FINERACT-2081: Fix delinquent data swagger type

This commit is contained in:
Jose Alberto Hernandez
2024-07-17 11:28:05 +02:00
committed by Adam Saghy
parent 6c4932bd64
commit eb06b40190
3 changed files with 24 additions and 24 deletions
@@ -640,9 +640,9 @@ final class LoansApiResourceSwagger {
@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;
@@ -1011,13 +1011,13 @@ final class LoansApiResourceSwagger {
@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")
@@ -4720,8 +4720,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
// 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
@@ -4732,14 +4732,14 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
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
@@ -4749,8 +4749,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
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());
});
}
@@ -1508,9 +1508,9 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
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,
@@ -1521,8 +1521,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
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());
@@ -1532,8 +1532,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
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());
@@ -1543,8 +1543,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
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,
@@ -1554,8 +1554,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
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,