FINERACT-1960: GL account mappings to use Savings product with Accrual accounting

This commit is contained in:
Jose Alberto Hernandez
2024-02-26 15:25:28 +01:00
committed by Adam Saghy
parent 051b37c4b3
commit 6ee881b89a
29 changed files with 1278 additions and 796 deletions
@@ -277,6 +277,54 @@ public final class AccountingConstants {
}
}
/***
* Accounting placeholders for periodic accrual based accounting for savings products
***/
public enum AccrualAccountsForSavings {
SAVINGS_REFERENCE(1), //
SAVINGS_CONTROL(2), //
INTEREST_ON_SAVINGS(3), //
INCOME_FROM_FEES(4), //
INCOME_FROM_PENALTIES(5), //
TRANSFERS_SUSPENSE(10), //
OVERDRAFT_PORTFOLIO_CONTROL(11), //
INCOME_FROM_INTEREST(12), //
LOSSES_WRITTEN_OFF(13), //
ESCHEAT_LIABILITY(14), //
FEES_RECEIVABLE(15), //
PENALTIES_RECEIVABLE(16), //
INTEREST_PAYABLE(17);
private final Integer value;
AccrualAccountsForSavings(final Integer value) {
this.value = value;
}
@Override
public String toString() {
return name().toString().replaceAll("_", " ");
}
public Integer getValue() {
return this.value;
}
private static final Map<Integer, AccrualAccountsForSavings> intToEnumMap = new HashMap<>();
static {
for (final AccrualAccountsForSavings type : AccrualAccountsForSavings.values()) {
intToEnumMap.put(type.value, type);
}
}
public static AccrualAccountsForSavings fromInt(final int i) {
final AccrualAccountsForSavings type = intToEnumMap.get(Integer.valueOf(i));
return type;
}
}
/***
* Enum of all accounting related input parameter names used while creating/updating a savings product
***/
@@ -298,7 +346,10 @@ public final class AccountingConstants {
OVERDRAFT_PORTFOLIO_CONTROL("overdraftPortfolioControlId"), //
INCOME_FROM_INTEREST("incomeFromInterestId"), //
LOSSES_WRITTEN_OFF("writeOffAccountId"), //
ESCHEAT_LIABILITY("escheatLiabilityId"); //
ESCHEAT_LIABILITY("escheatLiabilityId"), //
PENALTIES_RECEIVABLE("penaltiesReceivableAccountId"), //
FEES_RECEIVABLE("feesReceivableAccountId"), //
INTEREST_PAYABLE("interestPayableAccountId");
private final String value;
@@ -332,7 +383,10 @@ public final class AccountingConstants {
OVERDRAFT_PORTFOLIO_CONTROL("overdraftPortfolioControl"), //
INCOME_FROM_INTEREST("incomeFromInterest"), //
LOSSES_WRITTEN_OFF("writeOffAccount"), //
ESCHEAT_LIABILITY("escheatLiabilityAccount"); //
ESCHEAT_LIABILITY("escheatLiabilityAccount"), //
FEES_RECEIVABLE("feeReceivableAccount"), //
PENALTIES_RECEIVABLE("penaltyReceivableAccount"), //
INTEREST_PAYABLE("interestPayableAccount"); //
private final String value;
@@ -218,8 +218,10 @@ public final class DepositsApiConstants {
SavingProductAccountingParams.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(),
SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(),
SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), SavingProductAccountingParams.FEE_INCOME_ACCOUNT_MAPPING.getValue(),
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), chartsParamName,
SavingsApiConstants.withHoldTaxParamName, SavingsApiConstants.taxGroupIdParamName));
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
SavingProductAccountingParams.INTEREST_PAYABLE.getValue(), SavingProductAccountingParams.PENALTIES_RECEIVABLE.getValue(),
SavingProductAccountingParams.FEES_RECEIVABLE.getValue(), chartsParamName, SavingsApiConstants.withHoldTaxParamName,
SavingsApiConstants.taxGroupIdParamName));
private static final Set<String> PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(preClosurePenalApplicableParamName, preClosurePenalInterestParamName, preClosurePenalInterestOnTypeIdParamName));
@@ -40,6 +40,7 @@ public enum SavingsAccountTransactionType {
WAIVE_CHARGES(6, "savingsAccountTransactionType.waiveCharge"), //
PAY_CHARGE(7, "savingsAccountTransactionType.payCharge", TransactionEntryType.DEBIT), //
DIVIDEND_PAYOUT(8, "savingsAccountTransactionType.dividendPayout", TransactionEntryType.CREDIT), //
ACCRUAL(10, "savingsAccountTransactionType.accrual"), //
INITIATE_TRANSFER(12, "savingsAccountTransactionType.initiateTransfer"), //
APPROVE_TRANSFER(13, "savingsAccountTransactionType.approveTransfer"), //
WITHDRAW_TRANSFER(14, "savingsAccountTransactionType.withdrawTransfer"), //
@@ -181,6 +182,10 @@ public enum SavingsAccountTransactionType {
return this == AMOUNT_RELEASE;
}
public boolean isAccrual() {
return this == ACCRUAL;
}
public boolean isCredit() {
// AMOUNT_RELEASE is not credit, because the account balance is not changed
return isCreditEntryType() && !isAmountRelease();
@@ -49,6 +49,7 @@ public class SavingsAccountTransactionEnumData implements Serializable {
private final boolean escheat;
private final boolean amountHold;
private final boolean amountRelease;
private final boolean accrual;
public SavingsAccountTransactionEnumData(final Long id, final String code, final String value) {
this.id = id;
@@ -57,6 +58,7 @@ public class SavingsAccountTransactionEnumData implements Serializable {
SavingsAccountTransactionType transactionType = id == null ? null : SavingsAccountTransactionType.fromInt(id.intValue());
this.deposit = transactionType == SavingsAccountTransactionType.DEPOSIT;
this.dividendPayout = transactionType == SavingsAccountTransactionType.DIVIDEND_PAYOUT;
this.accrual = transactionType == SavingsAccountTransactionType.ACCRUAL;
this.withdrawal = transactionType == SavingsAccountTransactionType.WITHDRAWAL;
this.interestPosting = transactionType == SavingsAccountTransactionType.INTEREST_POSTING;
this.feeDeduction = transactionType == SavingsAccountTransactionType.ANNUAL_FEE
@@ -141,6 +141,10 @@ public final class SavingsEnumerations {
optionData = new SavingsAccountTransactionEnumData(SavingsAccountTransactionType.WITHDRAWAL.getValue().longValue(),
SavingsAccountTransactionType.WITHDRAWAL.getCode(), "Withdrawal");
break;
case ACCRUAL:
optionData = new SavingsAccountTransactionEnumData(SavingsAccountTransactionType.ACCRUAL.getValue().longValue(),
SavingsAccountTransactionType.ACCRUAL.getCode(), "Accrual");
break;
case INTEREST_POSTING:
optionData = new SavingsAccountTransactionEnumData(SavingsAccountTransactionType.INTEREST_POSTING.getValue().longValue(),
SavingsAccountTransactionType.INTEREST_POSTING.getCode(), "Interest posting");