Skip to content

Commit

Permalink
FINERACT-1981: Fix interest calculation logic (rounding issues with s…
Browse files Browse the repository at this point in the history
…ub interest periods)
  • Loading branch information
adamsaghy committed Feb 20, 2025
1 parent b4b9d3e commit e02420f
Show file tree
Hide file tree
Showing 17 changed files with 803 additions and 782 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -6263,15 +6263,15 @@ Feature: Loan
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 |
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 83.52 | 16.48 | 0.53 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 2 | 29 | 01 March 2024 | | 66.91 | 16.61 | 0.4 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 3 | 31 | 01 April 2024 | | 50.2 | 16.71 | 0.3 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 4 | 30 | 01 May 2024 | | 33.4 | 16.8 | 0.21 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.5 | 16.9 | 0.11 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.5 | 0.01 | 0.0 | 0.0 | 16.51 | 15.0 | 15.0 | 0.0 | 1.51 |
| 1 | 31 | 01 February 2024 | | 83.53 | 16.47 | 0.54 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 2 | 29 | 01 March 2024 | | 66.92 | 16.61 | 0.4 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 3 | 31 | 01 April 2024 | | 50.21 | 16.71 | 0.3 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 4 | 30 | 01 May 2024 | | 33.41 | 16.8 | 0.21 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.51 | 16.9 | 0.11 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.51 | 0.01 | 0.0 | 0.0 | 16.52 | 15.0 | 15.0 | 0.0 | 1.52 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.56 | 0.0 | 0.0 | 101.56 | 15.0 | 15.0 | 0.0 | 86.56 |
| 100.0 | 1.57 | 0.0 | 0.0 | 101.57 | 15.0 | 15.0 | 0.0 | 86.57 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 |
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3647,7 +3647,7 @@ Feature: Charge-off
| 29 February 2024 | Charge-off | 83.89 | 82.99 | 0.9 | 0.0 | 0.0 | 0.0 | false | false |

@Skip @TestRailId:C3361 @AdvancedPaymentAllocation
Scenario: Verify accelerate maturity to charge-off date when interest recalculation is enabled - case when charge-off occurs with allocation to last installment with interest allocation change
Scenario: SKIPPED - Verify accelerate maturity to charge-off date when interest recalculation is enabled - case when charge-off occurs with allocation to last installment with interest allocation change
When Admin sets the business date to "01 January 2024"
When Admin creates a client with random data
When Admin creates a fully customized loan with the following data:
Expand Down Expand Up @@ -5638,16 +5638,16 @@ Feature: Charge-off
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 |
| 2 | 28 | 29 February 2024 | | 0.0 | 83.57 | 0.43 | 0.0 | 0.0 | 84.0 | 17.01 | 17.01 | 0.0 | 66.99 |
| 2 | 28 | 29 February 2024 | | 0.0 | 83.57 | 0.42 | 0.0 | 0.0 | 83.99 | 17.01 | 17.01 | 0.0 | 66.98 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100.0 | 1.01 | 0.0 | 0.0 | 101.01 | 34.02 | 17.01 | 0.0 | 66.99 |
| 100.0 | 1.0 | 0.0 | 0.0 | 101.0 | 34.02 | 17.01 | 0.0 | 66.98 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
| 01 February 2024 | Repayment | 17.01 | 16.43 | 0.58 | 0.0 | 0.0 | 83.57 | false | false |
| 15 February 2024 | Repayment | 17.01 | 16.77 | 0.24 | 0.0 | 0.0 | 66.8 | false | true |
| 29 February 2024 | Charge-off | 66.99 | 66.8 | 0.19 | 0.0 | 0.0 | 0.0 | false | false |
| 29 February 2024 | Charge-off | 66.98 | 66.8 | 0.18 | 0.0 | 0.0 | 0.0 | false | false |

