-
Notifications
You must be signed in to change notification settings - Fork 2.1k
FINERACT-2326: Loan contract termination same disbursement date #5078
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?
FINERACT-2326: Loan contract termination same disbursement date #5078
Conversation
| loanTransactionHelper.moveLoanState(loanId, | ||
| new PostLoansLoanIdRequest().note("Contract Termination Test").externalId(Utils.randomStringGenerator("", 20)), | ||
| "contractTermination"); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests should have some kind of assertions, if we execute these operations what is the expected result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alberto-art3ch Have you addressed this?
09b64cc to
d7add12
Compare
|
@alberto-art3ch Please rebase and take a look on @budaidev's comment |
9a56a87 to
193d270
Compare
| /* | ||
| PostLoanProductsResponse loanProductsResponse = loanProductHelper.createLoanProduct(create4IProgressive().interestRecognitionOnDisbursementDate(false)); | ||
| Long loanId = applyAndApproveProgressiveLoan(client.getClientId(), loanProductsResponse.getResourceId(), "1 January 2024", | ||
| 500.0, 7.0, 6, (request) -> request.interestRecognitionOnDisbursementDate(false)); | ||
| disburseLoan(loanId, BigDecimal.valueOf(100), "1 January 2024"); | ||
| loanTransactionHelper.moveLoanState(loanId, | ||
| new PostLoansLoanIdRequest().note("Contract Termination Test").externalId(Utils.randomStringGenerator("", 20)), | ||
| "contractTermination"); | ||
| verifyTransactions(loanId, // | ||
| transaction(100.0, "Disbursement", "01 January 2024"), // | ||
| transaction(100.0, "Contract Termination", "01 January 2024")); | ||
| GetLoansLoanIdResponse loanDetails = loanTransactionHelper.getLoanDetails(loanId); | ||
| assertEquals(BigDecimal.ZERO.stripTrailingZeros(), | ||
| loanDetails.getSummary().getInterestCharged().stripTrailingZeros()); | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alberto-art3ch Remove if not needed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ITC updated, It is required
daf9a80 to
ccc36cf
Compare
ccc36cf to
d193a88
Compare
d193a88 to
fb90c01
Compare
dc07f34 to
4923088
Compare
PR updated and rebased with develop branch |
c332517 to
149b2ba
Compare
| transactionDate); | ||
| ProgressiveLoanInterestScheduleModel model = savedModel | ||
| .orElseGet(() -> processor.calculateInterestScheduleModel(loan.getId(), transactionDate)); | ||
| // final LocalDate tillDate = loanApplicationTerms.isInterestRecognitionOnDisbursementDate() ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Commented lines removed those are not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
| transactionProcessingStrategyCode); | ||
| if (loanRepaymentScheduleTransactionProcessor instanceof AdvancedPaymentScheduleTransactionProcessor advancedProcessor) { | ||
| LocalDate currentDate = DateUtils.getBusinessLocalDate(); | ||
| if (interestRecognitionOnDisbursementDate && currentDate.equals(disbursementDate)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks not right... we cannot go into the future...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Changed
adamsaghy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check my comments and let me know if we should connect. I see many changes which concerns me.
149b2ba to
8cef0fd
Compare
| public boolean isFirstNormalInstallment() { | ||
| return loan.getRepaymentScheduleInstallments().stream().filter(rp -> !rp.isDownPayment()).findFirst().stream() | ||
| .anyMatch(rp -> rp.equals(this)); | ||
| public boolean isFirstNormalInstallment(List<LoanRepaymentScheduleInstallment> installments) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alberto-art3ch well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is required to find the first normal installment because we are talking about the contract termination in the disbursement date and we were not able to identify the first normal installment @adamsaghy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was talking about why to provide installments as argument? What was the problem with the original?
| if (loanRepaymentScheduleTransactionProcessor instanceof AdvancedPaymentScheduleTransactionProcessor advancedProcessor) { | ||
| LocalDate currentDate = DateUtils.getBusinessLocalDate(); | ||
| LocalDate interestForDate = DateUtils.getBusinessLocalDate(); | ||
| if (interestRecognitionOnDisbursementDate && interestForDate.equals(disbursementDate)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think its correct to use current date + 1 which effectively a future date. We cannot work against future date for transaction processing. Also interest is payable on the current date anyway, we dont need this. interestRecognitionOnDisbursementDate is ONLY for accruals, nothing else!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parameter is used only to calculate the interest till that date, but I've restored to the original variable name @adamsaghy
8cef0fd to
31c717d
Compare
| default -> throw new UnsupportedOperationException(); | ||
| }; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we dont need this on the model, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not now, I've removed from that part
31c717d to
fa7d2fb
Compare
Description
When user tries a Contract termination on disbursement day it results an 500-Integral server error because there were not an Installment to be updated
FINERACT-2326
Checklist
Please make sure these boxes are checked before submitting your pull request - thanks!
FYI our guidelines for code reviews are at https://cwiki.apache.org/confluence/display/FINERACT/Code+Review+Guide.