FINERACT-2081: clear closed_on date on repayment reversal
This commit is contained in:
committed by
Adam Saghy
parent
69dd19c74b
commit
c70007e30a
+15
@@ -1352,6 +1352,21 @@ public class LoanStepDef extends AbstractStepDef {
|
|||||||
.isEqualTo(loanStatusExpectedValue);
|
.isEqualTo(loanStatusExpectedValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Then("Loan closedon_date is {}")
|
||||||
|
public void loanClosedonDate(String date) throws IOException {
|
||||||
|
Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||||
|
long loanId = loanCreateResponse.body().getLoanId();
|
||||||
|
|
||||||
|
Response<GetLoansLoanIdResponse> loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "", "", "").execute();
|
||||||
|
ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse);
|
||||||
|
testContext().set(TestContextKey.LOAN_RESPONSE, loanDetailsResponse);
|
||||||
|
if (date == null || "null".equals(date)) {
|
||||||
|
assertThat(loanDetailsResponse.body().getTimeline().getClosedOnDate()).isNull();
|
||||||
|
} else {
|
||||||
|
assertThat(loanDetailsResponse.body().getTimeline().getClosedOnDate()).isEqualTo(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Then("Admin can successfully set Fraud flag to the loan")
|
@Then("Admin can successfully set Fraud flag to the loan")
|
||||||
public void setFraud() throws IOException {
|
public void setFraud() throws IOException {
|
||||||
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
Response<PostLoansResponse> loanResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||||
|
|||||||
@@ -1244,6 +1244,20 @@ Feature: Loan
|
|||||||
| actualMaturityDate | expectedMaturityDate |
|
| actualMaturityDate | expectedMaturityDate |
|
||||||
| 01 July 2023 | 01 July 2023 |
|
| 01 July 2023 | 01 July 2023 |
|
||||||
|
|
||||||
|
Scenario: Verify that closed date is updated on repayment reversal
|
||||||
|
When Admin sets the business date to "01 June 2023"
|
||||||
|
When Admin creates a client with random data
|
||||||
|
When Admin creates a new default Loan with date: "01 June 2023"
|
||||||
|
And Admin successfully approves the loan on "01 June 2023" with "1000" amount and expected disbursement date on "01 June 2023"
|
||||||
|
When Admin successfully disburse the loan on "01 June 2023" with "1000" EUR transaction amount
|
||||||
|
Then Loan status will be "ACTIVE"
|
||||||
|
When Admin sets the business date to "20 June 2023"
|
||||||
|
And Customer makes "AUTOPAY" repayment on "20 June 2023" with 1000 EUR transaction amount
|
||||||
|
Then Loan status will be "CLOSED_OBLIGATIONS_MET"
|
||||||
|
When Admin sets the business date to "20 June 2023"
|
||||||
|
When Customer undo "1"th "Repayment" transaction made on "20 June 2023"
|
||||||
|
Then Loan status will be "ACTIVE"
|
||||||
|
Then Loan closedon_date is null
|
||||||
|
|
||||||
Scenario: As an admin I would like to delete a loan using external id
|
Scenario: As an admin I would like to delete a loan using external id
|
||||||
When Admin sets the business date to the actual date
|
When Admin sets the business date to the actual date
|
||||||
|
|||||||
+14
@@ -49,6 +49,20 @@ public class DefaultLoanLifecycleStateMachine implements LoanLifecycleStateMachi
|
|||||||
// in case of Loan creation, a LoanCreatedBusinessEvent is also raised, no need to send a status change
|
// in case of Loan creation, a LoanCreatedBusinessEvent is also raised, no need to send a status change
|
||||||
businessEventNotifierService.notifyPostBusinessEvent(new LoanStatusChangedBusinessEvent(loan));
|
businessEventNotifierService.notifyPostBusinessEvent(new LoanStatusChangedBusinessEvent(loan));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set mandatory field states based on new status after the transition
|
||||||
|
switch (newStatus) {
|
||||||
|
case ACTIVE -> {
|
||||||
|
if (loan.getClosedOnDate() != null) {
|
||||||
|
loan.setClosedOnDate(null);
|
||||||
|
}
|
||||||
|
if (loan.getOverpaidOnDate() != null) {
|
||||||
|
loan.setOverpaidOnDate(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user