formatting source code
This commit is contained in:
+2
-5
@@ -8,16 +8,13 @@ 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;
|
||||
|
||||
@@ -60,7 +57,7 @@ public enum PreClosurePenalInterestOnType {
|
||||
return values.toArray();
|
||||
}
|
||||
|
||||
public boolean isInvalid(){
|
||||
public boolean isInvalid() {
|
||||
return this.value.equals(PreClosurePenalInterestOnType.INVALID.value);
|
||||
}
|
||||
|
||||
|
||||
+2
-5
@@ -8,16 +8,13 @@ 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;
|
||||
|
||||
@@ -60,7 +57,7 @@ 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
-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;
|
||||
|
||||
+2
-1
@@ -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); }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -31,7 +31,9 @@ public class SavingsAccountTransactionDTO {
|
||||
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;
|
||||
}
|
||||
|
||||
+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
|
||||
|
||||
+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;
|
||||
|
||||
+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 FixedDepositProductRepository extends JpaRepository<FixedDepositProduct, Long>, JpaSpecificationExecutor<FixedDepositProduct> {
|
||||
public interface FixedDepositProductRepository extends JpaRepository<FixedDepositProduct, Long>,
|
||||
JpaSpecificationExecutor<FixedDepositProduct> {
|
||||
|
||||
}
|
||||
+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 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> {
|
||||
//
|
||||
}
|
||||
+1
-1
@@ -216,7 +216,7 @@ public class RecurringDepositScheduleInstallment extends AbstractAuditableCustom
|
||||
return Money.of(currency, decimal);
|
||||
}
|
||||
|
||||
public void resetDerivedFields(){
|
||||
public void resetDerivedFields() {
|
||||
this.depositAmountCompleted = null;
|
||||
this.totalPaidInAdvance = null;
|
||||
this.totalPaidLate = null;
|
||||
|
||||
+41
-50
@@ -473,20 +473,20 @@ public class SavingsAccount extends AbstractPersistable<Long> {
|
||||
return postingTransation;
|
||||
}
|
||||
|
||||
//Determine the last transaction for given day
|
||||
protected SavingsAccountTransaction findLastTransaction(final LocalDate date) {
|
||||
// Determine the last transaction for given day
|
||||
protected SavingsAccountTransaction findLastTransaction(final LocalDate date) {
|
||||
|
||||
SavingsAccountTransaction savingsTransaction = null;
|
||||
SavingsAccountTransaction savingsTransaction = null;
|
||||
|
||||
for (final SavingsAccountTransaction transaction : this.transactions) {
|
||||
if (transaction.isNotReversed() && transaction.occursOn(date)) {
|
||||
savingsTransaction = transaction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (final SavingsAccountTransaction transaction : this.transactions) {
|
||||
if (transaction.isNotReversed() && transaction.occursOn(date)) {
|
||||
savingsTransaction = transaction;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return savingsTransaction;
|
||||
}
|
||||
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);
|
||||
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();
|
||||
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 ApiParameterError error = ApiParameterError
|
||||
.parameterError(
|
||||
"error.msg.savingsaccount.transaction.incorrect.start.interest.calculation.date",
|
||||
defaultUserMessage, "transactionDate",
|
||||
getStartInterestCalculationDate().toString());
|
||||
final ApiParameterError error = ApiParameterError.parameterError(
|
||||
"error.msg.savingsaccount.transaction.incorrect.start.interest.calculation.date", defaultUserMessage,
|
||||
"transactionDate", getStartInterestCalculationDate().toString());
|
||||
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
dataValidationErrors.add(error);
|
||||
final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
|
||||
dataValidationErrors.add(error);
|
||||
|
||||
throw new PlatformApiDataValidationException(
|
||||
dataValidationErrors);
|
||||
}
|
||||
throw new PlatformApiDataValidationException(dataValidationErrors);
|
||||
}
|
||||
|
||||
periodStartingBalance = transaction
|
||||
.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 BigDecimal interestRateAsFraction = getEffectiveInterestRateAsFraction(mc, upToInterestCalculationDate);
|
||||
@@ -750,17 +742,16 @@ 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) {
|
||||
|
||||
|
||||
+2
-1
@@ -30,5 +30,6 @@ public interface SavingsAccountRepository extends JpaRepository<SavingsAccount,
|
||||
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);
|
||||
}
|
||||
+2
-4
@@ -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;
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ public final class SavingsAccountTransaction extends AbstractPersistable<Long> {
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ 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);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ 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) {
|
||||
|
||||
+2
-1
@@ -30,7 +30,8 @@ public interface DepositAccountReadPlatformService {
|
||||
|
||||
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();
|
||||
|
||||
|
||||
+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);
|
||||
}
|
||||
|
||||
+6
-3
@@ -53,17 +53,20 @@ 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);
|
||||
|
||||
|
||||
+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();
|
||||
*/
|
||||
|
||||
}
|
||||
+16
-14
@@ -19,19 +19,21 @@ public class DepositsDropdownReadPlatformServiceImpl implements DepositsDropdown
|
||||
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> retrieveInMultiplesOfDepositTermTypeOptions() {
|
||||
return SavingsEnumerations.recurringDepositFrequencyType(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()); }
|
||||
*/
|
||||
|
||||
}
|
||||
+7
-6
@@ -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()) //
|
||||
@@ -97,8 +97,8 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
|
||||
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()) {
|
||||
|
||||
+11
-10
@@ -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()) //
|
||||
@@ -97,8 +97,8 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
|
||||
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);
|
||||
|
||||
+1
-1
@@ -34,5 +34,5 @@ public interface SavingsAccountReadPlatformService {
|
||||
|
||||
SavingsAccountTransactionData retrieveSavingsTransaction(Long savingsId, Long transactionId, DepositAccountType depositAccountType);
|
||||
|
||||
Collection<SavingsAccountData> retrieveForLookup(Long clientId,Boolean overdraft);
|
||||
Collection<SavingsAccountData> retrieveForLookup(Long clientId, Boolean overdraft);
|
||||
}
|
||||
+12
-15
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
// //
|
||||
|
||||
+25
-17
@@ -63,9 +63,7 @@ public class SavingsEnumerations {
|
||||
return preClosurePenaltyInterestOnType(id);
|
||||
} 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -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