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