feat: update savings product backend changes

This commit is contained in:
Nitesh Yadav
2026-04-28 13:12:27 +05:30
parent 72adbf6305
commit dc4a720ae2
16 changed files with 17339 additions and 35 deletions
@@ -281,4 +281,31 @@ public class SavingsApiConstants {
public static final String avgBalanceCalcPeriodParamName = "avgBalanceCalcPeriod";
public static final String validForPeriodParamName = "validForPeriod";
public static final String odAccountClosedZeroBalanceInDayClosingParamName = "odAccountClosedZeroBalanceInDayClosing";
// Status of Account fields
public static final String accountStatusParamName = "accountStatus";
public static final String modeOfOperationParamName = "modeOfOperation";
public static final String guardianClientIdParamName = "guardianClientId";
public static final String specialCategoryParamName = "specialCategory";
public static final String weakerSectionParamName = "weakerSection";
public static final String guardianNameParamName = "guardianName";
public static final String guardianCifNumberParamName = "guardianCifNumber";
public static final String guardianRelationshipParamName = "guardianRelationship";
public static final String minorDateOfBirthParamName = "minorDateOfBirth";
// Introducer fields
public static final String introducerIdParamName = "introducerId";
public static final String introducerNameParamName = "introducerName";
public static final String introducerCifNumberParamName = "introducerCifNumber";
// Joint holders
public static final String jointHoldersParamName = "jointHolders";
// Nominee
public static final String nomineeParamName = "nominee";
// Deposit Account Link (DAL)
public static final String linkedAccountIdParamName = "linkedAccountId";
public static final String linkedAccountTypeParamName = "linkedAccountType";
public static final String linkedAccountNoParamName = "linkedAccountNo";
}
@@ -126,6 +126,26 @@ public final class SavingsAccountData implements Serializable {
private List<DatatableData> datatables = null;
// CBS Account fields (saved per account)
private String cbsAccountType;
private String accountStatus;
private String modeOfOperation;
private String specialCategory;
private String weakerSection;
private String guardianName;
private String guardianCifNumber;
private String guardianRelationship;
private LocalDate minorDateOfBirth;
private Long guardianClientId;
private Long introducerClientId;
private String introducerName;
private String introducerCifNumber;
private Map<String, Object> nomineeData;
private Long linkedAccountId;
private String linkedAccountType;
private String linkedAccountNo;
private List<java.util.Map<String, Object>> jointHolders;
// CBS Product fields (populated in template response from selected product)
private String accountType;
private String customerSegment;
@@ -731,37 +751,50 @@ public final class SavingsAccountData implements Serializable {
public static SavingsAccountData withTemplateOptions(final SavingsAccountData account, final SavingsAccountData template,
final Collection<SavingsAccountTransactionData> transactions, final Collection<SavingsAccountChargeData> charges) {
if (template == null) {
final Collection<SavingsProductData> productOptions = null;
final Collection<StaffData> fieldOfficerOptions = null;
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestPostingPeriodTypeOptions = null;
final Collection<EnumOptionData> interestCalculationTypeOptions = null;
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions = null;
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = null;
final Collection<EnumOptionData> withdrawalFeeTypeOptions = null;
final Collection<ChargeData> chargeOptions = null;
final Collection<SavingsProductData> productOptions = template == null ? null : template.productOptions;
final Collection<StaffData> fieldOfficerOptions = template == null ? null : template.fieldOfficerOptions;
final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions = template == null ? null
: template.interestCompoundingPeriodTypeOptions;
final Collection<EnumOptionData> interestPostingPeriodTypeOptions = template == null ? null
: template.interestPostingPeriodTypeOptions;
final Collection<EnumOptionData> interestCalculationTypeOptions = template == null ? null
: template.interestCalculationTypeOptions;
final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions = template == null ? null
: template.interestCalculationDaysInYearTypeOptions;
final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = template == null ? null
: template.lockinPeriodFrequencyTypeOptions;
final Collection<EnumOptionData> withdrawalFeeTypeOptions = template == null ? null
: template.withdrawalFeeTypeOptions;
final Collection<ChargeData> chargeOptions = template == null ? null : template.chargeOptions;
return withTemplateOptions(account, productOptions, fieldOfficerOptions, interestCompoundingPeriodTypeOptions,
interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, transactions, charges, chargeOptions);
}
return new SavingsAccountData(account.id, account.accountNo, account.depositType, account.externalId, account.groupId,
final SavingsAccountData result = new SavingsAccountData(account.id, account.accountNo, account.depositType, account.externalId,
account.groupId,
account.groupName, account.clientId, account.clientName, account.savingsProductId, account.savingsProductName,
account.fieldOfficerId, account.fieldOfficerName, account.status, account.subStatus, account.reasonForBlock,
account.timeline, account.currency, account.nominalAnnualInterestRate, account.interestCompoundingPeriodType,
account.interestPostingPeriodType, account.interestCalculationType, account.interestCalculationDaysInYearType,
account.minRequiredOpeningBalance, account.lockinPeriodFrequency, account.lockinPeriodFrequencyType,
account.withdrawalFeeForTransfers, account.summary, transactions, template.productOptions, template.fieldOfficerOptions,
template.interestCompoundingPeriodTypeOptions, template.interestPostingPeriodTypeOptions,
template.interestCalculationTypeOptions, template.interestCalculationDaysInYearTypeOptions,
template.lockinPeriodFrequencyTypeOptions, template.withdrawalFeeTypeOptions, charges, template.chargeOptions,
account.withdrawalFeeForTransfers, account.summary, transactions, productOptions, fieldOfficerOptions,
interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions,
interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions,
lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, charges, chargeOptions,
account.allowOverdraft, account.overdraftLimit, account.minRequiredBalance, account.enforceMinRequiredBalance,
account.maxAllowedLienLimit, account.lienAllowed, account.minBalanceForInterestCalculation, account.onHoldFunds,
account.nominalAnnualInterestRateOverdraft, account.minOverdraftForInterestCalculation, account.withHoldTax,
account.taxGroup, account.lastActiveTransactionDate, account.isDormancyTrackingActive, account.daysToInactive,
account.daysToDormancy, account.daysToEscheat, account.savingsAmountOnHold);
copyPresentationFields(result, template);
copyPresentationFields(result, account);
result.setProductOptions(productOptions);
result.setFieldOfficerOptions(fieldOfficerOptions);
result.setInterestCompoundingPeriodTypeOptions(interestCompoundingPeriodTypeOptions);
result.setInterestPostingPeriodTypeOptions(interestPostingPeriodTypeOptions);
result.setInterestCalculationTypeOptions(interestCalculationTypeOptions);
result.setInterestCalculationDaysInYearTypeOptions(interestCalculationDaysInYearTypeOptions);
result.setLockinPeriodFrequencyTypeOptions(lockinPeriodFrequencyTypeOptions);
result.setWithdrawalFeeTypeOptions(withdrawalFeeTypeOptions);
result.setChargeOptions(chargeOptions);
return result;
}
public static SavingsAccountData withTemplateOptions(final SavingsAccountData account,
@@ -774,7 +807,8 @@ public final class SavingsAccountData implements Serializable {
final Collection<SavingsAccountTransactionData> transactions, final Collection<SavingsAccountChargeData> charges,
final Collection<ChargeData> chargeOptions) {
return new SavingsAccountData(account.id, account.accountNo, account.depositType, account.externalId, account.groupId,
final SavingsAccountData result = new SavingsAccountData(account.id, account.accountNo, account.depositType, account.externalId,
account.groupId,
account.groupName, account.clientId, account.clientName, account.savingsProductId, account.savingsProductName,
account.fieldOfficerId, account.fieldOfficerName, account.status, account.subStatus, account.reasonForBlock,
account.timeline, account.currency, account.nominalAnnualInterestRate, account.interestCompoundingPeriodType,
@@ -789,6 +823,232 @@ public final class SavingsAccountData implements Serializable {
account.minOverdraftForInterestCalculation, account.withHoldTax, account.taxGroup, account.lastActiveTransactionDate,
account.isDormancyTrackingActive, account.daysToInactive, account.daysToDormancy, account.daysToEscheat,
account.savingsAmountOnHold);
copyPresentationFields(result, account);
result.setProductOptions(productOptions);
result.setFieldOfficerOptions(fieldOfficerOptions);
result.setInterestCompoundingPeriodTypeOptions(interestCompoundingPeriodTypeOptions);
result.setInterestPostingPeriodTypeOptions(interestPostingPeriodTypeOptions);
result.setInterestCalculationTypeOptions(interestCalculationTypeOptions);
result.setInterestCalculationDaysInYearTypeOptions(interestCalculationDaysInYearTypeOptions);
result.setLockinPeriodFrequencyTypeOptions(lockinPeriodFrequencyTypeOptions);
result.setWithdrawalFeeTypeOptions(withdrawalFeeTypeOptions);
result.setChargeOptions(chargeOptions);
return result;
}
private static void copyPresentationFields(final SavingsAccountData target, final SavingsAccountData source) {
if (source == null) {
return;
}
if (source.previewAccountNo != null) {
target.setPreviewAccountNo(source.previewAccountNo);
}
if (source.cbsAccountType != null) {
target.setCbsAccountType(source.cbsAccountType);
}
if (source.customerSegment != null) {
target.setCustomerSegment(source.customerSegment);
}
if (source.accountStatus != null) {
target.setAccountStatus(source.accountStatus);
}
if (source.modeOfOperation != null) {
target.setModeOfOperation(source.modeOfOperation);
}
if (source.specialCategory != null) {
target.setSpecialCategory(source.specialCategory);
}
if (source.weakerSection != null) {
target.setWeakerSection(source.weakerSection);
}
if (source.guardianName != null) {
target.setGuardianName(source.guardianName);
}
if (source.guardianCifNumber != null) {
target.setGuardianCifNumber(source.guardianCifNumber);
}
if (source.guardianRelationship != null) {
target.setGuardianRelationship(source.guardianRelationship);
}
if (source.minorDateOfBirth != null) {
target.setMinorDateOfBirth(source.minorDateOfBirth);
}
if (source.guardianClientId != null) {
target.setGuardianClientId(source.guardianClientId);
}
if (source.introducerClientId != null) {
target.setIntroducerClientId(source.introducerClientId);
}
if (source.introducerName != null) {
target.setIntroducerName(source.introducerName);
}
if (source.introducerCifNumber != null) {
target.setIntroducerCifNumber(source.introducerCifNumber);
}
if (source.nomineeData != null) {
target.setNomineeData(source.nomineeData);
}
if (source.linkedAccountId != null) {
target.setLinkedAccountId(source.linkedAccountId);
}
if (source.linkedAccountType != null) {
target.setLinkedAccountType(source.linkedAccountType);
}
if (source.linkedAccountNo != null) {
target.setLinkedAccountNo(source.linkedAccountNo);
}
if (source.jointHolders != null) {
target.setJointHolders(new ArrayList<>(source.jointHolders));
}
if (source.accountType != null) {
target.setAccountType(source.accountType);
}
if (source.customerSegmentOptions != null) {
target.setCustomerSegmentOptions(source.customerSegmentOptions);
}
if (source.accountTypeOptions != null) {
target.setAccountTypeOptions(source.accountTypeOptions);
}
if (source.productCode != null) {
target.setProductCode(source.productCode);
}
if (source.effectiveDate != null) {
target.setEffectiveDate(source.effectiveDate);
}
if (source.effectiveTo != null) {
target.setEffectiveTo(source.effectiveTo);
}
if (source.endDate != null) {
target.setEndDate(source.endDate);
}
if (source.introducerRequired != null) {
target.setIntroducerRequired(source.introducerRequired);
}
if (source.shareLinkingEnabled != null) {
target.setShareLinkingEnabled(source.shareLinkingEnabled);
}
if (source.nominationFacility != null) {
target.setNominationFacility(source.nominationFacility);
}
if (source.dormancyAlert != null) {
target.setDormancyAlert(source.dormancyAlert);
}
if (source.isDormancyTrackingActiveFromProduct != null) {
target.setIsDormancyTrackingActiveFromProduct(source.isDormancyTrackingActiveFromProduct);
}
if (source.daysToInactiveFromProduct != null) {
target.setDaysToInactiveFromProduct(source.daysToInactiveFromProduct);
}
if (source.daysToDormancyFromProduct != null) {
target.setDaysToDormancyFromProduct(source.daysToDormancyFromProduct);
}
if (source.daysToEscheatFromProduct != null) {
target.setDaysToEscheatFromProduct(source.daysToEscheatFromProduct);
}
if (source.interestCalculationTypeName != null) {
target.setInterestCalculationTypeName(source.interestCalculationTypeName);
}
if (source.enableLockinPeriod != null) {
target.setEnableLockinPeriod(source.enableLockinPeriod);
}
if (source.balanceFrequency != null) {
target.setBalanceFrequency(source.balanceFrequency);
}
if (source.accountClosedZeroBalanceInDayClosing != null) {
target.setAccountClosedZeroBalanceInDayClosing(source.accountClosedZeroBalanceInDayClosing);
}
if (source.balanceSwapOption != null) {
target.setBalanceSwapOption(source.balanceSwapOption);
}
if (source.msme != null) {
target.setMsme(source.msme);
}
if (source.autoDebitFacility != null) {
target.setAutoDebitFacility(source.autoDebitFacility);
}
if (source.avgBalanceCalcPeriod != null) {
target.setAvgBalanceCalcPeriod(source.avgBalanceCalcPeriod);
}
if (source.validForPeriod != null) {
target.setValidForPeriod(source.validForPeriod);
}
if (source.odAccountClosedZeroBalanceInDayClosing != null) {
target.setOdAccountClosedZeroBalanceInDayClosing(source.odAccountClosedZeroBalanceInDayClosing);
}
if (source.lastInterestDate != null) {
target.setLastInterestDate(source.lastInterestDate);
}
if (source.accountFacilityConfig != null) {
target.setAccountFacilityConfig(source.accountFacilityConfig);
}
if (source.accountFacilityLimits != null) {
target.setAccountFacilityLimits(source.accountFacilityLimits);
}
if (source.depositLimitKyc != null) {
target.setDepositLimitKyc(source.depositLimitKyc);
}
if (source.interestCalculateSelector != null) {
target.setInterestCalculateSelector(source.interestCalculateSelector);
}
if (source.averagePeriod != null) {
target.setAveragePeriod(source.averagePeriod);
}
if (source.autoPost != null) {
target.setAutoPost(source.autoPost);
}
if (source.frequencyFixDay != null) {
target.setFrequencyFixDay(source.frequencyFixDay);
}
if (source.interestCalculationTypeOption != null) {
target.setInterestCalculationTypeOption(source.interestCalculationTypeOption);
}
if (source.periodFrequencyOptions != null) {
target.setPeriodFrequencyOptions(source.periodFrequencyOptions);
}
if (source.productId != null) {
target.setProductId(source.productId);
}
if (source.locale != null) {
target.setLocale(source.locale);
}
if (source.dateFormat != null) {
target.setDateFormat(source.dateFormat);
}
if (source.rowIndex != null) {
target.setRowIndex(source.rowIndex);
}
if (source.submittedOnDate != null) {
target.setSubmittedOnDate(source.submittedOnDate);
}
if (source.startInterestCalculationDate != null) {
target.setStartInterestCalculationDate(source.startInterestCalculationDate);
}
if (source.activatedOnDate != null) {
target.setActivatedOnDate(source.activatedOnDate);
}
if (source.lockedInUntilDate != null) {
target.setLockedInUntilDate(source.lockedInUntilDate);
}
if (source.officeId != null) {
target.setOfficeId(source.officeId);
}
if (source.clientData != null) {
target.setClientData(source.clientData);
}
if (source.groupGeneralData != null) {
target.setGroupGeneralData(source.groupGeneralData);
}
if (source.savingsProductData != null) {
target.setSavingsProduct(source.savingsProductData);
}
if (source.savingsAccountSummaryData != null) {
target.setSavingsAccountSummaryData(source.savingsAccountSummaryData);
}
if (source.lastSavingsAccountTransaction != null) {
target.setLastSavingsAccountTransaction(source.lastSavingsAccountTransaction);
}
}
public static SavingsAccountData withClientTemplate(final Long clientId, final String clientName, final Long groupId,