bug fixes for accrual based accounting
This commit is contained in:
+4
-3
@@ -77,6 +77,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
final String transactionId = loanTransactionDTO.getTransactionId();
|
||||
final Date transactionDate = loanTransactionDTO.getTransactionDate();
|
||||
final BigDecimal disbursalAmount = loanTransactionDTO.getAmount();
|
||||
final BigDecimal interestAmount = loanDTO.getCalculatedInterest();
|
||||
final boolean isReversed = loanTransactionDTO.isReversed();
|
||||
|
||||
// create journal entries for the disbursement (or disbursement
|
||||
@@ -88,7 +89,7 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
BigDecimal interestApplied = loanDTO.getCalculatedInterest();
|
||||
if (interestApplied != null && !(interestApplied.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS, loanProductId, loanId, transactionId, transactionDate, disbursalAmount,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS, loanProductId, loanId, transactionId, transactionDate, interestAmount,
|
||||
isReversed);
|
||||
}
|
||||
}
|
||||
@@ -237,8 +238,8 @@ public class AccrualBasedAccountingProcessorForLoan implements AccountingProcess
|
||||
// create journal entries for the penalties application (or reversal)
|
||||
else if (penaltiesAmount != null && !(penaltiesAmount.compareTo(BigDecimal.ZERO) == 0)) {
|
||||
helper.createAccrualBasedJournalEntriesAndReversalsForLoan(office, ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE,
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES, loanProductId, loanId, transactionId, transactionDate, feesAmount,
|
||||
isReversed);
|
||||
ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES, loanProductId, loanId, transactionId, transactionDate,
|
||||
penaltiesAmount, isReversed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-8
@@ -411,6 +411,11 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
final LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor = this.transactionProcessorFactory
|
||||
.determineProcessor(this.transactionProcessingStrategy);
|
||||
|
||||
// store Id's of existing loan transactions and existing reversed loan
|
||||
// transactions
|
||||
existingTransactionIds.addAll(findExistingTransactionIds());
|
||||
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
|
||||
|
||||
if (!loanCharge.isDueAtDisbursement()) {
|
||||
final List<LoanTransaction> allNonContraTransactionsPostDisbursement = retreiveListOfTransactionsPostDisbursement();
|
||||
changedTransactionDetail = loanRepaymentScheduleTransactionProcessor.handleTransaction(getDisbursementDate(),
|
||||
@@ -426,16 +431,13 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
updateLoanSummaryDerivedFields();
|
||||
|
||||
existingTransactionIds.addAll(findExistingTransactionIds());
|
||||
existingReversedTransactionIds.addAll(findExistingReversedTransactionIds());
|
||||
|
||||
return changedTransactionDetail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a loanTransaction for "Apply Charge Event" with transaction date
|
||||
* set to "suppliedTransactionDate"
|
||||
* set to "suppliedTransactionDate". The newly created transaction is also
|
||||
* added to the Loan on which this method is called.
|
||||
*
|
||||
* If "suppliedTransactionDate" is not passed Id, the transaction date is
|
||||
* set to the loans due date if the due date is lesser than todays date. If
|
||||
@@ -445,7 +447,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
* @param suppliedTransactionDate
|
||||
* @return
|
||||
*/
|
||||
public LoanTransaction getChargeAppliedTransaction(final LoanCharge loanCharge, final LocalDate suppliedTransactionDate) {
|
||||
public LoanTransaction handleChargeAppliedTransaction(final LoanCharge loanCharge, final LocalDate suppliedTransactionDate) {
|
||||
final Money chargeAmount = loanCharge.getAmount(getCurrency());
|
||||
Money feeCharges = chargeAmount;
|
||||
Money penaltyCharges = Money.zero(loanCurrency());
|
||||
@@ -471,6 +473,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
|
||||
final LoanTransaction applyLoanChargeTransaction = LoanTransaction.applyLoanCharge(this, chargeAmount, transactionDate, feeCharges,
|
||||
penaltyCharges);
|
||||
this.loanTransactions.add(applyLoanChargeTransaction);
|
||||
return applyLoanChargeTransaction;
|
||||
}
|
||||
|
||||
@@ -629,6 +632,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
|
||||
final LoanTransaction waiveLoanChargeTransaction = LoanTransaction.waiveLoanCharge(this, amountWaived, transactionDate,
|
||||
feeChargesWaived, penaltyChargesWaived);
|
||||
this.loanTransactions.add(waiveLoanChargeTransaction);
|
||||
|
||||
// Waive of charges whose due date falls after latest 'repayment'
|
||||
// transaction dont require entire loan schedule to be reprocessed.
|
||||
@@ -1338,8 +1342,7 @@ public class Loan extends AbstractPersistable<Long> {
|
||||
if (charge.isDueAtDisbursement()) {
|
||||
charge.markAsFullyPaid();
|
||||
} else {
|
||||
LoanTransaction loanChargeAppliedTransaction = getChargeAppliedTransaction(charge, disbursedOn);
|
||||
this.loanTransactions.add(loanChargeAppliedTransaction);
|
||||
handleChargeAppliedTransaction(charge, disbursedOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -96,7 +96,6 @@ public final class LoanTransaction extends AbstractPersistable<Long> {
|
||||
final Money penaltyCharges) {
|
||||
LoanTransaction applyCharge = new LoanTransaction(loan, LoanTransactionType.APPLY_CHARGES, amount.getAmount(), applyDate);
|
||||
applyCharge.updateChargesComponents(feeCharges, penaltyCharges);
|
||||
|
||||
return applyCharge;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -552,7 +552,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
||||
final List<Long> existingReversedTransactionIds = new ArrayList<Long>();
|
||||
this.loanChargeRepository.save(loanCharge);
|
||||
|
||||
final LoanTransaction applyLoanChargeTransaction = loan.getChargeAppliedTransaction(loanCharge, null);
|
||||
final LoanTransaction applyLoanChargeTransaction = loan.handleChargeAppliedTransaction(loanCharge, null);
|
||||
final ChangedTransactionDetail changedTransactionDetail = loan.addLoanCharge(loanCharge, existingTransactionIds,
|
||||
existingReversedTransactionIds);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user