@TestRailId:C3360 @AdvancedPaymentAllocation
Scenario: Verify accelerate maturity to charge-off date when interest recalculation is disabled - case when charge-off occurs with adjustment to last installment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5230,13 +5230,13 @@ Feature: LoanChargeback
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | 01 February 2024 | 83.57 | 16.43 | 0.58 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 |
| 2 | 29 | 01 March 2024 | 01 March 2024 | 67.05 | 16.52 | 0.49 | 0.0 | 0.0 | 17.01 | 17.01 | 0.0 | 0.0 | 0.0 |
| 3 | 31 | 01 April 2024 | | 50.49 | 33.08 | 0.94 | 0.0 | 0.0 | 34.02 | 0.0 | 0.0 | 0.0 | 34.02 |
| 4 | 30 | 01 May 2024 | | 33.77 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.96 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.96 | 0.1 | 0.0 | 0.0 | 17.06 | 0.0 | 0.0 | 0.0 | 17.06 |
| 3 | 31 | 01 April 2024 | | 50.48 | 33.09 | 0.93 | 0.0 | 0.0 | 34.02 | 0.0 | 0.0 | 0.0 | 34.02 |
| 4 | 30 | 01 May 2024 | | 33.76 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.95 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.95 | 0.1 | 0.0 | 0.0 | 17.05 | 0.0 | 0.0 | 0.0 | 17.05 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 116.52 | 2.6 | 0 | 0 | 119.12 | 34.02 | 0 | 0 | 85.1 |
| 116.52 | 2.59 | 0 | 0 | 119.11 | 34.02 | 0 | 0 | 85.09 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,14 +344,14 @@ Feature: Loan interest pause on repayment schedule
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| | | 01 January 2024 | | 100.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | 14 January 2024 | 83.23 | 16.77 | 0.24 | 0.0 | 0.0 | 17.01 | 17.01 | 17.01 | 0.0 | 0.0 |
| 2 | 29 | 01 March 2024 | | 66.99 | 16.24 | 0.77 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 3 | 31 | 01 April 2024 | | 50.37 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 4 | 30 | 01 May 2024 | | 33.65 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.84 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.84 | 0.1 | 0.0 | 0.0 | 16.94 | 0.0 | 0.0 | 0.0 | 16.94 |
| 2 | 29 | 01 March 2024 | | 67.0 | 16.23 | 0.78 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 3 | 31 | 01 April 2024 | | 50.38 | 16.62 | 0.39 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 4 | 30 | 01 May 2024 | | 33.66 | 16.72 | 0.29 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 5 | 31 | 01 June 2024 | | 16.85 | 16.81 | 0.2 | 0.0 | 0.0 | 17.01 | 0.0 | 0.0 | 0.0 | 17.01 |
| 6 | 30 | 01 July 2024 | | 0.0 | 16.85 | 0.1 | 0.0 | 0.0 | 16.95 | 0.0 | 0.0 | 0.0 | 16.95 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 100 | 1.99 | 0 | 0 | 101.99 | 17.01 | 17.01 | 0 | 84.98 |
| 100 | 2.0 | 0 | 0 | 102.0 | 17.01 | 17.01 | 0 | 84.99 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2024 | Disbursement | 100.0 | 0.0 | 0.0 | 0.0 | 0.0 | 100.0 | false | false |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3969,7 +3969,7 @@ Feature: LoanRepayment
| 15 January 2024 | Merchant Issued Refund | 50.0 | 48.9 | 1.1 | 0.0 | 0.0 | 126.1 | false |
| 15 January 2024 | Interest Refund | 0.29 | 0.29 | 0.0 | 0.0 | 0.0 | 125.81 | false |
| 16 January 2024 | Payout Refund | 50.0 | 49.95 | 0.05 | 0.0 | 0.0 | 75.86 | false |
| 16 January 2024 | Interest Refund | 0.3 | 0.3 | 0.0 | 0.0 | 0.0 | 75.56 | false |
| 16 January 2024 | Interest Refund | 0.31 | 0.31 | 0.0 | 0.0 | 0.0 | 75.55 | false |
Then In Loan Transactions the "4"th Transaction has relationship type=RELATED with the "3"th Transaction
Then In Loan Transactions the "6"th Transaction has relationship type=RELATED with the "5"th Transaction
When Customer undo "1"th "Merchant Issued Refund" transaction made on "15 January 2024"
Expand Down Expand Up @@ -4220,12 +4220,12 @@ Feature: LoanRepayment
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| | | 01 January 2024 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| | | 01 January 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 417.87 | 82.13 | 2.92 | 0.0 | 0.0 | 85.05 | 49.5 | 49.5 | 0.0 | 35.55 |
| 2 | 29 | 01 March 2024 | | 335.26 | 82.61 | 2.44 | 0.0 | 0.0 | 85.05 | 49.79 | 49.79 | 0.0 | 35.26 |
| 3 | 31 | 01 April 2024 | | 252.17 | 83.09 | 1.96 | 0.0 | 0.0 | 85.05 | 50.08 | 50.08 | 0.0 | 34.97 |
| 4 | 30 | 01 May 2024 | | 168.59 | 83.58 | 1.47 | 0.0 | 0.0 | 85.05 | 50.22 | 50.22 | 0.0 | 34.83 |
| 5 | 31 | 01 June 2024 | | 84.52 | 84.07 | 0.98 | 0.0 | 0.0 | 85.05 | 50.22 | 50.22 | 0.0 | 34.83 |
| 6 | 30 | 01 July 2024 | | 0.0 | 84.52 | 0.49 | 0.0 | 0.0 | 85.01 | 50.19 | 50.19 | 0.0 | 34.82 |
| 1 | 31 | 01 February 2024 | | 417.88 | 82.12 | 2.92 | 0.0 | 0.0 | 85.04 | 49.5 | 49.5 | 0.0 | 35.54 |
| 2 | 29 | 01 March 2024 | | 335.28 | 82.6 | 2.44 | 0.0 | 0.0 | 85.04 | 49.79 | 49.79 | 0.0 | 35.25 |
| 3 | 31 | 01 April 2024 | | 252.2 | 83.08 | 1.96 | 0.0 | 0.0 | 85.04 | 50.08 | 50.08 | 0.0 | 34.96 |
| 4 | 30 | 01 May 2024 | | 168.63 | 83.57 | 1.47 | 0.0 | 0.0 | 85.04 | 50.22 | 50.22 | 0.0 | 34.82 |
| 5 | 31 | 01 June 2024 | | 84.57 | 84.06 | 0.98 | 0.0 | 0.0 | 85.04 | 50.22 | 50.22 | 0.0 | 34.82 |
| 6 | 30 | 01 July 2024 | | 0.0 | 84.57 | 0.49 | 0.0 | 0.0 | 85.06 | 50.19 | 50.19 | 0.0 | 34.87 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 500.0 | 10.26 | 0.0 | 0.0 | 510.26 | 300.0 | 300.0 | 0.0 | 210.26 |
Expand Down Expand Up @@ -4283,14 +4283,14 @@ Feature: LoanRepayment
| | | 01 January 2024 | | 300.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 1 | 31 | 01 February 2024 | | 250.72 | 49.28 | 1.75 | 0.0 | 0.0 | 51.03 | 49.5 | 49.5 | 0.0 | 1.53 |
| | | 10 February 2024 | | 200.0 | | | 0.0 | | 0.0 | 0.0 | | | |
| 2 | 29 | 01 March 2024 | | 361.32 | 89.4 | 2.26 | 0.0 | 0.0 | 91.66 | 49.79 | 49.79 | 0.0 | 41.87 |
| 3 | 31 | 01 April 2024 | | 271.77 | 89.55 | 2.11 | 0.0 | 0.0 | 91.66 | 50.08 | 50.08 | 0.0 | 41.58 |
| 4 | 30 | 01 May 2024 | | 181.7 | 90.07 | 1.59 | 0.0 | 0.0 | 91.66 | 50.22 | 50.22 | 0.0 | 41.44 |
| 5 | 31 | 01 June 2024 | | 91.1 | 90.6 | 1.06 | 0.0 | 0.0 | 91.66 | 50.22 | 50.22 | 0.0 | 41.44 |
| 6 | 30 | 01 July 2024 | | 0.0 | 91.1 | 0.53 | 0.0 | 0.0 | 91.63 | 50.19 | 50.19 | 0.0 | 41.44 |
| 2 | 29 | 01 March 2024 | | 361.33 | 89.39 | 2.27 | 0.0 | 0.0 | 91.66 | 49.79 | 49.79 | 0.0 | 41.87 |
| 3 | 31 | 01 April 2024 | | 271.78 | 89.55 | 2.11 | 0.0 | 0.0 | 91.66 | 50.08 | 50.08 | 0.0 | 41.58 |
| 4 | 30 | 01 May 2024 | | 181.71 | 90.07 | 1.59 | 0.0 | 0.0 | 91.66 | 50.22 | 50.22 | 0.0 | 41.44 |
| 5 | 31 | 01 June 2024 | | 91.11 | 90.6 | 1.06 | 0.0 | 0.0 | 91.66 | 50.22 | 50.22 | 0.0 | 41.44 |
| 6 | 30 | 01 July 2024 | | 0.0 | 91.11 | 0.53 | 0.0 | 0.0 | 91.64 | 50.19 | 50.19 | 0.0 | 41.45 |
Then Loan Repayment schedule has the following data in Total row:
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
| 500.0 | 9.3 | 0.0 | 0.0 | 509.3 | 300.0 | 300.0 | 0.0 | 209.3 |
| 500.0 | 9.31 | 0.0 | 0.0 | 509.31 | 300.0 | 300.0 | 0.0 | 209.31 |
Then Loan Transactions tab has the following data:
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
| 01 January 2024 | Disbursement | 300.0 | 0.0 | 0.0 | 0.0 | 0.0 | 300.0 | false | false |
Expand Down
Loading

0 comments on commit e02420f

Please sign in to comment.