Skip to content

Commit 65bb5ae

Browse files
committed
FINERACT-2421: Added e2e tests for verifying EMI Rounding issue due to 0.01 disbursement
1 parent a5ce666 commit 65bb5ae

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

fineract-e2e-tests-runner/src/test/resources/features/EMICalculation-Part4.feature

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
447447
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance |
448448
| 01 January 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 |
449449

450+
@TestRailId:C76742
450451
Scenario: Progressive loan with downpayment - 0.01 disbursement is assigned to the last installment and full repayment closes the loan
451452
When Admin sets the business date to "18 February 2026"
452453
When Admin creates a client with random data
@@ -476,3 +477,100 @@ Feature: EMI calculation and repayment schedule checks for interest bearing loan
476477
| 18 February 2026 | Disbursement | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 | 0.01 |
477478
| 08 April 2026 | Repayment | 0.01 | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 |
478479

480+
@TestRailId:C76743
481+
Scenario: Disbursement of 0.01 on progressive product distributes residual to first installment
482+
When Admin sets the business date to "18 February 2026"
483+
When Admin creates a client with random data
484+
When Admin creates a fully customized loan with the following data:
485+
| 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 |
486+
| LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 18 February 2026 | 100 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 48 | DAYS | 16 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
487+
And Admin successfully approves the loan on "18 February 2026" with "100" amount and expected disbursement date on "18 February 2026"
488+
When Admin successfully disburse the loan on "18 February 2026" with "0.01" EUR transaction amount
489+
Then Loan status will be "ACTIVE"
490+
Then Loan has 0.01 outstanding amount
491+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
492+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
493+
| | | 18 February 2026 | | 0.01 | | | 0.0 | | 0.0 | 0.0 | | | |
494+
| 1 | 0 | 18 February 2026 | 18 February 2026 | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
495+
| 2 | 16 | 06 March 2026 | | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | 0.01 |
496+
| 3 | 16 | 22 March 2026 | 18 February 2026 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
497+
| 4 | 16 | 07 April 2026 | 18 February 2026 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
498+
Then Loan Repayment schedule has the following data in Total row:
499+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
500+
| 0.01 | 0.0 | 0.0 | 0.0 | 0.01 | 0.0 | 0.0 | 0.0 | 0.01 |
501+
When Admin sets the business date to "06 March 2026"
502+
And Customer makes "AUTOPAY" repayment on "06 March 2026" with 0.01 EUR transaction amount
503+
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
504+
Then Loan has 0.0 outstanding amount
505+
Then Loan Transactions tab has the following data:
506+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance |
507+
| 18 February 2026 | Disbursement | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 | 0.01 |
508+
| 06 March 2026 | Repayment | 0.01 | 0.01 | 0.0 | 0.0 | 0.0 | 0.0 |
509+
510+
@TestRailId:C76744
511+
Scenario: Disbursement of 0.02 on progressive product distributes residual to first installment
512+
When Admin sets the business date to "18 February 2026"
513+
When Admin creates a client with random data
514+
When Admin creates a fully customized loan with the following data:
515+
| 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 |
516+
| LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 18 February 2026 | 100 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 48 | DAYS | 16 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
517+
And Admin successfully approves the loan on "18 February 2026" with "100" amount and expected disbursement date on "18 February 2026"
518+
When Admin successfully disburse the loan on "18 February 2026" with "0.02" EUR transaction amount
519+
Then Loan status will be "ACTIVE"
520+
Then Loan has 0.02 outstanding amount
521+
Then Loan Repayment schedule has 4 periods, with the following data for periods:
522+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
523+
| | | 18 February 2026 | | 0.02 | | | 0.0 | | 0.0 | 0.0 | | | |
524+
| 1 | 0 | 18 February 2026 | 18 February 2026 | 0.02 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
525+
| 2 | 16 | 06 March 2026 | | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | 0.02 |
526+
| 3 | 16 | 22 March 2026 | 18 February 2026 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
527+
| 4 | 16 | 07 April 2026 | 18 February 2026 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 |
528+
Then Loan Repayment schedule has the following data in Total row:
529+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
530+
| 0.02 | 0.0 | 0.0 | 0.0 | 0.02 | 0.0 | 0.0 | 0.0 | 0.02 |
531+
When Admin sets the business date to "06 March 2026"
532+
And Customer makes "AUTOPAY" repayment on "06 March 2026" with 0.02 EUR transaction amount
533+
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
534+
Then Loan has 0.0 outstanding amount
535+
Then Loan Transactions tab has the following data:
536+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance |
537+
| 18 February 2026 | Disbursement | 0.02 | 0.0 | 0.0 | 0.0 | 0.0 | 0.02 |
538+
| 06 March 2026 | Repayment | 0.02 | 0.02 | 0.0 | 0.0 | 0.0 | 0.0 |
539+
540+
@TestRailId:C76745
541+
Scenario: Partial repayment of 0.01 residual does not flip loan to OVERPAID
542+
When Admin sets the business date to "18 February 2026"
543+
When Admin creates a client with random data
544+
When Admin creates a fully customized loan with the following data:
545+
| 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 |
546+
| LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 18 February 2026 | 100 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 48 | DAYS | 16 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
547+
And Admin successfully approves the loan on "18 February 2026" with "100" amount and expected disbursement date on "18 February 2026"
548+
When Admin successfully disburse the loan on "18 February 2026" with "0.01" EUR transaction amount
549+
Then Loan status will be "ACTIVE"
550+
# Repayment of 0.01 on the disbursement day must close the loan, NOT leave balance 0.01 and flip to OVERPAID
551+
And Customer makes "AUTOPAY" repayment on "18 February 2026" with 0.01 EUR transaction amount
552+
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
553+
Then Loan has 0.0 outstanding amount
554+
555+
@TestRailId:C76746
556+
Scenario: Multi-disbursement, 0.01 first tranche followed by 99.99 second tranche amortises cleanly
557+
When Admin sets the business date to "18 February 2026"
558+
When Admin creates a client with random data
559+
When Admin creates a fully customized loan with the following data:
560+
| 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 |
561+
| LP2_DOWNPAYMENT_AUTO_ADVANCED_PAYMENT_ALLOCATION | 18 February 2026 | 100 | 0 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 48 | DAYS | 16 | DAYS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
562+
And Admin successfully approves the loan on "18 February 2026" with "100" amount and expected disbursement date on "18 February 2026"
563+
# First tranche
564+
When Admin successfully disburse the loan on "18 February 2026" with "0.01" EUR transaction amount
565+
Then Loan status will be "ACTIVE"
566+
Then Loan has 0.01 outstanding amount
567+
# Second tranche on the same day, before any installment is due, must re-amortise to a full 100-loan schedule.
568+
# Auto-downpayment on 99.99 is round(99.99 * 25%, multiplesOf=1) = 25, so outstanding = 0.01 + 99.99 - 25 = 75.00.
569+
When Admin successfully disburse the loan on "18 February 2026" with "99.99" EUR transaction amount
570+
Then Loan status will be "ACTIVE"
571+
Then Loan has 75.0 outstanding amount
572+
# Pay down full outstanding, loan must close cleanly (not OVERPAID with a ghost 0.01 residual from the first tranche)
573+
When Admin sets the business date to "08 April 2026"
574+
And Customer makes "AUTOPAY" repayment on "08 April 2026" with 75 EUR transaction amount
575+
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
576+
Then Loan has 0.0 outstanding amount

0 commit comments

Comments
 (0)