FINERACT-2330: Buy-Down fees adjustment Acct for non merchant product

This commit is contained in:
Jose Alberto Hernandez
2025-08-21 10:23:09 +02:00
committed by Adam Saghy
parent 14589e2600
commit 141f17ecfc
2 changed files with 18 additions and 4 deletions
@@ -457,12 +457,14 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
final BigDecimal amount = loanTransactionDTO.getAmount(); final BigDecimal amount = loanTransactionDTO.getAmount();
final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId(); final Long paymentTypeId = loanTransactionDTO.getPaymentTypeId();
final AccrualAccountsForLoan debitAccountType = loanDTO.isMerchantBuyDownFee() ? AccrualAccountsForLoan.BUY_DOWN_EXPENSE
: AccrualAccountsForLoan.FUND_SOURCE;
if (MathUtil.isGreaterThanZero(amount)) { if (MathUtil.isGreaterThanZero(amount)) {
// Mirror of Buy Down Fee entries (as per PS-2574 requirements) // Mirror of Buy Down Fee entries (as per PS-2574 requirements)
// Debit: Deferred Income Liability, Credit: Buy Down Expense // Debit: Deferred Income Liability, Credit: Buy Down Expense (merchant)
// Debit: Deferred Income Liability, Credit: Fund Source (non merchant)
this.helper.createJournalEntriesForLoan(office, currencyCode, AccrualAccountsForLoan.DEFERRED_INCOME_LIABILITY.getValue(), this.helper.createJournalEntriesForLoan(office, currencyCode, AccrualAccountsForLoan.DEFERRED_INCOME_LIABILITY.getValue(),
AccrualAccountsForLoan.BUY_DOWN_EXPENSE.getValue(), loanProductId, paymentTypeId, loanId, transactionId, debitAccountType.getValue(), loanProductId, paymentTypeId, loanId, transactionId, transactionDate, amount);
transactionDate, amount);
} }
} }
@@ -881,7 +881,7 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
loanTransactionHelper.approveLoan(loanId, approveLoanRequest(1000.0, "01 September 2024")); loanTransactionHelper.approveLoan(loanId, approveLoanRequest(1000.0, "01 September 2024"));
disburseLoan(loanId, BigDecimal.valueOf(1000.0), "01 September 2024"); disburseLoan(loanId, BigDecimal.valueOf(1000.0), "01 September 2024");
final Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, "10 September 2024"); Long buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, "10 September 2024");
assertNotNull(buyDownFeeTransactionId); assertNotNull(buyDownFeeTransactionId);
verifyTransactions(loanId, // verifyTransactions(loanId, //
@@ -902,6 +902,18 @@ public class LoanBuyDownFeeTest extends BaseLoanIntegrationTest {
// Verify initial buy down fee (non merchant) reversed accounting entries // Verify initial buy down fee (non merchant) reversed accounting entries
verifyTRJournalEntries(buyDownFeeTransactionId, debit(fundSource, 400.0), credit(deferredIncomeLiabilityAccount, 400.0), verifyTRJournalEntries(buyDownFeeTransactionId, debit(fundSource, 400.0), credit(deferredIncomeLiabilityAccount, 400.0),
credit(fundSource, 400.0), debit(deferredIncomeLiabilityAccount, 400.0)); credit(fundSource, 400.0), debit(deferredIncomeLiabilityAccount, 400.0));
buyDownFeeTransactionId = addBuyDownFeeForLoan(loanId, 400.0, "10 September 2024");
assertNotNull(buyDownFeeTransactionId);
// Buy Down Fee Adjustment (non merchant)
final PostLoansLoanIdTransactionsResponse buyDownFeeAdjustmentTransaction = loanTransactionHelper.buyDownFeeAdjustment(loanId,
buyDownFeeTransactionId, "10 September 2024", 200.0);
assertNotNull(buyDownFeeAdjustmentTransaction);
// Verify buy down fee adjustment (non merchant)
verifyTRJournalEntries(buyDownFeeAdjustmentTransaction.getResourceId(), debit(deferredIncomeLiabilityAccount, 200.0),
credit(fundSource, 200.0));
}); });
} }