FINERACT-1971: Down payment (auto) transaction using installment multiples of setting
This commit is contained in:
committed by
Adam Saghy
parent
7499859d39
commit
849790ea46
+135
-34
@@ -60,6 +60,7 @@ import org.apache.fineract.infrastructure.businessdate.domain.BusinessDateType;
|
||||
import org.apache.fineract.integrationtests.common.BusinessDateHelper;
|
||||
import org.apache.fineract.integrationtests.common.ClientHelper;
|
||||
import org.apache.fineract.integrationtests.common.CommonConstants;
|
||||
import org.apache.fineract.integrationtests.common.GlobalConfigurationHelper;
|
||||
import org.apache.fineract.integrationtests.common.LoanRescheduleRequestHelper;
|
||||
import org.apache.fineract.integrationtests.common.Utils;
|
||||
import org.apache.fineract.integrationtests.common.accounting.Account;
|
||||
@@ -1802,7 +1803,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC103: Advanced payment allocation, add charge after maturity -> N+1 installment, repay the loan
|
||||
// UC103: Advanced payment allocation, add charge after maturity -> N+1
|
||||
// installment, repay the loan
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Disburse the loan (500)
|
||||
// 2. Add charge after maturity date
|
||||
@@ -1872,7 +1874,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
// 1. Disburse the loan (500)
|
||||
// 2. Add charge for 3rd and 4th installments
|
||||
// 3. Pay little more than the charge of 1st installment
|
||||
// 4. Pay little more than the principal of 1st installment and charge of 2nd installment
|
||||
// 4. Pay little more than the principal of 1st installment and charge of 2nd
|
||||
// installment
|
||||
@Test
|
||||
public void uc104() {
|
||||
runAt("22 February 2023", () -> {
|
||||
@@ -2026,9 +2029,11 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC106: Advanced payment allocation, horizontal repayment processing, mixed grouping of allocation rules
|
||||
// UC106: Advanced payment allocation, horizontal repayment processing, mixed
|
||||
// grouping of allocation rules
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, but the allocation rules are mixed -> expect validation error
|
||||
// 1. Create a Loan product, but the allocation rules are mixed -> expect
|
||||
// validation error
|
||||
@Test
|
||||
public void uc106() {
|
||||
runAt("22 February 2023", () -> {
|
||||
@@ -2048,11 +2053,15 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC107: Advanced payment allocation, vertical repayment processing, mixed grouping of allocation rules
|
||||
// UC107: Advanced payment allocation, vertical repayment processing, mixed
|
||||
// grouping of allocation rules
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, but the allocation rules are mixed -> no validation error
|
||||
// 2. Change transaction processor while submitting loan -> expect validation error
|
||||
// 3. Change to HORIZONTAL loan schedule processing and allocation rules are mixed - > expect validation error
|
||||
// 1. Create a Loan product, but the allocation rules are mixed -> no validation
|
||||
// error
|
||||
// 2. Change transaction processor while submitting loan -> expect validation
|
||||
// error
|
||||
// 3. Change to HORIZONTAL loan schedule processing and allocation rules are
|
||||
// mixed - > expect validation error
|
||||
@Test
|
||||
public void uc107() {
|
||||
runAt("22 February 2023", () -> {
|
||||
@@ -2087,7 +2096,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC108: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||
// UC108: Advanced payment allocation, progressive loan schedule handling,
|
||||
// rounding test
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, 1000 principal, across 3 installment
|
||||
// 2. Submit the loan, and check the generated repayment schedule
|
||||
@@ -2175,7 +2185,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC109: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||
// UC109: Advanced payment allocation, progressive loan schedule handling,
|
||||
// rounding test
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, 1000 principal, across 3 installment
|
||||
// 2. Submit the loan, and check the generated repayment schedule
|
||||
@@ -2263,9 +2274,11 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC110: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||
// UC110: Advanced payment allocation, progressive loan schedule handling,
|
||||
// rounding test
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down payment, 3 normal installment)
|
||||
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down
|
||||
// payment, 3 normal installment)
|
||||
// 2. Submit the loan, and check the generated repayment schedule
|
||||
@Test
|
||||
public void uc110() {
|
||||
@@ -2314,9 +2327,11 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC111: Advanced payment allocation, progressive loan schedule handling, rounding test
|
||||
// UC111: Advanced payment allocation, progressive loan schedule handling,
|
||||
// rounding test
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down payment, 3 normal installment)
|
||||
// 1. Create a Loan product, 40.50 principal, across 4 installment (1 down
|
||||
// payment, 3 normal installment)
|
||||
// 2. Submit the loan, and check the generated repayment schedule
|
||||
@Test
|
||||
public void uc111() {
|
||||
@@ -2785,7 +2800,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC116: Advanced payment allocation, horizontal repayment processing, disbursement on due date of an installment
|
||||
// UC116: Advanced payment allocation, horizontal repayment processing,
|
||||
// disbursement on due date of an installment
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Disburse the loan (1000)
|
||||
// 2. Add charge on disbursement date(50)
|
||||
@@ -2869,7 +2885,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC117: Advanced payment allocation, horizontal repayment processing, multi disbursement on due date of an
|
||||
// UC117: Advanced payment allocation, horizontal repayment processing, multi
|
||||
// disbursement on due date of an
|
||||
// installment
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Disburse the loan (1000)
|
||||
@@ -2962,7 +2979,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC118: Advanced payment allocation, horizontal repayment processing, multi disbursement on disbursement date
|
||||
// UC118: Advanced payment allocation, horizontal repayment processing, multi
|
||||
// disbursement on disbursement date
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Disburse the loan (1000)
|
||||
// 2. Disburse on disbursement date (400)
|
||||
@@ -3019,7 +3037,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
|
||||
// UC119: Advanced payment allocation with Loan Schedule as Cumulative
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc., but the loan schedule as Cumulative -> expect validation error
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc., but the loan schedule as
|
||||
// Cumulative -> expect validation error
|
||||
@Test
|
||||
public void uc119() {
|
||||
runAt("02 February 2023", () -> {
|
||||
@@ -3038,7 +3057,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC120: Advanced payment allocation with auto down payment and multiple disbursement on the first day
|
||||
// UC120: Advanced payment allocation with auto down payment and multiple
|
||||
// disbursement on the first day
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc., and auto down payment
|
||||
// 2. Submit Loan and approve
|
||||
@@ -3095,7 +3115,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC121: Advanced payment allocation, horizontal repayment processing product and Loan application
|
||||
// UC121: Advanced payment allocation, horizontal repayment processing product
|
||||
// and Loan application
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
@Test
|
||||
public void uc121() {
|
||||
@@ -3542,7 +3563,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC126: Advanced payment allocation with Fixed Length for 40 days and Loan Term for 45 days (3 repayments every 15
|
||||
// UC126: Advanced payment allocation with Fixed Length for 40 days and Loan
|
||||
// Term for 45 days (3 repayments every 15
|
||||
// days)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
@@ -3587,7 +3609,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC127: Advanced payment allocation with Fixed Length for 5 weeks and Loan Term for 6 weeks (3 repayments every 2
|
||||
// UC127: Advanced payment allocation with Fixed Length for 5 weeks and Loan
|
||||
// Term for 6 weeks (3 repayments every 2
|
||||
// weeks)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
@@ -3636,7 +3659,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC128: Advanced payment allocation with Fixed Length for 11 months and Loan Term for 12 months (6 repayments each
|
||||
// UC128: Advanced payment allocation with Fixed Length for 11 months and Loan
|
||||
// Term for 12 months (6 repayments each
|
||||
// 2 months)
|
||||
// every 2 months)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
@@ -3690,7 +3714,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC129: Advanced payment allocation with Fixed Length for 5 months and Loan Term for 6 months (6 repayments
|
||||
// UC129: Advanced payment allocation with Fixed Length for 5 months and Loan
|
||||
// Term for 6 months (6 repayments
|
||||
// every month)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
@@ -3714,11 +3739,13 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC130: Advanced payment allocation with Fixed Length for 5 months and Loan Term for 6 months (6 repayments
|
||||
// UC130: Advanced payment allocation with Fixed Length for 5 months and Loan
|
||||
// Term for 6 months (6 repayments
|
||||
// every month)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
// 2. Submit Loan and approve -> expect validation error - Fixed Length without Advanced Payment Allocation
|
||||
// 2. Submit Loan and approve -> expect validation error - Fixed Length without
|
||||
// Advanced Payment Allocation
|
||||
@Test
|
||||
public void uc130() {
|
||||
final String operationDate = "22 November 2023";
|
||||
@@ -3730,7 +3757,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
.numberOfRepayments(6).repaymentEvery(1).repaymentFrequencyType(repaymentFrequencyType.longValue()).fixedLength(6);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||
|
||||
// Try to use Fixed Length without Advanced Payment Allocation as transaction processing strategy code
|
||||
// Try to use Fixed Length without Advanced Payment Allocation as transaction
|
||||
// processing strategy code
|
||||
LOG.info("Try to use Fixed Length without Advanced Payment Allocation as transaction processing strategy code");
|
||||
CallFailedRuntimeException exception = assertThrows(CallFailedRuntimeException.class,
|
||||
() -> loanTransactionHelper.applyLoan(new PostLoansRequest().clientId(client.getClientId())
|
||||
@@ -3749,11 +3777,13 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC131: Advanced payment allocation with Fixed Length for 5 months and Loan Term for 6 months (6 repayments
|
||||
// UC131: Advanced payment allocation with Fixed Length for 5 months and Loan
|
||||
// Term for 6 months (6 repayments
|
||||
// every month)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
// 2. Submit Loan and approve -> expect validation error - Interest Rate value higher than Zero
|
||||
// 2. Submit Loan and approve -> expect validation error - Interest Rate value
|
||||
// higher than Zero
|
||||
@Test
|
||||
public void uc131() {
|
||||
final String operationDate = "22 November 2023";
|
||||
@@ -3784,11 +3814,13 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC132: Advanced payment allocation with Fixed Length for 5 months and Loan Term for 6 months (3 repayments
|
||||
// UC132: Advanced payment allocation with Fixed Length for 5 months and Loan
|
||||
// Term for 6 months (3 repayments
|
||||
// every 2 months)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
// 2. Submit Loan and approve -> expect validation error - Loan acount Fixed Length with a wrong Loan Term setup
|
||||
// 2. Submit Loan and approve -> expect validation error - Loan acount Fixed
|
||||
// Length with a wrong Loan Term setup
|
||||
@Test
|
||||
public void uc132() {
|
||||
final String operationDate = "22 November 2023";
|
||||
@@ -3819,7 +3851,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC133: Advanced payment allocation with higher Fixed Length for 50 days than Loan Term for 45 days (3 repayments
|
||||
// UC133: Advanced payment allocation with higher Fixed Length for 50 days than
|
||||
// Loan Term for 45 days (3 repayments
|
||||
// every 15 days)
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc. and No Interest
|
||||
@@ -3867,7 +3900,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC134: Advanced payment allocation with Fixed Length for 119 days and Loan Term for 120 days (4 repayments every
|
||||
// UC134: Advanced payment allocation with Fixed Length for 119 days and Loan
|
||||
// Term for 120 days (4 repayments every
|
||||
// 30
|
||||
// days) and Reschedule
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
@@ -3939,7 +3973,8 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC135: Advanced payment allocation with Fixed Length for 119 days and Loan Term for 120 days (4 repayments every
|
||||
// UC135: Advanced payment allocation with Fixed Length for 119 days and Loan
|
||||
// Term for 120 days (4 repayments every
|
||||
// 30
|
||||
// days) and Reschedule
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
@@ -4011,6 +4046,72 @@ public class AdvancedPaymentAllocationLoanRepaymentScheduleTest extends BaseLoan
|
||||
});
|
||||
}
|
||||
|
||||
// UC136: Advanced payment allocation, using auto downpayment with installment
|
||||
// amount in multiples of 1
|
||||
// ADVANCED_PAYMENT_ALLOCATION_STRATEGY
|
||||
// 1. Create a Loan product with Adv. Pment. Alloc.
|
||||
// 2. Submit Loan and approve
|
||||
// 3. Disburse the loan and validate downpayment
|
||||
@Test
|
||||
public void uc136() {
|
||||
AtomicLong createdLoanId = new AtomicLong();
|
||||
runAt("23 March 2024", () -> {
|
||||
// Rounding mode - HALF_DOWN
|
||||
GlobalConfigurationHelper.updateValueForGlobalConfigurationInternal(requestSpec, responseSpec, "23", 5);
|
||||
createLoanForRoundingMethodValidation(true);
|
||||
|
||||
// Rounding mode - HALF_UP
|
||||
GlobalConfigurationHelper.updateValueForGlobalConfigurationInternal(requestSpec, responseSpec, "23", 4);
|
||||
createLoanForRoundingMethodValidation(false);
|
||||
|
||||
// Rounding mode - HALF_EVEN - Default
|
||||
GlobalConfigurationHelper.updateValueForGlobalConfigurationInternal(requestSpec, responseSpec, "23", 6);
|
||||
});
|
||||
}
|
||||
|
||||
private void createLoanForRoundingMethodValidation(boolean isHalfDown) {
|
||||
LOG.info("------------------------------ROUNDING HALF DOWN {} ---------------------------------------", isHalfDown);
|
||||
|
||||
PostLoanProductsRequest product = createOnePeriod30DaysLongNoInterestPeriodicAccrualProductWithAdvancedPaymentAllocation()
|
||||
.installmentAmountInMultiplesOf(null).numberOfRepayments(3).repaymentEvery(15).enableDownPayment(true)
|
||||
.enableAutoRepaymentForDownPayment(true).disbursedAmountPercentageForDownPayment(BigDecimal.valueOf(25)).minPrincipal(10.0)
|
||||
.installmentAmountInMultiplesOf(1);
|
||||
PostLoanProductsResponse loanProductResponse = loanProductHelper.createLoanProduct(product);
|
||||
PostLoansRequest applicationRequest = applyLoanRequest(client.getClientId(), loanProductResponse.getResourceId(), "23 March 2024",
|
||||
10.0, 4);
|
||||
|
||||
applicationRequest = applicationRequest.numberOfRepayments(3).loanTermFrequency(45)
|
||||
.transactionProcessingStrategyCode(LoanProductTestBuilder.ADVANCED_PAYMENT_ALLOCATION_STRATEGY).repaymentEvery(15);
|
||||
|
||||
PostLoansResponse loanResponse = loanTransactionHelper.applyLoan(applicationRequest);
|
||||
|
||||
loanTransactionHelper.approveLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest().approvedLoanAmount(BigDecimal.valueOf(10))
|
||||
.dateFormat(DATETIME_PATTERN).approvedOnDate("23 March 2024").locale("en"));
|
||||
|
||||
loanTransactionHelper.disburseLoan(loanResponse.getLoanId(), new PostLoansLoanIdRequest().actualDisbursementDate("23 March 2024")
|
||||
.dateFormat(DATETIME_PATTERN).transactionAmount(BigDecimal.valueOf(10.0)).locale("en"));
|
||||
|
||||
// verify schedule
|
||||
if (isHalfDown) {
|
||||
verifyRepaymentSchedule(loanResponse.getLoanId(), //
|
||||
installment(10, null, "23 March 2024"), //
|
||||
installment(2, 0, 0, 0, 0.0, true, "23 March 2024", 8), //
|
||||
installment(3, 0, 0, 0, 3, false, "07 April 2024", 5), //
|
||||
installment(3, 0, 0, 0, 3, false, "22 April 2024", 2), //
|
||||
installment(2, 0, 0, 0, 2, false, "07 May 2024", 0.0) //
|
||||
);
|
||||
} else {
|
||||
LOG.info("Loan Id {}", loanResponse.getLoanId());
|
||||
verifyRepaymentSchedule(loanResponse.getLoanId(), //
|
||||
installment(10, null, "23 March 2024"), //
|
||||
installment(3, 0, 0, 0, 0.0, true, "23 March 2024", 7), //
|
||||
installment(2, 0, 0, 0, 2, false, "07 April 2024", 5), //
|
||||
installment(2, 0, 0, 0, 2, false, "22 April 2024", 3), //
|
||||
installment(3, 0, 0, 0, 3, false, "07 May 2024", 0.0) //
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<PaymentAllocationOrder> getPaymentAllocationOrder(PaymentAllocationType... paymentAllocationTypes) {
|
||||
AtomicInteger integer = new AtomicInteger(1);
|
||||
return Arrays.stream(paymentAllocationTypes).map(pat -> {
|
||||
|
||||
+24
-24
@@ -76,10 +76,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// delete all external events
|
||||
@@ -124,10 +124,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
addRepaymentForLoan(loanId, 313.0, "31 January 2023");
|
||||
@@ -135,10 +135,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, true, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, true, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// delete all external events
|
||||
@@ -181,10 +181,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// delete all external events
|
||||
@@ -227,10 +227,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// delete all external events
|
||||
@@ -271,10 +271,10 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), //
|
||||
installment(313.0, false, "02 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "31 January 2023"), //
|
||||
installment(312.0, false, "02 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// delete all external events
|
||||
|
||||
+30
-30
@@ -74,31 +74,31 @@ public class InstallmentLevelDelinquencyAPIIntegrationTests extends BaseLoanInte
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), // 120 days delinquent -> range4
|
||||
installment(313.0, false, "02 March 2023"), // 90 days delinquent -> range4
|
||||
installment(313.0, false, "01 April 2023"), // 60 days delinquent -> range3
|
||||
installment(311.0, false, "01 May 2023") // 30 days delinquent -> range2
|
||||
installment(312.0, false, "31 January 2023"), // 120 days delinquent -> range4
|
||||
installment(312.0, false, "02 March 2023"), // 90 days delinquent -> range4
|
||||
installment(312.0, false, "01 April 2023"), // 60 days delinquent -> range3
|
||||
installment(314.0, false, "01 May 2023") // 30 days delinquent -> range2
|
||||
);
|
||||
|
||||
// since the current day is 31 May 2023, therefore all the installments are delinquent
|
||||
verifyDelinquency(loanId, 120, "1250.0", //
|
||||
delinquency(11, 30, "311.0"), // 4th installment
|
||||
delinquency(31, 60, "313.0"), // 3rd installment
|
||||
delinquency(61, null, "626.0") // 1st installment + 2nd installment
|
||||
delinquency(11, 30, "314.0"), // 4th installment
|
||||
delinquency(31, 60, "312.0"), // 3rd installment
|
||||
delinquency(61, null, "624.0") // 1st installment + 2nd installment
|
||||
);
|
||||
|
||||
// Repayment of the first two installments
|
||||
addRepaymentForLoan(loanId, 626.0, "31 May 2023");
|
||||
verifyDelinquency(loanId, 60, "624.0", //
|
||||
delinquency(11, 30, "311.0"), // 4th installment
|
||||
delinquency(31, 60, "313.0") // 3rd installment
|
||||
delinquency(11, 30, "314.0"), // 4th installment
|
||||
delinquency(31, 60, "310.0") // 3rd installment
|
||||
);
|
||||
|
||||
// Partial repayment
|
||||
addRepaymentForLoan(loanId, 100.0, "31 May 2023");
|
||||
verifyDelinquency(loanId, 60, "524.0", //
|
||||
delinquency(11, 30, "311.0"), // 4th installment
|
||||
delinquency(31, 60, "213.0") // 3rd installment
|
||||
delinquency(11, 30, "314.0"), // 4th installment
|
||||
delinquency(31, 60, "210.0") // 3rd installment
|
||||
);
|
||||
|
||||
// Repay the loan fully
|
||||
@@ -135,23 +135,23 @@ public class InstallmentLevelDelinquencyAPIIntegrationTests extends BaseLoanInte
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), // 120 days delinquent -> range2
|
||||
installment(313.0, false, "02 March 2023"), // 90 days delinquent -> range2
|
||||
installment(313.0, false, "01 April 2023"), // 60 days delinquent -> range1
|
||||
installment(311.0, false, "01 May 2023") // 30 days delinquent -> range1
|
||||
installment(312.0, false, "31 January 2023"), // 120 days delinquent -> range2
|
||||
installment(312.0, false, "02 March 2023"), // 90 days delinquent -> range2
|
||||
installment(312.0, false, "01 April 2023"), // 60 days delinquent -> range1
|
||||
installment(314.0, false, "01 May 2023") // 30 days delinquent -> range1
|
||||
);
|
||||
|
||||
verifyDelinquency(loanId, 120, "1250.0", //
|
||||
delinquency(1, 60, "624.0"), // 4th installment
|
||||
delinquency(61, null, "626.0") // 1st installment + 2nd installment
|
||||
delinquency(1, 60, "626.0"), // 4th installment
|
||||
delinquency(61, null, "624.0") // 1st installment + 2nd installment
|
||||
);
|
||||
|
||||
// repay the first installment
|
||||
addRepaymentForLoan(loanId, 313.0, "31 May 2023");
|
||||
|
||||
verifyDelinquency(loanId, 90, "937.0", //
|
||||
delinquency(1, 60, "624.0"), // 4th installment
|
||||
delinquency(61, null, "313.0") // 1st installment + 2nd installment
|
||||
delinquency(1, 60, "626.0"), // 4th installment
|
||||
delinquency(61, null, "311.0") // 1st installment + 2nd installment
|
||||
);
|
||||
|
||||
});
|
||||
@@ -185,10 +185,10 @@ public class InstallmentLevelDelinquencyAPIIntegrationTests extends BaseLoanInte
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "31 January 2023"), // 120 days delinquent -> range2
|
||||
installment(313.0, false, "02 March 2023"), // 90 days delinquent -> range2
|
||||
installment(313.0, false, "01 April 2023"), // 60 days delinquent -> range1
|
||||
installment(311.0, false, "01 May 2023") // 30 days delinquent -> range1
|
||||
installment(312.0, false, "31 January 2023"), // 120 days delinquent -> range2
|
||||
installment(312.0, false, "02 March 2023"), // 90 days delinquent -> range2
|
||||
installment(312.0, false, "01 April 2023"), // 60 days delinquent -> range1
|
||||
installment(314.0, false, "01 May 2023") // 30 days delinquent -> range1
|
||||
);
|
||||
|
||||
// this should be empty as the installment level delinquency is not enabled for this loan
|
||||
@@ -223,21 +223,21 @@ public class InstallmentLevelDelinquencyAPIIntegrationTests extends BaseLoanInte
|
||||
|
||||
// Verify Repayment Schedule and Due Dates
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), installment(313.0, false, "31 January 2023"),
|
||||
installment(313.0, false, "02 March 2023"), installment(313.0, false, "01 April 2023"),
|
||||
installment(311.0, false, "01 May 2023"));
|
||||
installment(1250.0, null, "01 January 2023"), installment(312.0, false, "31 January 2023"),
|
||||
installment(312.0, false, "02 March 2023"), installment(312.0, false, "01 April 2023"),
|
||||
installment(314.0, false, "01 May 2023"));
|
||||
|
||||
// The first installment falls into the first range
|
||||
verifyDelinquency(loanId, 1, "313.0", //
|
||||
delinquency(1, 1, "313.0") // 4th installment
|
||||
verifyDelinquency(loanId, 1, "312.0", //
|
||||
delinquency(1, 1, "312.0") // 4th installment
|
||||
);
|
||||
|
||||
// Let's go one day ahead in the time
|
||||
updateBusinessDateAndExecuteCOBJob("2 February 2023");
|
||||
|
||||
// The first installment is not two days delinquent and therefore falls into the second range
|
||||
verifyDelinquency(loanId, 2, "313.0", //
|
||||
delinquency(2, null, "313.0") // 4th installment
|
||||
verifyDelinquency(loanId, 2, "312.0", //
|
||||
delinquency(2, null, "312.0") // 4th installment
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
+8
-8
@@ -205,19 +205,19 @@ public class LoanAccountRepaymentCalculationTest {
|
||||
assertNotNull(loanDetails.getRepaymentSchedule());
|
||||
|
||||
// first period [2023-03-03 to 2023-03-03] down payment installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(1), 313.0, 1, LocalDate.of(2023, 3, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(1), 312.0, 1, LocalDate.of(2023, 3, 3),
|
||||
LocalDate.of(2023, 3, 3), false);
|
||||
|
||||
// second period [2023-03-03 to 2023-04-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(2), 312.0, 2, LocalDate.of(2023, 3, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(2), 313.0, 2, LocalDate.of(2023, 3, 3),
|
||||
LocalDate.of(2023, 4, 3), false);
|
||||
|
||||
// third period [2023-04-03 to 2023-05-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(3), 312.0, 3, LocalDate.of(2023, 4, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(3), 313.0, 3, LocalDate.of(2023, 4, 3),
|
||||
LocalDate.of(2023, 5, 3), false);
|
||||
|
||||
// fourth period [2023-05-03 to 2023-06-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(4), 313.0, 4, LocalDate.of(2023, 5, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(4), 312.0, 4, LocalDate.of(2023, 5, 3),
|
||||
LocalDate.of(2023, 6, 3), false);
|
||||
|
||||
// disbursement
|
||||
@@ -228,19 +228,19 @@ public class LoanAccountRepaymentCalculationTest {
|
||||
assertNotNull(loanDetails.getRepaymentSchedule());
|
||||
|
||||
// first period [2023-03-03 to 2023-03-03] down payment installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(1), 313.0, 1, LocalDate.of(2023, 3, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(1), 312.0, 1, LocalDate.of(2023, 3, 3),
|
||||
LocalDate.of(2023, 3, 3), false);
|
||||
|
||||
// second period [2023-03-03 to 2023-04-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(2), 312.0, 2, LocalDate.of(2023, 3, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(2), 313.0, 2, LocalDate.of(2023, 3, 3),
|
||||
LocalDate.of(2023, 4, 3), false);
|
||||
|
||||
// third period [2023-04-03 to 2023-05-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(3), 312.0, 3, LocalDate.of(2023, 4, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(3), 313.0, 3, LocalDate.of(2023, 4, 3),
|
||||
LocalDate.of(2023, 5, 3), false);
|
||||
|
||||
// fourth period [2023-05-03 to 2023-06-03] regular installment
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(4), 313.0, 4, LocalDate.of(2023, 5, 3),
|
||||
verifyPeriodDetails(loanDetails.getRepaymentSchedule().getPeriods().get(4), 312.0, 4, LocalDate.of(2023, 5, 3),
|
||||
LocalDate.of(2023, 6, 3), false);
|
||||
|
||||
} finally {
|
||||
|
||||
+225
-225
@@ -70,24 +70,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -96,17 +96,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -133,24 +133,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("01 February 2023");
|
||||
@@ -161,17 +161,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "01 February 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "01 February 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0, true, "01 February 2023"), //
|
||||
installment(343.0, 0, 50, 20, 413.0, false, "01 March 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0, true, "01 February 2023"), //
|
||||
installment(342.0, 0, 50, 20, 412.0, false, "01 March 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -198,24 +198,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("01 May 2023");
|
||||
@@ -226,17 +226,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "01 May 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "01 May 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(341.0, 0, 50, 20, 411.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(344.0, 0, 50, 20, 414.0, false, "01 May 2023") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -259,36 +259,36 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date + and make a full repayment for the first installment
|
||||
updateBusinessDate("20 January 2023");
|
||||
addRepaymentForLoan(loanId, 313.0, "20 January 2023");
|
||||
addRepaymentForLoan(loanId, 312.0, "20 January 2023");
|
||||
|
||||
// Update Business Date + and make a full repayment for the second installment
|
||||
updateBusinessDate("20 February 2023");
|
||||
addRepaymentForLoan(loanId, 313.0, "20 February 2023");
|
||||
addRepaymentForLoan(loanId, 312.0, "20 February 2023");
|
||||
|
||||
// Update Business Date + and make a full repayment for the third installment
|
||||
updateBusinessDate("20 March 2023");
|
||||
addRepaymentForLoan(loanId, 313.0, "20 March 2023");
|
||||
addRepaymentForLoan(loanId, 312.0, "20 March 2023");
|
||||
|
||||
// Add some charges Update Business Date + and make a full repayment for the fourth installment
|
||||
updateBusinessDate("20 April 2023");
|
||||
addCharge(loanId, false, 50, "20 April 2023");
|
||||
addCharge(loanId, true, 20, "20 April 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 381.0, "20 April 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 384.0, "20 April 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 50, 20, 0.0, true, "01 May 2023") //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 50, 20, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Let's move over the maturity date and chargeback some money
|
||||
@@ -299,20 +299,20 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(313.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(313.0, "Repayment", "20 February 2023", 624.0, 313.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(313.0, "Repayment", "20 March 2023", 311.0, 313.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(381.0, "Repayment", "20 April 2023", 0.0, 311.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(312.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(312.0, "Repayment", "20 February 2023", 626.0, 312.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(312.0, "Repayment", "20 March 2023", 314.0, 312.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(384.0, "Repayment", "20 April 2023", 0.0, 314.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(70.0, "Accrual", "20 April 2023", 0.0, 0.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "02 May 2023", 30.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 50, 20, 0.0, true, "01 May 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 50, 20, 0.0, true, "01 May 2023"), //
|
||||
installment(30.0, 0, 50, 20, 100.0, false, "02 May 2023") //
|
||||
);
|
||||
});
|
||||
@@ -340,24 +340,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("21 January 2023");
|
||||
@@ -367,17 +367,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// let's add a backdated repayment on 19th of January to trigger reverse replaying the chargeback, that will
|
||||
@@ -387,8 +387,8 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(200.0, "Repayment", "19 January 2023", 1120.0, 130.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 737.0, 383.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 837.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 738.0, 382.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 838.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -415,24 +415,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("22 January 2023");
|
||||
@@ -442,17 +442,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "22 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "22 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// let's add a backdated repayment on 21th of January that will reverse replay the chargeback transaction
|
||||
@@ -462,12 +462,12 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(200.0, "Repayment", "21 January 2023", 737.0, 200.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "22 January 2023", 767.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(200.0, "Repayment", "21 January 2023", 738.0, 200.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "22 January 2023", 768.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
verifyLoanSummaryAmounts(loanId, 30.0, 50.0, 20.0, 837.0);
|
||||
verifyLoanSummaryAmounts(loanId, 30.0, 50.0, 20.0, 838.0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -495,24 +495,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -520,20 +520,20 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 1037.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 1038.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(413.0, 0, 50, 20, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(412.0, 0, 50, 20, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
verifyLoanSummaryAmounts(loanId, 100.0, 0.0, 0.0, 1037);
|
||||
verifyLoanSummaryAmounts(loanId, 100.0, 0.0, 0.0, 1038);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -559,10 +559,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
@@ -574,10 +574,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("02 May 2023");
|
||||
@@ -596,10 +596,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
// DEFAULT payment allocation is ..., DUE_PENALTY, DUE_FEE, DUE_PRINCIPAL, ...
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0, true, "01 May 2023"), //
|
||||
installment(312.0, 0, 50, 20, 0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0, true, "01 May 2023"), //
|
||||
installment(100.0, 0, 0, 0, outstanding(50.0, 0d, 0d, 50.0), false, "02 May 2023") //
|
||||
);
|
||||
});
|
||||
@@ -627,10 +627,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
@@ -642,10 +642,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -662,10 +662,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
// DEFAULT payment allocation is ..., DUE_PENALTY, DUE_FEE, DUE_PRINCIPAL, ...
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, outstanding(30.0, 20.0, 0.0, 50.0), false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, outstanding(30.0, 20.0, 0.0, 50.0), false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
verifyLoanSummaryAmounts(loanId, 30.0, 50.0, 20.0, 50.0);
|
||||
@@ -694,10 +694,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
@@ -709,10 +709,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -729,10 +729,10 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
// DEFAULT payment allocation is ..., DUE_PRINCIPAL, DUE_FEE, DUE_PENALTY ...
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, outstanding(0.0, 30.0, 20.0, 50.0), false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, outstanding(0.0, 30.0, 20.0, 50.0), false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 0.0, true, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 0.0, true, "01 May 2023") //
|
||||
);
|
||||
|
||||
verifyLoanSummaryAmounts(loanId, 30.0, 50.0, 20.0, 50.0);
|
||||
@@ -761,24 +761,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -787,17 +787,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("21 January 2023");
|
||||
@@ -806,18 +806,18 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1067.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1068.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(443.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(442.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
});
|
||||
@@ -845,24 +845,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -871,17 +871,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("21 January 2023");
|
||||
@@ -890,18 +890,18 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1067.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1068.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(443.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(442.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Let's add repayment to trigger reverse replay for both chargebacks
|
||||
@@ -910,9 +910,9 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(200.0, "Repayment", "19 January 2023", 1120.0, 130.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 737.0, 383.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 837.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 937.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 738.0, 382.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 838.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 938.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -939,24 +939,24 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 383.0, false, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 382.0, false, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Update Business Date
|
||||
updateBusinessDate("20 January 2023");
|
||||
|
||||
// Add Repayment
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 383.0, "20 January 2023");
|
||||
Long repaymentTransaction = addRepaymentForLoan(loanId, 382.0, "20 January 2023");
|
||||
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(312.0, 0, 50, 20, 0.0, true, "01 February 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Add Chargeback
|
||||
@@ -965,17 +965,17 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(343.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(342.0, 0, 100, 40, 100.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
updateBusinessDate("21 January 2023");
|
||||
@@ -984,18 +984,18 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 937.0, 313.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1067.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 938.0, 312.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 30.0, 0.0, 50.0, 20.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1068.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(443.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 March 2023"), //
|
||||
installment(313.0, 0, 0, 0, 313.0, false, "01 April 2023"), //
|
||||
installment(311.0, 0, 0, 0, 311.0, false, "01 May 2023") //
|
||||
installment(442.0, 0, 100, 40, 200.0, false, "01 February 2023"),
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 March 2023"), //
|
||||
installment(312.0, 0, 0, 0, 312.0, false, "01 April 2023"), //
|
||||
installment(314.0, 0, 0, 0, 314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// Let's add repayment to trigger reverse replay for both chargebacks
|
||||
@@ -1004,9 +1004,9 @@ public class LoanChargebackWithCreditAllocationsIntegrationTests extends BaseLoa
|
||||
verifyTransactions(loanId, //
|
||||
transaction(1250.0, "Disbursement", "01 January 2023", 1250.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), //
|
||||
transaction(20.0, "Repayment", "19 January 2023", 1250.0, 0.0, 0.0, 0.0, 20.0, 0.0, 0.0), //
|
||||
transaction(383.0, "Repayment", "20 January 2023", 917.0, 333.0, 0.0, 50.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 967.0, 50.0, 0.0, 50.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1067.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
transaction(382.0, "Repayment", "20 January 2023", 918.0, 332.0, 0.0, 50.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "20 January 2023", 968.0, 50.0, 0.0, 50.0, 0.0, 0.0, 0.0), //
|
||||
transaction(100.0, "Chargeback", "21 January 2023", 1068.0, 100.0, 0.0, 0.0, 0.0, 0.0, 0.0) //
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
+16
-16
@@ -78,10 +78,10 @@ public class LoanInstallmentMultiplesOfTest extends BaseLoanIntegrationTest {
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "01 February 2023"), //
|
||||
installment(313.0, false, "01 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(312.0, false, "01 February 2023"), //
|
||||
installment(312.0, false, "01 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
|
||||
// disburse Loan
|
||||
@@ -89,11 +89,11 @@ public class LoanInstallmentMultiplesOfTest extends BaseLoanIntegrationTest {
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(313.0, false, "01 February 2023"), //
|
||||
installment(313.0, false, "01 March 2023"), //
|
||||
installment(313.0, false, "01 April 2023"), //
|
||||
installment(311.0, false, "01 May 2023") //
|
||||
installment(1250, null, "01 January 2023"), //
|
||||
installment(312.0, false, "01 February 2023"), //
|
||||
installment(312.0, false, "01 March 2023"), //
|
||||
installment(312.0, false, "01 April 2023"), //
|
||||
installment(314.0, false, "01 May 2023") //
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -142,9 +142,9 @@ public class LoanInstallmentMultiplesOfTest extends BaseLoanIntegrationTest {
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(417.5, 12.5, 430.0, false, "01 February 2023"), //
|
||||
installment(417.5, 12.5, 430.0, false, "01 March 2023"), //
|
||||
installment(415.0, 12.5, 427.5, false, "01 April 2023") //
|
||||
installment(416.5, 12.5, 429.0, false, "01 February 2023"), //
|
||||
installment(416.5, 12.5, 429.0, false, "01 March 2023"), //
|
||||
installment(417.0, 12.5, 429.5, false, "01 April 2023") //
|
||||
);
|
||||
|
||||
// disburse Loan
|
||||
@@ -152,10 +152,10 @@ public class LoanInstallmentMultiplesOfTest extends BaseLoanIntegrationTest {
|
||||
|
||||
// Verify Repayment Schedule
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1250.0, null, "01 January 2023"), //
|
||||
installment(417.5, 12.5, 430.0, false, "01 February 2023"), //
|
||||
installment(417.5, 12.5, 430.0, false, "01 March 2023"), //
|
||||
installment(415.0, 12.5, 427.5, false, "01 April 2023") //
|
||||
installment(1250, null, "01 January 2023"), //
|
||||
installment(416.5, 12.5, 429.0, false, "01 February 2023"), //
|
||||
installment(416.5, 12.5, 429.0, false, "01 March 2023"), //
|
||||
installment(417.0, 12.5, 429.5, false, "01 April 2023") //
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
+2
-2
@@ -59,8 +59,8 @@ public class LoanRescheduleTestWithDownpayment extends BaseLoanIntegrationTest {
|
||||
verifyRepaymentSchedule(loanId, //
|
||||
installment(1500.0, null, "01 January 2023"), //
|
||||
installment(375.0, false, "01 January 2023"), //
|
||||
installment(563.0, false, "31 January 2023"), //
|
||||
installment(562.0, false, "02 March 2023") //
|
||||
installment(562.0, false, "31 January 2023"), //
|
||||
installment(563.0, false, "02 March 2023") //
|
||||
);
|
||||
|
||||
// 1st Disburse Loan
|
||||
|
||||
+8
@@ -614,6 +614,14 @@ public class GlobalConfigurationHelper {
|
||||
updateGlobalConfigUpdateEnabledFlagAsJSON(enabled), "resourceId");
|
||||
}
|
||||
|
||||
public static void updateValueForGlobalConfigurationInternal(final RequestSpecification requestSpec,
|
||||
final ResponseSpecification responseSpec, final String configId, final int value) {
|
||||
final String GLOBAL_CONFIG_UPDATE_URL = "/fineract-provider/api/v1/internal/configurations/" + configId + "/value/" + value + "?"
|
||||
+ Utils.TENANT_IDENTIFIER;
|
||||
log.info("---------------------------UPDATE VALUE FOR GLOBAL CONFIG (internal) ---------------------------------------");
|
||||
Utils.performServerPost(requestSpec, responseSpec, GLOBAL_CONFIG_UPDATE_URL, Utils.emptyJson());
|
||||
}
|
||||
|
||||
// Deprecated because it's using configId as a String
|
||||
@Deprecated
|
||||
public static Integer updateEnabledFlagForGlobalConfiguration(final RequestSpecification requestSpec,
|
||||
|
||||
Reference in New Issue
Block a user