Adam Saghy created FINERACT-2080:
------------------------------------
Summary: Refactor Loan entity class
Key: FINERACT-2080
URL: https://issues.apache.org/jira/browse/FINERACT-2080
Project: Apache Fineract
Issue Type: Improvement
Components: Loan
Affects Versions: 1.9.0, 1.10.0
Reporter: Adam Saghy
Fix For: 1.11.0
At the moment the Loan entity contains 7200+ lines. It’s way too complex and
became a monster.
*Steps to fix the situation*
* The business logic needs to be extracted out from this class
** This is an entity, it should only contains the fields, getters, setters and
maximum some lightweight methods to manipulate its own state
** At the moment different kind of other classes were injected into this
class, all of them need to be extracted into assemblers, services and mapper
classes
*** transactionProcessorFactory
*** loanLifecycleStateMachine
*** loanSummaryWrapper
*** etc
* Overcomplicated methods and business logic
** Need to refactor and simplify them
*** 1 method should do 1 thing
*** the enormous amount of conditions and overhead need to be resolved
*** Example: handleRepaymentOrRecoveryOrWaiverTransaction
* We should extract into multiple services / assemblers / mappers as
** Validators
** Creation and modification
** State changes
** Actions on loan
** Disbursement related actions
** Utility actions
** Loan Transaction related actions
** Loan repayment schedule related actions
** Loan balance related actions
** Loan offices related actions
** Loan accounting related actions
** Loan charge related actions
** Interest recalculation related actions
** Loan mapping related actions
** Guarantor related actions
** Loan reschedule related actions
** Delinquency related actions
** Loan mapping actions
** etc
*Acceptance criteria*
* Job is done, when the Loan entity only contains its fields, setters, getters
and basic methods to manipulate its own state
* It does not contain any helpers class anymore
* The business logic extracted into services, assemblers and mappers
* The complex methods and business logic split into smaller well defined
pieces which can be easily reused
--
This message was sent by Atlassian Jira
(v8.20.10#820010)