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
+115 -134
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,
"feeToIncomeAccountMappings":[ "name": "income from savings fee",
{ "glCode": "24"
"chargeId":6, },
"incomeAccountId":16 "incomeFromPenaltyAccount": {
} "id": 17,
], "name": "income from sav penalites",
"penaltyToIncomeAccountMappings":[ "glCode": "25"
{ },
"chargeId":4, "interestOnSavingsAccount": {
"incomeAccountId":15 "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": [ "paymentChannelToFundSourceMappings": [
{ {
"paymentTypeId": 14, "paymentType": {
"fundSourceAccountId": 2 "id": 10,
"name": "check"
},
"fundSourceAccount": {
"id": 12,
"name": "savings ref",
"glCode": "20"
}
} }
], ],
"charges": [ "feeToIncomeAccountMappings": [
{ {
"id": 1, "charge": {
"name": "Annual fee", "id": 11,
"active": true, "name": "sav charge",
"penalty": false, "active": false,
"currency": { "penalty": false
"code": "USD",
"name": "US Dollar",
"decimalPlaces": 2,
"displaySymbol": "$",
"nameCode": "currency.USD",
"displayLabel": "US Dollar ($)"
}, },
"amount": 50, "incomeAccount": {
"chargeTimeType": { "id": 16,
"id": 6, "name": "income from savings fee",
"code": "chargeTimeType.annualFee", "glCode": "24"
"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"
} }
} }
] ],
"penaltyToIncomeAccountMappings": [
{
"charge": {
"id": 12,
"name": "sav 2",
"active": false,
"penalty": true
},
"incomeAccount": {
"id": 17,
"name": "income from sav penalites",
"glCode": "25"
}
}
],
"charges": []
} }
</code> </code>
</div> </div>
@@ -13730,37 +13701,47 @@ Content-Type: application/json
<code class="method-declaration">GET https://Domain Name/api/v1/savingsproducts</code> <code class="method-declaration">GET https://Domain Name/api/v1/savingsproducts</code>
<code class="method-response"> <code class="method-response">
[ [
{ {
"id": 1,
"name": "Passbook Savings",
"description": "Daily compounding using Daily Balance, 5% per year, 365 days in year",
"currency": {
"code": "USD",
"name": "US Dollar",
"decimalPlaces": 2,
"displaySymbol": "$",
"nameCode": "currency.USD",
"displayLabel": "US Dollar ($)"
},
"nominalAnnualInterestRate": 5,
"interestCompoundingPeriodType": {
"id": 1, "id": 1,
"code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily", "name": "Savings product",
"value": "Daily" "description": "gtasga",
}, "currency": {
"interestCalculationType": { "code": "USD",
"id": 1, "name": "US Dollar",
"code": "savingsInterestCalculationType.dailybalance", "decimalPlaces": 2,
"value": "Daily Balance" "displaySymbol": "$",
}, "nameCode": "currency.USD",
"interestCalculationDaysInYearType": { "displayLabel": "US Dollar ($)"
"id": 365, },
"code": "savingsInterestCalculationDaysInYearType.days365", "nominalAnnualInterestRate": 5.000000,
"value": "365 Days" "interestCompoundingPeriodType": {
"id": 1,
"code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily",
"value": "Daily"
},
"interestPostingPeriodType": {
"id": 4,
"code": "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly",
"value": "Monthly"
},
"interestCalculationType": {
"id": 1,
"code": "savingsInterestCalculationType.dailybalance",
"value": "Daily Balance"
},
"interestCalculationDaysInYearType": {
"id": 365,
"code": "savingsInterestCalculationDaysInYearType.days365",
"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 -->
@@ -190,6 +190,30 @@ public class AccountingConstants {
return this.value; return this.value;
} }
} }
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";
@@ -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);
} }
} }
} }