FINERACT-1440 : Enable Daily Interest Posting for Savings

This commit is contained in:
Manoj
2021-11-13 11:08:02 +08:00
committed by Petri Tuomola
parent 868820ba23
commit 7ff3f38243
7 changed files with 145 additions and 8 deletions
@@ -28,6 +28,7 @@ import java.util.List;
public enum SavingsPostingInterestPeriodType {
INVALID(0, "savingsPostingInterestPeriodType.invalid"), //
DAILY(1, "savingsPostingInterestPeriodType.daily"), //
MONTHLY(4, "savingsPostingInterestPeriodType.monthly"), //
QUATERLY(5, "savingsPostingInterestPeriodType.quarterly"), //
BIANNUAL(6, "savingsPostingInterestPeriodType.biannual"), ANNUAL(7, "savingsPostingInterestPeriodType.annual");
@@ -63,6 +64,9 @@ public enum SavingsPostingInterestPeriodType {
SavingsPostingInterestPeriodType repaymentFrequencyType = SavingsPostingInterestPeriodType.INVALID;
if (type != null) {
switch (type) {
case 1:
repaymentFrequencyType = SavingsPostingInterestPeriodType.DAILY;
break;
case 4:
repaymentFrequencyType = SavingsPostingInterestPeriodType.MONTHLY;
break;
@@ -2813,6 +2813,10 @@ public class SavingsAccount extends AbstractPersistableCustom {
public void validateInterestPostingAndCompoundingPeriodTypes(final DataValidatorBuilder baseDataValidator) {
Map<SavingsPostingInterestPeriodType, List<SavingsCompoundingInterestPeriodType>> postingtoCompoundMap = new HashMap<>();
postingtoCompoundMap.put(SavingsPostingInterestPeriodType.DAILY,
Arrays.asList(new SavingsCompoundingInterestPeriodType[] { SavingsCompoundingInterestPeriodType.DAILY }));
postingtoCompoundMap.put(SavingsPostingInterestPeriodType.MONTHLY, Arrays.asList(new SavingsCompoundingInterestPeriodType[] {
SavingsCompoundingInterestPeriodType.DAILY, SavingsCompoundingInterestPeriodType.MONTHLY }));
@@ -118,6 +118,10 @@ public final class SavingsHelper {
switch (interestPostingPeriodType) {
case INVALID:
break;
case DAILY:
// produce period end date on current day
periodEndDate = periodStartDate;
break;
case MONTHLY:
// produce period end date on last day of current month
periodEndDate = periodStartDate.with(TemporalAdjusters.lastDayOfMonth());
@@ -56,10 +56,6 @@ public class SavingsDropdownReadPlatformServiceImpl implements SavingsDropdownRe
public Collection<EnumOptionData> retrieveCompoundingInterestPeriodTypeOptions() {
final List<EnumOptionData> allowedOptions = Arrays.asList(
SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.DAILY),
// SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.WEEKLY),
// //
// SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.BIWEEKLY),
// //
SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.MONTHLY),
SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.QUATERLY),
SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.BI_ANNUAL),
@@ -75,10 +71,12 @@ public class SavingsDropdownReadPlatformServiceImpl implements SavingsDropdownRe
@Override
public Collection<EnumOptionData> retrieveInterestPostingPeriodTypeOptions() {
final List<EnumOptionData> allowedOptions = Arrays.asList(
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.MONTHLY),
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.QUATERLY),
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.BIANNUAL),
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.ANNUAL));
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.DAILY), //
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.MONTHLY), //
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.QUATERLY), //
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.BIANNUAL), //
SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.ANNUAL) //
);
return allowedOptions;
}
@@ -364,6 +364,10 @@ public final class SavingsEnumerations {
switch (type) {
case INVALID:
break;
case DAILY:
optionData = new EnumOptionData(SavingsPostingInterestPeriodType.DAILY.getValue().longValue(),
codePrefix + SavingsPostingInterestPeriodType.DAILY.getCode(), "Daily");
break;
case MONTHLY:
optionData = new EnumOptionData(SavingsPostingInterestPeriodType.MONTHLY.getValue().longValue(),
codePrefix + SavingsPostingInterestPeriodType.MONTHLY.getCode(), "Monthly");