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") @Schema(example = "0.000000")
public Double totalRepaymentTransactionReversed; public Double totalRepaymentTransactionReversed;
@Schema(example = "0.000000") @Schema(example = "0.000000")
public Double totalUnpaidAccruedDueInterest; public BigDecimal totalUnpaidAccruedDueInterest;
@Schema(example = "0.000000") @Schema(example = "0.000000")
public Double totalUnpaidAccruedNotDueInterest; public BigDecimal totalUnpaidAccruedNotDueInterest;
public Set<GetLoansLoanIdOverdueCharges> overdueCharges; public Set<GetLoansLoanIdOverdueCharges> overdueCharges;
@Schema(example = "1") @Schema(example = "1")
public Long chargeOffReasonId; public Long chargeOffReasonId;
@@ -1011,13 +1011,13 @@ final class LoansApiResourceSwagger {
@Schema(example = "100.000000") @Schema(example = "100.000000")
public Double delinquentAmount; public Double delinquentAmount;
@Schema(example = "80.000000") @Schema(example = "80.000000")
public Double delinquentPrincipal; public BigDecimal delinquentPrincipal;
@Schema(example = "10.000000") @Schema(example = "10.000000")
public Double delinquentInterest; public BigDecimal delinquentInterest;
@Schema(example = "6.000000") @Schema(example = "6.000000")
public Double delinquentFee; public BigDecimal delinquentFee;
@Schema(example = "4.000000") @Schema(example = "4.000000")
public Double delinquentPenalty; public BigDecimal delinquentPenalty;
@Schema(example = "[2022, 07, 01]") @Schema(example = "[2022, 07, 01]")
public LocalDate lastPaymentDate; public LocalDate lastPaymentDate;
@Schema(example = "100.000000") @Schema(example = "100.000000")
@@ -4720,8 +4720,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
// After Disbursement we are expecting no Accrual transactions // After Disbursement we are expecting no Accrual transactions
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId()); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanResponse.getLoanId());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
}); });
// Not Due yet // Not Due yet
@@ -4732,14 +4732,14 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("30 January 2024"); periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("30 January 2024");
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get()); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(0.97, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest()); assertEquals(new BigDecimal("0.97"), loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
// Partial interest repayment // Partial interest repayment
addRepaymentForLoan(createdLoanId.get(), 20.50, "30 January 2024"); addRepaymentForLoan(createdLoanId.get(), 20.50, "30 January 2024");
loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get()); loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.0, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(0.05, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest()); assertEquals(new BigDecimal("0.05"), loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest().stripTrailingZeros());
}); });
// Not Due and Due Interest // Not Due and Due Interest
@@ -4749,8 +4749,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("20 February 2024"); periodicAccrualAccountingHelper.runPeriodicAccrualAccounting("20 February 2024");
GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get()); GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(createdLoanId.get());
assertEquals(0.12, loanDetails.getSummary().getTotalUnpaidAccruedDueInterest()); assertEquals(new BigDecimal("0.12"), loanDetails.getSummary().getTotalUnpaidAccruedDueInterest().stripTrailingZeros());
assertEquals(0.52, loanDetails.getSummary().getTotalUnpaidAccruedNotDueInterest()); 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(), log.info("Loan Delinquency Data {} {}", loanDetails.getDelinquent().getDelinquentPrincipal(),
loanDetails.getDelinquent().getDelinquentInterest()); loanDetails.getDelinquent().getDelinquentInterest());
assertNotNull(loanDetails.getDelinquent().getDelinquentPrincipal()); assertNotNull(loanDetails.getDelinquent().getDelinquentPrincipal());
assertEquals(305.91, loanDetails.getDelinquent().getDelinquentPrincipal()); assertEquals(new BigDecimal("305.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertNotNull(loanDetails.getDelinquent().getDelinquentInterest()); 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 // Apply a partial repayment to move only the interest
PostLoansLoanIdTransactionsResponse loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 120f, PostLoansLoanIdTransactionsResponse loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 120f,
@@ -1521,8 +1521,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
loanDetails = loanTransactionHelper.getLoanDetails(loanId); loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification()); assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(305.91, loanDetails.getDelinquent().getDelinquentPrincipal()); assertEquals(new BigDecimal("305.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(130.72, loanDetails.getDelinquent().getDelinquentInterest()); assertEquals(new BigDecimal("130.72"), loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());
// Apply a repayment to cover interest and part of the principal // Apply a repayment to cover interest and part of the principal
loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 330.72f, loanId.intValue()); loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 330.72f, loanId.intValue());
@@ -1532,8 +1532,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
loanDetails = loanTransactionHelper.getLoanDetails(loanId); loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification()); assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(105.91, loanDetails.getDelinquent().getDelinquentPrincipal()); assertEquals(new BigDecimal("105.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());
// Apply a repayment to cover the remain principal // Apply a repayment to cover the remain principal
loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 105.91f, loanId.intValue()); loansLoanIdTransactions = loanTransactionHelper.makeLoanRepayment(operationDate, 105.91f, loanId.intValue());
@@ -1543,8 +1543,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
loanDetails = loanTransactionHelper.getLoanDetails(loanId); loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent());
assertNull(loanDetails.getDelinquencyRange()); assertNull(loanDetails.getDelinquencyRange());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentPrincipal()); assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());
// Undo the last repayment transaction we must to have pending the principal // Undo the last repayment transaction we must to have pending the principal
PostLoansLoanIdTransactionsResponse reverseRepayment = loanTransactionHelper.reverseLoanTransaction(loanId, PostLoansLoanIdTransactionsResponse reverseRepayment = loanTransactionHelper.reverseLoanTransaction(loanId,
@@ -1554,8 +1554,8 @@ public class DelinquencyBucketsIntegrationTest extends BaseLoanIntegrationTest {
loanDetails = loanTransactionHelper.getLoanDetails(loanId); loanDetails = loanTransactionHelper.getLoanDetails(loanId);
assertNotNull(loanDetails.getDelinquent()); assertNotNull(loanDetails.getDelinquent());
assertNotNull(loanDetails.getDelinquencyRange().getClassification()); assertNotNull(loanDetails.getDelinquencyRange().getClassification());
assertEquals(105.91, loanDetails.getDelinquent().getDelinquentPrincipal()); assertEquals(new BigDecimal("105.91"), loanDetails.getDelinquent().getDelinquentPrincipal().stripTrailingZeros());
assertEquals(0.0, loanDetails.getDelinquent().getDelinquentInterest()); assertEquals(BigDecimal.ZERO, loanDetails.getDelinquent().getDelinquentInterest().stripTrailingZeros());
} }
private GetLoanProductsProductIdResponse createLoanProduct(final LoanTransactionHelper loanTransactionHelper, private GetLoanProductsProductIdResponse createLoanProduct(final LoanTransactionHelper loanTransactionHelper,