formatting source code

This commit is contained in:
Vishwas Babu A J
2014-09-14 10:36:06 -07:00
parent 3e5db84702
commit 4b9f6f3042
53 changed files with 291 additions and 270 deletions
@@ -72,7 +72,7 @@ public enum DepositAccountOnClosureType {
public boolean isInvalid() { public boolean isInvalid() {
return this.value.equals(DepositAccountOnClosureType.INVALID.getValue()); return this.value.equals(DepositAccountOnClosureType.INVALID.getValue());
} }
public static Object[] integerValues() { public static Object[] integerValues() {
final List<Integer> values = new ArrayList<>(); final List<Integer> values = new ArrayList<>();
for (final DepositAccountOnClosureType enumType : values()) { for (final DepositAccountOnClosureType enumType : values()) {
@@ -8,15 +8,12 @@ package org.mifosplatform.portfolio.savings;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* An enumeration of supported calendar periods used in savings. * An enumeration of supported calendar periods used in savings.
*/ */
public enum PreClosurePenalInterestOnType { public enum PreClosurePenalInterestOnType {
INVALID(0, "preClosurePenalInterestOnType.invalid"), INVALID(0, "preClosurePenalInterestOnType.invalid"), WHOLE_TERM(1, "preClosurePenalInterestOnType.wholeTerm"), //
WHOLE_TERM(1, "preClosurePenalInterestOnType.wholeTerm"), //
TILL_PREMATURE_WITHDRAWAL(2, "preClosurePenalInterestOnType.tillPrematureWithdrawal"); // TILL_PREMATURE_WITHDRAWAL(2, "preClosurePenalInterestOnType.tillPrematureWithdrawal"); //
private final Integer value; private final Integer value;
private final String code; private final String code;
@@ -48,7 +45,7 @@ public enum PreClosurePenalInterestOnType {
} }
return penalInterestType; return penalInterestType;
} }
public static Object[] integerValues() { public static Object[] integerValues() {
final List<Integer> values = new ArrayList<>(); final List<Integer> values = new ArrayList<>();
for (final PreClosurePenalInterestOnType enumType : values()) { for (final PreClosurePenalInterestOnType enumType : values()) {
@@ -59,15 +56,15 @@ public enum PreClosurePenalInterestOnType {
return values.toArray(); return values.toArray();
} }
public boolean isInvalid(){ public boolean isInvalid() {
return this.value.equals(PreClosurePenalInterestOnType.INVALID.value); return this.value.equals(PreClosurePenalInterestOnType.INVALID.value);
} }
public boolean isWholeTerm() { public boolean isWholeTerm() {
return this.value.equals(PreClosurePenalInterestOnType.WHOLE_TERM.getValue()); return this.value.equals(PreClosurePenalInterestOnType.WHOLE_TERM.getValue());
} }
public boolean isTillPrematureWithdrawal() { public boolean isTillPrematureWithdrawal() {
return this.value.equals(PreClosurePenalInterestOnType.TILL_PREMATURE_WITHDRAWAL.getValue()); return this.value.equals(PreClosurePenalInterestOnType.TILL_PREMATURE_WITHDRAWAL.getValue());
} }
@@ -8,15 +8,12 @@ package org.mifosplatform.portfolio.savings;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* An enumeration of supported calendar periods used in savings. * An enumeration of supported calendar periods used in savings.
*/ */
public enum RecurringDepositType { public enum RecurringDepositType {
INVALID(0, "recurringDepositType.invalid"), INVALID(0, "recurringDepositType.invalid"), VOLUNTARY(1, "recurringDepositType.voluntary"), //
VOLUNTARY(1, "recurringDepositType.voluntary"), //
MANDATORY(2, "recurringDepositType.mandatory"); // MANDATORY(2, "recurringDepositType.mandatory"); //
private final Integer value; private final Integer value;
private final String code; private final String code;
@@ -48,7 +45,7 @@ public enum RecurringDepositType {
} }
return rdType; return rdType;
} }
public static Object[] integerValues() { public static Object[] integerValues() {
final List<Integer> values = new ArrayList<>(); final List<Integer> values = new ArrayList<>();
for (final RecurringDepositType enumType : values()) { for (final RecurringDepositType enumType : values()) {
@@ -59,8 +56,8 @@ public enum RecurringDepositType {
return values.toArray(); return values.toArray();
} }
public boolean isInvalid(){ public boolean isInvalid() {
return this.value.equals(RecurringDepositType.INVALID.value); return this.value.equals(RecurringDepositType.INVALID.value);
} }
} }
@@ -173,8 +173,8 @@ public class SavingsApiConstants {
"interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions")); "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions"));
public static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, public static final Set<String> SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName, externalIdParamName, clientIdParamName, groupIdParamName, dateFormatParamName, monthDayFormatParamName, staffIdParamName, accountNoParamName, externalIdParamName, clientIdParamName,
productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName, groupIdParamName, productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName,
interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName,
interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
lockinPeriodFrequencyTypeParamName, lockinPeriodFrequencyTypeParamName,
@@ -188,8 +188,8 @@ public class SavingsApiConstants {
* parameters to match those of request parameters. * parameters to match those of request parameters.
*/ */
public static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName, public static final Set<String> SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName,
externalIdParamName, statusParamName, activatedOnDateParamName,staffIdParamName, clientIdParamName, "clientName", groupIdParamName, "groupName", externalIdParamName, statusParamName, activatedOnDateParamName, staffIdParamName, clientIdParamName, "clientName",
"savingsProductId", "savingsProductName", "currency", nominalAnnualInterestRateParamName, groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency", nominalAnnualInterestRateParamName,
interestCompoundingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, interestCompoundingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName,
minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName,
withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName, feeAmountParamName, withdrawalFeeAmountParamName, withdrawalFeeTypeParamName, withdrawalFeeForTransfersParamName, feeAmountParamName,
@@ -58,7 +58,7 @@ public enum SavingsPeriodFrequencyType {
public boolean isInvalid() { public boolean isInvalid() {
return this.value.equals(SavingsPeriodFrequencyType.INVALID.value); return this.value.equals(SavingsPeriodFrequencyType.INVALID.value);
} }
public static Object[] integerValues() { public static Object[] integerValues() {
final List<Integer> values = new ArrayList<>(); final List<Integer> values = new ArrayList<>();
for (final SavingsPeriodFrequencyType enumType : values()) { for (final SavingsPeriodFrequencyType enumType : values()) {
@@ -17,8 +17,7 @@ public enum SavingsPostingInterestPeriodType {
INVALID(0, "savingsPostingInterestPeriodType.invalid"), // INVALID(0, "savingsPostingInterestPeriodType.invalid"), //
MONTHLY(4, "savingsPostingInterestPeriodType.monthly"), // MONTHLY(4, "savingsPostingInterestPeriodType.monthly"), //
QUATERLY(5, "savingsPostingInterestPeriodType.quarterly"), // QUATERLY(5, "savingsPostingInterestPeriodType.quarterly"), //
BIANNUAL(6, "savingsPostingInterestPeriodType.biannual"), BIANNUAL(6, "savingsPostingInterestPeriodType.biannual"), ANNUAL(7, "savingsPostingInterestPeriodType.annual");
ANNUAL(7, "savingsPostingInterestPeriodType.annual");
private final Integer value; private final Integer value;
private final String code; private final String code;
@@ -174,7 +174,8 @@ public class FixedDepositAccountsApiResource {
} }
private FixedDepositAccountData populateTemplateAndAssociations(final Long accountId, final FixedDepositAccountData savingsAccount, private FixedDepositAccountData populateTemplateAndAssociations(final Long accountId, final FixedDepositAccountData savingsAccount,
final boolean staffInSelectedOfficeOnly, final String chargeStatus, final UriInfo uriInfo, final Set<String> mandatoryResponseParameters) { final boolean staffInSelectedOfficeOnly, final String chargeStatus, final UriInfo uriInfo,
final Set<String> mandatoryResponseParameters) {
Collection<SavingsAccountTransactionData> transactions = null; Collection<SavingsAccountTransactionData> transactions = null;
Collection<SavingsAccountChargeData> charges = null; Collection<SavingsAccountChargeData> charges = null;
@@ -85,7 +85,7 @@ public class RecurringDepositAccountTransactionsApiResource {
this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); this.context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME);
/*** /***
* Check @Param commandParam value for deposit or withdrawal * Check @Param commandParam value for deposit or withdrawal
*/ */
if (!(is(commandParam, "deposit") || is(commandParam, "withdrawal"))) { throw new UnrecognizedQueryParamException("command", if (!(is(commandParam, "deposit") || is(commandParam, "withdrawal"))) { throw new UnrecognizedQueryParamException("command",
commandParam, new Object[] { "deposit", "withdrawal" }); } commandParam, new Object[] { "deposit", "withdrawal" }); }
@@ -181,7 +181,8 @@ public class RecurringDepositAccountTransactionsApiResource {
final CommandWrapper commandRequest = builder.undoRecurringAccountTransaction(recurringDepositAccountId, transactionId).build(); final CommandWrapper commandRequest = builder.undoRecurringAccountTransaction(recurringDepositAccountId, transactionId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
} else if (is(commandParam, DepositsApiConstants.COMMAND_ADJUST_TRANSACTION)) { } else if (is(commandParam, DepositsApiConstants.COMMAND_ADJUST_TRANSACTION)) {
final CommandWrapper commandRequest = builder.adjustRecurringAccountTransaction(recurringDepositAccountId, transactionId).build(); final CommandWrapper commandRequest = builder.adjustRecurringAccountTransaction(recurringDepositAccountId, transactionId)
.build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
} }
@@ -82,7 +82,8 @@ public class SavingsAccountTransactionsApiResource {
// FIXME - KW - for now just send back generic default information for // FIXME - KW - for now just send back generic default information for
// both deposit/withdrawal templates // both deposit/withdrawal templates
SavingsAccountTransactionData savingsAccount = this.savingsAccountReadPlatformService.retrieveDepositTransactionTemplate(savingsId, DepositAccountType.SAVINGS_DEPOSIT); SavingsAccountTransactionData savingsAccount = this.savingsAccountReadPlatformService.retrieveDepositTransactionTemplate(savingsId,
DepositAccountType.SAVINGS_DEPOSIT);
final Collection<CodeValueData> paymentTypeOptions = this.codeValueReadPlatformService final Collection<CodeValueData> paymentTypeOptions = this.codeValueReadPlatformService
.retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName); .retrieveCodeValuesByCode(PaymentDetailConstants.paymentTypeCodeName);
savingsAccount = SavingsAccountTransactionData.templateOnTop(savingsAccount, paymentTypeOptions); savingsAccount = SavingsAccountTransactionData.templateOnTop(savingsAccount, paymentTypeOptions);
@@ -248,21 +248,21 @@ public class SavingsAccountsApiResource {
} else if (is(commandParam, "close")) { } else if (is(commandParam, "close")) {
final CommandWrapper commandRequest = builder.closeSavingsAccountApplication(accountId).build(); final CommandWrapper commandRequest = builder.closeSavingsAccountApplication(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
}else if (is(commandParam, "assignFieldOfficer")) { } else if (is(commandParam, "assignFieldOfficer")) {
final CommandWrapper commandRequest = builder.assignFieldOfficer(accountId).build(); final CommandWrapper commandRequest = builder.assignFieldOfficer(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result); return this.toApiJsonSerializer.serialize(result);
} else if (is(commandParam, "unassignFieldOfficer")) { } else if (is(commandParam, "unassignFieldOfficer")) {
final CommandWrapper commandRequest = builder.unassignFieldOfficer(accountId).build(); final CommandWrapper commandRequest = builder.unassignFieldOfficer(accountId).build();
result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result); return this.toApiJsonSerializer.serialize(result);
} }
if (result == null) { if (result == null) {
// //
throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "reject", "withdrawnByApplicant", "approve", throw new UnrecognizedQueryParamException("command", commandParam,
"undoapproval", "activate", "calculateInterest", "postInterest", "close" ,"assignFieldOfficer" ,"unassignFieldOfficer"}); new Object[] { "reject", "withdrawnByApplicant", "approve", "undoapproval", "activate", "calculateInterest",
"postInterest", "close", "assignFieldOfficer", "unassignFieldOfficer" });
} }
return this.toApiJsonSerializer.serialize(result); return this.toApiJsonSerializer.serialize(result);
@@ -527,8 +527,10 @@ public class DepositAccountDataValidator {
private void validateRecurringDetailForSubmit(final JsonElement element, final DataValidatorBuilder baseDataValidator) { private void validateRecurringDetailForSubmit(final JsonElement element, final DataValidatorBuilder baseDataValidator) {
final BigDecimal mandatoryRecommendedDepositAmount = fromApiJsonHelper.extractBigDecimalWithLocaleNamed(mandatoryRecommendedDepositAmountParamName, element); final BigDecimal mandatoryRecommendedDepositAmount = fromApiJsonHelper.extractBigDecimalWithLocaleNamed(
baseDataValidator.reset().parameter(mandatoryRecommendedDepositAmountParamName).value(mandatoryRecommendedDepositAmount).notNull().positiveAmount(); mandatoryRecommendedDepositAmountParamName, element);
baseDataValidator.reset().parameter(mandatoryRecommendedDepositAmountParamName).value(mandatoryRecommendedDepositAmount).notNull()
.positiveAmount();
if (this.fromApiJsonHelper.parameterExists(isMandatoryDepositParamName, element)) { if (this.fromApiJsonHelper.parameterExists(isMandatoryDepositParamName, element)) {
final Boolean isMandatoryDeposit = this.fromApiJsonHelper.extractBooleanNamed(isMandatoryDepositParamName, element); final Boolean isMandatoryDeposit = this.fromApiJsonHelper.extractBooleanNamed(isMandatoryDepositParamName, element);
@@ -66,8 +66,8 @@ public class DepositAccountTransactionDataValidator {
DepositsApiConstants.DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS); DepositsApiConstants.DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS);
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType
.resource(depositAccountType.resourceName()); .resourceName());
final JsonElement element = command.parsedJson(); final JsonElement element = command.parsedJson();
@@ -80,8 +80,8 @@ public class DepositAccountTransactionDataValidator {
// Validate all string payment detail fields for max length // Validate all string payment detail fields for max length
final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element);
baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero();
final Set<String> paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, final Set<String> paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, checkNumberParamName,
checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); routingCodeParamName, receiptNumberParamName, bankNumberParamName));
for (final String paymentDetailParameterName : paymentDetailParameters) { for (final String paymentDetailParameterName : paymentDetailParameters) {
final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element);
baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull() baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull()
@@ -158,8 +158,12 @@ public class DepositAccountTransactionDataValidator {
final DepositAccountOnClosureType accountOnClosureType = DepositAccountOnClosureType.fromInt(onAccountClosureId); final DepositAccountOnClosureType accountOnClosureType = DepositAccountOnClosureType.fromInt(onAccountClosureId);
if (accountOnClosureType.isTransferToSavings()) { if (accountOnClosureType.isTransferToSavings()) {
final Long toSavingsAccountId = this.fromApiJsonHelper.extractLongNamed(toSavingsAccountIdParamName, element); final Long toSavingsAccountId = this.fromApiJsonHelper.extractLongNamed(toSavingsAccountIdParamName, element);
baseDataValidator.reset().parameter(toSavingsAccountIdParamName).value(toSavingsAccountId) baseDataValidator
.cantBeBlankWhenParameterProvidedIs(onAccountClosureIdParamName, DepositAccountOnClosureType.fromInt(onAccountClosureId).getCode()); .reset()
.parameter(toSavingsAccountIdParamName)
.value(toSavingsAccountId)
.cantBeBlankWhenParameterProvidedIs(onAccountClosureIdParamName,
DepositAccountOnClosureType.fromInt(onAccountClosureId).getCode());
} else if (accountOnClosureType.isReinvest() && isPreMatureClose) { } else if (accountOnClosureType.isReinvest() && isPreMatureClose) {
baseDataValidator.reset().parameter(onAccountClosureIdParamName).value(onAccountClosureId) baseDataValidator.reset().parameter(onAccountClosureIdParamName).value(onAccountClosureId)
.failWithCode("reinvest.not.allowed", "Re-Invest is not supported for account pre mature close"); .failWithCode("reinvest.not.allowed", "Re-Invest is not supported for account pre mature close");
@@ -169,8 +173,8 @@ public class DepositAccountTransactionDataValidator {
// Validate all string payment detail fields for max length // Validate all string payment detail fields for max length
final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element);
baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero();
final Set<String> paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, final Set<String> paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, checkNumberParamName,
checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); routingCodeParamName, receiptNumberParamName, bankNumberParamName));
for (final String paymentDetailParameterName : paymentDetailParameters) { for (final String paymentDetailParameterName : paymentDetailParameters) {
final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element);
baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull() baseDataValidator.reset().parameter(paymentDetailParameterName).value(paymentDetailParameterValue).ignoreIfNull()
@@ -390,6 +390,7 @@ public class SavingsAccountDataValidator {
} }
} }
public void validateForAssignFieldOfficer(final String json) { public void validateForAssignFieldOfficer(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
@@ -414,8 +415,8 @@ public class SavingsAccountDataValidator {
} }
public void validateForUnAssignFieldOfficer(final String json) { public void validateForUnAssignFieldOfficer(final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType(); final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
@@ -435,6 +436,5 @@ public class SavingsAccountDataValidator {
if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); }
}
}
} }
@@ -30,8 +30,10 @@ public class SavingsAccountTransactionDTO {
this.createdDate = createdDate; this.createdDate = createdDate;
this.savingsAccountId = null; this.savingsAccountId = null;
} }
/** This constructor is used for bulk deposit transactions /**
* This constructor is used for bulk deposit transactions
*
* @param formatter * @param formatter
* @param transactionDate * @param transactionDate
* @param transactionAmount * @param transactionAmount
@@ -49,8 +51,6 @@ public class SavingsAccountTransactionDTO {
this.savingsAccountId = savingsAccountId; this.savingsAccountId = savingsAccountId;
} }
public DateTimeFormatter getFormatter() { public DateTimeFormatter getFormatter() {
return this.formatter; return this.formatter;
} }
@@ -70,9 +70,9 @@ public class SavingsAccountTransactionDTO {
public Date getCreatedDate() { public Date getCreatedDate() {
return this.createdDate; return this.createdDate;
} }
public Long getSavingsAccountId() { public Long getSavingsAccountId() {
return this.savingsAccountId; return this.savingsAccountId;
} }
} }
@@ -87,7 +87,8 @@ public class SavingsAccountTransactionData {
this.paymentTypeOptions = paymentTypeOptions; this.paymentTypeOptions = paymentTypeOptions;
} }
public static SavingsAccountTransactionData withWithDrawalTransactionDetails(final SavingsAccountTransactionData savingsAccountTransactionData) { public static SavingsAccountTransactionData withWithDrawalTransactionDetails(
final SavingsAccountTransactionData savingsAccountTransactionData) {
final LocalDate currentDate = DateUtils.getLocalDateOfTenant(); final LocalDate currentDate = DateUtils.getLocalDateOfTenant();
final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations
@@ -72,7 +72,7 @@ public class SavingsAccountTransactionDataValidator {
final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(transactionAmountParamName, element); final BigDecimal transactionAmount = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(transactionAmountParamName, element);
baseDataValidator.reset().parameter(transactionAmountParamName).value(transactionAmount).notNull().positiveAmount(); baseDataValidator.reset().parameter(transactionAmountParamName).value(transactionAmount).notNull().positiveAmount();
validatePaymentTypeDetails(baseDataValidator, element); validatePaymentTypeDetails(baseDataValidator, element);
throwExceptionIfValidationWarningsExist(dataValidationErrors); throwExceptionIfValidationWarningsExist(dataValidationErrors);
@@ -64,7 +64,7 @@ public class DepositRecurringDetail {
actualChanges.put(allowWithdrawalParamName, newValue); actualChanges.put(allowWithdrawalParamName, newValue);
this.allowWithdrawal = newValue; this.allowWithdrawal = newValue;
} }
if (command.isChangeInBooleanParameterNamed(adjustAdvanceTowardsFuturePaymentsParamName, this.adjustAdvanceTowardsFuturePayments)) { if (command.isChangeInBooleanParameterNamed(adjustAdvanceTowardsFuturePaymentsParamName, this.adjustAdvanceTowardsFuturePayments)) {
final boolean newValue = command.booleanObjectValueOfParameterNamed(adjustAdvanceTowardsFuturePaymentsParamName); final boolean newValue = command.booleanObjectValueOfParameterNamed(adjustAdvanceTowardsFuturePaymentsParamName);
actualChanges.put(adjustAdvanceTowardsFuturePaymentsParamName, newValue); actualChanges.put(adjustAdvanceTowardsFuturePaymentsParamName, newValue);
@@ -73,15 +73,15 @@ public class DepositRecurringDetail {
return actualChanges; return actualChanges;
} }
public boolean isMandatoryDeposit() { public boolean isMandatoryDeposit() {
return this.isMandatoryDeposit; return this.isMandatoryDeposit;
} }
public boolean allowWithdrawal() { public boolean allowWithdrawal() {
return this.allowWithdrawal; return this.allowWithdrawal;
} }
public boolean adjustAdvanceTowardsFuturePayments() { public boolean adjustAdvanceTowardsFuturePayments() {
return this.adjustAdvanceTowardsFuturePayments; return this.adjustAdvanceTowardsFuturePayments;
} }
@@ -8,7 +8,7 @@ package org.mifosplatform.portfolio.savings.domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface FixedDepositAccountRepository extends JpaRepository<FixedDepositAccount, Long>, JpaSpecificationExecutor<FixedDepositAccount> { public interface FixedDepositAccountRepository extends JpaRepository<FixedDepositAccount, Long>,
JpaSpecificationExecutor<FixedDepositAccount> {
} }
@@ -75,7 +75,8 @@ public class FixedDepositProduct extends SavingsProduct {
final SavingsPostingInterestPeriodType interestPostingPeriodType, final SavingsInterestCalculationType interestCalculationType, final SavingsPostingInterestPeriodType interestPostingPeriodType, final SavingsInterestCalculationType interestCalculationType,
final SavingsInterestCalculationDaysInYearType interestCalculationDaysInYearType, final Integer lockinPeriodFrequency, final SavingsInterestCalculationDaysInYearType interestCalculationDaysInYearType, final Integer lockinPeriodFrequency,
final SavingsPeriodFrequencyType lockinPeriodFrequencyType, final AccountingRuleType accountingRuleType, final SavingsPeriodFrequencyType lockinPeriodFrequencyType, final AccountingRuleType accountingRuleType,
final Set<Charge> charges, final DepositProductTermAndPreClosure productTermAndPreClosure, final Set<InterestRateChart> charts, BigDecimal minBalanceForInterestCalculation) { final Set<Charge> charges, final DepositProductTermAndPreClosure productTermAndPreClosure, final Set<InterestRateChart> charts,
BigDecimal minBalanceForInterestCalculation) {
final BigDecimal minRequiredOpeningBalance = null; final BigDecimal minRequiredOpeningBalance = null;
final boolean withdrawalFeeApplicableForTransfer = false; final boolean withdrawalFeeApplicableForTransfer = false;
@@ -8,6 +8,7 @@ package org.mifosplatform.portfolio.savings.domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface FixedDepositProductRepository extends JpaRepository<FixedDepositProduct, Long>, JpaSpecificationExecutor<FixedDepositProduct> { public interface FixedDepositProductRepository extends JpaRepository<FixedDepositProduct, Long>,
JpaSpecificationExecutor<FixedDepositProduct> {
} }
@@ -8,6 +8,7 @@ package org.mifosplatform.portfolio.savings.domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface RecurringDepositAccountRepository extends JpaRepository<RecurringDepositAccount, Long>, JpaSpecificationExecutor<RecurringDepositAccount> { public interface RecurringDepositAccountRepository extends JpaRepository<RecurringDepositAccount, Long>,
JpaSpecificationExecutor<RecurringDepositAccount> {
} }
@@ -8,6 +8,7 @@ package org.mifosplatform.portfolio.savings.domain;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface RecurringDepositProductRepository extends JpaRepository<RecurringDepositProduct, Long>, JpaSpecificationExecutor<RecurringDepositProduct> { public interface RecurringDepositProductRepository extends JpaRepository<RecurringDepositProduct, Long>,
JpaSpecificationExecutor<RecurringDepositProduct> {
// //
} }
@@ -160,7 +160,7 @@ public class RecurringDepositScheduleInstallment extends AbstractAuditableCustom
public LocalDate dueDate() { public LocalDate dueDate() {
return (this.dueDate == null) ? null : new LocalDate(this.dueDate); return (this.dueDate == null) ? null : new LocalDate(this.dueDate);
} }
public Money payInstallment(final LocalDate transactionDate, final Money transactionAmountRemaining) { public Money payInstallment(final LocalDate transactionDate, final Money transactionAmountRemaining) {
final MonetaryCurrency currency = transactionAmountRemaining.getCurrency(); final MonetaryCurrency currency = transactionAmountRemaining.getCurrency();
@@ -183,18 +183,18 @@ public class RecurringDepositScheduleInstallment extends AbstractAuditableCustom
return depositAmountPortionOfTransaction; return depositAmountPortionOfTransaction;
} }
private void checkIfInstallmentObligationsAreMet(final LocalDate transactionDate, final MonetaryCurrency currency) { private void checkIfInstallmentObligationsAreMet(final LocalDate transactionDate, final MonetaryCurrency currency) {
this.obligationsMet = getTotalOutstanding(currency).isZero(); this.obligationsMet = getTotalOutstanding(currency).isZero();
if (this.obligationsMet) { if (this.obligationsMet) {
this.obligationsMetOnDate = transactionDate.toDate(); this.obligationsMetOnDate = transactionDate.toDate();
} }
} }
public Money getTotalOutstanding(final MonetaryCurrency currency) { public Money getTotalOutstanding(final MonetaryCurrency currency) {
return getDepositAmountOutstanding(currency); return getDepositAmountOutstanding(currency);
} }
private void trackAdvanceAndLateTotalsForInstallment(final LocalDate transactionDate, final MonetaryCurrency currency, private void trackAdvanceAndLateTotalsForInstallment(final LocalDate transactionDate, final MonetaryCurrency currency,
final Money amountPaidInInstallment) { final Money amountPaidInInstallment) {
if (isInAdvance(transactionDate)) { if (isInAdvance(transactionDate)) {
@@ -203,7 +203,7 @@ public class RecurringDepositScheduleInstallment extends AbstractAuditableCustom
this.totalPaidLate = asMoney(this.totalPaidLate, currency).plus(amountPaidInInstallment).getAmount(); this.totalPaidLate = asMoney(this.totalPaidLate, currency).plus(amountPaidInInstallment).getAmount();
} }
} }
private boolean isInAdvance(final LocalDate transactionDate) { private boolean isInAdvance(final LocalDate transactionDate) {
return transactionDate.isBefore(dueDate()); return transactionDate.isBefore(dueDate());
} }
@@ -211,12 +211,12 @@ public class RecurringDepositScheduleInstallment extends AbstractAuditableCustom
private boolean isLatePayment(final LocalDate transactionDate) { private boolean isLatePayment(final LocalDate transactionDate) {
return transactionDate.isAfter(dueDate()); return transactionDate.isAfter(dueDate());
} }
private Money asMoney(final BigDecimal decimal, final MonetaryCurrency currency) { private Money asMoney(final BigDecimal decimal, final MonetaryCurrency currency) {
return Money.of(currency, decimal); return Money.of(currency, decimal);
} }
public void resetDerivedFields(){ public void resetDerivedFields() {
this.depositAmountCompleted = null; this.depositAmountCompleted = null;
this.totalPaidInAdvance = null; this.totalPaidInAdvance = null;
this.totalPaidLate = null; this.totalPaidLate = null;
@@ -246,7 +246,7 @@ public class SavingsAccount extends AbstractPersistable<Long> {
@Column(name = "min_required_balance", scale = 6, precision = 19, nullable = true) @Column(name = "min_required_balance", scale = 6, precision = 19, nullable = true)
private BigDecimal minRequiredBalance; private BigDecimal minRequiredBalance;
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "start_interest_calculation_date") @Column(name = "start_interest_calculation_date")
protected Date startInterestCalculationDate; protected Date startInterestCalculationDate;
@@ -472,21 +472,21 @@ public class SavingsAccount extends AbstractPersistable<Long> {
return postingTransation; return postingTransation;
} }
//Determine the last transaction for given day
protected SavingsAccountTransaction findLastTransaction(final LocalDate date) {
SavingsAccountTransaction savingsTransaction = null; // Determine the last transaction for given day
protected SavingsAccountTransaction findLastTransaction(final LocalDate date) {
for (final SavingsAccountTransaction transaction : this.transactions) { SavingsAccountTransaction savingsTransaction = null;
if (transaction.isNotReversed() && transaction.occursOn(date)) {
savingsTransaction = transaction;
break;
}
}
return savingsTransaction; for (final SavingsAccountTransaction transaction : this.transactions) {
} if (transaction.isNotReversed() && transaction.occursOn(date)) {
savingsTransaction = transaction;
break;
}
}
return savingsTransaction;
}
/** /**
* All interest calculation based on END-OF-DAY-BALANCE. * All interest calculation based on END-OF-DAY-BALANCE.
@@ -529,42 +529,34 @@ public class SavingsAccount extends AbstractPersistable<Long> {
final SavingsInterestCalculationDaysInYearType daysInYearType = SavingsInterestCalculationDaysInYearType final SavingsInterestCalculationDaysInYearType daysInYearType = SavingsInterestCalculationDaysInYearType
.fromInt(this.interestCalculationDaysInYearType); .fromInt(this.interestCalculationDaysInYearType);
final List<LocalDateInterval> postingPeriodIntervals = this.savingsHelper.determineInterestPostingPeriods(getStartInterestCalculationDate(), final List<LocalDateInterval> postingPeriodIntervals = this.savingsHelper.determineInterestPostingPeriods(
upToInterestCalculationDate, postingPeriodType); getStartInterestCalculationDate(), upToInterestCalculationDate, postingPeriodType);
final List<PostingPeriod> allPostingPeriods = new ArrayList<>(); final List<PostingPeriod> allPostingPeriods = new ArrayList<>();
Money periodStartingBalance;
if (this.startInterestCalculationDate != null) {
LocalDate startInterestCalculationDate = new LocalDate(
this.startInterestCalculationDate);
final SavingsAccountTransaction transaction = findLastTransaction(startInterestCalculationDate);
if (transaction == null) { Money periodStartingBalance;
final String defaultUserMessage = "No transactions were found on the specified date " if (this.startInterestCalculationDate != null) {
+ getStartInterestCalculationDate().toString() LocalDate startInterestCalculationDate = new LocalDate(this.startInterestCalculationDate);
+ " for account number " final SavingsAccountTransaction transaction = findLastTransaction(startInterestCalculationDate);
+ this.accountNumber.toString()
+ " and resource id "
+ getId();
final ApiParameterError error = ApiParameterError if (transaction == null) {
.parameterError( final String defaultUserMessage = "No transactions were found on the specified date "
"error.msg.savingsaccount.transaction.incorrect.start.interest.calculation.date", + getStartInterestCalculationDate().toString() + " for account number " + this.accountNumber.toString()
defaultUserMessage, "transactionDate", + " and resource id " + getId();
getStartInterestCalculationDate().toString());
final List<ApiParameterError> dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError(
dataValidationErrors.add(error); "error.msg.savingsaccount.transaction.incorrect.start.interest.calculation.date", defaultUserMessage,
"transactionDate", getStartInterestCalculationDate().toString());
throw new PlatformApiDataValidationException( final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
dataValidationErrors); dataValidationErrors.add(error);
}
periodStartingBalance = transaction throw new PlatformApiDataValidationException(dataValidationErrors);
.getRunningBalance(this.currency); }
} else
periodStartingBalance = Money.zero(this.currency); periodStartingBalance = transaction.getRunningBalance(this.currency);
} else
periodStartingBalance = Money.zero(this.currency);
final SavingsInterestCalculationType interestCalculationType = SavingsInterestCalculationType.fromInt(this.interestCalculationType); final SavingsInterestCalculationType interestCalculationType = SavingsInterestCalculationType.fromInt(this.interestCalculationType);
final BigDecimal interestRateAsFraction = getEffectiveInterestRateAsFraction(mc, upToInterestCalculationDate); final BigDecimal interestRateAsFraction = getEffectiveInterestRateAsFraction(mc, upToInterestCalculationDate);
@@ -749,18 +741,17 @@ public class SavingsAccount extends AbstractPersistable<Long> {
} }
return activationLocalDate; return activationLocalDate;
} }
//startInterestCalculationDate is set during migration so that there is no // startInterestCalculationDate is set during migration so that there is no
//interference with interest posting of previous system // interference with interest posting of previous system
public LocalDate getStartInterestCalculationDate() { public LocalDate getStartInterestCalculationDate() {
LocalDate startInterestCalculationLocalDate = null; LocalDate startInterestCalculationLocalDate = null;
if (this.startInterestCalculationDate != null) { if (this.startInterestCalculationDate != null) {
startInterestCalculationLocalDate = new LocalDate( startInterestCalculationLocalDate = new LocalDate(this.startInterestCalculationDate);
this.startInterestCalculationDate); } else
} else startInterestCalculationLocalDate = getActivationLocalDate();
startInterestCalculationLocalDate = getActivationLocalDate(); return startInterestCalculationLocalDate;
return startInterestCalculationLocalDate; }
}
public SavingsAccountTransaction withdraw(final SavingsAccountTransactionDTO transactionDTO, final boolean applyWithdrawFee) { public SavingsAccountTransaction withdraw(final SavingsAccountTransactionDTO transactionDTO, final boolean applyWithdrawFee) {
@@ -104,7 +104,7 @@ public class SavingsAccountCharge extends AbstractPersistable<Long> {
@Column(name = "is_active", nullable = false) @Column(name = "is_active", nullable = false)
private boolean status = true; private boolean status = true;
@Temporal(TemporalType.DATE) @Temporal(TemporalType.DATE)
@Column(name = "inactivated_on_date") @Column(name = "inactivated_on_date")
private Date inactivationDate; private Date inactivationDate;
@@ -28,7 +28,8 @@ public interface SavingsAccountRepository extends JpaRepository<SavingsAccount,
@Query("from SavingsAccount sa where sa.client.id is null and sa.group.id = :groupId") @Query("from SavingsAccount sa where sa.client.id is null and sa.group.id = :groupId")
List<SavingsAccount> findByGroupId(@Param("groupId") Long groupId); List<SavingsAccount> findByGroupId(@Param("groupId") Long groupId);
@Query("from SavingsAccount sa where sa.id = :accountId and sa.depositType = :depositAccountTypeId") @Query("from SavingsAccount sa where sa.id = :accountId and sa.depositType = :depositAccountTypeId")
SavingsAccount findByIdAndDepositAccountType(@Param("accountId") Long accountId, @Param("depositAccountTypeId") Integer depositAccountTypeId); SavingsAccount findByIdAndDepositAccountType(@Param("accountId") Long accountId,
@Param("depositAccountTypeId") Integer depositAccountTypeId);
} }
@@ -37,7 +37,7 @@ public class SavingsAccountRepositoryWrapper {
if (account == null) { throw new SavingsAccountNotFoundException(savingsId); } if (account == null) { throw new SavingsAccountNotFoundException(savingsId); }
return account; return account;
} }
public SavingsAccount findOneWithNotFoundDetection(final Long savingsId, final DepositAccountType depositAccountType) { public SavingsAccount findOneWithNotFoundDetection(final Long savingsId, final DepositAccountType depositAccountType) {
final SavingsAccount account = this.repository.findByIdAndDepositAccountType(savingsId, depositAccountType.getValue()); final SavingsAccount account = this.repository.findByIdAndDepositAccountType(savingsId, depositAccountType.getValue());
if (account == null) { throw new SavingsAccountNotFoundException(savingsId); } if (account == null) { throw new SavingsAccountNotFoundException(savingsId); }
@@ -18,10 +18,8 @@ public enum SavingsAccountStatusType {
TRANSFER_ON_HOLD(304, "savingsAccountStatusType.transfer.on.hold"), // TRANSFER_ON_HOLD(304, "savingsAccountStatusType.transfer.on.hold"), //
WITHDRAWN_BY_APPLICANT(400, "savingsAccountStatusType.withdrawn.by.applicant"), // WITHDRAWN_BY_APPLICANT(400, "savingsAccountStatusType.withdrawn.by.applicant"), //
REJECTED(500, "savingsAccountStatusType.rejected"), // REJECTED(500, "savingsAccountStatusType.rejected"), //
CLOSED(600, "savingsAccountStatusType.closed"), CLOSED(600, "savingsAccountStatusType.closed"), PRE_MATURE_CLOSURE(700, "savingsAccountStatusType.pre.mature.closure"), MATURED(800,
PRE_MATURE_CLOSURE(700, "savingsAccountStatusType.pre.mature.closure"), "savingsAccountStatusType.matured");
MATURED(800, "savingsAccountStatusType.matured");
private final Integer value; private final Integer value;
private final String code; private final String code;
@@ -100,7 +98,7 @@ public enum SavingsAccountStatusType {
public boolean isActive() { public boolean isActive() {
return this.value.equals(SavingsAccountStatusType.ACTIVE.getValue()); return this.value.equals(SavingsAccountStatusType.ACTIVE.getValue());
} }
public boolean isActiveOrAwaitingApprovalOrDisbursal() { public boolean isActiveOrAwaitingApprovalOrDisbursal() {
return isApproved() || isSubmittedAndPendingApproval() || isActive(); return isApproved() || isSubmittedAndPendingApproval() || isActive();
} }
@@ -120,11 +118,11 @@ public enum SavingsAccountStatusType {
public boolean isUnderTransfer() { public boolean isUnderTransfer() {
return isTransferInProgress() || isTransferOnHold(); return isTransferInProgress() || isTransferOnHold();
} }
public boolean isMatured() { public boolean isMatured() {
return this.value.equals(SavingsAccountStatusType.MATURED.getValue()); return this.value.equals(SavingsAccountStatusType.MATURED.getValue());
} }
public boolean isPreMatureClosure() { public boolean isPreMatureClosure() {
return this.value.equals(SavingsAccountStatusType.PRE_MATURE_CLOSURE.getValue()); return this.value.equals(SavingsAccountStatusType.PRE_MATURE_CLOSURE.getValue());
} }
@@ -216,9 +216,9 @@ public final class SavingsAccountTransaction extends AbstractPersistable<Long> {
public Money getAmount(final MonetaryCurrency currency) { public Money getAmount(final MonetaryCurrency currency) {
return Money.of(currency, this.amount); return Money.of(currency, this.amount);
} }
public Money getRunningBalance(final MonetaryCurrency currency) { public Money getRunningBalance(final MonetaryCurrency currency) {
return Money.of(currency, this.runningBalance); return Money.of(currency, this.runningBalance);
} }
public boolean isDeposit() { public boolean isDeposit() {
@@ -10,6 +10,7 @@ import org.mifosplatform.infrastructure.core.exception.AbstractPlatformResourceN
public class DepositAccountInterestRateChartNotFoundException extends AbstractPlatformResourceNotFoundException { public class DepositAccountInterestRateChartNotFoundException extends AbstractPlatformResourceNotFoundException {
public DepositAccountInterestRateChartNotFoundException(final Long id) { public DepositAccountInterestRateChartNotFoundException(final Long id) {
super("error.msg.deposit.account.interest.rate.chart.id.invalid", "Deposit Account Interest rate chart with identifier " + id + " does not exist", id); super("error.msg.deposit.account.interest.rate.chart.id.invalid", "Deposit Account Interest rate chart with identifier " + id
+ " does not exist", id);
} }
} }
@@ -16,7 +16,7 @@ import org.mifosplatform.portfolio.savings.service.SavingsEnumerations;
public class DepositAccountTransactionNotAllowedException extends AbstractPlatformServiceUnavailableException { public class DepositAccountTransactionNotAllowedException extends AbstractPlatformServiceUnavailableException {
public DepositAccountTransactionNotAllowedException(final Long accountId, final String action, final DepositAccountType type) { public DepositAccountTransactionNotAllowedException(final Long accountId, final String action, final DepositAccountType type) {
super("error.msg." + type.resourceName() + ".account.trasaction." + action + ".notallowed", SavingsEnumerations.depositType(type).getValue() super("error.msg." + type.resourceName() + ".account.trasaction." + action + ".notallowed", SavingsEnumerations.depositType(type)
+ "account " + action + " transaction not allowed with account identifier " + accountId, accountId); .getValue() + "account " + action + " transaction not allowed with account identifier " + accountId, accountId);
} }
} }
@@ -10,8 +10,8 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class AssignFieldOfficerSavingsAccountCommandHandler implements NewCommandSourceHandler { public class AssignFieldOfficerSavingsAccountCommandHandler implements NewCommandSourceHandler {
private final SavingsAccountWritePlatformService savingsWritePlatformService; private final SavingsAccountWritePlatformService savingsWritePlatformService;
@Autowired @Autowired
public AssignFieldOfficerSavingsAccountCommandHandler(final SavingsAccountWritePlatformService savingAccountWritePlatformService) { public AssignFieldOfficerSavingsAccountCommandHandler(final SavingsAccountWritePlatformService savingAccountWritePlatformService) {
@@ -20,7 +20,8 @@ public class CalculateInterestRecurringDepositAccountCommandHandler implements N
private final DepositAccountWritePlatformService depositAccountWritePlatformService; private final DepositAccountWritePlatformService depositAccountWritePlatformService;
@Autowired @Autowired
public CalculateInterestRecurringDepositAccountCommandHandler(final DepositAccountWritePlatformService depositAccountWritePlatformService) { public CalculateInterestRecurringDepositAccountCommandHandler(
final DepositAccountWritePlatformService depositAccountWritePlatformService) {
this.depositAccountWritePlatformService = depositAccountWritePlatformService; this.depositAccountWritePlatformService = depositAccountWritePlatformService;
} }
@@ -28,6 +28,7 @@ public class FixedDepositAccountApplicationApprovalUndoCommandHandler implements
@Transactional @Transactional
@Override @Override
public CommandProcessingResult processCommand(final JsonCommand command) { public CommandProcessingResult processCommand(final JsonCommand command) {
return this.depositAccountWritePlatformService.undoApplicationApproval(command.entityId(), command, DepositAccountType.FIXED_DEPOSIT); return this.depositAccountWritePlatformService.undoApplicationApproval(command.entityId(), command,
DepositAccountType.FIXED_DEPOSIT);
} }
} }
@@ -28,6 +28,7 @@ public class RecurringDepositAccountApplicationApprovalCommandHandler implements
@Transactional @Transactional
@Override @Override
public CommandProcessingResult processCommand(final JsonCommand command) { public CommandProcessingResult processCommand(final JsonCommand command) {
return this.depositAccountWritePlatformService.approveApplication(command.entityId(), command, DepositAccountType.RECURRING_DEPOSIT); return this.depositAccountWritePlatformService
.approveApplication(command.entityId(), command, DepositAccountType.RECURRING_DEPOSIT);
} }
} }
@@ -28,6 +28,7 @@ public class RecurringDepositAccountApplicationApprovalUndoCommandHandler implem
@Transactional @Transactional
@Override @Override
public CommandProcessingResult processCommand(final JsonCommand command) { public CommandProcessingResult processCommand(final JsonCommand command) {
return this.depositAccountWritePlatformService.undoApplicationApproval(command.entityId(), command, DepositAccountType.RECURRING_DEPOSIT); return this.depositAccountWritePlatformService.undoApplicationApproval(command.entityId(), command,
DepositAccountType.RECURRING_DEPOSIT);
} }
} }
@@ -10,8 +10,8 @@ import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class UnassignFieldOfficerSavingsAccountCommandHandler implements NewCommandSourceHandler { public class UnassignFieldOfficerSavingsAccountCommandHandler implements NewCommandSourceHandler {
private final SavingsAccountWritePlatformService savingsWritePlatformService; private final SavingsAccountWritePlatformService savingsWritePlatformService;
@Autowired @Autowired
public UnassignFieldOfficerSavingsAccountCommandHandler(final SavingsAccountWritePlatformService savingAccountWritePlatformService) { public UnassignFieldOfficerSavingsAccountCommandHandler(final SavingsAccountWritePlatformService savingAccountWritePlatformService) {
@@ -8,14 +8,14 @@ package org.mifosplatform.portfolio.savings.service;
import org.mifosplatform.portfolio.savings.data.DepositAccountInterestRateChartData; import org.mifosplatform.portfolio.savings.data.DepositAccountInterestRateChartData;
public interface DepositAccountInterestRateChartReadPlatformService { public interface DepositAccountInterestRateChartReadPlatformService {
DepositAccountInterestRateChartData retrieveOne(Long interestChartId); DepositAccountInterestRateChartData retrieveOne(Long interestChartId);
DepositAccountInterestRateChartData retrieveOneWithSlabs(Long interestChartId); DepositAccountInterestRateChartData retrieveOneWithSlabs(Long interestChartId);
DepositAccountInterestRateChartData retrieveWithTemplate(DepositAccountInterestRateChartData DepositAccountInterestRateChartData); DepositAccountInterestRateChartData retrieveWithTemplate(DepositAccountInterestRateChartData DepositAccountInterestRateChartData);
DepositAccountInterestRateChartData retrieveOneWithSlabsOnAccountId(Long accountId); DepositAccountInterestRateChartData retrieveOneWithSlabsOnAccountId(Long accountId);
DepositAccountInterestRateChartData template(); DepositAccountInterestRateChartData template();
} }
@@ -17,23 +17,24 @@ import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionData;
public interface DepositAccountReadPlatformService { public interface DepositAccountReadPlatformService {
Collection<DepositAccountData> retrieveAll(final DepositAccountType depositAccountType, final PaginationParameters paginationParameters); Collection<DepositAccountData> retrieveAll(final DepositAccountType depositAccountType, final PaginationParameters paginationParameters);
Page<DepositAccountData> retrieveAllPaged(final DepositAccountType depositAccountType, final PaginationParameters paginationParameters); Page<DepositAccountData> retrieveAllPaged(final DepositAccountType depositAccountType, final PaginationParameters paginationParameters);
Collection<DepositAccountData> retrieveAllForLookup(final DepositAccountType depositAccountType); Collection<DepositAccountData> retrieveAllForLookup(final DepositAccountType depositAccountType);
DepositAccountData retrieveOne(final DepositAccountType depositAccountType, Long accountId); DepositAccountData retrieveOne(final DepositAccountType depositAccountType, Long accountId);
DepositAccountData retrieveOneWithClosureTemplate(final DepositAccountType depositAccountType, Long accountId); DepositAccountData retrieveOneWithClosureTemplate(final DepositAccountType depositAccountType, Long accountId);
DepositAccountData retrieveOneWithChartSlabs(final DepositAccountType depositAccountType, Long productId); DepositAccountData retrieveOneWithChartSlabs(final DepositAccountType depositAccountType, Long productId);
Collection<SavingsAccountTransactionData> retrieveAllTransactions(final DepositAccountType depositAccountType, Long accountId); Collection<SavingsAccountTransactionData> retrieveAllTransactions(final DepositAccountType depositAccountType, Long accountId);
DepositAccountData retrieveTemplate(final DepositAccountType depositAccountType, Long clientId, Long groupId, Long productId, boolean staffInSelectedOfficeOnly); DepositAccountData retrieveTemplate(final DepositAccountType depositAccountType, Long clientId, Long groupId, Long productId,
boolean staffInSelectedOfficeOnly);
Collection<DepositAccountData> retrieveForMaturityUpdate(); Collection<DepositAccountData> retrieveForMaturityUpdate();
SavingsAccountTransactionData retrieveRecurringAccountDepositTransactionTemplate(final Long accountId); SavingsAccountTransactionData retrieveRecurringAccountDepositTransactionTemplate(final Long accountId);
Collection<AccountTransferDTO> retrieveDataForInterestTransfer(); Collection<AccountTransferDTO> retrieveDataForInterestTransfer();
@@ -1366,7 +1366,8 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead
.transactionType(SavingsAccountTransactionType.DEPOSIT.getValue()); .transactionType(SavingsAccountTransactionType.DEPOSIT.getValue());
final PaymentDetailData paymentDetailData = null; final PaymentDetailData paymentDetailData = null;
final AccountTransferData transfer = null; final AccountTransferData transfer = null;
final BigDecimal runningBalance = JdbcSupport.getBigDecimalDefaultToNullIfZero(rs, "runningBalance");; final BigDecimal runningBalance = JdbcSupport.getBigDecimalDefaultToNullIfZero(rs, "runningBalance");
;
return SavingsAccountTransactionData.create(savingsId, transactionType, paymentDetailData, savingsId, accountNo, duedate, return SavingsAccountTransactionData.create(savingsId, transactionType, paymentDetailData, savingsId, accountNo, duedate,
currency, dueamount, runningBalance, false, transfer); currency, dueamount, runningBalance, false, transfer);
} }
@@ -18,11 +18,11 @@ import org.mifosplatform.portfolio.savings.domain.SavingsAccountTransaction;
public interface DepositAccountWritePlatformService { public interface DepositAccountWritePlatformService {
CommandProcessingResult activateFDAccount(Long savingsId, JsonCommand command); CommandProcessingResult activateFDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult activateRDAccount(Long savingsId, JsonCommand command); CommandProcessingResult activateRDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult depositToFDAccount(Long savingsId, JsonCommand command); CommandProcessingResult depositToFDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult depositToRDAccount(Long savingsId, JsonCommand command); CommandProcessingResult depositToRDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult withdrawal(Long savingsId, JsonCommand command, final DepositAccountType depositAccountType); CommandProcessingResult withdrawal(Long savingsId, JsonCommand command, final DepositAccountType depositAccountType);
@@ -32,19 +32,19 @@ public interface DepositAccountWritePlatformService {
CommandProcessingResult postInterest(Long savingsId, final DepositAccountType depositAccountType); CommandProcessingResult postInterest(Long savingsId, final DepositAccountType depositAccountType);
CommandProcessingResult undoFDTransaction(Long savingsId, Long transactionId, boolean allowAccountTransferModification); CommandProcessingResult undoFDTransaction(Long savingsId, Long transactionId, boolean allowAccountTransferModification);
CommandProcessingResult undoRDTransaction(Long savingsId, Long transactionId, boolean allowAccountTransferModification); CommandProcessingResult undoRDTransaction(Long savingsId, Long transactionId, boolean allowAccountTransferModification);
CommandProcessingResult adjustFDTransaction(Long savingsId, Long transactionId, JsonCommand command); CommandProcessingResult adjustFDTransaction(Long savingsId, Long transactionId, JsonCommand command);
CommandProcessingResult adjustRDTransaction(Long savingsId, Long transactionId, JsonCommand command); CommandProcessingResult adjustRDTransaction(Long savingsId, Long transactionId, JsonCommand command);
CommandProcessingResult closeFDAccount(Long savingsId, JsonCommand command); CommandProcessingResult closeFDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult closeRDAccount(Long savingsId, JsonCommand command); CommandProcessingResult closeRDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult prematureCloseFDAccount(Long savingsId, JsonCommand command); CommandProcessingResult prematureCloseFDAccount(Long savingsId, JsonCommand command);
CommandProcessingResult prematureCloseRDAccount(Long savingsId, JsonCommand command); CommandProcessingResult prematureCloseRDAccount(Long savingsId, JsonCommand command);
SavingsAccountTransaction initiateSavingsTransfer(Long accountId, LocalDate transferDate, final DepositAccountType depositAccountType); SavingsAccountTransaction initiateSavingsTransfer(Long accountId, LocalDate transferDate, final DepositAccountType depositAccountType);
@@ -53,23 +53,26 @@ public interface DepositAccountWritePlatformService {
void rejectSavingsTransfer(Long accountId, final DepositAccountType depositAccountType); void rejectSavingsTransfer(Long accountId, final DepositAccountType depositAccountType);
SavingsAccountTransaction acceptSavingsTransfer(Long accountId, LocalDate transferDate, Office acceptedInOffice, Staff staff, final DepositAccountType depositAccountType); SavingsAccountTransaction acceptSavingsTransfer(Long accountId, LocalDate transferDate, Office acceptedInOffice, Staff staff,
final DepositAccountType depositAccountType);
CommandProcessingResult addSavingsAccountCharge(JsonCommand command, final DepositAccountType depositAccountType); CommandProcessingResult addSavingsAccountCharge(JsonCommand command, final DepositAccountType depositAccountType);
CommandProcessingResult updateSavingsAccountCharge(JsonCommand command, final DepositAccountType depositAccountType); CommandProcessingResult updateSavingsAccountCharge(JsonCommand command, final DepositAccountType depositAccountType);
CommandProcessingResult deleteSavingsAccountCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command, final DepositAccountType depositAccountType); CommandProcessingResult deleteSavingsAccountCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command,
final DepositAccountType depositAccountType);
CommandProcessingResult waiveCharge(Long savingsAccountId, Long savingsAccountChargeId, final DepositAccountType depositAccountType); CommandProcessingResult waiveCharge(Long savingsAccountId, Long savingsAccountChargeId, final DepositAccountType depositAccountType);
CommandProcessingResult payCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command, final DepositAccountType depositAccountType); CommandProcessingResult payCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command,
final DepositAccountType depositAccountType);
void applyChargeDue(final Long savingsAccountChargeId, final Long accountId, final DepositAccountType depositAccountType); void applyChargeDue(final Long savingsAccountChargeId, final Long accountId, final DepositAccountType depositAccountType);
void updateMaturityDetails(final Long depositAccountId, final DepositAccountType depositAccountType); void updateMaturityDetails(final Long depositAccountId, final DepositAccountType depositAccountType);
void transferInterestToSavings() throws JobExecutionException; void transferInterestToSavings() throws JobExecutionException;
SavingsAccountTransaction mandatorySavingsAccountDeposit(final SavingsAccountTransactionDTO accountTransactionDTO); SavingsAccountTransaction mandatorySavingsAccountDeposit(final SavingsAccountTransactionDTO accountTransactionDTO);
} }
@@ -12,11 +12,11 @@ import org.mifosplatform.portfolio.savings.DepositAccountType;
public interface DepositApplicationProcessWritePlatformService { public interface DepositApplicationProcessWritePlatformService {
CommandProcessingResult submitFDApplication(JsonCommand command); CommandProcessingResult submitFDApplication(JsonCommand command);
CommandProcessingResult submitRDApplication(JsonCommand command); CommandProcessingResult submitRDApplication(JsonCommand command);
CommandProcessingResult modifyFDApplication(Long accountId, JsonCommand command); CommandProcessingResult modifyFDApplication(Long accountId, JsonCommand command);
CommandProcessingResult modifyRDApplication(Long accountId, JsonCommand command); CommandProcessingResult modifyRDApplication(Long accountId, JsonCommand command);
CommandProcessingResult deleteApplication(Long accountId, DepositAccountType depositAccountType); CommandProcessingResult deleteApplication(Long accountId, DepositAccountType depositAccountType);
@@ -17,7 +17,7 @@ public interface DepositProductReadPlatformService {
Collection<DepositProductData> retrieveAllForLookup(final DepositAccountType depositAccountType); Collection<DepositProductData> retrieveAllForLookup(final DepositAccountType depositAccountType);
DepositProductData retrieveOne(final DepositAccountType depositAccountType, Long productId); DepositProductData retrieveOne(final DepositAccountType depositAccountType, Long productId);
DepositProductData retrieveOneWithChartSlabs(final DepositAccountType depositAccountType, Long productId); DepositProductData retrieveOneWithChartSlabs(final DepositAccountType depositAccountType, Long productId);
} }
@@ -15,10 +15,12 @@ public interface DepositsDropdownReadPlatformService {
Collection<EnumOptionData> retrievePreClosurePenalInterestOnTypeOptions(); Collection<EnumOptionData> retrievePreClosurePenalInterestOnTypeOptions();
/*Collection<EnumOptionData> retrieveDepositTermTypeOptions(); /*
* Collection<EnumOptionData> retrieveDepositTermTypeOptions();
Collection<EnumOptionData> retrieveInMultiplesOfDepositTermTypeOptions(); *
* Collection<EnumOptionData> retrieveInMultiplesOfDepositTermTypeOptions();
Collection<EnumOptionData> retrieveDepositPeriodFrequencyOptions();*/ *
* Collection<EnumOptionData> retrieveDepositPeriodFrequencyOptions();
*/
} }
@@ -13,25 +13,27 @@ import org.springframework.stereotype.Service;
@Service @Service
public class DepositsDropdownReadPlatformServiceImpl implements DepositsDropdownReadPlatformService { public class DepositsDropdownReadPlatformServiceImpl implements DepositsDropdownReadPlatformService {
@Override @Override
public Collection<EnumOptionData> retrievePreClosurePenalInterestOnTypeOptions() { public Collection<EnumOptionData> retrievePreClosurePenalInterestOnTypeOptions() {
return SavingsEnumerations.preClosurePenaltyInterestOnType(PreClosurePenalInterestOnType.values()); return SavingsEnumerations.preClosurePenaltyInterestOnType(PreClosurePenalInterestOnType.values());
} }
/*@Override /*
public Collection<EnumOptionData> retrieveDepositTermTypeOptions() { * @Override public Collection<EnumOptionData>
return SavingsEnumerations.recurringDepositFrequencyType(SavingsPeriodFrequencyType.values()); * retrieveDepositTermTypeOptions() { return
} * SavingsEnumerations.recurringDepositFrequencyType
* (SavingsPeriodFrequencyType.values()); }
@Override *
public Collection<EnumOptionData> retrieveDepositPeriodFrequencyOptions() { * @Override public Collection<EnumOptionData>
return SavingsEnumerations.depositPeriodFrequency(SavingsPeriodFrequencyType.values()); * retrieveDepositPeriodFrequencyOptions() { return
} * SavingsEnumerations.depositPeriodFrequency
* (SavingsPeriodFrequencyType.values()); }
*
* @Override public Collection<EnumOptionData>
* retrieveInMultiplesOfDepositTermTypeOptions() { return
* SavingsEnumerations
* .recurringDepositFrequencyType(SavingsPeriodFrequencyType.values()); }
*/
@Override
public Collection<EnumOptionData> retrieveInMultiplesOfDepositTermTypeOptions() {
return SavingsEnumerations.recurringDepositFrequencyType(SavingsPeriodFrequencyType.values());
}*/
} }
@@ -45,8 +45,7 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
@Autowired @Autowired
public FixedDepositProductWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, public FixedDepositProductWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
final FixedDepositProductRepository fixedDepositProductRepository, final FixedDepositProductRepository fixedDepositProductRepository, final DepositProductDataValidator fromApiJsonDataValidator,
final DepositProductDataValidator fromApiJsonDataValidator,
final DepositProductAssembler depositProductAssembler, final DepositProductAssembler depositProductAssembler,
final ProductToGLAccountMappingWritePlatformService accountMappingWritePlatformService, final ProductToGLAccountMappingWritePlatformService accountMappingWritePlatformService,
final InterestRateChartAssembler chartAssembler) { final InterestRateChartAssembler chartAssembler) {
@@ -71,7 +70,8 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
this.fixedDepositProductRepository.save(product); this.fixedDepositProductRepository.save(product);
// save accounting mappings // save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.FIXED_DEPOSIT); this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command,
DepositAccountType.FIXED_DEPOSIT);
return new CommandProcessingResultBuilder() // return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) // .withEntityId(product.getId()) //
@@ -93,12 +93,12 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
final FixedDepositProduct product = this.fixedDepositProductRepository.findOne(productId); final FixedDepositProduct product = this.fixedDepositProductRepository.findOne(productId);
if (product == null) { throw new FixedDepositProductNotFoundException(productId); } if (product == null) { throw new FixedDepositProductNotFoundException(productId); }
product.setHelpers(this.chartAssembler); product.setHelpers(this.chartAssembler);
final Map<String, Object> changes = product.update(command); final Map<String, Object> changes = product.update(command);
if (changes.containsKey(chargesParamName)) { if (changes.containsKey(chargesParamName)) {
final Set<Charge> savingsProductCharges = this.depositProductAssembler.assembleListOfSavingsProductCharges(command, final Set<Charge> savingsProductCharges = this.depositProductAssembler.assembleListOfSavingsProductCharges(command, product
product.currency().getCode()); .currency().getCode());
final boolean updated = product.update(savingsProductCharges); final boolean updated = product.update(savingsProductCharges);
if (!updated) { if (!updated) {
changes.remove(chargesParamName); changes.remove(chargesParamName);
@@ -108,7 +108,8 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
// accounting related changes // accounting related changes
final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName); final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName);
final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.FIXED_DEPOSIT); .updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(),
DepositAccountType.FIXED_DEPOSIT);
changes.putAll(accountingMappingChanges); changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) { if (!changes.isEmpty()) {
@@ -46,8 +46,7 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
@Autowired @Autowired
public RecurringDepositProductWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context, public RecurringDepositProductWritePlatformServiceJpaRepositoryImpl(final PlatformSecurityContext context,
final RecurringDepositProductRepository recurringDepositProductRepository, final RecurringDepositProductRepository recurringDepositProductRepository,
final DepositProductDataValidator fromApiJsonDataValidator, final DepositProductDataValidator fromApiJsonDataValidator, final DepositProductAssembler depositProductAssembler,
final DepositProductAssembler depositProductAssembler,
final ProductToGLAccountMappingWritePlatformService accountMappingWritePlatformService, final ProductToGLAccountMappingWritePlatformService accountMappingWritePlatformService,
final InterestRateChartAssembler chartAssembler) { final InterestRateChartAssembler chartAssembler) {
this.context = context; this.context = context;
@@ -71,7 +70,8 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
this.recurringDepositProductRepository.save(product); this.recurringDepositProductRepository.save(product);
// save accounting mappings // save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.RECURRING_DEPOSIT); this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command,
DepositAccountType.RECURRING_DEPOSIT);
return new CommandProcessingResultBuilder() // return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) // .withEntityId(product.getId()) //
@@ -93,12 +93,12 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
final RecurringDepositProduct product = this.recurringDepositProductRepository.findOne(productId); final RecurringDepositProduct product = this.recurringDepositProductRepository.findOne(productId);
if (product == null) { throw new RecurringDepositProductNotFoundException(productId); } if (product == null) { throw new RecurringDepositProductNotFoundException(productId); }
product.setHelpers(this.chartAssembler); product.setHelpers(this.chartAssembler);
final Map<String, Object> changes = product.update(command); final Map<String, Object> changes = product.update(command);
if (changes.containsKey(chargesParamName)) { if (changes.containsKey(chargesParamName)) {
final Set<Charge> savingsProductCharges = this.depositProductAssembler.assembleListOfSavingsProductCharges(command, final Set<Charge> savingsProductCharges = this.depositProductAssembler.assembleListOfSavingsProductCharges(command, product
product.currency().getCode()); .currency().getCode());
final boolean updated = product.update(savingsProductCharges); final boolean updated = product.update(savingsProductCharges);
if (!updated) { if (!updated) {
changes.remove(chargesParamName); changes.remove(chargesParamName);
@@ -108,7 +108,8 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
// accounting related changes // accounting related changes
final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName); final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName);
final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.RECURRING_DEPOSIT); .updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(),
DepositAccountType.RECURRING_DEPOSIT);
changes.putAll(accountingMappingChanges); changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) { if (!changes.isEmpty()) {
@@ -149,13 +150,13 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
if (realCause.getMessage().contains("sp_unq_name")) { if (realCause.getMessage().contains("sp_unq_name")) {
final String name = command.stringValueOfParameterNamed("name"); final String name = command.stringValueOfParameterNamed("name");
throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.name", "Recurring Deposit product with name `" + name throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.name", "Recurring Deposit product with name `"
+ "` already exists", "name", name); + name + "` already exists", "name", name);
} else if (realCause.getMessage().contains("sp_unq_short_name")) { } else if (realCause.getMessage().contains("sp_unq_short_name")) {
final String shortName = command.stringValueOfParameterNamed("shortName"); final String shortName = command.stringValueOfParameterNamed("shortName");
throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.short.name", "Recurring Deposit product with short name `" throw new PlatformDataIntegrityException("error.msg.product.savings.duplicate.short.name",
+ shortName + "` already exists", "shortName", shortName); "Recurring Deposit product with short name `" + shortName + "` already exists", "shortName", shortName);
} }
logAsErrorUnexpectedDataIntegrityException(dae); logAsErrorUnexpectedDataIntegrityException(dae);
@@ -18,7 +18,7 @@ public interface SavingsAccountReadPlatformService {
Page<SavingsAccountData> retrieveAll(SearchParameters searchParameters); Page<SavingsAccountData> retrieveAll(SearchParameters searchParameters);
Collection<SavingsAccountData> retrieveAllForLookup(Long clientId); Collection<SavingsAccountData> retrieveAllForLookup(Long clientId);
Collection<SavingsAccountData> retrieveActiveForLookup(Long clientId, DepositAccountType depositAccountType); Collection<SavingsAccountData> retrieveActiveForLookup(Long clientId, DepositAccountType depositAccountType);
SavingsAccountData retrieveOne(Long savingsId); SavingsAccountData retrieveOne(Long savingsId);
@@ -33,6 +33,6 @@ public interface SavingsAccountReadPlatformService {
// retrieveAccountsWithAnnualFeeDue(); // retrieveAccountsWithAnnualFeeDue();
SavingsAccountTransactionData retrieveSavingsTransaction(Long savingsId, Long transactionId, DepositAccountType depositAccountType); SavingsAccountTransactionData retrieveSavingsTransaction(Long savingsId, Long transactionId, DepositAccountType depositAccountType);
Collection<SavingsAccountData> retrieveForLookup(Long clientId,Boolean overdraft); Collection<SavingsAccountData> retrieveForLookup(Long clientId, Boolean overdraft);
} }
@@ -55,11 +55,11 @@ public interface SavingsAccountWritePlatformService {
CommandProcessingResult waiveCharge(Long savingsAccountId, Long savingsAccountChargeId); CommandProcessingResult waiveCharge(Long savingsAccountId, Long savingsAccountChargeId);
CommandProcessingResult payCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command); CommandProcessingResult payCharge(Long savingsAccountId, Long savingsAccountChargeId, JsonCommand command);
CommandProcessingResult inactivateCharge(Long savingsAccountId, Long savingsAccountChargeId); CommandProcessingResult inactivateCharge(Long savingsAccountId, Long savingsAccountChargeId);
CommandProcessingResult assignFieldOfficer(Long savingsAccountId, JsonCommand command); CommandProcessingResult assignFieldOfficer(Long savingsAccountId, JsonCommand command);
CommandProcessingResult unassignFieldOfficer(Long savingsAccountId, JsonCommand command); CommandProcessingResult unassignFieldOfficer(Long savingsAccountId, JsonCommand command);
void applyChargeDue(final Long savingsAccountChargeId, final Long accountId); void applyChargeDue(final Long savingsAccountChargeId, final Long accountId);
@@ -128,8 +128,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final ChargeRepositoryWrapper chargeRepository, final SavingsAccountChargeRepositoryWrapper savingsAccountChargeRepository, final ChargeRepositoryWrapper chargeRepository, final SavingsAccountChargeRepositoryWrapper savingsAccountChargeRepository,
final HolidayWritePlatformService holidayWritePlatformService, final HolidayWritePlatformService holidayWritePlatformService,
final WorkingDaysWritePlatformService workingDaysWritePlatformService, final WorkingDaysWritePlatformService workingDaysWritePlatformService,
final SavingsAccountDataValidator fromApiJsonDeserializer, final SavingsAccountDataValidator fromApiJsonDeserializer, final SavingsAccountRepositoryWrapper savingsRepository,
final SavingsAccountRepositoryWrapper savingsRepository,
final StaffRepositoryWrapper staffRepository) { final StaffRepositoryWrapper staffRepository) {
this.context = context; this.context = context;
this.savingAccountRepository = savingAccountRepository; this.savingAccountRepository = savingAccountRepository;
@@ -195,8 +194,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
boolean isRegularTransaction = false; boolean isRegularTransaction = false;
if (amountForDeposit.isGreaterThanZero()) { if (amountForDeposit.isGreaterThanZero()) {
boolean isAccountTransfer = false; boolean isAccountTransfer = false;
this.savingsAccountDomainService.handleDeposit(account, fmt, account.getActivationLocalDate(), this.savingsAccountDomainService.handleDeposit(account, fmt, account.getActivationLocalDate(), amountForDeposit.getAmount(),
amountForDeposit.getAmount(), null, isAccountTransfer, isRegularTransaction); null, isAccountTransfer, isRegularTransaction);
updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
} }
account.processAccountUponActivation(); account.processAccountUponActivation();
@@ -1022,10 +1021,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
return null; return null;
} }
@Override @Override
public CommandProcessingResult assignFieldOfficer(Long savingsAccountId, public CommandProcessingResult assignFieldOfficer(Long savingsAccountId, JsonCommand command) {
JsonCommand command) { this.context.authenticatedUser();
this.context.authenticatedUser();
final Map<String, Object> actualChanges = new LinkedHashMap<>(5); final Map<String, Object> actualChanges = new LinkedHashMap<>(5);
@@ -1037,7 +1035,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
final Long staffId = command.longValueOfParameterNamed(SavingsApiConstants.staffIdParamName); final Long staffId = command.longValueOfParameterNamed(SavingsApiConstants.staffIdParamName);
if (staffId != null) { if (staffId != null) {
staff = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(staffId, savingsForUpdate.office().getHierarchy()); staff = this.staffRepository.findByOfficeHierarchyWithNotFoundDetection(staffId, savingsForUpdate.office().getHierarchy());
savingsForUpdate.assignFieldOfficer(staff); savingsForUpdate.assignFieldOfficer(staff);
} }
@@ -1052,12 +1050,11 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
.withClientId(savingsAccountId) // .withClientId(savingsAccountId) //
.with(actualChanges) // .with(actualChanges) //
.build(); .build();
} }
@Override @Override
public CommandProcessingResult unassignFieldOfficer(Long savingsAccountId, public CommandProcessingResult unassignFieldOfficer(Long savingsAccountId, JsonCommand command) {
JsonCommand command) { this.context.authenticatedUser();
this.context.authenticatedUser();
final Map<String, Object> actualChanges = new LinkedHashMap<>(5); final Map<String, Object> actualChanges = new LinkedHashMap<>(5);
@@ -1071,7 +1068,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
presentStaffId = presentStaff.getId(); presentStaffId = presentStaff.getId();
final String staffIdParamName = SavingsApiConstants.staffIdParamName; final String staffIdParamName = SavingsApiConstants.staffIdParamName;
if (!command.isChangeInLongParameterNamed(staffIdParamName, presentStaffId)) { if (!command.isChangeInLongParameterNamed(staffIdParamName, presentStaffId)) {
savingsForUpdate.unassignFieldOfficer(); savingsForUpdate.unassignFieldOfficer();
} }
this.savingsRepository.saveAndFlush(savingsForUpdate); this.savingsRepository.saveAndFlush(savingsForUpdate);
@@ -1084,6 +1081,6 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi
.withClientId(savingsAccountId) // .withClientId(savingsAccountId) //
.with(actualChanges) // .with(actualChanges) //
.build(); .build();
} }
} }
@@ -45,7 +45,8 @@ public class SavingsDropdownReadPlatformServiceImpl implements SavingsDropdownRe
@Override @Override
public Collection<EnumOptionData> retrieveCompoundingInterestPeriodTypeOptions() { public Collection<EnumOptionData> retrieveCompoundingInterestPeriodTypeOptions() {
final List<EnumOptionData> allowedOptions = Arrays.asList( // final List<EnumOptionData> allowedOptions = Arrays.asList(
//
SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.DAILY), // SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.DAILY), //
// SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.WEEKLY), // SavingsEnumerations.compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.WEEKLY),
// // // //
@@ -26,7 +26,7 @@ import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionEnumDat
import org.mifosplatform.portfolio.savings.domain.SavingsAccountStatusType; import org.mifosplatform.portfolio.savings.domain.SavingsAccountStatusType;
public class SavingsEnumerations { public class SavingsEnumerations {
public static final String INTEREST_COMPOUNDING_PERIOD_TYPE = "interestCompoundingPeriodType"; public static final String INTEREST_COMPOUNDING_PERIOD_TYPE = "interestCompoundingPeriodType";
public static final String INTEREST_POSTING_PERIOD_TYPE = "interestPostingPeriodType"; public static final String INTEREST_POSTING_PERIOD_TYPE = "interestPostingPeriodType";
public static final String INTEREST_CALCULATION_TYPE = "interestCalculationType"; public static final String INTEREST_CALCULATION_TYPE = "interestCalculationType";
@@ -39,7 +39,7 @@ public class SavingsEnumerations {
public static final String PRE_CLOSURE_PENAL_INTEREST_TYPE = "preClosurePenalInterestOnTypeId"; public static final String PRE_CLOSURE_PENAL_INTEREST_TYPE = "preClosurePenalInterestOnTypeId";
public static final String INTEREST_CALCULATION_DAYS_IN_YEAR = "interestCalculationDaysInYearType"; public static final String INTEREST_CALCULATION_DAYS_IN_YEAR = "interestCalculationDaysInYearType";
public static final String RECURRING_FREQUENCY_TYPE = "recurringFrequencyType"; public static final String RECURRING_FREQUENCY_TYPE = "recurringFrequencyType";
public static EnumOptionData savingEnumueration(final String typeName, final int id) { public static EnumOptionData savingEnumueration(final String typeName, final int id) {
if (typeName.equals(INTEREST_COMPOUNDING_PERIOD_TYPE)) { if (typeName.equals(INTEREST_COMPOUNDING_PERIOD_TYPE)) {
return compoundingInterestPeriodType(id); return compoundingInterestPeriodType(id);
@@ -57,18 +57,16 @@ public class SavingsEnumerations {
return depositPeriodFrequency(id); return depositPeriodFrequency(id);
} else if (typeName.equals(LOCKIN_PERIOD_FREQUNCY_TYPE)) { } else if (typeName.equals(LOCKIN_PERIOD_FREQUNCY_TYPE)) {
return lockinPeriodFrequencyType(id); return lockinPeriodFrequencyType(id);
} else if (typeName.equals(ACCOUNTING_RULE_TYPE)) { } else if (typeName.equals(ACCOUNTING_RULE_TYPE)) {
return AccountingEnumerations.accountingRuleType(id); return AccountingEnumerations.accountingRuleType(id);
} else if (typeName.equals(PRE_CLOSURE_PENAL_INTEREST_TYPE)) { } else if (typeName.equals(PRE_CLOSURE_PENAL_INTEREST_TYPE)) {
return preClosurePenaltyInterestOnType(id); return preClosurePenaltyInterestOnType(id);
} else if (typeName.equals(INTEREST_CALCULATION_DAYS_IN_YEAR)) { } else if (typeName.equals(INTEREST_CALCULATION_DAYS_IN_YEAR)) {
return interestCalculationDaysInYearType(id); return interestCalculationDaysInYearType(id);
} else if (typeName.equals(RECURRING_FREQUENCY_TYPE)) { } else if (typeName.equals(RECURRING_FREQUENCY_TYPE)) { return depositPeriodFrequency(id); }
return depositPeriodFrequency(id);
}
return null; return null;
} }
public static EnumOptionData lockinPeriodFrequencyType(final int id) { public static EnumOptionData lockinPeriodFrequencyType(final int id) {
return lockinPeriodFrequencyType(SavingsPeriodFrequencyType.fromInt(id)); return lockinPeriodFrequencyType(SavingsPeriodFrequencyType.fromInt(id));
} }
@@ -211,7 +209,8 @@ public class SavingsEnumerations {
case WITHDRAWN_BY_APPLICANT: case WITHDRAWN_BY_APPLICANT:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT.getValue().longValue(),
SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT.getCode(), "Withdrawn by applicant", submittedAndPendingApproval, SavingsAccountStatusType.WITHDRAWN_BY_APPLICANT.getCode(), "Withdrawn by applicant", submittedAndPendingApproval,
isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold); isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress,
isTransferOnHold);
break; break;
case APPROVED: case APPROVED:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.APPROVED.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.APPROVED.getValue().longValue(),
@@ -231,22 +230,24 @@ public class SavingsEnumerations {
case TRANSFER_IN_PROGRESS: case TRANSFER_IN_PROGRESS:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue().longValue(),
SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getCode(), "Transfer in progress", submittedAndPendingApproval, SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getCode(), "Transfer in progress", submittedAndPendingApproval,
isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold); isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress,
isTransferOnHold);
break; break;
case TRANSFER_ON_HOLD: case TRANSFER_ON_HOLD:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.TRANSFER_IN_PROGRESS.getValue().longValue(),
SavingsAccountStatusType.TRANSFER_ON_HOLD.getCode(), "Transfer in progress", submittedAndPendingApproval, SavingsAccountStatusType.TRANSFER_ON_HOLD.getCode(), "Transfer in progress", submittedAndPendingApproval,
isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold); isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress,
isTransferOnHold);
break; break;
case PRE_MATURE_CLOSURE: case PRE_MATURE_CLOSURE:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.PRE_MATURE_CLOSURE.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.PRE_MATURE_CLOSURE.getValue().longValue(),
SavingsAccountStatusType.PRE_MATURE_CLOSURE.getCode(), "Premature Closed", submittedAndPendingApproval, SavingsAccountStatusType.PRE_MATURE_CLOSURE.getCode(), "Premature Closed", submittedAndPendingApproval, isApproved,
isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold); isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold);
break; break;
case MATURED: case MATURED:
optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.MATURED.getValue().longValue(), optionData = new SavingsAccountStatusEnumData(SavingsAccountStatusType.MATURED.getValue().longValue(),
SavingsAccountStatusType.MATURED.getCode(), "Matured", submittedAndPendingApproval, SavingsAccountStatusType.MATURED.getCode(), "Matured", submittedAndPendingApproval, isApproved, isRejected,
isApproved, isRejected, isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold); isWithdrawnByApplicant, isActive, isClosed, isPrematureClosed, isTransferInProgress, isTransferOnHold);
break; break;
default: default:
break; break;
@@ -622,16 +623,20 @@ public class SavingsEnumerations {
case INVALID: case INVALID:
break; break;
case SAVINGS_DEPOSIT: case SAVINGS_DEPOSIT:
optionData = new EnumOptionData(DepositAccountType.SAVINGS_DEPOSIT.getValue().longValue(), DepositAccountType.SAVINGS_DEPOSIT.getCode(), "Savings"); optionData = new EnumOptionData(DepositAccountType.SAVINGS_DEPOSIT.getValue().longValue(),
DepositAccountType.SAVINGS_DEPOSIT.getCode(), "Savings");
break; break;
case FIXED_DEPOSIT: case FIXED_DEPOSIT:
optionData = new EnumOptionData(DepositAccountType.FIXED_DEPOSIT.getValue().longValue(), DepositAccountType.FIXED_DEPOSIT.getCode(), "Fixed Deposit"); optionData = new EnumOptionData(DepositAccountType.FIXED_DEPOSIT.getValue().longValue(),
DepositAccountType.FIXED_DEPOSIT.getCode(), "Fixed Deposit");
break; break;
case RECURRING_DEPOSIT: case RECURRING_DEPOSIT:
optionData = new EnumOptionData(DepositAccountType.RECURRING_DEPOSIT.getValue().longValue(), DepositAccountType.RECURRING_DEPOSIT.getCode(), "Recurring Deposit"); optionData = new EnumOptionData(DepositAccountType.RECURRING_DEPOSIT.getValue().longValue(),
DepositAccountType.RECURRING_DEPOSIT.getCode(), "Recurring Deposit");
break; break;
case CURRENT_DEPOSIT: case CURRENT_DEPOSIT:
optionData = new EnumOptionData(DepositAccountType.CURRENT_DEPOSIT.getValue().longValue(), DepositAccountType.CURRENT_DEPOSIT.getCode(), "Current Deposit"); optionData = new EnumOptionData(DepositAccountType.CURRENT_DEPOSIT.getValue().longValue(),
DepositAccountType.CURRENT_DEPOSIT.getCode(), "Current Deposit");
break; break;
} }
return optionData; return optionData;
@@ -646,7 +651,7 @@ public class SavingsEnumerations {
} }
return optionDatas; return optionDatas;
} }
public static EnumOptionData depositPeriodFrequency(final int id) { public static EnumOptionData depositPeriodFrequency(final int id) {
return depositPeriodFrequency(SavingsPeriodFrequencyType.fromInt(id)); return depositPeriodFrequency(SavingsPeriodFrequencyType.fromInt(id));
} }
@@ -687,7 +692,7 @@ public class SavingsEnumerations {
} }
return optionDatas; return optionDatas;
} }
public static EnumOptionData depositAccountOnClosureType(final int id) { public static EnumOptionData depositAccountOnClosureType(final int id) {
return depositAccountOnClosureType(DepositAccountOnClosureType.fromInt(id)); return depositAccountOnClosureType(DepositAccountOnClosureType.fromInt(id));
} }
@@ -699,13 +704,16 @@ public class SavingsEnumerations {
case INVALID: case INVALID:
break; break;
case WITHDRAW_DEPOSIT: case WITHDRAW_DEPOSIT:
optionData = new EnumOptionData(DepositAccountOnClosureType.WITHDRAW_DEPOSIT.getValue().longValue(), DepositAccountOnClosureType.WITHDRAW_DEPOSIT.getCode(), "Withdraw Deposit"); optionData = new EnumOptionData(DepositAccountOnClosureType.WITHDRAW_DEPOSIT.getValue().longValue(),
DepositAccountOnClosureType.WITHDRAW_DEPOSIT.getCode(), "Withdraw Deposit");
break; break;
case TRANSFER_TO_SAVINGS: case TRANSFER_TO_SAVINGS:
optionData = new EnumOptionData(DepositAccountOnClosureType.TRANSFER_TO_SAVINGS.getValue().longValue(), DepositAccountOnClosureType.TRANSFER_TO_SAVINGS.getCode(), "Transfer to Savings"); optionData = new EnumOptionData(DepositAccountOnClosureType.TRANSFER_TO_SAVINGS.getValue().longValue(),
DepositAccountOnClosureType.TRANSFER_TO_SAVINGS.getCode(), "Transfer to Savings");
break; break;
case REINVEST: case REINVEST:
optionData = new EnumOptionData(DepositAccountOnClosureType.REINVEST.getValue().longValue(), DepositAccountOnClosureType.REINVEST.getCode(), "Re-Invest"); optionData = new EnumOptionData(DepositAccountOnClosureType.REINVEST.getValue().longValue(),
DepositAccountOnClosureType.REINVEST.getCode(), "Re-Invest");
break; break;
} }
return optionData; return optionData;
@@ -94,7 +94,8 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
this.savingProductRepository.save(product); this.savingProductRepository.save(product);
// save accounting mappings // save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.SAVINGS_DEPOSIT); this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command,
DepositAccountType.SAVINGS_DEPOSIT);
return new CommandProcessingResultBuilder() // return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) // .withEntityId(product.getId()) //
@@ -130,7 +131,8 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
// accounting related changes // accounting related changes
final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName); final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName);
final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.SAVINGS_DEPOSIT); .updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(),
DepositAccountType.SAVINGS_DEPOSIT);
changes.putAll(accountingMappingChanges); changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) { if (!changes.isEmpty()) {