FINERACT-1806: Advanced accounting - Charge-off reason

This commit is contained in:
Adam Saghy
2025-01-07 19:40:45 +01:00
parent b7e6f356da
commit e1d043bb2d
10 changed files with 159 additions and 18 deletions
@@ -2190,13 +2190,9 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
boolean isBeforeChargeOffDate) {
final Map<String, Object> accountingBridgeDataChargeOff = new LinkedHashMap<>(
getAccountingBridgeDataGenericAttributes(currencyCode, isAccountTransfer));
if (isBeforeChargeOffDate) {
accountingBridgeDataChargeOff.put("isChargeOff", false);
accountingBridgeDataChargeOff.put("isFraud", isFraud());
} else {
accountingBridgeDataChargeOff.put("isChargeOff", isChargedOff());
accountingBridgeDataChargeOff.put("isFraud", isFraud());
}
accountingBridgeDataChargeOff.put("isChargeOff", !isBeforeChargeOffDate && isChargedOff());
accountingBridgeDataChargeOff.put("isFraud", isFraud());
accountingBridgeDataChargeOff.put("chargeOffReasonCodeValue", fetchChargeOffReasonId());
return accountingBridgeDataChargeOff;
}
@@ -2274,6 +2270,8 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
accountingBridgeData.put("periodicAccrualBasedAccountingEnabled", isPeriodicAccrualAccountingEnabledOnLoanProduct());
accountingBridgeData.put("isAccountTransfer", isAccountTransfer);
accountingBridgeData.put("isChargeOff", isChargedOff());
accountingBridgeData.put("chargeOffReasonCodeValue", fetchChargeOffReasonId());
accountingBridgeData.put("isFraud", isFraud());
final List<Map<String, Object>> newLoanTransactions = new ArrayList<>();
@@ -2290,6 +2288,10 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom<Long> {
return accountingBridgeData;
}
private Long fetchChargeOffReasonId() {
return isChargedOff() && getChargeOffReason() != null ? getChargeOffReason().getId() : null;
}
public Money getReceivableInterest(final LocalDate tillDate) {
Money receivableInterest = Money.zero(getCurrency());
for (final LoanTransaction transaction : this.loanTransactions) {