-
Notifications
You must be signed in to change notification settings - Fork 2.5k
FINERACT-2593: when loan product is null #5813
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
37fa791
3264fbc
0655b47
4d278a9
0c080bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,7 +156,7 @@ public CollectionData calculateLoanCollectionData(final Long loanId) { | |
|
|
||
| // If the Loan is not Active yet or is cancelled (rejected or withdrawn), return template data | ||
| if (loan.isSubmittedAndPendingApproval() || loan.isApproved() || loan.isCancelled()) { | ||
| if (loan.getLoanProduct() == null || loan.getLoanProduct().isAllowApprovedDisbursedAmountsOverApplied()) { | ||
| if (loan.getLoanProduct() != null && loan.getLoanProduct().isAllowApprovedDisbursedAmountsOverApplied()) { | ||
| collectionData.setAvailableDisbursementAmountWithOverApplied(calculateAvailableDisbursementAmountWithOverApplied(loan)); | ||
| } | ||
| return collectionData; | ||
|
|
@@ -173,7 +173,9 @@ public CollectionData calculateLoanCollectionData(final Long loanId) { | |
| // loans | ||
| collectionData = loanDelinquencyDomainService.getOverdueCollectionData(loan, effectiveDelinquencyList); | ||
| collectionData.setAvailableDisbursementAmount(calculateAvailableDisbursementAmount(loan)); | ||
| collectionData.setAvailableDisbursementAmountWithOverApplied(calculateAvailableDisbursementAmountWithOverApplied(loan)); | ||
| if (loan.getLoanProduct() != null) { | ||
| collectionData.setAvailableDisbursementAmountWithOverApplied(calculateAvailableDisbursementAmountWithOverApplied(loan)); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please explain when loanProduct is required in calculateAvailableDisbursementAmountWithOverApplied function ? When loanProduct is not present what part of loan product it utilize when calculating AvailableDisburementAmountWithOverApplied
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on Adam's review I have one more concern. If loan product is non nullable and giving NPE shouldn't we use fail fast approach in this? As you have applied the npe handling in calculation wouldn't it cause logical issues? Even through all tests are passing. |
||
| } | ||
| collectionData.setNextPaymentDueDate(possibleNextRepaymentDate(nextPaymentDueDateConfig, loan)); | ||
| PossibleNextRepaymentCalculationService possibleNextRepaymentCalculationService = possibleNextRepaymentCalculationServiceDiscovery | ||
| .getService(loan); | ||
|
|
@@ -212,7 +214,7 @@ public BigDecimal calculateAvailableDisbursementAmountWithOverApplied(@NonNull f | |
| BigDecimal approvedWithOverApplied = loan.getApprovedPrincipal(); | ||
|
|
||
| // If over applied amount is enabled, calculate the maximum allowed amount | ||
| if (loanProduct.isAllowApprovedDisbursedAmountsOverApplied()) { | ||
| if (loanProduct != null && loanProduct.isAllowApprovedDisbursedAmountsOverApplied()) { | ||
| if (loanProduct.getOverAppliedCalculationType() != null) { | ||
| if ("percentage".equalsIgnoreCase(loanProduct.getOverAppliedCalculationType())) { | ||
| final BigDecimal overAppliedNumber = BigDecimal.valueOf(loanProduct.getOverAppliedNumber()); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.