savings product account detail API clean up

This commit is contained in:
Pramod Nuthakki
2013-11-29 13:33:37 +05:30
parent f587d83722
commit c2b42df3ab
3 changed files with 146 additions and 141 deletions
+89 -108
View File
@@ -13520,8 +13520,8 @@ Request Body:
<code class="method-response"> <code class="method-response">
{ {
"id": 1, "id": 1,
"name": "First Product", "name": "savings product",
"description": "A cool saving product", "description": "gtasga",
"currency": { "currency": {
"code": "USD", "code": "USD",
"name": "US Dollar", "name": "US Dollar",
@@ -13530,15 +13530,15 @@ Request Body:
"nameCode": "currency.USD", "nameCode": "currency.USD",
"displayLabel": "US Dollar ($)" "displayLabel": "US Dollar ($)"
}, },
"nominalAnnualInterestRate": 50.000000, "nominalAnnualInterestRate": 5.000000,
"interestCompoundingPeriodType": { "interestCompoundingPeriodType": {
"id": 4, "id": 1,
"code": "savings.interest.period.savingsCompoundingInterestPeriodType.monthly", "code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily",
"value": "Monthly" "value": "Daily"
}, },
"interestPostingPeriodType": { "interestPostingPeriodType": {
"id": 4, "id": 4,
"code": "savings.interest.posting.period.savingsInterestPostingPeriodType.monthly", "code": "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly",
"value": "Monthly" "value": "Monthly"
}, },
"interestCalculationType": { "interestCalculationType": {
@@ -13551,117 +13551,88 @@ Request Body:
"code": "savingsInterestCalculationDaysInYearType.days365", "code": "savingsInterestCalculationDaysInYearType.days365",
"value": "365 Days" "value": "365 Days"
}, },
"minRequiredOpeningBalance": 20.000000, "withdrawalFeeForTransfers": false,
"lockinPeriodFrequency": 1,
"lockinPeriodFrequencyType": {
"id": 1,
"code": "savings.lockin.savingsPeriodFrequencyType.weeks",
"value": "Weeks"
},
"withdrawalFeeForTransfers":true,
"accountingRule": { "accountingRule": {
"id": 2, "id": 2,
"code": "accountingRuleType.cash", "code": "accountingRuleType.cash",
"value": "CASH BASED" "value": "CASH BASED"
}, },
"accountingMappings": { "accountingMappings": {
"savingsReferenceAccountId":1, "savingsReferenceAccount": {
"incomeFromFeeAccountId":5, "id": 12,
"interestOnSavingsAccountId":4, "name": "savings ref",
"savingsControlAccountId":2, "glCode": "20"
"transfersInSuspenseAccountId":3,
"incomeFromPenaltyAccountId":15
}, },
"incomeFromFeeAccount": {
"id": 16,
"name": "income from savings fee",
"glCode": "24"
},
"incomeFromPenaltyAccount": {
"id": 17,
"name": "income from sav penalites",
"glCode": "25"
},
"interestOnSavingsAccount": {
"id": 15,
"name": "interest on savings",
"glCode": "23"
},
"savingsControlAccount": {
"id": 13,
"name": "savings ref tool kit",
"glCode": "21"
},
"transfersInSuspenseAccount": {
"id": 14,
"name": "saving transfers",
"glCode": "22"
}
},
"paymentChannelToFundSourceMappings": [
{
"paymentType": {
"id": 10,
"name": "check"
},
"fundSourceAccount": {
"id": 12,
"name": "savings ref",
"glCode": "20"
}
}
],
"feeToIncomeAccountMappings": [ "feeToIncomeAccountMappings": [
{ {
"chargeId":6, "charge": {
"incomeAccountId":16 "id": 11,
"name": "sav charge",
"active": false,
"penalty": false
},
"incomeAccount": {
"id": 16,
"name": "income from savings fee",
"glCode": "24"
}
} }
], ],
"penaltyToIncomeAccountMappings": [ "penaltyToIncomeAccountMappings": [
{ {
"chargeId":4, "charge": {
"incomeAccountId":15 "id": 12,
"name": "sav 2",
"active": false,
"penalty": true
},
"incomeAccount": {
"id": 17,
"name": "income from sav penalites",
"glCode": "25"
}
} }
], ],
"paymentChannelToFundSourceMappings": [ "charges": []
{
"paymentTypeId": 14,
"fundSourceAccountId": 2
}
],
"charges": [
{
"id": 1,
"name": "Annual fee",
"active": true,
"penalty": false,
"currency": {
"code": "USD",
"name": "US Dollar",
"decimalPlaces": 2,
"displaySymbol": "$",
"nameCode": "currency.USD",
"displayLabel": "US Dollar ($)"
},
"amount": 50,
"chargeTimeType": {
"id": 6,
"code": "chargeTimeType.annualFee",
"value": "Annual Fee"
},
"chargeAppliesTo": {
"id": 2,
"code": "chargeAppliesTo.savings",
"value": "Savings"
},
"chargeCalculationType": {
"id": 1,
"code": "chargeCalculationType.flat",
"value": "Flat"
},
"chargePaymentMode": {
"id": 0,
"code": "chargepaymentmode.regular",
"value": "Regular"
}
},
{
"id": 2,
"name": "Withdrawal fee percentage",
"active": true,
"penalty": false,
"currency": {
"code": "USD",
"name": "US Dollar",
"decimalPlaces": 2,
"displaySymbol": "$",
"nameCode": "currency.USD",
"displayLabel": "US Dollar ($)"
},
"amount": 0.25,
"chargeTimeType": {
"id": 5,
"code": "chargeTimeType.withdrawalFee",
"value": "Withdrawal Fee"
},
"chargeAppliesTo": {
"id": 2,
"code": "chargeAppliesTo.savings",
"value": "Savings"
},
"chargeCalculationType": {
"id": 2,
"code": "chargeCalculationType.percent.of.amount",
"value": "% Amount"
},
"chargePaymentMode": {
"id": 0,
"code": "chargepaymentmode.regular",
"value": "Regular"
}
}
]
} }
</code> </code>
</div> </div>
@@ -13732,8 +13703,8 @@ Content-Type: application/json
[ [
{ {
"id": 1, "id": 1,
"name": "Passbook Savings", "name": "Savings product",
"description": "Daily compounding using Daily Balance, 5% per year, 365 days in year", "description": "gtasga",
"currency": { "currency": {
"code": "USD", "code": "USD",
"name": "US Dollar", "name": "US Dollar",
@@ -13742,12 +13713,17 @@ Content-Type: application/json
"nameCode": "currency.USD", "nameCode": "currency.USD",
"displayLabel": "US Dollar ($)" "displayLabel": "US Dollar ($)"
}, },
"nominalAnnualInterestRate": 5, "nominalAnnualInterestRate": 5.000000,
"interestCompoundingPeriodType": { "interestCompoundingPeriodType": {
"id": 1, "id": 1,
"code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily", "code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily",
"value": "Daily" "value": "Daily"
}, },
"interestPostingPeriodType": {
"id": 4,
"code": "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly",
"value": "Monthly"
},
"interestCalculationType": { "interestCalculationType": {
"id": 1, "id": 1,
"code": "savingsInterestCalculationType.dailybalance", "code": "savingsInterestCalculationType.dailybalance",
@@ -13757,10 +13733,15 @@ Content-Type: application/json
"id": 365, "id": 365,
"code": "savingsInterestCalculationDaysInYearType.days365", "code": "savingsInterestCalculationDaysInYearType.days365",
"value": "365 Days" "value": "365 Days"
},
"withdrawalFeeForTransfers": false,
"accountingRule": {
"id": 2,
"code": "accountingRuleType.cash",
"value": "CASH BASED"
} }
} }
] ] </code>
</code>
</div> </div>
</div> </div>
<!-- end of saving products api docs --> <!-- end of saving products api docs -->
@@ -191,6 +191,30 @@ public class AccountingConstants {
} }
} }
public static enum SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS {
SAVINGS_REFERENCE("savingsReferenceAccount"), SAVINGS_CONTROL("savingsControlAccount"), INCOME_FROM_FEES(
"incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), INTEREST_ON_SAVINGS(
"interestOnSavingsAccount"), PAYMENT_TYPE("paymentType"), FUND_SOURCE("fundSourceAccount"),
TRANSFERS_SUSPENSE("transfersInSuspenseAccount"), PENALTY_INCOME_ACCOUNT_MAPPING("penaltyToIncomeAccountMappings"), CHARGE_ID("charge"), INCOME_ACCOUNT_ID(
"incomeAccount");
private final String value;
private SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS(final String value) {
this.value = value;
}
@Override
public String toString() {
return name().toString().replaceAll("_", " ");
}
public String getValue() {
return this.value;
}
}
public static final String ASSESTS_TAG_OPTION_CODE_NAME = "AssetAccountTags"; public static final String ASSESTS_TAG_OPTION_CODE_NAME = "AssetAccountTags";
public static final String LIABILITIES_TAG_OPTION_CODE_NAME = "LiabilityAccountTags"; public static final String LIABILITIES_TAG_OPTION_CODE_NAME = "LiabilityAccountTags";
public static final String EQUITY_TAG_OPTION_CODE_NAME = "EquityAccountTags"; public static final String EQUITY_TAG_OPTION_CODE_NAME = "EquityAccountTags";
@@ -16,7 +16,7 @@ import org.mifosplatform.accounting.common.AccountingConstants.ACCRUAL_ACCOUNTS_
import org.mifosplatform.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN; import org.mifosplatform.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_LOAN;
import org.mifosplatform.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS; import org.mifosplatform.accounting.common.AccountingConstants.CASH_ACCOUNTS_FOR_SAVINGS;
import org.mifosplatform.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS; import org.mifosplatform.accounting.common.AccountingConstants.LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS;
import org.mifosplatform.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_PARAMS; import org.mifosplatform.accounting.common.AccountingConstants.SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS;
import org.mifosplatform.accounting.common.AccountingRuleType; import org.mifosplatform.accounting.common.AccountingRuleType;
import org.mifosplatform.accounting.glaccount.data.GLAccountData; import org.mifosplatform.accounting.glaccount.data.GLAccountData;
import org.mifosplatform.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper; import org.mifosplatform.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
@@ -193,17 +193,17 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE)) { if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.SAVINGS_REFERENCE.getValue(), gLAccountData);
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL)) { } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.SAVINGS_CONTROL.getValue(), gLAccountData);
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES)) { } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_FEES)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData);
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES)) { } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INCOME_FROM_PENALTIES)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData);
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE)) { } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.TRANSFERS_SUSPENSE)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData);
} else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS)) { } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.INTEREST_ON_SAVINGS)) {
accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData); accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData);
} }
} }
} }