FINERACT-2455: Working Capital Loan Charge - Product Creation & Template#5847
Conversation
e48e3c7 to
3b1ab5e
Compare
galovics
left a comment
There was a problem hiding this comment.
Hi @contributor, thanks for the PR. The feature shape looks reasonable. I have a few things I'd like to discuss before approving.
The retrieveCalculationTypes override returns null when chargeAppliesTo is WORKING_CAPITAL_LOAN and chargeTimeType is provided but isn't SPECIFIED_DUE_DATE - that's a potential NPE for any caller that iterates the returned list. And in the step defs, the new methods break the pattern established by the rest of the file and hardcode raw integers where the existing code uses proper enum types.
Also one small thing in the feature file. Thoughts?
| @Override | ||
| public List<EnumOptionData> retrieveCalculationTypes(ChargeAppliesTo chargeAppliesTo, ChargeTimeType chargeTimeType) { | ||
| if (ChargeAppliesTo.WORKING_CAPITAL_LOAN.equals(chargeAppliesTo)) { | ||
| if (chargeTimeType == null) { |
There was a problem hiding this comment.
I'm not convinced returning null is safe here. Today it's probably unreachable since validWorkingCapitalLoanValues() only contains SPECIFIED_DUE_DATE, but if more time types are added to working capital loans later, any caller iterating the result will get an NPE. Wouldn't it make more sense to return an empty list (or Collections.emptyList()) as the fallback? Thoughts?
| import org.apache.fineract.client.models.PostChargesResponse; | ||
| import org.apache.fineract.test.data.ChargeCalculationType; | ||
| import org.apache.fineract.test.data.ChargeProductResolver; | ||
| import org.apache.fineract.test.data.ChargeProductType; |
There was a problem hiding this comment.
The rest of this file uses ChargeCalculationType.valueOf(...) and ChargeProductType.valueOf(...) to avoid magic numbers, but these new methods bypass that entirely and hardcode 5, 2, 1 directly (with comments explaining what they mean, which is a smell in itself). Any chance we can extract these into constants or reuse the existing enum abstractions the way the other step defs in this class do? Thanks.
| Feature: WorkingCapitalLoanChargesFeature | ||
|
|
||
| @TestRailId:Cxxxx1 | ||
| Scenario: Verify that charge can be created modified and deleted |
There was a problem hiding this comment.
Looks like a placeholder - was this intentional or did the TestRail ID not get filled in?
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.