Skip to content

Commit

Permalink
FINERACT-2081: fix loan status on CBR reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
kjozsa committed Aug 8, 2024
1 parent 26388ea commit f6984fa
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public void cantRefundMoreThanOverpaidTest(LoanProductTestBuilder loanProductTes

@ParameterizedTest
@MethodSource("loanProductFactory")
public void fullRefundChangesStatusToClosedObligationMetTest(LoanProductTestBuilder loanProductTestBuilder) {
public void fullRefundChangesStatusToClosedObligationMetAndSetBackToOverpayAfterReverseTest(LoanProductTestBuilder loanProductTestBuilder) {
disburseLoanOfAccountingRule(ACCRUAL_PERIODIC, loanProductTestBuilder);
HashMap loanStatusHashMap = makeRepayment("06 January 2022", 20000.00f); // overpayment
LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap);
Expand All @@ -255,7 +255,8 @@ public void fullRefundChangesStatusToClosedObligationMetTest(LoanProductTestBuil

final String creditBalanceRefundDate = "09 January 2022";
final String externalId = null;
loanTransactionHelper.creditBalanceRefund(creditBalanceRefundDate, totalOverpaid, externalId, disbursedLoanID, null);
Integer resourceId = (Integer) loanTransactionHelper.creditBalanceRefund(creditBalanceRefundDate, totalOverpaid, externalId,
disbursedLoanID, "resourceId");
loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, disbursedLoanID,
"status");
LoanStatusChecker.verifyLoanAccountIsClosed(loanStatusHashMap);
Expand All @@ -267,6 +268,18 @@ public void fullRefundChangesStatusToClosedObligationMetTest(LoanProductTestBuil
totalOverpaidAtEnd = floatZero;
}
assertEquals(totalOverpaidAtEnd, floatZero);

loanTransactionHelper.reverseLoanTransaction(disbursedLoanID, resourceId.longValue(), creditBalanceRefundDate, responseSpec);

loanStatusHashMap = (HashMap) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec, disbursedLoanID,
"status");

LoanStatusChecker.verifyLoanAccountIsOverPaid(loanStatusHashMap);

Float totalOverpaidAfterReverse = (Float) this.loanTransactionHelper.getLoanDetail(this.requestSpec, this.responseSpec,
disbursedLoanID, "totalOverpaid");

assertEquals(totalOverpaidAfterReverse, totalOverpaid);
}

@ParameterizedTest
Expand Down

0 comments on commit f6984fa

Please sign in to comment.