Skip to content

Commit

Permalink
FINERACT-1968: Advance payment allocation - ASCII doc
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsaghy authored and galovics committed Aug 23, 2023
1 parent 3210a09 commit 2f47059
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
= Introducing Advanced payment allocation - WIP*

Since the first repayment strategy got introduced, many followed, but there was one thing common in them:

* They were hard coding the allocation rules for each transaction type.
By introducing the "Advanced payment allocation" the idea was to have a repayment strategy which was:

* supporting dynamic configuration of the allocation rules for transaction types
* supporting configuration of more fine-grained allocation rules for future installments
* supporting reprocessing of transactions and charges in chronological order
== Glossary

[cols="1,1"]
|===

|*WIP
| Work in progress

|*Advanced payment allocation
| Ability to configure allocation rules dynamically for transactions

|*Payment allocation
|Rule that defines which outstanding balance to be paid of first on which installment

|*Re-amortization
| Transaction amount to be divided into equal portions by the number of future installments and those installments to be paid by these portions.
|===

== Capabilities

* Payment allocation should be configurable for transactions:
** Repayment
** Goodwill credit
** Payout refund
** Merchant refund
** Charge adjustments
** Down payment (WIP)

* Can be configured for Loan products
** Payment allocation rule changes on the loan product will affect only the newly created Loan accounts.

* Chronological reprocess order
** Transactions (including disbursements) and charges are (re)processed and allocated in chronological order

* Support re-amortization between future installments
** Transaction amount to be divided into equal portions (based on the number of future installments) and to repay each future installment by the calculated portion.
*** It's not hard coded, but usually the principal portion needs to be allocated first, but if there are still unprocessed amounts, the rest of the outstanding balances are to be allocated based on the rest of the rules

* Main allocation rules (installment level)
** Past Due Installment(s):
*** Oldest first
** Due Installment(s):
*** Normal installment takes priority over Down-payment installment (if applicable)
** Future Installment(s):
*** Available allocation orders:
**** Next installment first
**** Last installment first
**** Re-amortization*
* Secondary allocation rules
** Penalty
** Fee
** Interest
** Principal

== Configuration

Advanced repayment allocation rules can be configured for the Loan product if "Advanced payment allocation" got selected as repayment strategy.

There will be a (always required) “DEFAULT” transaction type configuration which acts as fallback ruleset, if the there are no configured rules for a specific transaction type.

=== New repayment strategy
* Name: Advanced payment allocation
* Code: advanced-payment-allocation-strategy
* Order: 8

=== Allocation rules
* Past due penalty
* Past due fee
* Past due principal
* Past due interest
* Due penalty
* Due fee
* Due principal
* Due interest
* In advance penalty
* In advance fee
* In advance principal
* In advance interest

==== Future installment allocation rules:
* Next installment
* Last installment
* Re-amortization

=== Example Request
```
{
...
"paymentAllocation": [
{
"transactionType": "DEFAULT",
"paymentAllocationOrder": [
{
"paymentAllocationRule": "DUE_PAST_PENALTY",
"order": 1
},
{
"paymentAllocationRule": "DUE_PAST_FEE",
"order": 2
},
{
"paymentAllocationRule": "DUE_PAST_INTEREST",
"order": 3
},
...
{
"paymentAllocationRule": "IN_ADVANCE_INTEREST",
"order": 14
}
],
"futureInstallmentAllocationRule": "NEXT_INSTALLMENT"
}
],
...
}
```

The above request configures the "DEFAULT" allocation rules:

* First the already due penalties to be paid
* Second the already due fees to be paid
* Last the future interests to be paid

Also for future installments set the allocation rules as

* First future installment by due date to be paid first

=== High level design

Flow of advanced payment allocation processing

image::{imagesdir}/payment_allocation_flow.png[]
2 changes: 2 additions & 0 deletions fineract-doc/src/docs/en/chapters/architecture/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ include::modules.adoc[leveloffset=+1]
include::business-date.adoc[leveloffset=+1]

include::reliable-event-framework.adoc[leveloffset=+1]

include::advanced-payment-allocation.adoc[leveloffset=+1]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2f47059

Please sign in to comment.