Advanced deposit products and accounts (FD & RD) with interest rate

extensions bug fixes
This commit is contained in:
Michael Duku-Kaakyire
2014-04-30 21:42:56 +00:00
parent d033ea22ca
commit 31a6e07e87
13 changed files with 97 additions and 35 deletions
+16 -4
View File
@@ -15675,7 +15675,7 @@ Content-Type: application/json
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
<tr class=alt>
<td>name, shortName, description, currencyCode, digitsAfterDecimal,inMultiplesOf,
interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, recurringDepositFrequency, recurringDepositFrequencyTypeId, accountingRule </td>
interestCompoundingPeriodType, interestCalculationType, interestCalculationDaysInYearType, minDepositTerm, minDepositTermTypeId, recurringDepositFrequency, recurringDepositFrequencyTypeId, accountingRule, depositAmount </td>
</tr>
</table>
<br/>
@@ -15688,7 +15688,7 @@ Content-Type: application/json
<br/>
<table class=matrixHeading>
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Optional Fields</div></td></tr>
<tr class=alt><td>lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts</tr>
<tr class=alt><td>lockinPeriodFrequency, lockinPeriodFrequencyType, maxDepositTerm, maxDepositTermTypeId, inMultiplesOfDepositTerm, inMultiplesOfDepositTermTypeId, preClosurePenalApplicable, preClosurePenalInterest, preClosurePenalInterestOnTypeId, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, charges, charts, minDepositAmount, maxDepositAmount</tr>
</table>
</div>
<div class="method-example">
@@ -15718,6 +15718,9 @@ Request Body:
"minDepositTermTypeId":1,
"maxDepositTerm":5,
"maxDepositTermTypeId":3,
depositAmount: "10000",
minDepositAmount: "100",
maxDepositAmount: "1000000",
"charts":[
{
"fromDate": "01 Jan 2014",
@@ -15860,6 +15863,9 @@ Request Body:
"code": "recurring.deposit.savingsPeriodFrequencyType.months",
"value": "Months"
},
"minDepositAmount":100.00,
"depositAmount":10000.00,
"maxDepositAmount":1000000.00,
"preClosurePenalApplicable":"true",
"preClosurePenalInterest":"1.75",
"preClosurePenalInterestOnType": {
@@ -20000,7 +20006,7 @@ No Request Body:
<br/>
<table class=matrixHeading>
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
<tr class=alt><td>clientId or groupId, productId, submittedOnDate, recurringDepositAmount, depositPeriod, depositPeriodFrequencyId, recurringDepositFrequency, recurringDepositFrequencyTypeId</td></tr>
<tr class=alt><td>clientId or groupId, productId, submittedOnDate, recurringDepositAmount, depositPeriod, depositPeriodFrequencyId, recurringDepositFrequency, recurringDepositFrequencyTypeId, expectedFirstDepositOnDate</td></tr>
</table>
<br/>
<table class=matrixHeading>
@@ -20049,7 +20055,8 @@ Request Body:
"depositPeriod":"6",
"depositPeriodFrequencyId":"2",
"accountNo": "RD000023",
"externalId": "RD-23"
"externalId": "RD-23",
expectedFirstDepositOnDate: "02 April 2014"
}
</code>
<p>Full request: accountNo provided (must be unique), remaining details override details from recurring deposit product (except currency).</p>
@@ -20882,6 +20889,11 @@ Request Body:
},
"recurringDepositAmount": 100,
"recurringDepositFrequency": 1,
"expectedFirstDepositOnDate": [
2014,
4,
2
],
"recurringDepositFrequencyType": {
"id": 2,
"code": "recurring.deposit.savingsPeriodFrequencyType.months",
@@ -79,6 +79,7 @@ public class RecurringDepositTest {
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.MONTH, 1);
final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime());
@@ -90,7 +91,7 @@ public class RecurringDepositTest {
Assert.assertNotNull(recurringDepositProductId);
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -151,6 +152,7 @@ public class RecurringDepositTest {
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.MONTH, 1);
final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime());
@@ -177,7 +179,7 @@ public class RecurringDepositTest {
Assert.assertNotNull(recurringDepositProductId);
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -256,6 +258,7 @@ public class RecurringDepositTest {
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.MONTH, 1);
final String CLOSED_ON_DATE = dateFormat.format(todaysDate.getTime());
@@ -272,7 +275,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -323,6 +326,7 @@ public class RecurringDepositTest {
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -337,7 +341,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap modificationsHashMap = this.recurringDepositAccountHelper.updateRecurringDepositAccount(clientId.toString(),
@@ -364,6 +368,7 @@ public class RecurringDepositTest {
todaysDate.add(Calendar.MONTH, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -378,7 +383,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -412,6 +417,7 @@ public class RecurringDepositTest {
todaysDate.add(Calendar.MONTH, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String REJECTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -426,7 +432,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -458,6 +464,7 @@ public class RecurringDepositTest {
todaysDate.add(Calendar.MONTH, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String WITHDRAWN_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -472,7 +479,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -502,6 +509,7 @@ public class RecurringDepositTest {
todaysDate = Calendar.getInstance();
todaysDate.add(Calendar.MONTH, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
Integer clientId = ClientHelper.createClient(this.requestSpec, this.responseSpec);
@@ -516,7 +524,7 @@ public class RecurringDepositTest {
this.responseSpec, recurringDepositProductId.toString());
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -553,6 +561,7 @@ public class RecurringDepositTest {
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String APPROVED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String ACTIVATION_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_DATE = dateFormat.format(todaysDate.getTime());
final String MONTH_DAY = monthDayFormat.format(todaysDate.getTime());
todaysDate.add(Calendar.MONTH, 1);
final String DEPOSIT_DATE = dateFormat.format(todaysDate.getTime());
@@ -564,7 +573,7 @@ public class RecurringDepositTest {
Assert.assertNotNull(recurringDepositProductId);
Integer recurringDepositAccountId = applyForRecurringDepositApplication(clientId.toString(), recurringDepositProductId.toString(),
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE);
VALID_FROM, VALID_TO, SUBMITTED_ON_DATE, EXPECTED_FIRST_DEPOSIT_ON_DATE);
Assert.assertNotNull(recurringDepositAccountId);
HashMap recurringDepositAccountStatusHashMap = RecurringDepositAccountStatusChecker.getStatusOfRecurringDepositAccount(
@@ -601,10 +610,10 @@ public class RecurringDepositTest {
}
private Integer applyForRecurringDepositApplication(final String clientID, final String productID, final String validFrom,
final String validTo, final String submittedOnDate) {
final String validTo, final String submittedOnDate, final String expectedFirstDepositOnDate) {
System.out.println("--------------------------------APPLYING FOR RECURRING DEPOSIT ACCOUNT --------------------------------");
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(submittedOnDate).build(clientID, productID, validFrom, validTo);
.withSubmittedOnDate(submittedOnDate).withExpectedFirstDepositOnDate(expectedFirstDepositOnDate).build(clientID, productID, validFrom, validTo);
return this.recurringDepositAccountHelper.applyRecurringDepositApplication(recurringDepositApplicationJSON, this.requestSpec,
this.responseSpec);
}
@@ -89,6 +89,7 @@ public class RecurringDepositAccountHelper {
private final String recurringDepositFrequencyTypeId = MONTHS;
private final String recurringDepositAmount = "2000";
private String submittedOnDate = "";
private String expectedFirstDepositOnDate = "";
public String build(final String clientId, final String productId, final String validFrom, final String validTo) {
final HashMap<String, Object> map = new HashMap<String, Object>();
@@ -169,6 +170,7 @@ public class RecurringDepositAccountHelper {
map.put("recurringDepositFrequency", this.recurringDepositFrequency);
map.put("recurringDepositFrequencyTypeId", this.recurringDepositFrequencyTypeId);
map.put("recurringDepositAmount", this.recurringDepositAmount);
map.put("expectedFirstDepositOnDate", this.expectedFirstDepositOnDate);
String recurringDepositAccountJson = new Gson().toJson(map);
System.out.println(recurringDepositAccountJson);
@@ -203,8 +205,10 @@ public class RecurringDepositAccountHelper {
todaysDate.add(Calendar.MONTH, -1);
todaysDate.add(Calendar.DATE, -1);
final String SUBMITTED_ON_DATE = dateFormat.format(todaysDate.getTime());
final String EXPECTED_FIRST_DEPOSIT_ON_ON_DATE = SUBMITTED_ON_DATE;
final String recurringDepositApplicationJSON = new RecurringDepositAccountHelper(this.requestSpec, this.responseSpec) //
.withSubmittedOnDate(SUBMITTED_ON_DATE) //
.withExpectedFirstDepositOnDate(EXPECTED_FIRST_DEPOSIT_ON_ON_DATE)
.build(clientID, productID, validFrom, validTo);
return Utils.performServerPut(this.requestSpec, this.responseSpec, RECURRING_DEPOSIT_ACCOUNT_URL + "/" + accountID + "?"
@@ -411,5 +415,10 @@ public class RecurringDepositAccountHelper {
this.submittedOnDate = recurringDepositApplicationSubmittedDate;
return this;
}
public RecurringDepositAccountHelper withExpectedFirstDepositOnDate(final String recurringDepositApplicationExpectedFirstDepositOnDate) {
this.expectedFirstDepositOnDate = recurringDepositApplicationExpectedFirstDepositOnDate;
return this;
}
}
@@ -78,6 +78,9 @@ public class RecurringDepositProductHelper {
private final String recurringDepositTypeId = VOLUNTARY;
private final String recurringDepositFrequencyTypeId = MONTHS;
private final String recurringDepositFrequency = "1";
private final String depositAmount = "10000";
private final String minDepositAmount = "100";
private final String maxDepositAmount = "1000000";
private Account[] accountList = null;
public String build(final String validFrom, final String validTo) {
@@ -157,6 +160,9 @@ public class RecurringDepositProductHelper {
map.put("recurringDepositTypeId", this.recurringDepositTypeId);
map.put("recurringDepositFrequencyTypeId", this.recurringDepositFrequencyTypeId);
map.put("recurringDepositFrequency", this.recurringDepositFrequency);
map.put("depositAmount", this.depositAmount);
map.put("minDepositAmount", this.minDepositAmount);
map.put("maxDepositAmount", this.maxDepositAmount);
if (this.accountingRule.equals(CASH_BASED)) {
map.putAll(getAccountMappingForCashBased());
@@ -8,17 +8,18 @@ package org.mifosplatform.accounting.producttoaccountmapping.service;
import java.util.Map;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.portfolio.savings.DepositAccountType;
public interface ProductToGLAccountMappingWritePlatformService {
void createLoanProductToGLAccountMapping(Long loanProductId, JsonCommand command);
void createSavingProductToGLAccountMapping(Long savingProductId, JsonCommand command);
void createSavingProductToGLAccountMapping(Long savingProductId, JsonCommand command, DepositAccountType accountType);
Map<String, Object> updateLoanProductToGLAccountMapping(Long loanProductId, JsonCommand command, boolean accountingRuleChanged,
int accountingRuleTypeId);
Map<String, Object> updateSavingsProductToGLAccountMapping(Long savingsProductId, JsonCommand command, boolean accountingRuleChanged,
int accountingRuleTypeId);
int accountingRuleTypeId, DepositAccountType accountType);
}
@@ -20,6 +20,7 @@ import org.mifosplatform.accounting.common.AccountingRuleType;
import org.mifosplatform.accounting.producttoaccountmapping.serialization.ProductToGLAccountMappingFromApiJsonDeserializer;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
import org.mifosplatform.portfolio.savings.DepositAccountType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -145,7 +146,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
@Override
@Transactional
public void createSavingProductToGLAccountMapping(final Long savingProductId, final JsonCommand command) {
public void createSavingProductToGLAccountMapping(final Long savingProductId, final JsonCommand command, DepositAccountType accountType) {
final JsonElement element = this.fromApiJsonHelper.parse(command.json());
final Integer accountingRuleTypeId = this.fromApiJsonHelper.extractIntegerNamed(accountingRuleParamName, element,
Locale.getDefault());
@@ -159,9 +160,12 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
this.savingsProductToGLAccountMappingHelper.saveSavingsToAssetAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE.getValue());
this.savingsProductToGLAccountMappingHelper.saveSavingsToAssetAccountMapping(element,
if(!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
this.savingsProductToGLAccountMappingHelper.saveSavingsToAssetAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.OVERDRAFT_PORTFOLIO_CONTROL.getValue());
}
// income
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
@@ -171,19 +175,23 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES.getValue());
if(!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
this.savingsProductToGLAccountMappingHelper.saveSavingsToIncomeAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_INTEREST.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_INTEREST.getValue());
}
// expenses
this.savingsProductToGLAccountMappingHelper.saveSavingsToExpenseAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS.getValue());
if(!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
this.savingsProductToGLAccountMappingHelper.saveSavingsToExpenseAccountMapping(element,
SAVINGS_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), savingProductId,
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.getValue());
CASH_ACCOUNTS_FOR_SAVINGS.LOSSES_WRITTEN_OFF.getValue());
}
// liability
this.savingsProductToGLAccountMappingHelper.saveSavingsToLiabilityAccountMapping(element,
@@ -237,7 +245,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
@Override
public Map<String, Object> updateSavingsProductToGLAccountMapping(final Long savingsProductId, final JsonCommand command,
final boolean accountingRuleChanged, final int accountingRuleTypeId) {
final boolean accountingRuleChanged, final int accountingRuleTypeId, final DepositAccountType accountType) {
/***
* Variable tracks all accounting mapping properties that have been
* updated
@@ -253,7 +261,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
if (accountingRuleChanged) {
this.deserializer.validateForSavingsProductCreate(command.json());
this.savingsProductToGLAccountMappingHelper.deleteSavingsProductToGLAccountMapping(savingsProductId);
createSavingProductToGLAccountMapping(savingsProductId, command);
createSavingProductToGLAccountMapping(savingsProductId, command, accountType);
changes = this.savingsProductToGLAccountMappingHelper.populateChangesForNewSavingsProductToGLAccountMappingCreation(element,
accountingRuleType);
}/*** else examine and update individual changes ***/
@@ -266,4 +274,4 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc
}
return changes;
}
}
}
@@ -212,6 +212,8 @@ public class InterestRateChartSlabFields {
}
public boolean isAmountBetween(final BigDecimal depositAmount){
if(depositAmount == null || amountRangeFrom == null || amountRangeTo == null)
return true;
return depositAmount.compareTo(amountRangeFrom) >= 0 && depositAmount.compareTo(amountRangeTo) <= 0;
}
}
@@ -213,9 +213,7 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi
}
this.savingsAccountRepository.save(account);
if (withdrawal != null) {
saveTransactionToGenerateTransactionId(withdrawal);
}
postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds);
return withdrawal;
@@ -8,6 +8,7 @@ package org.mifosplatform.portfolio.savings.domain;
import static org.mifosplatform.portfolio.savings.DepositsApiConstants.depositAmountParamName;
import static org.mifosplatform.portfolio.savings.DepositsApiConstants.depositPeriodFrequencyIdParamName;
import static org.mifosplatform.portfolio.savings.DepositsApiConstants.depositPeriodParamName;
import static org.mifosplatform.portfolio.savings.DepositsApiConstants.expectedFirstDepositOnDateParamName;
import java.math.BigDecimal;
import java.util.Date;
@@ -32,6 +33,7 @@ import org.mifosplatform.infrastructure.core.api.JsonCommand;
import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
import org.mifosplatform.organisation.monetary.domain.Money;
import org.mifosplatform.portfolio.savings.DepositAccountOnClosureType;
import org.mifosplatform.portfolio.savings.SavingsApiConstants;
import org.mifosplatform.portfolio.savings.SavingsPeriodFrequencyType;
import org.mifosplatform.portfolio.savings.service.SavingsEnumerations;
import org.springframework.data.jpa.domain.AbstractPersistable;
@@ -122,6 +124,18 @@ public class DepositAccountTermAndPreClosure extends AbstractPersistable<Long> {
actualChanges.put(depositPeriodFrequencyIdParamName, SavingsEnumerations.depositTermFrequencyType(newValue));
this.depositPeriodFrequency = newValue;
}
final String localeAsInput = command.locale();
final String dateFormat = command.dateFormat();
if (command.isChangeInLocalDateParameterNamed(expectedFirstDepositOnDateParamName, getExpectedFirstDepositOnDate())) {
final LocalDate newValue = command.localDateValueOfParameterNamed(expectedFirstDepositOnDateParamName);
final String newValueAsString = command.stringValueOfParameterNamed(expectedFirstDepositOnDateParamName);
actualChanges.put(expectedFirstDepositOnDateParamName, newValueAsString);
actualChanges.put(SavingsApiConstants.localeParamName, localeAsInput);
actualChanges.put(SavingsApiConstants.dateFormatParamName, dateFormat);
this.expectedFirstDepositOnDate = newValue.toDate();
}
if (this.preClosureDetail != null) {
actualChanges.putAll(this.preClosureDetail.update(command, baseDataValidator));
@@ -576,7 +576,7 @@ public class SavingsAccount extends AbstractPersistable<Long> {
LocalDate endOfBalanceDate = interestPostingUpToDate;
for (int i = accountTransactionsSorted.size() - 1; i >= 0; i--) {
final SavingsAccountTransaction transaction = accountTransactionsSorted.get(i);
if (transaction.isNotReversed()) {
if (transaction.isNotReversed() && !transaction.isInterestPostingAndNotReversed()) {
transaction.updateCumulativeBalanceAndDates(this.currency, endOfBalanceDate);
// this transactions transaction date is end of balance date for
@@ -19,6 +19,7 @@ import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityExce
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.portfolio.charge.domain.Charge;
import org.mifosplatform.portfolio.interestratechart.service.InterestRateChartAssembler;
import org.mifosplatform.portfolio.savings.DepositAccountType;
import org.mifosplatform.portfolio.savings.data.DepositProductDataValidator;
import org.mifosplatform.portfolio.savings.domain.DepositProductAssembler;
import org.mifosplatform.portfolio.savings.domain.FixedDepositProduct;
@@ -70,7 +71,7 @@ public class FixedDepositProductWritePlatformServiceJpaRepositoryImpl implements
this.fixedDepositProductRepository.save(product);
// save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command);
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.FIXED_DEPOSIT);
return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) //
@@ -107,7 +108,7 @@ 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());
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.FIXED_DEPOSIT);
changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) {
@@ -19,6 +19,7 @@ import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityExce
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.portfolio.charge.domain.Charge;
import org.mifosplatform.portfolio.interestratechart.service.InterestRateChartAssembler;
import org.mifosplatform.portfolio.savings.DepositAccountType;
import org.mifosplatform.portfolio.savings.data.DepositProductDataValidator;
import org.mifosplatform.portfolio.savings.domain.DepositProductAssembler;
import org.mifosplatform.portfolio.savings.domain.RecurringDepositProduct;
@@ -70,7 +71,7 @@ public class RecurringDepositProductWritePlatformServiceJpaRepositoryImpl implem
this.recurringDepositProductRepository.save(product);
// save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command);
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.RECURRING_DEPOSIT);
return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) //
@@ -107,7 +108,7 @@ 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());
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.RECURRING_DEPOSIT);
changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) {
@@ -18,6 +18,7 @@ import org.mifosplatform.infrastructure.core.data.CommandProcessingResultBuilder
import org.mifosplatform.infrastructure.core.exception.PlatformDataIntegrityException;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.portfolio.charge.domain.Charge;
import org.mifosplatform.portfolio.savings.DepositAccountType;
import org.mifosplatform.portfolio.savings.data.SavingsProductDataValidator;
import org.mifosplatform.portfolio.savings.domain.SavingsProduct;
import org.mifosplatform.portfolio.savings.domain.SavingsProductAssembler;
@@ -93,7 +94,7 @@ public class SavingsProductWritePlatformServiceJpaRepositoryImpl implements Savi
this.savingProductRepository.save(product);
// save accounting mappings
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command);
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command, DepositAccountType.SAVINGS_DEPOSIT);
return new CommandProcessingResultBuilder() //
.withEntityId(product.getId()) //
@@ -129,7 +130,7 @@ 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());
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(), DepositAccountType.SAVINGS_DEPOSIT);
changes.putAll(accountingMappingChanges);
if (!changes.isEmpty()) {