FINERACT-2455: WorkingCapital - % repayment modification options#5771
FINERACT-2455: WorkingCapital - % repayment modification options#5771budaidev wants to merge 2 commits intoapache:developfrom
Conversation
1a44be3 to
ffff593
Compare
ffff593 to
e1c7df0
Compare
|
@budaidev Please rebase |
d556345 to
744409d
Compare
|
@budaidev Please rebase |
53c4074 to
8608328
Compare
Aman-Mittal
left a comment
There was a problem hiding this comment.
Please address my comments, reviewed based on code changes only. Currently no usecase doc in ticket or in code so i will not able to review based on Use Case implementation
8608328 to
5cad8ee
Compare
98c6dbb to
b261a90
Compare
1572df9 to
9878cd2
Compare
|
@budaidev Please rebase. |
9878cd2 to
3335dd5
Compare
| } | ||
|
|
||
| @PUT | ||
| @Path("{loanId}/rate") |
There was a problem hiding this comment.
"rate" as endpoint is not descriptive, lets rename: payment-rate
| public String locale; | ||
|
|
||
| @Schema(example = "dd MMMM yyyy") | ||
| public String dateFormat; |
There was a problem hiding this comment.
No dates involved. Having dateFormat seems useless, no?
| private final List<AppliedPayment> appliedPayments; | ||
|
|
||
| @Getter(AccessLevel.NONE) | ||
| private final List<RateSegment> rateSegments; |
There was a problem hiding this comment.
I was wondering whether we should rename this to reflect better the involved logic:
- We are changing the projected payment amount
I dont think the model need to know the payment percentage rate, but rather what is the expected payment amount only, no?
| final BigDecimal newNetDisb = balanceAtSplit; | ||
| final BigDecimal newDiscount = origDiscount.add(origNet, mc).subtract(balanceAtSplit, mc).subtract(paymentsReceived, mc); | ||
| final BigDecimal newDailyPayment = tpv.multiply(newPeriodPaymentRate, mc).divide(BigDecimal.valueOf(npvDayCount), mc).setScale(2, | ||
| RoundingMode.HALF_UP); |
There was a problem hiding this comment.
Is it wise to hardcode rounding? I think we should rather rely on the configured rounding rules instead!
| private String jsonModelVersion; | ||
|
|
||
| @Column(name = "previous_json_model", columnDefinition = "text") | ||
| private String previousJsonModel; |
|
|
||
| @Override | ||
| @Transactional | ||
| public CommandProcessingResult updateRate(final Long loanId, final JsonCommand command) { |
There was a problem hiding this comment.
Lets use more descriptive method name... update rate could mean many thing and maybe other similar, but not same operations might be implemented.
| if (loan.getLoanStatus() != LoanStatus.ACTIVE) { | ||
| throw new PlatformApiDataValidationException("validation.msg.wc.loan.rate.change.not.allowed", | ||
| "Period payment rate change is allowed only for active loans", "loanStatus"); | ||
| } | ||
|
|
||
| final BigDecimal newRate = this.fromApiJsonHelper.extractBigDecimalNamed(WorkingCapitalLoanConstants.periodPaymentRateParamName, | ||
| command.parsedJson(), new HashSet<>()); | ||
| final BigDecimal previousRate = loan.getLoanProductRelatedDetails().getPeriodPaymentRate(); | ||
|
|
||
| if (previousRate != null && previousRate.compareTo(newRate) == 0) { | ||
| throw new PlatformApiDataValidationException("validation.msg.wc.loan.rate.change.same.rate", | ||
| "New period payment rate is the same as the current rate", WorkingCapitalLoanConstants.periodPaymentRateParamName); | ||
| } |
There was a problem hiding this comment.
These should be in the validator class, no?
adamsaghy
left a comment
There was a problem hiding this comment.
Kindly review my concerns!
Also the calculator getting more complex, some comments which explain calculations should be added to help our work in the future.
3335dd5 to
a82c065
Compare
…he middle of the loan life cycle
c68ab85 to
1403499
Compare
1403499 to
b586c82
Compare
WorkingCapital - % repayment modification options in the middle of the loan life cycle
Description
Describe the changes made and why they were made. (Ignore if these details are present on the associated Apache Fineract JIRA ticket.)
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
Your assigned reviewer(s) will follow our guidelines for code reviews.