Skip to content

Commit 0729eab

Browse files
ruzeynalovadamsaghy
authored andcommitted
FINERACT-2325: added e2e tests covering edge cases for disable automatic Interest Refund calculation feature
1 parent aad7756 commit 0729eab

2 files changed

Lines changed: 217 additions & 0 deletions

File tree

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

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,148 @@ Feature: MerchantIssuedRefund
189189
| 10 July 2024 | Repayment | 338.9 | 336.48 | 2.42 | 0.0 | 0.0 | 663.52 | false | false |
190190
| 15 July 2024 | Merchant Issued Refund | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 613.52 | false | false |
191191
| 15 July 2024 | Interest Refund | 0.19 | 0.0 | 0.19 | 0.0 | 0.0 | 613.52 | false | false |
192+
193+
@TestRailId:C3854
194+
Scenario: Verify reversal of Merchant Issued Refund when interestRefundCalculation=false (no Interest Refund to reverse)
195+
When Admin sets the business date to "01 July 2024"
196+
And Admin creates a client with random data
197+
And Admin creates a fully customized loan with the following data:
198+
| 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 |
199+
| LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 July 2024 | 1000 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
200+
And Admin successfully approves the loan on "01 July 2024" with "1000" amount and expected disbursement date on "01 July 2024"
201+
And Admin successfully disburse the loan on "01 July 2024" with "1000" EUR transaction amount
202+
Then Loan Repayment schedule has 3 periods, with the following data for periods:
203+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
204+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
205+
| 1 | 31 | 01 August 2024 | | 669.43 | 330.57 | 8.33 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
206+
| 2 | 31 | 01 September 2024 | | 336.11 | 333.32 | 5.58 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
207+
| 3 | 30 | 01 October 2024 | | 0.0 | 336.11 | 2.8 | 0.0 | 0.0 | 338.91 | 0.0 | 0.0 | 0.0 | 338.91 |
208+
And Loan Repayment schedule has the following data in Total row:
209+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
210+
| 1000.0 | 16.71 | 0.0 | 0.0 | 1016.71 | 0.0 | 0.0 | 0.0 | 1016.71 |
211+
And Loan Transactions tab has the following data:
212+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
213+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
214+
When Admin sets the business date to "15 July 2024"
215+
And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "15 July 2024" with 50 EUR transaction amount and system-generated Idempotency key and interestRefundCalculation false
216+
Then Loan Repayment schedule has 3 periods, with the following data for periods:
217+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
218+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
219+
| 1 | 31 | 01 August 2024 | | 669.2 | 330.8 | 8.1 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
220+
| 2 | 31 | 01 September 2024 | | 335.46 | 333.74 | 5.16 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
221+
| 3 | 30 | 01 October 2024 | | 0.0 | 335.46 | 2.38 | 0.0 | 0.0 | 337.84 | 50.0 | 50.0 | 0.0 | 287.84 |
222+
And Loan Repayment schedule has the following data in Total row:
223+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
224+
| 1000.0 | 15.64 | 0.0 | 0.0 | 1015.64 | 50.0 | 50.0 | 0.0 | 965.64 |
225+
And Loan Transactions tab has the following data:
226+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
227+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
228+
| 15 July 2024 | Merchant Issued Refund | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 950.0 | false | false |
229+
When Customer undo "1"th "Merchant Issued Refund" transaction made on "15 July 2024"
230+
Then Loan Repayment schedule has 3 periods, with the following data for periods:
231+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
232+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
233+
| 1 | 31 | 01 August 2024 | | 669.43 | 330.57 | 8.33 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
234+
| 2 | 31 | 01 September 2024 | | 336.11 | 333.32 | 5.58 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
235+
| 3 | 30 | 01 October 2024 | | 0.0 | 336.11 | 2.8 | 0.0 | 0.0 | 338.91 | 0.0 | 0.0 | 0.0 | 338.91 |
236+
And Loan Repayment schedule has the following data in Total row:
237+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
238+
| 1000.0 | 16.71 | 0.0 | 0.0 | 1016.71 | 0.0 | 0.0 | 0.0 | 1016.71 |
239+
And Loan Transactions tab has the following data:
240+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
241+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
242+
| 15 July 2024 | Merchant Issued Refund | 50.0 | 50.0 | 0.0 | 0.0 | 0.0 | 950.0 | true | false |
243+
244+
@TestRailId:C3855
245+
Scenario: Multiple refunds on same loan with different interestRefundCalculation settings
246+
When Admin sets the business date to "01 July 2024"
247+
And Admin creates a client with random data
248+
And Admin creates a fully customized loan with the following data:
249+
| 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 |
250+
| LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 July 2024 | 1000 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 3 | MONTHS | 1 | MONTHS | 3 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
251+
And Admin successfully approves the loan on "01 July 2024" with "1000" amount and expected disbursement date on "01 July 2024"
252+
And Admin successfully disburse the loan on "01 July 2024" with "1000" EUR transaction amount
253+
Then Loan Repayment schedule has 3 periods, with the following data for periods:
254+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
255+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
256+
| 1 | 31 | 01 August 2024 | | 669.43 | 330.57 | 8.33 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
257+
| 2 | 31 | 01 September 2024 | | 336.11 | 333.32 | 5.58 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
258+
| 3 | 30 | 01 October 2024 | | 0.0 | 336.11 | 2.8 | 0.0 | 0.0 | 338.91 | 0.0 | 0.0 | 0.0 | 338.91 |
259+
And Loan Repayment schedule has the following data in Total row:
260+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
261+
| 1000.0 | 16.71 | 0.0 | 0.0 | 1016.71 | 0.0 | 0.0 | 0.0 | 1016.71 |
262+
And Loan Transactions tab has the following data:
263+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
264+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
265+
When Admin sets the business date to "10 July 2024"
266+
And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "10 July 2024" with 30 EUR transaction amount and system-generated Idempotency key and interestRefundCalculation true
267+
And Customer makes "PAYOUT_REFUND" transaction with "AUTOPAY" payment type on "10 July 2024" with 20 EUR transaction amount and system-generated Idempotency key and interestRefundCalculation false
268+
Then Loan Repayment schedule has 3 periods, with the following data for periods:
269+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
270+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
271+
| 1 | 31 | 01 August 2024 | | 669.14 | 330.86 | 8.04 | 0.0 | 0.0 | 338.9 | 20.07 | 20.07 | 0.0 | 318.83 |
272+
| 2 | 31 | 01 September 2024 | | 335.57 | 333.57 | 5.33 | 0.0 | 0.0 | 338.9 | 0.0 | 0.0 | 0.0 | 338.9 |
273+
| 3 | 30 | 01 October 2024 | | 0.0 | 335.57 | 2.55 | 0.0 | 0.0 | 338.12 | 30.0 | 30.0 | 0.0 | 308.12 |
274+
And Loan Repayment schedule has the following data in Total row:
275+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
276+
| 1000.0 | 15.92 | 0.0 | 0.0 | 1015.92 | 50.07 | 50.07 | 0.0 | 965.85 |
277+
And Loan Transactions tab has the following data:
278+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
279+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
280+
| 10 July 2024 | Merchant Issued Refund | 30.0 | 30.0 | 0.0 | 0.0 | 0.0 | 970.0 | false | false |
281+
| 10 July 2024 | Interest Refund | 0.07 | 0.0 | 0.07 | 0.0 | 0.0 | 970.0 | false | false |
282+
| 10 July 2024 | Payout Refund | 20.0 | 20.0 | 0.0 | 0.0 | 0.0 | 950.0 | false | false |
283+
284+
@TestRailId:C3856
285+
Scenario: Merchant Issued Refund on fully paid loan with interestRefundCalculation variations
286+
When Admin sets the business date to "01 July 2024"
287+
And Admin creates a client with random data
288+
And Admin creates a fully customized loan with the following data:
289+
| 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 |
290+
| LP2_ADV_CUSTOM_PMT_ALLOC_PROGRESSIVE_LOAN_SCHEDULE_HORIZONTAL | 01 July 2024 | 1000 | 10 | DECLINING_BALANCE | DAILY | EQUAL_INSTALLMENTS | 1 | MONTHS | 1 | MONTHS | 1 | 0 | 0 | 0 | ADVANCED_PAYMENT_ALLOCATION |
291+
And Admin successfully approves the loan on "01 July 2024" with "1000" amount and expected disbursement date on "01 July 2024"
292+
And Admin successfully disburse the loan on "01 July 2024" with "1000" EUR transaction amount
293+
Then Loan Repayment schedule has 1 periods, with the following data for periods:
294+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
295+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
296+
| 1 | 31 | 01 August 2024 | | 0.0 | 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 0.0 | 0.0 | 0.0 | 1008.33 |
297+
And Loan Repayment schedule has the following data in Total row:
298+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
299+
| 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 0.0 | 0.0 | 0.0 | 1008.33 |
300+
And Loan Transactions tab has the following data:
301+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
302+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
303+
When Admin sets the business date to "01 August 2024"
304+
And Customer makes "REPAYMENT" transaction with "AUTOPAY" payment type on "01 August 2024" with 1008.33 EUR transaction amount and system-generated Idempotency key
305+
Then Loan Repayment schedule has 1 periods, with the following data for periods:
306+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
307+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
308+
| 1 | 31 | 01 August 2024 | 01 August 2024 | 0.0 | 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 1008.33 | 0.0 | 0.0 | 0.0 |
309+
And Loan Repayment schedule has the following data in Total row:
310+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
311+
| 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 1008.33 | 0.0 | 0.0 | 0.0 |
312+
And Loan Transactions tab has the following data:
313+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
314+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
315+
| 01 August 2024 | Repayment | 1008.33 | 1000.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
316+
| 01 August 2024 | Accrual | 8.33 | 0.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
317+
| 01 August 2024 | Accrual Activity | 8.33 | 0.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
318+
When Loan status will be "CLOSED_OBLIGATIONS_MET"
319+
When Admin sets the business date to "05 August 2024"
320+
And Customer makes "MERCHANT_ISSUED_REFUND" transaction with "AUTOPAY" payment type on "05 August 2024" with 10 EUR transaction amount and system-generated Idempotency key and interestRefundCalculation false
321+
Then Loan Repayment schedule has 1 periods, with the following data for periods:
322+
| Nr | Days | Date | Paid date | Balance of loan | Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
323+
| | | 01 July 2024 | | 1000.0 | | | 0.0 | | 0.0 | 0.0 | | | |
324+
| 1 | 31 | 01 August 2024 | 01 August 2024 | 0.0 | 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 1008.33 | 0.0 | 0.0 | 0.0 |
325+
And Loan Repayment schedule has the following data in Total row:
326+
| Principal due | Interest | Fees | Penalties | Due | Paid | In advance | Late | Outstanding |
327+
| 1000.0 | 8.33 | 0.0 | 0.0 | 1008.33 | 1008.33 | 0.0 | 0.0 | 0.0 |
328+
#verify that "Interest Refund" transaction is not created
329+
And Loan Transactions tab has the following data:
330+
| Transaction date | Transaction Type | Amount | Principal | Interest | Fees | Penalties | Loan Balance | Reverted | Replayed |
331+
| 01 July 2024 | Disbursement | 1000.0 | 0.0 | 0.0 | 0.0 | 0.0 | 1000.0 | false | false |
332+
| 01 August 2024 | Repayment | 1008.33 | 1000.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
333+
| 01 August 2024 | Accrual | 8.33 | 0.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
334+
| 01 August 2024 | Accrual Activity | 8.33 | 0.0 | 8.33 | 0.0 | 0.0 | 0.0 | false | false |
335+
| 05 August 2024 | Merchant Issued Refund | 10.0 | 0.0 | 0.0 | 0.0 | 0.0 | 0.0 | false | false |
336+
Then Loan status will be "OVERPAID"

0 commit comments

Comments
 (0)