FINERACT-1891 - Overdue calculation fix

- [x] Arrears event not called fix
- [x] Integration test
This commit is contained in:
Janos Haber
2023-02-20 10:15:18 +01:00
committed by Arnold Gálovics
parent 5a1c3babcc
commit 89deb6d3b8
2 changed files with 65 additions and 0 deletions
@@ -27,6 +27,7 @@ import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.fineract.client.models.GetLoansLoanIdResponse;
import org.apache.fineract.client.models.PostLoansLoanIdTransactionsResponse;
import org.apache.fineract.integrationtests.common.ClientHelper;
import org.apache.fineract.integrationtests.common.CommonConstants;
@@ -387,6 +388,44 @@ public class ClientLoanCreditBalanceRefundandRepaymentTypeIntegrationTest {
}
}
@Test
public void goodWillCreditWillCloseTheLoanCorrectly() {
disburseLoanOfAccountingRule(ACCRUAL_PERIODIC);
HashMap loanSummaryMap = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, disbursedLoanID);
// pay off all of principal, interest (no fees or penalties)
final Float totalOutstanding = (Float) loanSummaryMap.get("totalOutstanding");
final Float goodwillAmount = totalOutstanding;
final String goodwillDate = "09 March 2022";
HashMap loanStatusHashMap = (HashMap) this.loanTransactionHelper.makeRepaymentTypePayment(GOODWILL_CREDIT, goodwillDate,
goodwillAmount, this.disbursedLoanID, "");
GetLoansLoanIdResponse details = this.loanTransactionHelper.getLoan(this.requestSpec, this.responseSpec, disbursedLoanID);
Assertions.assertNull(details.getSummary().getInArrears());
Assertions.assertTrue(details.getStatus().getClosedObligationsMet());
}
@Test
public void paymentRefundWillCloseTheLoanCorrectly() {
disburseLoanOfAccountingRule(ACCRUAL_PERIODIC);
HashMap loanSummaryMap = this.loanTransactionHelper.getLoanSummary(this.requestSpec, this.responseSpec, disbursedLoanID);
// pay off all of principal, interest (no fees or penalties)
final Float totalOutstanding = (Float) loanSummaryMap.get("totalOutstanding");
final Float goodwillAmount = totalOutstanding;
final String goodwillDate = "09 March 2022";
HashMap loanStatusHashMap = (HashMap) this.loanTransactionHelper.makeRepaymentTypePayment(PAYOUT_REFUND, goodwillDate,
goodwillAmount, this.disbursedLoanID, "");
GetLoansLoanIdResponse details = this.loanTransactionHelper.getLoan(this.requestSpec, this.responseSpec, disbursedLoanID);
Assertions.assertNull(details.getSummary().getInArrears());
Assertions.assertTrue(details.getStatus().getClosedObligationsMet());
}
@Test
public void newGoodwillCreditCreatesCorrectJournalEntriesForPeriodicAccrualsTest() {