[ 
https://issues.apache.org/jira/browse/FINERACT-2897?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Piotr Wargulak updated FINERACT-2897:
-------------------------------------
    Description: 
Customising how a payment is distributed across allocation buckets currently 
means copying `AdvancedPaymentScheduleTransactionProcessor` whole. An example 
is limiting how much of an in-advance payment a given charge may absorb.

`processPaymentAllocation` is private and reached from many places inside the 
class. Several core classes check instanceof 
AdvancedPaymentScheduleTransactionProcessor, so a replacement must also extend 
it. A subclass cannot redirect those calls, so an extension ends up as a full 
copy that has to be kept in step with every release.

*Proposed change:*
 * Make processPaymentAllocation protected, or extract a protected hook for the 
per-bucket amount, called where the amount for a bucket is decided.

 * Default behaviour is unchanged.

 * Add a test with a subclass overriding the hook, to show the extension point 
works and is reached from every call site.

  was:
Customising how a payment is distributed across allocation buckets currently 
means copying AdvancedPaymentScheduleTransactionProcessor whole. An example is 
limiting how much of an in-advance payment a given charge may absorb.

processPaymentAllocation is private and reached from many places inside the 
class. Several core classes check instanceof 
AdvancedPaymentScheduleTransactionProcessor, so a replacement must also extend 
it. A subclass cannot redirect those calls, so an extension ends up as a full 
copy that has to be kept in step with every release.

*Proposed change:*
 * Make processPaymentAllocation protected, or extract a protected hook for the 
per-bucket amount, called where the amount for a bucket is decided.

 * Default behaviour is unchanged.

 * Add a test with a subclass overriding the hook, to show the extension point 
works and is reached from every call site.


> Allow subclasses to customise payment allocation in 
> AdvancedPaymentScheduleTransactionProcessor
> -----------------------------------------------------------------------------------------------
>
>                 Key: FINERACT-2897
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2897
>             Project: Apache Fineract
>          Issue Type: Improvement
>            Reporter: Piotr Wargulak
>            Priority: Trivial
>
> Customising how a payment is distributed across allocation buckets currently 
> means copying `AdvancedPaymentScheduleTransactionProcessor` whole. An example 
> is limiting how much of an in-advance payment a given charge may absorb.
> `processPaymentAllocation` is private and reached from many places inside the 
> class. Several core classes check instanceof 
> AdvancedPaymentScheduleTransactionProcessor, so a replacement must also 
> extend it. A subclass cannot redirect those calls, so an extension ends up as 
> a full copy that has to be kept in step with every release.
> *Proposed change:*
>  * Make processPaymentAllocation protected, or extract a protected hook for 
> the per-bucket amount, called where the amount for a bucket is decided.
>  * Default behaviour is unchanged.
>  * Add a test with a subclass overriding the hook, to show the extension 
> point works and is reached from every call site.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to