INERACT-2211: added e2e test for validation of bug fix
This commit is contained in:
committed by
Adam Saghy
parent
56e89ba544
commit
a687227f33
+1
@@ -44,6 +44,7 @@ public enum DefaultLoanProduct implements LoanProduct {
|
||||
LP2_DOWNPAYMENT, //
|
||||
LP2_DOWNPAYMENT_AUTO, //
|
||||
LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION, //
|
||||
LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION, //
|
||||
LP2_DOWNPAYMENT_ADVANCED_PAYMENT_ALLOCATION, //
|
||||
LP2_DOWNPAYMENT_INTEREST, //
|
||||
LP2_DOWNPAYMENT_INTEREST_AUTO, //
|
||||
|
||||
+44
@@ -2735,6 +2735,50 @@ public class LoanProductGlobalInitializerStep implements FineractGlobalInitializ
|
||||
TestContext.INSTANCE.set(
|
||||
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_ADV_PYMNT_INTEREST_DAILY_RECALC_EMI_360_30_MULTIDISB_APPROVED_OVER_APPLIED_CAPITALIZED_INCOME,
|
||||
responseLoanProductsRequestLP2ProgressiveAdvPymnt36030InterestRecalcMultidisbursalApprovedOverAppliedCapitalizedIncome);
|
||||
|
||||
// LP2 with Down-payment+autopayment + custom advanced payment allocation
|
||||
// (LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION)
|
||||
String name109 = DefaultLoanProduct.LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION.getName();
|
||||
PostLoanProductsRequest loanProductsRequestDownPaymentAutoAdvCustomPaymentAllocation = loanProductsRequestFactory
|
||||
.defaultLoanProductsRequestLP2()//
|
||||
.name(name109)//
|
||||
.transactionProcessingStrategyCode(ADVANCED_PAYMENT_ALLOCATION.getValue())//
|
||||
.loanScheduleType("PROGRESSIVE") //
|
||||
.paymentAllocation(List.of(//
|
||||
createPaymentAllocation("DEFAULT", "REAMORTIZATION"), //
|
||||
createPaymentAllocation("GOODWILL_CREDIT", "LAST_INSTALLMENT"), //
|
||||
createPaymentAllocation("MERCHANT_ISSUED_REFUND", "LAST_INSTALLMENT",
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_FEE, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_FEE, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_FEE), //
|
||||
createPaymentAllocation("DOWN_PAYMENT", "NEXT_INSTALLMENT",
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.PAST_DUE_FEE, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.DUE_FEE, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PENALTY, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_INTEREST, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_PRINCIPAL, //
|
||||
LoanProductPaymentAllocationRule.AllocationTypesEnum.IN_ADVANCE_FEE), //
|
||||
createPaymentAllocation("PAYOUT_REFUND", "NEXT_INSTALLMENT")));//
|
||||
Response<PostLoanProductsResponse> responseLoanProductsRequestDownPaymentAutoAdvCustomPaymentAllocation = loanProductsApi
|
||||
.createLoanProduct(loanProductsRequestDownPaymentAutoAdvCustomPaymentAllocation).execute();
|
||||
TestContext.INSTANCE.set(
|
||||
TestContextKey.DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION,
|
||||
responseLoanProductsRequestDownPaymentAutoAdvCustomPaymentAllocation);
|
||||
}
|
||||
|
||||
public static AdvancedPaymentData createPaymentAllocation(String transactionType, String futureInstallmentAllocationRule,
|
||||
|
||||
+1
@@ -73,6 +73,7 @@ public abstract class TestContextKey {
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_PERIOD_DAILY_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP1InterestDecliningPeriodDailyAccrualActivity";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP1_INTEREST_DECLINING_BALANCE_DAILY_RECALCULATION_COMPOUNDING_NONE_ACCRUAL_ACTIVITY = "loanProductCreateResponseLP1InterestDecliningBalanceRecalculationCompoundingNoneAccrualActivity";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION = "loanProductCreateResponseLP2DownPaymentAutoAdvancedPaymentAllocation";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION = "loanProductCreateResponseLP2DownPaymentAutoAdvancedCustomPaymentAllocation";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_AUTO_ADVANCED_REPAYMENT_ALLOCATION_PAYMENT_START_SUBMITTED = "loanProductCreateResponseLP2DownPaymentAutoAdvancedPaymentAllocationPaymentStartSubmitted";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT_ADVANCED_PAYMENT_ALLOCATION = "loanProductCreateResponseLP2DownPaymentAdvancedPaymentAllocation";
|
||||
public static final String DEFAULT_LOAN_PRODUCT_CREATE_RESPONSE_LP2_DOWNPAYMENT = "loanProductCreateResponseLP2DownPayment";
|
||||
|
||||
@@ -1674,3 +1674,120 @@ Feature: Credit Balance Refund
|
||||
Then Loan status will be "OVERPAID"
|
||||
Then Loan has 0 outstanding amount
|
||||
Then Loan has 250 overpaid amount
|
||||
|
||||
@TestRailId:C3734
|
||||
Scenario: Verify that 2nd disbursement is allowed after MIR, Payout Refund and Credit Balance Refund closes the loan
|
||||
When Admin sets the business date to "14 March 2024"
|
||||
When Admin creates a client with random data
|
||||
When Admin creates a fully customized loan with the following data:
|
||||
| LoanProduct | submitted on date | with Principal | ANNUAL interest rate % | interest type | interest calculation period | amortization type | loanTermFrequency | loanTermFrequencyType | repaymentEvery | repaymentFrequencyType | numberOfRepayments | graceOnPrincipalPayment | graceOnInterestPayment | interest free period | Payment strategy |
|
||||
| LP2_DOWNPAYMENT_AUTO_ADVANCED_CUSTOM_PAYMENT_ALLOCATION | 14 March 2024 | 487.58 | 0 | FLAT | SAME_AS_REPAYMENT_PERIOD | EQUAL_INSTALLMENTS | 45 | DAYS | 15 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
|
||||
And Admin successfully approves the loan on "14 March 2024" with "487.58" amount and expected disbursement date on "14 March 2024"
|
||||
# First disbursement with automatic downpayment
|
||||
When Admin successfully disburse the loan on "14 March 2024" with "487.58" EUR transaction amount
|
||||
Then Loan Repayment schedule has 4 periods, with the following data for periods:
|
||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| | | 14 March 2024 | | 487.58 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 0 | 14 March 2024 | 14 March 2024 | 365.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 2 | 15 | 29 March 2024 | | 243.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 |
|
||||
| 3 | 15 | 13 April 2024 | | 121.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 |
|
||||
| 4 | 15 | 28 April 2024 | | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 487.58 | 0.0 | 0.0 | 0.0 | 487.58 | 122.0 | 0.0 | 0.0 | 365.58 |
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
|
||||
| 14 March 2024 | Disbursement | 487.58 | 0.0 | 0.0 | 0.0 | 0.0 | 487.58 | false | false |
|
||||
| 14 March 2024 | Down Payment | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 | 365.58 | false | false |
|
||||
When Admin runs inline COB job for Loan
|
||||
# Merchant Issued Refund
|
||||
When Admin sets the business date to "24 March 2024"
|
||||
When Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "24 March 2024" with 201.39 EUR transaction amount and system-generated Idempotency key
|
||||
Then Loan Repayment schedule has 4 periods, with the following data for periods:
|
||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| | | 14 March 2024 | | 487.58 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 0 | 14 March 2024 | 14 March 2024 | 365.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 2 | 15 | 29 March 2024 | | 243.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 |
|
||||
| 3 | 15 | 13 April 2024 | | 121.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 79.81 | 79.81 | 0.0 | 42.19 |
|
||||
| 4 | 15 | 28 April 2024 | 24 March 2024 | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 | 121.58 | 121.58 | 0.0 | 0.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 487.58 | 0.0 | 0.0 | 0.0 | 487.58 | 323.39 | 201.39 | 0.0 | 164.19 |
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
|
||||
| 14 March 2024 | Disbursement | 487.58 | 0.0 | 0.0 | 0.0 | 0.0 | 487.58 | false | false |
|
||||
| 14 March 2024 | Down Payment | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 | 365.58 | false | false |
|
||||
| 24 March 2024 | Merchant Issued Refund | 201.39 | 201.39 | 0.0 | 0.0 | 0.0 | 164.19 | false | false |
|
||||
When Admin runs inline COB job for Loan
|
||||
# Move forward to next year for Payout Refund
|
||||
When Admin sets the business date to "24 March 2025"
|
||||
When Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "24 March 2025" with 286.19 EUR transaction amount and system-generated Idempotency key
|
||||
Then Loan Repayment schedule has 4 periods, with the following data for periods:
|
||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| | | 14 March 2024 | | 487.58 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 0 | 14 March 2024 | 14 March 2024 | 365.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 2 | 15 | 29 March 2024 | 24 March 2025 | 243.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 122.0 | 0.0 |
|
||||
| 3 | 15 | 13 April 2024 | 24 March 2025 | 121.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 79.81 | 42.19 | 0.0 |
|
||||
| 4 | 15 | 28 April 2024 | 24 March 2024 | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 | 121.58 | 121.58 | 0.0 | 0.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 487.58 | 0.0 | 0.0 | 0.0 | 487.58 | 487.58 | 201.39 | 164.19 | 0.0 |
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
|
||||
| 14 March 2024 | Disbursement | 487.58 | 0.0 | 0.0 | 0.0 | 0.0 | 487.58 | false | false |
|
||||
| 14 March 2024 | Down Payment | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 | 365.58 | false | false |
|
||||
| 24 March 2024 | Merchant Issued Refund | 201.39 | 201.39 | 0.0 | 0.0 | 0.0 | 164.19 | false | false |
|
||||
| 24 March 2025 | Payout Refund | 286.19 | 164.19 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
Then Loan status will be "OVERPAID"
|
||||
Then Loan has 0 outstanding amount
|
||||
Then Loan has 122.0 overpaid amount
|
||||
When Admin runs inline COB job for Loan
|
||||
# Credit Balance Refund to close the loan
|
||||
When Admin sets the business date to "25 March 2025"
|
||||
When Admin makes Credit Balance Refund transaction on "25 March 2025" with 122.0 EUR transaction amount
|
||||
Then Loan Repayment schedule has 4 periods, with the following data for periods:
|
||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| | | 14 March 2024 | | 487.58 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 0 | 14 March 2024 | 14 March 2024 | 365.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 2 | 15 | 29 March 2024 | 24 March 2025 | 243.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 122.0 | 0.0 |
|
||||
| 3 | 15 | 13 April 2024 | 24 March 2025 | 121.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 79.81 | 42.19 | 0.0 |
|
||||
| 4 | 15 | 28 April 2024 | 24 March 2024 | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 | 121.58 | 121.58 | 0.0 | 0.0 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 487.58 | 0.0 | 0.0 | 0.0 | 487.58 | 487.58 | 201.39 | 164.19 | 0.0 |
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
|
||||
| 14 March 2024 | Disbursement | 487.58 | 0.0 | 0.0 | 0.0 | 0.0 | 487.58 | false | false |
|
||||
| 14 March 2024 | Down Payment | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 | 365.58 | false | false |
|
||||
| 24 March 2024 | Merchant Issued Refund | 201.39 | 201.39 | 0.0 | 0.0 | 0.0 | 164.19 | false | false |
|
||||
| 24 March 2025 | Payout Refund | 286.19 | 164.19 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 25 March 2025 | Credit Balance Refund | 122.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
|
||||
Then Loan has 0 outstanding amount
|
||||
When Admin runs inline COB job for Loan
|
||||
# Second disbursement
|
||||
When Admin sets the business date to "01 April 2025"
|
||||
When Admin successfully disburse the loan on "01 April 2025" with "243.79" EUR transaction amount
|
||||
Then Loan Repayment schedule has 6 periods, with the following data for periods:
|
||||
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| | | 14 March 2024 | | 487.58 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 1 | 0 | 14 March 2024 | 14 March 2024 | 365.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 2 | 15 | 29 March 2024 | 24 March 2025 | 243.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 0.0 | 122.0 | 0.0 |
|
||||
| 3 | 15 | 13 April 2024 | 24 March 2025 | 121.58 | 122.0 | 0.0 | 0.0 | 0.0 | 122.0 | 122.0 | 79.81 | 42.19 | 0.0 |
|
||||
| 4 | 15 | 28 April 2024 | 24 March 2024 | 0.0 | 121.58 | 0.0 | 0.0 | 0.0 | 121.58 | 121.58 | 121.58 | 0.0 | 0.0 |
|
||||
| | | 01 April 2025 | | 243.79 | | | 0.0 | | 0.0 | 0.0 | | | |
|
||||
| 5 | 0 | 01 April 2025 | 01 April 2025 | 182.79 | 61.0 | 0.0 | 0.0 | 0.0 | 61.0 | 61.0 | 0.0 | 0.0 | 0.0 |
|
||||
| 6 | 0 | 01 April 2025 | | 0.0 | 182.79 | 0.0 | 0.0 | 0.0 | 182.79 | 0.0 | 0.0 | 0.0 | 182.79 |
|
||||
Then Loan Repayment schedule has the following data in Total row:
|
||||
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
|
||||
| 731.37 | 0.0 | 0.0 | 0.0 | 731.37 | 548.58 | 201.39 | 164.19 | 182.79 |
|
||||
Then Loan Transactions tab has the following data:
|
||||
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
|
||||
| 14 March 2024 | Disbursement | 487.58 | 0.0 | 0.0 | 0.0 | 0.0 | 487.58 | false | false |
|
||||
| 14 March 2024 | Down Payment | 122.0 | 122.0 | 0.0 | 0.0 | 0.0 | 365.58 | false | false |
|
||||
| 24 March 2024 | Merchant Issued Refund | 201.39 | 201.39 | 0.0 | 0.0 | 0.0 | 164.19 | false | false |
|
||||
| 24 March 2025 | Payout Refund | 286.19 | 164.19 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 25 March 2025 | Credit Balance Refund | 122.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
|
||||
| 01 April 2025 | Disbursement | 243.79 | 0.0 | 0.0 | 0.0 | 0.0 | 243.79 | false | false |
|
||||
| 01 April 2025 | Down Payment | 61.0 | 61.0 | 0.0 | 0.0 | 0.0 | 182.79 | false | false |
|
||||
Then Loan status will be "ACTIVE"
|
||||
Reference in New Issue
Block a user