diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 4a1831bfc..92859b3e3 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -7858,6 +7858,12 @@ Request Body: It is a flag, Used to denote whether the loans should include in loan cycle counter or not. + + useBorrowerCycle + + + It is a flag, Used to denote whether the loans should depend on
borrower loan cycle counter or not. + currencyCode @@ -7963,6 +7969,15 @@ Request Body: loan is in arrears. + + principalVariationsForBorrowerCycle,interestRateVariationsForBorrowerCycle,
numberOfRepaymentVariationsForBorrowerCycle + + + Variations for loan, based on borrower cycle number + + + + transactionProcessingStrategyId @@ -8041,39 +8056,57 @@ GET https://DomainName/api/v1/loanproducts [ { "id": 1, - "name": "LP with Charges but no accounting)", + "name": "personal loan product", + "includeInBorrowerCycle": false, + "useBorrowerCycle": false, + "startDate": [ + 2013, + 9, + 2 + ], + "closeDate": [ + 2014, + 2, + 7 + ], + "status": "loanProduct.active", "currency": { "code": "USD", "name": "US Dollar", "decimalPlaces": 2, + "inMultiplesOf": 0, "displaySymbol": "$", "nameCode": "currency.USD", "displayLabel": "US Dollar ($)" }, - "principal": 100000, - "numberOfRepayments": 12, - "repaymentEvery": 1, + "principal": 10000.000000, + "minPrincipal": 5000.000000, + "maxPrincipal": 15000.000000, + "numberOfRepayments": 10, + "minNumberOfRepayments": 5, + "maxNumberOfRepayments": 15, + "repaymentEvery": 7, "repaymentFrequencyType": { - "id": 2, - "code": "repaymentFrequency.periodFrequencyType.months", - "value": "Months" + "id": 0, + "code": "repaymentFrequency.periodFrequencyType.days", + "value": "Days" }, - "interestRatePerPeriod": 1.75, + "interestRatePerPeriod": 15.000000, "interestRateFrequencyType": { - "id": 2, - "code": "interestRateFrequency.periodFrequencyType.months", - "value": "Per month" + "id": 3, + "code": "interestRateFrequency.periodFrequencyType.years", + "value": "Per year" }, - "annualInterestRate": 21, + "annualInterestRate": 15.000000, "amortizationType": { "id": 1, "code": "amortizationType.equal.installments", "value": "Equal installments" }, "interestType": { - "id": 0, - "code": "interestType.declining.balance", - "value": "Declining Balance" + "id": 1, + "code": "interestType.flat", + "value": "Flat" }, "interestCalculationPeriodType": { "id": 1, @@ -8082,10 +8115,13 @@ GET https://DomainName/api/v1/loanproducts }, "transactionProcessingStrategyId": 1, "transactionProcessingStrategyName": "Mifos style", + "principalVariationsForBorrowerCycle": [], + "interestRateVariationsForBorrowerCycle": [], + "numberOfRepaymentVariationsForBorrowerCycle": [], "accountingRule": { - "id": 1, - "code": "accountingRuleType.none", - "value": "NONE" + "id": 2, + "code": "accountingRuleType.cash", + "value": "CASH BASED" } } ] @@ -8116,13 +8152,16 @@ GET https://DomainName/api/v1/loanproducts/template { + "includeInBorrowerCycle": false, + "useBorrowerCycle": false, "currency": { - "code": "UGX", - "name": "Uganda Shilling", - "decimalPlaces": 2, - "displaySymbol": "USh", - "nameCode": "currency.UGX", - "displayLabel": "Uganda Shilling (USh)" + "code": "", + "name": "", + "decimalPlaces": 0, + "inMultiplesOf": 0, + "displaySymbol": "", + "nameCode": "", + "displayLabel": " []" }, "repaymentFrequencyType": { "id": 2, @@ -8149,22 +8188,29 @@ GET https://DomainName/api/v1/loanproducts/template "code": "interestCalculationPeriodType.same.as.repayment.period", "value": "Same as repayment period" }, - "transactionProcessingStrategyId": 2, - "transactionProcessingStrategyName": "Heavensfamily", + "principalVariationsForBorrowerCycle": [], + "interestRateVariationsForBorrowerCycle": [], + "numberOfRepaymentVariationsForBorrowerCycle": [], "accountingRule": { "id": 1, "code": "accountingRuleType.none", "value": "NONE" }, - "accountingMappings": {}, + "paymentTypeOptions": [ + { + "id": 10, + "name": "check", + "position": 1 + } + ], "currencyOptions": [ { - "code": "UGX", - "name": "Uganda Shilling", + "code": "USD", + "name": "US Dollar", "decimalPlaces": 2, - "displaySymbol": "USh", - "nameCode": "currency.UGX", - "displayLabel": "Uganda Shilling (USh)" + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" } ], "repaymentFrequencyTypeOptions": [ @@ -8205,7 +8251,7 @@ GET https://DomainName/api/v1/loanproducts/template { "id": 0, "code": "amortizationType.equal.principal", - "value": "Equal principle payments" + "value": "Equal principal payments" } ], "interestTypeOptions": [ @@ -8233,27 +8279,262 @@ GET https://DomainName/api/v1/loanproducts/template } ], "transactionProcessingStrategyOptions": [ + { + "id": 1, + "code": "mifos-standard-strategy", + "name": "Mifos style" + }, { "id": 2, "code": "heavensfamily-strategy", "name": "Heavensfamily" + }, + { + "id": 3, + "code": "creocore-strategy", + "name": "Creocore" + }, + { + "id": 4, + "code": "rbi-india-strategy", + "name": "RBI (India)" + }, + { + "id": 5, + "code": "principal-interest-penalties-fees-order-strategy", + "name": "Principal Interest Penalties Fees Order" + }, + { + "id": 6, + "code": "interest-principal-penalties-fees-order-strategy", + "name": "Interest Principal Penalties Fees Order" } ], "chargeOptions": [ { - "id": 1, - "name": "Bank Fee (per installment)", + "id": 5, + "name": "des charge", "active": true, "penalty": false, "currency": { - "code": "UGX", - "name": "Uganda Shilling", + "code": "USD", + "name": "US Dollar", "decimalPlaces": 2, - "displaySymbol": "USh", - "nameCode": "currency.UGX", - "displayLabel": "Uganda Shilling (USh)" + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" }, - "amount": 1500, + "amount": 100.000000, + "chargeTimeType": { + "id": 1, + "code": "chargeTimeType.disbursement", + "value": "Disbursement" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 1, + "code": "chargeCalculationType.flat", + "value": "Flat" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 1, + "name": "flat install", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 50.000000, + "chargeTimeType": { + "id": 8, + "code": "chargeTimeType.instalmentFee", + "value": "Instalment Fee" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 1, + "code": "chargeCalculationType.flat", + "value": "Flat" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 9, + "name": "install amt+int", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 8, + "code": "chargeTimeType.instalmentFee", + "value": "Instalment Fee" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 3, + "code": "chargeCalculationType.percent.of.amount.and.interest", + "value": "% Loan Amount + Interest" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 10, + "name": "install int", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 8, + "code": "chargeTimeType.instalmentFee", + "value": "Instalment Fee" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 4, + "code": "chargeCalculationType.percent.of.interest", + "value": "% Interest" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 2, + "name": "install per", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 8, + "code": "chargeTimeType.instalmentFee", + "value": "Instalment Fee" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 2, + "code": "chargeCalculationType.percent.of.amount", + "value": "% Amount" + }, + "chargePaymentMode": { + "id": 1, + "code": "chargepaymentmode.accounttransfer", + "value": "Account transfer" + } + }, + { + "id": 8, + "name": "spe int", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 4, + "code": "chargeCalculationType.percent.of.interest", + "value": "% Interest" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 4, + "name": "specific acc transfer", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 100.000000, "chargeTimeType": { "id": 2, "code": "chargeTimeType.specifiedDueDate", @@ -8268,6 +8549,116 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "chargeCalculationType.flat", "value": "Flat" + }, + "chargePaymentMode": { + "id": 1, + "code": "chargepaymentmode.accounttransfer", + "value": "Account transfer" + } + }, + { + "id": 7, + "name": "specific amt+int", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 3, + "code": "chargeCalculationType.percent.of.amount.and.interest", + "value": "% Loan Amount + Interest" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 3, + "name": "specific per", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 5.000000, + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 2, + "code": "chargeCalculationType.percent.of.amount", + "value": "% Amount" + }, + "chargePaymentMode": { + "id": 0, + "code": "chargepaymentmode.regular", + "value": "Regular" + } + }, + { + "id": 6, + "name": "xyz", + "active": true, + "penalty": false, + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 50.000000, + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 1, + "code": "chargeCalculationType.flat", + "value": "Flat" + }, + "chargePaymentMode": { + "id": 1, + "code": "chargepaymentmode.accounttransfer", + "value": "Account transfer" } } ], @@ -8289,11 +8680,35 @@ GET https://DomainName/api/v1/loanproducts/template } ], "accountingMappingOptions": { + "liabilityAccountOptions": [ + { + "id": 11, + "name": "over payment", + "glCode": "13", + "disabled": false, + "manualEntriesAllowed": true, + "type": { + "id": 2, + "code": "accountType.liability", + "value": "LIABILITY" + }, + "usage": { + "id": 1, + "code": "accountUsage.detail", + "value": "DETAIL" + }, + "nameDecorated": "over payment", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 0 + }, + ], "assetAccountOptions": [ { - "id": 2, - "name": "Cash in Valut 1", - "glCode": "11101", + "id": 1, + "name": "fund source", + "glCode": "01", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8305,12 +8720,17 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } + }, + "nameDecorated": "fund source", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": -60000 }, { - "id": 4, - "name": "Centenary Opening Account", - "glCode": "11201", + "id": 2, + "name": "Loan portfolio", + "glCode": "02", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8322,14 +8742,41 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } - } + }, + "nameDecorated": "Loan portfolio", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 60000 + }, + { + "id": 3, + "name": "transfers", + "glCode": "03", + "disabled": false, + "manualEntriesAllowed": true, + "type": { + "id": 1, + "code": "accountType.asset", + "value": "ASSET" + }, + "usage": { + "id": 1, + "code": "accountUsage.detail", + "value": "DETAIL" + }, + "nameDecorated": "transfers", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 0 + }, ], "expenseAccountOptions": [ { - "id": 41, - "name": "Water Charges", - "glCode": "42102", + "id": 10, + "name": "loans written off 2", + "glCode": "12", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8341,48 +8788,19 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } - }, - { - "id": 42, - "name": "Electricity Charges", - "glCode": "42103", - "disabled": false, - "manualEntriesAllowed": true, - "type": { - "id": 5, - "code": "accountType.expense", - "value": "EXPENSE" }, - "usage": { - "id": 1, - "code": "accountUsage.detail", - "value": "DETAIL" - } - }, - { - "id": 97, - "name": "Miscellaneous", - "glCode": "42905", - "disabled": false, - "manualEntriesAllowed": true, - "type": { - "id": 5, - "code": "accountType.expense", - "value": "EXPENSE" + "nameDecorated": "loans written off 2", + "tagId": { + "id": 0 }, - "usage": { - "id": 1, - "code": "accountUsage.detail", - "value": "DETAIL" - } + "organizationRunningBalance": 0 } ], "incomeAccountOptions": [ { - "id": 34, - "name": "Interest on Loans", - "glCode": "31101", + "id": 4, + "name": "income from interest", + "glCode": "04", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8394,12 +8812,17 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } + }, + "nameDecorated": "income from interest", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 19 }, { - "id": 35, - "name": "Late Payment Interest", - "glCode": "31102", + "id": 8, + "name": "income from fees 2", + "glCode": "10", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8411,12 +8834,17 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } + }, + "nameDecorated": "income from fees 2", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 0 }, { - "id": 37, - "name": "Collected Bank Fees Receivable", - "glCode": "6201", + "id": 9, + "name": "income from penalities 2", + "glCode": "11", "disabled": false, "manualEntriesAllowed": true, "type": { @@ -8428,10 +8856,27 @@ GET https://DomainName/api/v1/loanproducts/template "id": 1, "code": "accountUsage.detail", "value": "DETAIL" - } + }, + "nameDecorated": "income from penalities 2", + "tagId": { + "id": 0 + }, + "organizationRunningBalance": 0 } ] - } + }, + "valueConditionTypeOptions": [ + { + "id": 2, + "code": "LoanProductValueConditionType.equal", + "value": "equals" + }, + { + "id": 3, + "code": "LoanProductValueConditionType.greterthan", + "value": "greter than" + } + ] } @@ -8457,31 +8902,37 @@ GET https://DomainName/api/v1/loanproducts/{productId} { - "id": 1, - "name": "LP with Charges but no accounting)", + "id": 11, + "name": "advanced accounting", + "includeInBorrowerCycle": true, + "useBorrowerCycle": true, + "status": "loanProduct.active", "currency": { "code": "USD", "name": "US Dollar", "decimalPlaces": 2, + "inMultiplesOf": 0, "displaySymbol": "$", "nameCode": "currency.USD", "displayLabel": "US Dollar ($)" }, - "principal": 100000, - "numberOfRepayments": 12, - "repaymentEvery": 1, + "principal": 10000.000000, + "minPrincipal": 2000.000000, + "maxPrincipal": 15000.000000, + "numberOfRepayments": 7, + "repaymentEvery": 7, "repaymentFrequencyType": { - "id": 2, - "code": "repaymentFrequency.periodFrequencyType.months", - "value": "Months" + "id": 0, + "code": "repaymentFrequency.periodFrequencyType.days", + "value": "Days" }, - "interestRatePerPeriod": 1.75, + "interestRatePerPeriod": 5.000000, "interestRateFrequencyType": { "id": 2, "code": "interestRateFrequency.periodFrequencyType.months", "value": "Per month" }, - "annualInterestRate": 21, + "annualInterestRate": 60.000000, "amortizationType": { "id": 1, "code": "amortizationType.equal.installments", @@ -8499,43 +8950,146 @@ GET https://DomainName/api/v1/loanproducts/{productId} }, "transactionProcessingStrategyId": 1, "transactionProcessingStrategyName": "Mifos style", - "charges": [ + "charges": [], + "principalVariationsForBorrowerCycle": [ { + "id": 21, + "borrowerCycleNumber": 1, + "paramType": { + "id": 1, + "code": "LoanProductParamType.principal", + "value": "principal" + }, + "valueConditionType": { + "id": 2, + "code": "LoanProductValueConditionType.equal", + "value": "equals" + }, + "minValue": 2000.000000, + "maxValue": 20000.000000, + "defaultValue": 15000.000000 + }, + { + "id": 20, + "borrowerCycleNumber": 1, + "paramType": { + "id": 1, + "code": "LoanProductParamType.principal", + "value": "principal" + }, + "valueConditionType": { + "id": 3, + "code": "LoanProductValueConditionType.greterthan", + "value": "greter than" + }, + "minValue": 3000.000000, + "maxValue": 25000.000000, + "defaultValue": 20000.000000 + } + ], + "interestRateVariationsForBorrowerCycle": [], + "numberOfRepaymentVariationsForBorrowerCycle": [], + "accountingRule": { + "id": 2, + "code": "accountingRuleType.cash", + "value": "CASH BASED" + }, + "accountingMappings": { + "fundSourceAccount": { "id": 1, - "name": "Loan service fee", - "active": true, - "penalty": false, - "currency": { - "code": "USD", - "name": "US Dollar", - "decimalPlaces": 2, - "displaySymbol": "$", - "nameCode": "currency.USD", - "displayLabel": "US Dollar ($)" + "name": "fund source", + "glCode": "01" + }, + "loanPortfolioAccount": { + "id": 2, + "name": "Loan portfolio", + "glCode": "02" + }, + "transfersInSuspenseAccount": { + "id": 3, + "name": "transfers", + "glCode": "03" + }, + "interestOnLoanAccount": { + "id": 4, + "name": "income from interest", + "glCode": "04" + }, + "incomeFromFeeAccount": { + "id": 8, + "name": "income from fees 2", + "glCode": "10" + }, + "incomeFromPenaltyAccount": { + "id": 9, + "name": "income from penalities 2", + "glCode": "11" + }, + "writeOffAccount": { + "id": 10, + "name": "loans written off 2", + "glCode": "12" + }, + "overpaymentLiabilityAccount": { + "id": 11, + "name": "over payment", + "glCode": "13" + } + }, + "paymentChannelToFundSourceMappings": [ + { + "paymentType": { + "id": 10, + "name": "check" }, - "amount": 230.56, - "chargeTimeType": { + "fundSourceAccount": { "id": 1, - "code": "chargeTimeType.disbursement", - "value": "Disbursement" - }, - "chargeAppliesTo": { - "id": 1, - "code": "chargeAppliesTo.loan", - "value": "Loan" - }, - "chargeCalculationType": { - "id": 1, - "code": "chargeCalculationType.flat", - "value": "Flat" + "name": "fund source", + "glCode": "01" } } ], - "accountingRule": { - "id": 1, - "code": "accountingRuleType.none", - "value": "NONE" - } + "feeToIncomeAccountMappings": [ + { + "charge": { + "id": 1, + "name": "flat install", + "active": false, + "penalty": false + }, + "incomeAccount": { + "id": 8, + "name": "income from fees 2", + "glCode": "10" + } + }, + { + "charge": { + "id": 2, + "name": "install per", + "active": false, + "penalty": false + }, + "incomeAccount": { + "id": 4, + "name": "income from interest", + "glCode": "04" + } + }, + { + "charge": { + "id": 5, + "name": "des charge", + "active": false, + "penalty": false + }, + "incomeAccount": { + "id": 9, + "name": "income from penalities 2", + "glCode": "11" + } + } + ] } @@ -8571,7 +9125,10 @@ GET https://DomainName/api/v1/loanproducts/{productId}
Optional Fields
- inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, includeInBorrowerCycle + inArrearsTolerance, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, charges, paymentChannelToFundSourceMappings, feeToIncomeAccountMappings, penaltyToIncomeAccountMappings, includeInBorrowerCycle, + useBorrowerCycle,principalVariationsForBorrowerCycle, + numberOfRepaymentVariationsForBorrowerCycle, + interestRateVariationsForBorrowerCycle @@ -8601,25 +9158,55 @@ POST https://DomainName/api/v1/loanproducts POST loanproducts Content-Type: application/json Request Body: -{ - "name": "LP with Charges but no accounting)", - "currencyCode": "USD", - "locale": "en_GB", - "digitsAfterDecimal": "2", - "inMultiplesOf": 0, - "principal": "100,000.00", - "numberOfRepayments": "12", - "repaymentEvery": "1", - "repaymentFrequencyType": 2, - "interestRatePerPeriod": "1.75", - "interestRateFrequencyType": 2, - "amortizationType": 1, - "interestType": 0, - "interestCalculationPeriodType": 1, - "inArrearsTolerance": "0", - "transactionProcessingStrategyId": 1, - "charges":[{"id":"1"}], - "accountingRule": 1 +{"currencyCode":"USD", +"includeInBorrowerCycle":"true", +"useBorrowerCycle":true, +"digitsAfterDecimal":"2", +"inMultiplesOf":"0", +"repaymentFrequencyType":0, +"interestRateFrequencyType":2, +"amortizationType":1, +"interestType":0, +"interestCalculationPeriodType":1, +"transactionProcessingStrategyId":1, +"principalVariationsForBorrowerCycle":[], +"interestRateVariationsForBorrowerCycle":[], +"numberOfRepaymentVariationsForBorrowerCycle":[ + { + "valueConditionType":2, + "borrowerCycleNumber":"1", + "minValue":"5", + "defaultValue":"10", + "maxValue":"15" + }, + { + "valueConditionType":3, + "borrowerCycleNumber":"1", + "minValue":"7", + "defaultValue":"15", + "maxValue":"20" + } +], +"accountingRule":"2", +"name":"product 5", +"principal":"5000", +"numberOfRepayments":"7", +"repaymentEvery":"7", +"interestRatePerPeriod":"5", +"paymentChannelToFundSourceMappings":[], +"feeToIncomeAccountMappings":[], +"penaltyToIncomeAccountMappings":[], +"charges":[], +"dateFormat":"dd MMMM yyyy", +"locale":"en", +"fundSourceAccountId":1, +"loanPortfolioAccountId":2, +"transfersInSuspenseAccountId":3, +"interestOnLoanAccountId":4, +"incomeFromFeeAccountId":8, +"incomeFromPenaltyAccountId":9, +"writeOffAccountId":10, +"overpaymentLiabilityAccountId":11 } 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 c2b2e6f9e..d679c4e3a 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 @@ -106,6 +106,30 @@ public class AccountingConstants { } } + public static enum LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS { + FUND_SOURCE("fundSourceAccount"), LOAN_PORTFOLIO("loanPortfolioAccount"), INTEREST_ON_LOANS("interestOnLoanAccount"), INCOME_FROM_FEES( + "incomeFromFeeAccount"), INCOME_FROM_PENALTIES("incomeFromPenaltyAccount"), LOSSES_WRITTEN_OFF("writeOffAccount"), OVERPAYMENT( + "overpaymentLiabilityAccount"), INTEREST_RECEIVABLE("receivableInterestAccount"), FEES_RECEIVABLE( + "receivableFeeAccount"), PENALTIES_RECEIVABLE("receivablePenaltyAccount"), TRANSFERS_SUSPENSE( + "transfersInSuspenseAccount"), INCOME_ACCOUNT_ID("incomeAccount"); + + private final String value; + + private LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS(final String value) { + this.value = value; + } + + @Override + public String toString() { + return name().toString().replaceAll("_", " "); + } + + public String getValue() { + return this.value; + } + } + + /*** Accounting placeholders for cash based accounting for savings products ***/ public static enum CASH_ACCOUNTS_FOR_SAVINGS { SAVINGS_REFERENCE(1), SAVINGS_CONTROL(2), INTEREST_ON_SAVINGS(3), INCOME_FROM_FEES(4), INCOME_FROM_PENALTIES(5), TRANSFERS_SUSPENSE( diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/data/GLAccountData.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/data/GLAccountData.java index de1faa54f..100d6fe84 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/data/GLAccountData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/data/GLAccountData.java @@ -26,8 +26,8 @@ public class GLAccountData { private final String name; private final Long parentId; private final String glCode; - private final boolean disabled; - private final boolean manualEntriesAllowed; + private final Boolean disabled; + private final Boolean manualEntriesAllowed; private final EnumOptionData type; private final EnumOptionData usage; private final String description; @@ -139,8 +139,8 @@ public class GLAccountData { this.name = name; this.parentId = null; this.glCode = glCode; - this.disabled = false; - this.manualEntriesAllowed = false; + this.disabled = null; + this.manualEntriesAllowed = null; this.type = null; this.usage = null; this.description = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java index 70d87ba6f..4edee73af 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/ChargeToGLAccountMapper.java @@ -5,16 +5,19 @@ */ package org.mifosplatform.accounting.producttoaccountmapping.data; +import org.mifosplatform.accounting.glaccount.data.GLAccountData; +import org.mifosplatform.portfolio.charge.data.ChargeData; + public class ChargeToGLAccountMapper { @SuppressWarnings("unused") - private final long chargeId; + private final ChargeData charge; @SuppressWarnings("unused") - private final long incomeAccountId; + private final GLAccountData incomeAccount; - public ChargeToGLAccountMapper(final long chargeId, final long incomeAccountId) { - this.chargeId = chargeId; - this.incomeAccountId = incomeAccountId; + public ChargeToGLAccountMapper(final ChargeData charge, final GLAccountData incomeAccount) { + this.charge = charge; + this.incomeAccount = incomeAccount; } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java index 37bb31831..af0367419 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/data/PaymentTypeToGLAccountMapper.java @@ -5,16 +5,19 @@ */ package org.mifosplatform.accounting.producttoaccountmapping.data; +import org.mifosplatform.accounting.glaccount.data.GLAccountData; +import org.mifosplatform.infrastructure.codes.data.CodeValueData; + public class PaymentTypeToGLAccountMapper { @SuppressWarnings("unused") - private final long paymentTypeId; + private final CodeValueData paymentType; @SuppressWarnings("unused") - private final long fundSourceAccountId; + private final GLAccountData fundSourceAccount; - public PaymentTypeToGLAccountMapper(final long paymentTypeId, final long fundSourceAccountId) { - this.paymentTypeId = paymentTypeId; - this.fundSourceAccountId = fundSourceAccountId; + public PaymentTypeToGLAccountMapper(final CodeValueData paymentType, final GLAccountData fundSourceAccount) { + this.paymentType = paymentType; + this.fundSourceAccount = fundSourceAccount; } } 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 2ce50d032..fc8d49efc 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 @@ -15,14 +15,17 @@ import java.util.Map; import org.mifosplatform.accounting.common.AccountingConstants.ACCRUAL_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.LOAN_PRODUCT_ACCOUNTING_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.AccountingRuleType; +import org.mifosplatform.accounting.glaccount.data.GLAccountData; import org.mifosplatform.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper; import org.mifosplatform.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper; import org.mifosplatform.accounting.producttoaccountmapping.domain.PortfolioProductType; +import org.mifosplatform.infrastructure.codes.data.CodeValueData; import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.service.RoutingDataSource; +import org.mifosplatform.portfolio.charge.data.ChargeData; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; @@ -41,10 +44,13 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product private static final class ProductToGLAccountMappingMapper implements RowMapper> { public String schema() { - return " mapping.id as id, mapping.gl_account_id as glAccountId, mapping.product_id as productId, " - + " mapping.product_type as productType,mapping.financial_account_type as financialAccountType, " - + " mapping.payment_type as paymentTypeId, mapping.charge_id as chargeId, charge.is_penalty as penalty " + return " mapping.id as id, mapping.gl_account_id as glAccountId,glaccount.name as name,glaccount.gl_code as code," + + " mapping.product_id as productId, mapping.product_type as productType,mapping.financial_account_type as financialAccountType, " + + " mapping.payment_type as paymentTypeId,cv.code_value codeValue, mapping.charge_id as chargeId, charge.is_penalty as penalty, " + + " charge.name as chargeName " + " from acc_product_mapping mapping left join m_charge charge on mapping.charge_id=charge.id " + + " left join acc_gl_account as glaccount on mapping.gl_account_id = glaccount.id" + + " left join m_code_value cv on mapping.payment_type=cv.id" + " where mapping.product_type= ? "; } @@ -57,8 +63,13 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product final Long paymentTypeId = JdbcSupport.getLong(rs, "paymentTypeId"); final Long chargeId = rs.getLong("chargeId"); final Integer productType = rs.getInt("productType"); + final String paymentTypeValue = rs.getString("codeValue"); final Integer financialAccountType = rs.getInt("financialAccountType"); - + final String glAccountName = rs.getString("name"); + final String glCode = rs.getString("code"); + final String chargeName = rs.getString("chargeName"); + final Boolean penalty = rs.getBoolean("penalty"); + final Map loanProductToGLAccountMap = new LinkedHashMap(5); loanProductToGLAccountMap.put("id", id); loanProductToGLAccountMap.put("glAccountId", glAccountId); @@ -66,8 +77,12 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product loanProductToGLAccountMap.put("productType", productType); loanProductToGLAccountMap.put("financialAccountType", financialAccountType); loanProductToGLAccountMap.put("paymentTypeId", paymentTypeId); + loanProductToGLAccountMap.put("paymentTypeValue",paymentTypeValue); loanProductToGLAccountMap.put("chargeId", chargeId); - + loanProductToGLAccountMap.put("chargeName", chargeName); + loanProductToGLAccountMap.put("penalty", penalty); + loanProductToGLAccountMap.put("glAccountName", glAccountName); + loanProductToGLAccountMap.put("glCode", glCode); return loanProductToGLAccountMap; } } @@ -91,23 +106,26 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product final CASH_ACCOUNTS_FOR_LOAN glAccountForLoan = CASH_ACCOUNTS_FOR_LOAN.fromInt(financialAccountType); final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId"); + final String glAccountName = (String)productToGLAccountMap.get("glAccountName"); + final String glCode = (String)productToGLAccountMap.get("glCode"); + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.FUND_SOURCE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FUND_SOURCE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_LOANS.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOAN_PORTFOLIO.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOSSES_WRITTEN_OFF.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.OVERPAYMENT)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData); } } } else if (AccountingRuleType.ACCRUAL_BASED.getValue().equals(accountingType)) { @@ -117,29 +135,32 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product final ACCRUAL_ACCOUNTS_FOR_LOAN glAccountForLoan = ACCRUAL_ACCOUNTS_FOR_LOAN.fromInt(financialAccountType); final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId"); + final String glAccountName = (String)productToGLAccountMap.get("glAccountName"); + final String glCode = (String)productToGLAccountMap.get("glCode"); + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.FUND_SOURCE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FUND_SOURCE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_FEES)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_FEES.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_FEES.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INCOME_FROM_PENALTIES)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INCOME_FROM_PENALTIES.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_PENALTIES.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_ON_LOANS)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_ON_LOANS.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.LOAN_PORTFOLIO)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOAN_PORTFOLIO.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.OVERPAYMENT)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.OVERPAYMENT.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.TRANSFERS_SUSPENSE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.TRANSFERS_SUSPENSE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.TRANSFERS_SUSPENSE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.LOSSES_WRITTEN_OFF)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOSSES_WRITTEN_OFF.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.LOSSES_WRITTEN_OFF.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.INTEREST_RECEIVABLE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INTEREST_RECEIVABLE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.FEES_RECEIVABLE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.FEES_RECEIVABLE.getValue(), gLAccountData); } else if (glAccountForLoan.equals(ACCRUAL_ACCOUNTS_FOR_LOAN.PENALTIES_RECEIVABLE)) { - accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), glAccountId); + accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.PENALTIES_RECEIVABLE.getValue(), gLAccountData); } } @@ -166,19 +187,23 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product final CASH_ACCOUNTS_FOR_SAVINGS glAccountForSavings = CASH_ACCOUNTS_FOR_SAVINGS.fromInt(financialAccountType); final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId"); + final String glAccountName = (String)productToGLAccountMap.get("glAccountName"); + final String glCode = (String)productToGLAccountMap.get("glCode"); + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); + if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_REFERENCE)) { - accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), gLAccountData); } else if (glAccountForSavings.equals(CASH_ACCOUNTS_FOR_SAVINGS.SAVINGS_CONTROL)) { - accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_CONTROL.getValue(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_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(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_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(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_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(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_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(), glAccountId); + accountMappingDetails.put(SAVINGS_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_SAVINGS.getValue(), gLAccountData); } } } @@ -213,9 +238,15 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product if (paymentTypeToGLAccountMappers == null) { paymentTypeToGLAccountMappers = new ArrayList(); } - final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId"); final Long paymentTypeId = (Long) productToGLAccountMap.get("paymentTypeId"); - final PaymentTypeToGLAccountMapper paymentTypeToGLAccountMapper = new PaymentTypeToGLAccountMapper(paymentTypeId, glAccountId); + final String paymentTypeValue = (String)productToGLAccountMap.get("paymentTypeValue"); + final CodeValueData codeValueData = CodeValueData.instance(paymentTypeId, paymentTypeValue); + final Long glAccountId = (Long) productToGLAccountMap.get("glAccountId"); + final String glAccountName = (String)productToGLAccountMap.get("glAccountName"); + final String glCode = (String)productToGLAccountMap.get("glCode"); + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); + + final PaymentTypeToGLAccountMapper paymentTypeToGLAccountMapper = new PaymentTypeToGLAccountMapper(codeValueData,gLAccountData); paymentTypeToGLAccountMappers.add(paymentTypeToGLAccountMapper); } return paymentTypeToGLAccountMappers; @@ -259,8 +290,14 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product chargeToGLAccountMappers = new ArrayList(); } final Long glAccountId = (Long) chargeToIncomeAccountMap.get("glAccountId"); + final String glAccountName = (String)chargeToIncomeAccountMap.get("glAccountName"); + final String glCode = (String)chargeToIncomeAccountMap.get("glCode"); + final GLAccountData gLAccountData = new GLAccountData(glAccountId, glAccountName, glCode); final Long chargeId = (Long) chargeToIncomeAccountMap.get("chargeId"); - final ChargeToGLAccountMapper chargeToGLAccountMapper = new ChargeToGLAccountMapper(chargeId, glAccountId); + final String chargeName = (String)chargeToIncomeAccountMap.get("chargeName"); + final Boolean penalty1 = (Boolean)chargeToIncomeAccountMap.get("penalty"); + final ChargeData chargeData = ChargeData.lookup(chargeId, chargeName, penalty1); + final ChargeToGLAccountMapper chargeToGLAccountMapper = new ChargeToGLAccountMapper(chargeData, gLAccountData); chargeToGLAccountMappers.add(chargeToGLAccountMapper); } return chargeToGLAccountMappers;