diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 92859b3e3..ab1a79baa 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -13520,8 +13520,8 @@ Request Body: { "id": 1, - "name": "First Product", - "description": "A cool saving product", + "name": "savings product", + "description": "gtasga", "currency": { "code": "USD", "name": "US Dollar", @@ -13530,15 +13530,15 @@ Request Body: "nameCode": "currency.USD", "displayLabel": "US Dollar ($)" }, - "nominalAnnualInterestRate": 50.000000, + "nominalAnnualInterestRate": 5.000000, "interestCompoundingPeriodType": { - "id": 4, - "code": "savings.interest.period.savingsCompoundingInterestPeriodType.monthly", - "value": "Monthly" + "id": 1, + "code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily", + "value": "Daily" }, "interestPostingPeriodType": { "id": 4, - "code": "savings.interest.posting.period.savingsInterestPostingPeriodType.monthly", + "code": "savings.interest.posting.period.savingsPostingInterestPeriodType.monthly", "value": "Monthly" }, "interestCalculationType": { @@ -13551,117 +13551,88 @@ Request Body: "code": "savingsInterestCalculationDaysInYearType.days365", "value": "365 Days" }, - "minRequiredOpeningBalance": 20.000000, - "lockinPeriodFrequency": 1, - "lockinPeriodFrequencyType": { - "id": 1, - "code": "savings.lockin.savingsPeriodFrequencyType.weeks", - "value": "Weeks" - }, - "withdrawalFeeForTransfers":true, + "withdrawalFeeForTransfers": false, "accountingRule": { "id": 2, "code": "accountingRuleType.cash", "value": "CASH BASED" }, - "accountingMappings":{ - "savingsReferenceAccountId":1, - "incomeFromFeeAccountId":5, - "interestOnSavingsAccountId":4, - "savingsControlAccountId":2, - "transfersInSuspenseAccountId":3, - "incomeFromPenaltyAccountId":15 - }, - "feeToIncomeAccountMappings":[ - { - "chargeId":6, - "incomeAccountId":16 - } - ], - "penaltyToIncomeAccountMappings":[ - { - "chargeId":4, - "incomeAccountId":15 - } - ], + "accountingMappings": { + "savingsReferenceAccount": { + "id": 12, + "name": "savings ref", + "glCode": "20" + }, + "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": [ { - "paymentTypeId": 14, - "fundSourceAccountId": 2 + "paymentType": { + "id": 10, + "name": "check" + }, + "fundSourceAccount": { + "id": 12, + "name": "savings ref", + "glCode": "20" + } } ], - "charges": [ + "feeToIncomeAccountMappings": [ { - "id": 1, - "name": "Annual fee", - "active": true, - "penalty": false, - "currency": { - "code": "USD", - "name": "US Dollar", - "decimalPlaces": 2, - "displaySymbol": "$", - "nameCode": "currency.USD", - "displayLabel": "US Dollar ($)" + "charge": { + "id": 11, + "name": "sav charge", + "active": false, + "penalty": false }, - "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" + "incomeAccount": { + "id": 16, + "name": "income from savings fee", + "glCode": "24" } } - ] + ], + "penaltyToIncomeAccountMappings": [ + { + "charge": { + "id": 12, + "name": "sav 2", + "active": false, + "penalty": true + }, + "incomeAccount": { + "id": 17, + "name": "income from sav penalites", + "glCode": "25" + } + } + ], + "charges": [] } @@ -13730,37 +13701,47 @@ Content-Type: application/json GET https://Domain Name/api/v1/savingsproducts [ - { - "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, - "code": "savings.interest.period.savingsCompoundingInterestPeriodType.daily", - "value": "Daily" - }, - "interestCalculationType": { - "id": 1, - "code": "savingsInterestCalculationType.dailybalance", - "value": "Daily Balance" - }, - "interestCalculationDaysInYearType": { - "id": 365, - "code": "savingsInterestCalculationDaysInYearType.days365", - "value": "365 Days" + "name": "Savings product", + "description": "gtasga", + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "nominalAnnualInterestRate": 5.000000, + "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" + } } - } -] - +] diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java index d679c4e3a..eafd1c9fd 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java @@ -190,6 +190,30 @@ public class AccountingConstants { 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 LIABILITIES_TAG_OPTION_CODE_NAME = "LiabilityAccountTags"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java index fc8d49efc..3ac53c404 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java @@ -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_SAVINGS; 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.glaccount.data.GLAccountData; 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)) { - 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)) { - 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)) { - 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)) { - 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)) { - 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)) { - accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData); } } }