diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index e072939d0..56a85fb6c 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -632,38 +632,6 @@
Update a Charge |
Delete a Charge |
-
- | DEPOSIT PRODUCT |
- depositproducts |
- Create a Deposit product |
- List Deposit products |
- |
- |
-
-
- |
- depositproducts/{prodcutId} |
- |
- Retrieve a Deposit product |
- Update a Deposit product |
- Delete a Deposit product |
-
-
- | SAVING PRODUCT |
- savingproducts |
- Create a Saving product |
- List Saving products |
- |
- |
-
-
- |
- savingproducts/{prodcutId} |
- |
- Retrieve a Saving product |
- Update a Saving product |
- Delete a Saving product |
-
@@ -1082,6 +1050,7 @@
+
-
-
-
-
-
+
-
-
-
-
-
-
Fixed Deposit Account:
-
- Field Descriptions |
- | deposit : |
- | The amount to be deposited in the deposit account. |
- | externalId : |
- A place to put an external reference for this deposit account. e.g. The ID another system uses.
- If provided, it must be unique. |
-
- | tenureInMonths: |
- The time period for fixed deposit to mature(in months).
- Eg:The period of deposit shall be 24 months
- tenureInMonths=24.
- |
-
- | renewalAllowed: |
- Used to renew the deposit account after maturity.
- if 'true' the account is eligible for renew.
- |
-
- | isInterestWithdrawable: |
- | Denotes whether one can withdraw the interest from deposit account. |
-
- | interestCompoundingAllowed: |
- Denotes whether the interest is calculated on compounding basis or not.
- if true:interest calculated on compounding basis, else interest calculated on simple calculation basis.
- |
-
- | maturityInterestRate: |
- | Denotes the interest rate % on deposit amount. |
-
- | preClosureInterestRate: |
- Denotes the interest rate % of deposit amount for preclosing accounts.
- This rate is applicable if the account is preclosed.
- |
-
- | interestCompoundedEvery: |
- | Interest is calculated on deposit amount for every interestCompoundedEvery period |
-
- | lockinPeriod: |
- Defines a lockin period for deposit account.
- With in the lockin period one cannot preclose the deposit account.
- |
-
-
-
-
-
-
-
-
-
-
-
Retrieve Deposit Account Details Template:
-
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
-
- - Field Defaults
- - Allowed Value Lists
-
-
-
Arguments
-
- - clientId
- - Integer mandatory
- - productId
- - Integer optional
- - If entered productId, productName and selectedProduct fields are returned.
-
-
Example Requests:
-
depositaccounts/template?clientId=17&productId=1
-
-
depositaccounts/template?clientId=17
-
-
- GET https://Domain Name/api/v1/depositaccounts/template?clientId={clientId}&productId={productId}
-
-{
- "clientId": 1,
- "clientName": "First Client",
- "productId": 1,
- "productName": "MyFirstDepositProduct",
- "currency": {
- "code": "USD",
- "name": "",
- "decimalPlaces": 2,
- "displaySymbol": "",
- "nameCode": "",
- "displayLabel": " [USD]"
- },
- "deposit": 100,
- "maturityInterestRate": 6,
- "tenureInMonths": 12,
- "projectedCommencementDate": [
- 2013,
- 2,
- 6
- ],
- "interestCompoundedEvery": 1,
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "renewalAllowed": true,
- "preClosureAllowed": true,
- "preClosureInterestRate": 3,
- "isInterestWithdrawable": false,
- "interestCompoundingAllowed": true,
- "interestCompoundedEveryPeriodTypeOptions": [
- {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- }
- ],
- "productOptions": [
- {
- "id": 1,
- "name": "MyFirstDepositProduct"
- }
- ],
- "availableInterestForWithdrawal": 0,
- "availableWithdrawalAmount": 0,
- "todaysDate": [
- 2013,
- 2,
- 6
- ],
- "isLockinPeriodAllowed": true,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "availableInterest": 0,
- "interestPostedAmount": 0
-}
-
-
- GET https://Domain Name/api/v1/depositaccounts/template?clientId={clientId}
-{
- "clientId": 1,
- "clientName": "First Client",
- "renewalAllowed": false,
- "preClosureAllowed": false,
- "isInterestWithdrawable": false,
- "interestCompoundingAllowed": true,
- "interestCompoundedEveryPeriodTypeOptions": [
- {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- }
- ],
- "productOptions": [
- {
- "id": 1,
- "name": "MyFirstDepositProduct"
- }
- ],
- "availableInterestForWithdrawal": 0,
- "availableWithdrawalAmount": 0,
- "todaysDate": [
- 2013,
- 2,
- 6
- ],
- "isLockinPeriodAllowed": true,
- "availableInterest": 0,
- "interestPostedAmount": 0
-}
-
-
-
-
-
-
-
-
Retrieve a fixeddeposit:
-
-
Arguments
-
- - associations
- - optional, 'all' deposit associations are itemised below
-
Associations are just extra pieces of data that you might or might not want to retrieve.
- - 'all': Gets all association data.
- - 'permissions': Data that describes what things can happen to the deposit in its current state.
- Very specific to the needs of the current Individual Lending client application.
-
-
Example Requests:
-
depositaccounts/1
-
-
depositaccounts/1?associations=all
-
-
- GET https://DomainName/api/v1/depositaccounts/{depositaccountId}
- {
-{
- "id": 5,
- "status": {
- "id": 100,
- "code": "depositStatusType.submitted.and.pending.approval",
- "value": "Submitted and pending approval"
- },
- "clientId": 17,
- "clientName": "Agri",
- "productId": 1,
- "productName": "Micro Savings",
- "currency": {
- "code": "INR",
- "name": "Indian Rupee",
- "decimalPlaces": 2,
- "nameCode": "currency.INR",
- "displayLabel": "Indian Rupee [INR]"
- },
- "deposit": 200.000000,
- "maturityInterestRate": 12.000000,
- "tenureInMonths": 12,
- "projectedCommencementDate": [2012, 12, 16],
- "maturedOn": [2013, 12, 15],
- "projectedInterestAccrued": 24.000000,
- "projectedMaturityAmount": 224.000000,
- "interestCompoundedEvery": 6,
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "renewalAllowed": true,
- "preClosureAllowed": true,
- "preClosureInterestRate": 5.000000,
- "isInterestWithdrawable": true,
- "interestPaid": 0.000000,
- "interestCompoundingAllowed": false,
- "permissions": {
- "rejectAllowed": true,
- "withdrawnByApplicantAllowed": true,
- "undoApprovalAllowed": false,
- "pendingApproval": true,
- "isInterestWithdrawalAllowed": true,
- "renewelAllowed": false,
- "isMaturedDepositAccount": false,
- "anyActionOnAccountAllowed": true
- },
- "availableInterestForWithdrawal": 0,
- "availableWithdrawalAmount": 200.000000,
- "todaysDate": [2013, 1, 30],
- "isLockinPeriodAllowed": true,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "availableInterest": 0.000000,
- "interestPostedAmount": 0.000000,
- "imageKey": "/root/.mifosx/DefaultDemoTenant/images/clients/33/places.png"
-}
-}
-
-
-
-
-
-
-
-
Create a New DepositAccount / Submit a DepositAccount Application
-
Arguments
-
- - command
- - String Optional, case-insensitive
- - The default action is to Submit a New DepositAccount Application ("Submitted and awaiting approval" status).
-
-
-
- Mandatory Fields |
- | clientId, productId, deposit, maturityInterestRate, commencementDate |
-
-
-
- POST https://Domain Name/api/v1/depositaccounts
- POST depositaccount
-Content-Type: application/json
-Request Body:
-{
- "clientId": "17",
- "dateFormat": "dd MMMM yyyy",
- "locale": "en",
- "productId": "1",
- "commencementDate": "25 January 2013",
- "externalId": "123",
- "deposit": "20000",
- "tenureInMonths": "3",
- "renewalAllowed": "true",
- "preClosureAllowed": "true",
- "interestCompoundingAllowed": "false",
- "isInterestWithdrawable": "true",
- "isLockinPeriodAllowed": "true",
- "maturityInterestRate": "12",
- "preClosureInterestRate": "5",
- "interestCompoundedEvery": "6",
- "interestCompoundedEveryPeriodType": "2",
- "lockinPeriod": "1",
- "lockinPeriodType": "2"
-}
-
-
- {
- "resourceId": 42
-}
-
-
-
-
-
-
-
-
Approval, Reject or Withdraw a DepositAccount Application
-
Arguments
-
- - command
- - String Mandatory, case-insensitive
- - 'approve' : Approve DepositAccount
- - 'reject' : Reject DepositAccount
- - 'withdrewbyclient' : Client Withdrew DepositAccount Application
- - Deposit amount
- - IntegerMandatory
- - Deposit interest rate
- - IntegerMandatory
- - Tenure month
- - IntegerMandatory
- - Interest posted every
- - IntegerMandatory
-
-
-
- Mandatory Fields |
- | eventDate |
-
-
-
- POST https://DomainName/api/v1/depositaccounts/{depositaccountId}
- POST depositaccounts/1?command=reject
-Content-Type: application/json
-Request Body:
-{
- "dateFormat": "dd MMMM yyyy",
- "eventDate": "07 May 2012",
- "note": "and event note is added"
-}
-
-{
-"resourceId": 37
-}
-
-
-
-
-
-
-
Delete a DepositAccount
-
- Note: depositaccount is deleted.
-
-
-
- DELETE https://Domain Name/api/v1/depositaccounts/{depositaccountsId}
- DELETE depositaccounts/1
-Content-Type: application/json
-No Request Body:
-
- {
-"resourceId": 1
-}
-
-
-
-
-
-
-
-
-
Saving Account :
-
- Field Descriptions |
- | savingsDepositAmountPerPeriod : |
- The amount to be depositd in the savingaccount for every period.
- If the account is regular account enter what ever the amount you want to deposit |
- | externalId : |
- A place to put an external reference for this savingaccount. e.g. The ID another system uses.
- If provided, it must be unique. |
-
- | tenure : |
- | denotes the tenure period of savings account |
-
- | depositEvery : |
- | For every 'depositEvery' period the client has to deposit 'savingsDepositAmountPerPeriod' amount |
-
- | interestCalculationMethod: |
- denotes on what basis the interest is calculated
- e.g. AverageBal,Monthly Collection etc |
-
- | recurringInterestRate : |
- | The interest rate applicable on recurring deposit savingaccounts |
-
- | savingInterestRate : |
- | The interest rate applicable on regular savingaccounts |
-
- | interestPostEvery: |
- | Denotes for how many months the interest is posted for recurring/regular saving accounts |
-
- | lockinPeriod : |
- | With in a lockin period you cannot withdraw whole money(cannot Preclose) |
-
-
-
-
-
-
-
-
-
-
Retrieve SavingAccount Details Template :
-
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
-
- - Field Defaults
- - Allowed Value Lists
-
-
-
Arguments
-
- - clientId
- - Integer mandatory
- - productId
- - Integer optional
- - If entered, productId, productName and selectedProduct fields are returned.
-
-
Example Requests:
-
savingaccounts/template?clientId=25&productId=5
-
-
savingaccounts/template?clientId=25
-
-
- GET https://Domain Name/api/v1/savingaccounts/template
-{
- "clientId": 25,
- "clientName": "Clark Kent",
- "productId": 5,
- "productName": "Shares",
- "productType": {
- "id": 2,
- "code": "savings.product.savingProductType.regular",
- "value": "Regular"
- },
- "currencyData": {
- "code": "ZAR",
- "name": "South African Rand",
- "decimalPlaces": 2,
- "displaySymbol": "R",
- "nameCode": "currency.ZAR",
- "displayLabel": "South African Rand (R)"
- },
- "savingsDepositAmountPerPeriod": 500.000000,
- "savingsFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "recurringInterestRate": 12.000000,
- "savingInterestRate": 12.000000,
- "interestType": {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "tenure": 12,
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "projectedCommencementDate": [2013,
- 2,
- 1],
- "preClosureAllowed": true,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "depositEvery": 1,
- "productOptions": [{
- "id": 4,
- "name": "sb01"
- },
- {
- "id": 5,
- "name": "Shares"
- }],
- "currencyOptions": [{
- "code": "ZAR",
- "name": "South African Rand",
- "decimalPlaces": 2,
- "displaySymbol": "R",
- "nameCode": "currency.ZAR",
- "displayLabel": "South African Rand (R)"
- },
- {
- "code": "VND",
- "name": "Vietnamese Dong",
- "decimalPlaces": 2,
- "nameCode": "currency.VND",
- "displayLabel": "Vietnamese Dong [VND]"
- }],
- "savingsProductTypeOptions": [{
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
- {
- "id": 2,
- "code": "savings.product.savingProductType.regular",
- "value": "Regular"
- }],
- "tenureTypeOptions": [{
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- {
- "id": 2,
- "code": "savings.tenure.tenureTypeEnum.perpetual",
- "value": "Perpetual"
- }],
- "savingFrequencyOptions": [{
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- }],
- "savingsInterestTypeOptions": [{
- "id": 1,
- "code": "savings.interest.type.savingsInterestType.simple",
- "value": "Simple"
- },
- {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- }],
- "lockinPeriodTypeOptions": [{
- "id": 2,
- "code": "savings.product.lockin.period.type.months",
- "value": "Months"
- }],
- "interestCalculationOptions": [{
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- {
- "id": 3,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.monthlycllection",
- "value": "MonthlyCollection"
- }],
- "outstandingAmount": 0,
- "dueAmount": 0,
- "interestPostEvery": 3,
- "interestPostFrequency": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- }
-}
-
-
-
-
-
-
-
-
-
Retrieve a SavingAccount :
-
- Note: template=true parameter doesn't apply to this resource.
-
-
Arguments
-
- - associations
- - optional, Either 'all' or a comma separated list of savings 'associations' (itemised below).
-
Associations are just extra pieces of data that you might or might not want to retrieve.
- - 'all': Gets all association data.
- - 'permissions': Data that describes what things can happen to the saving account in its current state.
- Very specific to the needs of the current Individual Lending client application.
- - 'savingScheduleData': Some derived data that
- - 'transactions' : Some data
-
-
Example Requests :
-
savingaccounts/15
-
-
savingaccounts/15?associations=all
-
-
- GET https://DomainName/api/v1/savingaccounts/{savingaccountId}
- {
- "id": 15,
- "status": {
- "id": 100,
- "code": "depositStatusType.submitted.and.pending.approval",
- "value": "Submitted and pending approval"
- },
- "externalId": "23",
- "clientId": 50,
- "clientName": "Brendan Fahy",
- "productId": 4,
- "productName": "sb01",
- "productType": {
- "id": 2,
- "code": "savings.product.savingProductType.regular",
- "value": "Regular"
- },
- "currencyData": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "savingsDepositAmountPerPeriod": 200.000000,
- "savingsFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "totalDepositAmount": 0.000000,
- "recurringInterestRate": 4.000000,
- "savingInterestRate": 4.000000,
- "interestType": {
- "id": 1,
- "code": "savings.interest.type.savingsInterestType.simple",
- "value": "Simple"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "tenure": 12,
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "projectedCommencementDate": [2013,
- 2,
- 1],
- "projectedInterestAccuredOnMaturity": 0.000000,
- "actualInterestAccured": 0.000000,
- "projectedMaturityAmount": 200.000000,
- "actualMaturityAmount": 0.000000,
- "preClosureAllowed": false,
- "preClosureInterestRate": 0.000000,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "savings.product.lockin.period.type.months",
- "value": "Months"
- },
- "depositEvery": 1,
- "permissions": {
- "rejectAllowed": true,
- "withdrawnByApplicantAllowed": true,
- "undoApprovalAllowed": false,
- "pendingApproval": true,
- "renewelAllowed": false,
- "isMaturedDepositAccount": false,
- "anyActionOnAccountAllowed": true
- },
- "outstandingAmount": 0.000000,
- "savingScheduleData": {
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "cumulativeDepositDue": 200.0000,
- "cumulativeDepositPaid": 0.0000,
- "cummulativeInterestAccured": 0.0000,
- "periods": [{
- "period": 1,
- "dueDate": [2013,
- 3,
- 1],
- "depositDue": 200.0000,
- "depositPaid": 0.0000,
- "interestAccured": 0.0000
- }]
- },
- "transactions": [],
- "interestPostEvery": 3,
- "interestPostFrequency": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- }
-}
-
-
-
-
-
-
-
-
Create a New SavingAccount / Submit a SavingAccount Application
-
Arguments
-
- - command
- - String Optional, case-insensitive
- - The default action is to Submit a New SavingAccount Application ("Submitted and awaiting approval" status).
-
-
-
- Mandatory Fields |
- | clientId, productId, savingsDepositAmountPerPeriod, tenureMonths, depositEvery, interestCalculationMethod, recurringInterestRate, commencementDate, interestPostEvery |
-
-
-
- POST https://Domain Name/api/v1/savingaccounts
- POST savingaccount
-Content-Type: application/json
-Request Body:
-{
- "clientId": "17",
- "dateFormat": "dd MMMM yyyy",
- "locale": "en",
- "currencyCode": "ZAR",
- "digitsAfterDecimal": "2",
- "productId": "5",
- "commencementDate": "05 February 2013",
- "externalId": "",
- "savingsDepositAmountPerPeriod": "500",
- "minimumBalanceForWithdrawal": "100",
- "tenure": "12",
- "tenureType": "1",
- "depositEvery": "1",
- "frequency": "2",
- "isLockinPeriodAllowed": "false",
- "isPartialDepositAllowed": "false",
- "interestCalculationMethod": "1",
- "recurringInterestRate": "12",
- "interestType": "2",
- "savingInterestRate": "12",
- "interestPostEvery": "3",
- "interestPostFrequency": "2",
- "lockinPeriod": "0",
- "lockinPeriodType": "2"
-}
- {
- "resourceId": 42
-}
-
-
-
-
-
-
-
-
Approval, Reject or Withdraw a SavingAccount Application
-
Arguments
-
- - command
- - String Mandatory, case-insensitive
- - 'approve' : Approve SavingAccount
- - 'reject' : Reject SavingAccount
- - 'withdrewbyclient' : Client Withdrew SavingAccount Application
-
-
-
- Mandatory Fields |
- | eventDate |
-
-
-
- POST https://Domain Name/api/v1/savingaccounts/{savingaccountId}
- POST savingaccounts/1?command=reject
-Content-Type: application/json
-Request Body:
-{
- "dateFormat": "dd MMMM yyyy",
- "eventDate": "07 May 2012",
- "note": "and event note is added"
-}
-
-{
-"resourceId": 37
-}
-
-
-
-
-
-
-
Delete a SavingAccount
-
- Note: savingaccount is deleted.
-
-
-
- DELETE https://Domain Name/api/v1/savingaccounts/{savingaccountsId}
- DELETE savingaccounts/1
-Content-Type: application/json
-No Request Body:
-
- {
-"resourceId": 1
-}
-
-
-
-
-
-
-
+
@@ -7796,811 +6805,78 @@ Content-Type: application/json
{ "resourceId": 1 }
-
-
-
-
-
-
Deposit Products :
-
A Deposit product is a template that is used when creating a Fixed Deposit Account.
-
-
- Field Descriptions |
-
- | name |
- | The name of the product offering. |
-
- | description |
- | Used to provide extra textual information about the product. |
-
- | digitsAfterDecimal |
- | Override the currency default value for digitsAfterDecimal. |
-
- | minDeposit |
- | The minimum amount allowed when opening a deposit account. |
-
- | maxDeposit |
- | The maximum amount allowed when opening a deposit account. |
- | defaultDeposit |
- | The amount presented by default when opening a deposit account. |
-
- |
-
- | tenureInMonths |
- The duration for fixed deposit (in months).
- e.g. 12
- |
-
- | minInterestRate |
- The minimum allowed interest rate for this product.
- e.g. 1.5 |
-
- | maxInterestRate |
- The maximum allowed interest rate for this product.
- e.g. 11.5 |
-
- | defaultInterestRate |
- The interest rate presented by default when opening an account.
- e.g. 6.5 |
-
- | interestCompoundedEvery |
- Interest amount which is accrued or earned during the tenure of the deposit account will be posted to customer as interest as per the selected period in "interestCompoundedEvery" and combination of "interestCompoundedEveryPeriodType"
- e.g.Every 1-Month |
-
- | interestCompoundedEveryPeriodType |
- Denotes the interest compounding period type, used with combination of interestCompoundedEvery
- e.g. Days=0, Weeks=1, Months=2, Years=3 |
-
- | renewalAllowed |
- Indicates whether accounts are allowed to be renewed on maturity.
- Used like: renewalAllowed:true |
-
- | preClosureAllowed |
- Indicates whether accounts are allowed to be closed before maturity.
- If 'true' : Closure before maturity is allowed; otherwise closure before maturity is not allowed. |
-
- | preClosureInterestRate |
- | The interest rate used in cases where pre-closure occurs. Mandatory if preClosureAllowed=true |
-
- | interestCompoundingAllowed |
- | Denotes whether the interest is calculated using simple interest or compounding interest. |
-
- | isLockinPeriodAllowed |
- This will allow to set the lock-in period for a fixed deposit product
- If 'true' :isLockinPeriodAllowed otherwise isLockinPeriod not allowed |
-
- | lockinPeriod |
- | Defines a lock-in period for deposit account. |
-
-
-
-
-
-
-
-
-
-
List DepositProducts
-
Example Requests:
-
depositproducts
-
-
depositproducts?fields=name, ......
-
-
- GET https://Domain Name/api/v1/depositproducts
-
-[{
- "id": 1,
- "name": "Test",
- "description": "asdf",
- "currencyCode": "USD",
- "digitsAfterDecimal": 2,
- "minimumBalance": 100.000000,
- "maximumBalance": 1000.000000,
- "tenureInMonths": 12,
- "maturityDefaultInterestRate": 12.000000,
- "maturityMinInterestRate": 8.000000,
- "maturityMaxInterestRate": 12.000000,
- "interestCompoundedEvery": 1,
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "renewalAllowed": false,
- "preClosureAllowed": false,
- "preClosureInterestRate": 6.000000,
- "interestCompoundingAllowed": true,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 2,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360576753000,
- "lastModifedOn": 1360579312000
-}...]
-
-
-
-
-
-
-
-
Retrieve DepositProduct Details Template
-
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
-
- - Field Defaults
- - Allowed Value Lists
-
-
-
Example Request:
-
depositproducts/template
-
-
- GET https://Domain Name/api/v1/depositproducts/template
-
-{
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "renewalAllowed": false,
- "preClosureAllowed": false,
- "isLockinPeriodAllowed": false,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "currencyOptions": [{
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- }],
- "interestCompoundedEveryPeriodTypeOptions": [{
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- }]
-}
-
-
-
-
-
-
-
-
Retrieve a Deposit Product
-
Example Requests:
-
depositproducts/1
-
-
depositproducts/1?template=true
-
-
depositproducts/1?fields=name,description
-
-
-
GET https://Domain Name/api/v1/depositproducts/1
-
-{
- "id": 1,
- "name": "Test",
- "description": "asdf",
- "currencyCode": "USD",
- "digitsAfterDecimal": 2,
- "minimumBalance": 100,
- "maximumBalance": 1000,
- "tenureInMonths": 12,
- "maturityDefaultInterestRate": 12,
- "maturityMinInterestRate": 8,
- "maturityMaxInterestRate": 12,
- "interestCompoundedEvery": 1,
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "renewalAllowed": false,
- "preClosureAllowed": false,
- "preClosureInterestRate": 6,
- "interestCompoundingAllowed": true,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 2,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360576753000,
- "lastModifedOn": 1360579312000
-}
-
+
+
+
+
+
Savings Product:
+
An MFIs savings product offerings are modelled using this API.
+
When creating savings accounts, the details from the savings product are used to autofill details of savings account.
+
+ Field Descriptions |
- GET https://Domain Name/api/v1/depositproducts/1?template=true
-
-{
- "id": 1,
- "name": "Test",
- "description": "asdf",
- "currencyCode": "USD",
- "digitsAfterDecimal": 2,
- "minimumBalance": 100.000000,
- "maximumBalance": 1000.000000,
- "tenureInMonths": 12,
- "maturityDefaultInterestRate": 12.000000,
- "maturityMinInterestRate": 8.000000,
- "maturityMaxInterestRate": 12.000000,
- "interestCompoundedEvery": 1,
- "interestCompoundedEveryPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "renewalAllowed": false,
- "preClosureAllowed": false,
- "preClosureInterestRate": 6.000000,
- "interestCompoundingAllowed": true,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 2,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360576753000,
- "lastModifedOn": 1360579312000,
- "currencyOptions": [{
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- }],
- "interestCompoundedEveryPeriodTypeOptions": [{
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- }]
-}
-
-
-
-
-
-
-
-
Create a Deposit Product
-
- Mandatory Fields |
- | name, currencyCode, digitsAfterDecimal,interestPostedEvery, minimumBalance,
- |
- |
- tenureInMonths, maturityDefaultInterestRate,maturityMinInterestRate,
- |
- |
- maturityMaxInterestRate,interestCompoundedEvery,preClosureInterestRate.
- |
-
-
-
- POST https://Domain Name/api/v1/depositproducts
- POST depositproducts
-Content-Type: application/json
-Request Body:
-{
- "locale": "en",
- "name": "Test",
- "description": "asdf",
- "currencyCode": "USD",
- "digitsAfterDecimal": "2",
- "minimumBalance": "100",
- "maximumBalance": "1,000",
- "tenureInMonths": "12",
- "renewalAllowed": "true",
- "preClosureAllowed": "false",
- "interestCompoundingAllowed": "true",
- "isLockinPeriodAllowed": "false",
- "maturityDefaultInterestRate": "12",
- "maturityMinInterestRate": "8",
- "maturityMaxInterestRate": "12",
- "preClosureInterestRate": "6",
- "interestCompoundedEvery": "1",
- "interestCompoundedEveryPeriodType": "2",
- "lockinPeriod": "2",
- "lockinPeriodType": "2"
-}
-
- {
- "resourceId": 1
-}
-
-
-
-
-
-
-
-
Update a Deposit Product
-
-
- PUT https://Domain Name/api/v1/depositproducts/{depositId}
- POST depositproducts/1
-Content-Type: application/json
-Request Body:
-{
- "locale": "en",
- "description": "Update desc"
-}
-
- {
- "resourceId": 1
-}
-
-
-
-
-
-
-
-
Delete a Deposit Product
-
Deletes a Deposit Product.
-
-
-
-DELETE https://Domain Name/api/v1/depositproducts/{productId}
-
-
-DELETE depositproducts/1
-Content-Type: application/json
-
- { "resourceId": 1 }
-
-
-
+ | name |
+ | The name of the product offering. |
-
-
-
-
-
-
Saving Products :
-
A Saving product is a template that is used when creating a Saving Account.
-
-
- Field Descriptions |
-
- | digitsAfterDecimal |
- | Override the currency default value for digitsAfterDecimal. |
-
- | savingsDepositAmount : |
- | The deposit amount need to be deposited every depositEvery period. |
-
- | minimumBalanceForWithdrawal : |
- | The minimumbal that is need to be maintained in saving account |
- |
-
- | depositEvery: |
- The time period to deposit the amount to saving account every "depositEvery" "frequency"
- e.g. Every 1 Month |
-
- | tenureType |
- | This denotes the tenureType for savings account |
-
- | tenure |
- The duration for fixed deposit (in months).
- e.g. 12
- |
- | interestRate |
- Default interest rate for Saving account
- e.g. 12 |
-
- | interestType |
- Denotes the interestType for Saving account
- simple/compounding |
-
- | minInterestRate |
- Minimum supported interest rate for Saving account
- e.g. 8 |
-
- | maxInterestRate |
- Maximum supported interest rate for Saving account
- e.g. 14 |
-
- | isPartialDepositAllowed |
- Allows to deposit the partial amount for saving account.
- Used like: isPartialDepositAllowed:true |
-
- | isLockinPeriodAllowed |
- This will allow to set the lock-in period for a saving account
- If 'true' :isLockinPeriodAllowed otherwise isLockinPeriod not allowed |
-
- | lockinPeriod |
- | Defines a lock-in period for saving account. |
-
- | savingProductType |
- Defines the savingProductType for saving account.
- Recurring/Regular |
-
-
- | interestCalculationMethod |
- Defines the interestCalculationMethod for saving account.
- Montly Collection/Average Balance etc |
-
-
-
+
| description |
+
| A description of the product offering. |
+
+
| currencyCode |
+
| Three letter ISO code reprsenting currency. |
+
+
| digitsAfterDecimal |
+
| Override the currency default value for digitsAfterDecimal. |
+
+
| interestRate |
+
| The default interest rate set when creating savings accounts of this type of product. e.g. 5% Per year |
+
+
| interestRatePeriodFrequencyType |
+
| The default interest rate period type. 2=Per month, 3=Per year e.g. 5% Per year |
+
+
| minRequiredOpeningBalance |
+
| Optional: If provided, sets the minimum deposit amount required to open a savings account e.g. 2,000 |
+
+
| lockinPeriodFrequency |
+
| Optional: If provided, used along with lockinPeriodFrequencyType to indicate the length of time that the savings account is 'locked in' and withdrawals are not allowed. e.g. 6 Months |
+
+
| lockinPeriodFrequencyType |
+
| Optional: If provided, used along with lockinPeriodFrequency to indicate the length of time that the savings account is 'locked in' and withdrawals are not allowed. 0=Days, 1=Weeks, 2=Months, 3=Years
+ e.g. 6 Months |
+
+
+
+
+
+
+
+
Retrieve Savings Product Template
+
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
+
+ - Field Defaults
+ - Allowed Value Lists
+
+
+
Example Request:
+
savingsproducts/template
-
-
-
-
-
List SavingProducts
-
Example Requests:
-
savingproducts
-
-
savingproducts?fields=name, ......
-
-
- GET https://Domain Name/api/v1/savingproducts
-
-[{
- "id": 1,
- "name": "Test",
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "digitsAfterDecimal": 2,
- "interestRate": 12.000000,
- "minInterestRate": 6.000000,
- "maxInterestRate": 12.000000,
- "savingsDepositAmount": 1000.000000,
- "savingProductType": {
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "tenure": 12,
- "savingFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "interestType": {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "minimumBalanceForWithdrawal": 100.000000,
- "isPartialDepositAllowed": false,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360594232000,
- "lastModifedOn": 1360594232000,
- "depositEvery": 3
-}]
-
-
-
-
-
-
-
-
Retrieve SavingProduct Details Template
-
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
-
- - Field Defaults
- - Allowed Value Lists
-
-
-
Example Request:
-
savingproducts/template
-
-
-
GET https://Domain Name/api/v1/savingproducts/template
-
+
+ GET https://Domain Name/api/v1/savingsproducts/template
+
{
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "digitsAfterDecimal": 2,
- "interestRate": 0,
- "savingsDepositAmount": 0,
- "savingProductType": {
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "tenure": 12,
- "savingFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "interestType": {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "minimumBalanceForWithdrawal": 100,
- "isPartialDepositAllowed": false,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "savings.product.lockin.period.type.months",
- "value": "Months"
- },
- "createdOn": 1360596667364,
- "lastModifedOn": 1360596667364,
- "depositEvery": 3,
- "currencyOptions": [{
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- }],
- "savingsProductTypeOptions": [{
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
- {
- "id": 2,
- "code": "savings.product.savingProductType.regular",
- "value": "Regular"
- }],
- "tenureTypeOptions": [{
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- {
- "id": 2,
- "code": "savings.tenure.tenureTypeEnum.perpetual",
- "value": "Perpetual"
- }],
- "savingFrequencyOptions": [{
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- }],
- "savingsInterestTypeOptions": [{
- "id": 1,
- "code": "savings.interest.type.savingsInterestType.simple",
- "value": "Simple"
- },
- {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- }],
- "lockinPeriodTypeOptions": [{
- "id": 2,
- "code": "savings.product.lockin.period.type.months",
- "value": "Months"
- }],
- "interestCalculationOptions": [{
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- {
- "id": 2,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.minbal",
- "value": "Minimumbalance"
- },
- {
- "id": 3,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.monthlycllection",
- "value": "MonthlyCollection"
- }]
-}
-
-
-
-
-
-
-
-
Retrieve a Saving Product
-
Example Requests:
-
savingproducts/1
-
-
savingproducts/1?template=true
-
-
savingproducts/1?fields=name,description
-
-
- GET https://Domain Name/api/v1/savingproducts/1
-
-{
- "id": 1,
- "name": "Test",
"currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
+ "code": "",
+ "name": "",
+ "decimalPlaces": 0,
+ "displaySymbol": "",
+ "nameCode": "",
+ "displayLabel": " []"
},
- "digitsAfterDecimal": 2,
- "interestRate": 12,
- "minInterestRate": 6,
- "maxInterestRate": 12,
- "savingsDepositAmount": 1000,
- "savingProductType": {
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
+ "interestRatePeriodFrequencyType": {
+ "id": 3,
+ "code": "savings.interest.rate.periodFrequencyType.years",
+ "value": "Per year"
},
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "tenure": 12,
- "savingFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "interestType": {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "minimumBalanceForWithdrawal": 100,
- "isPartialDepositAllowed": false,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360594232000,
- "lastModifedOn": 1360594232000,
- "depositEvery": 3
-}
-
-
- GET https://Domain Name/api/v1/depositproducts/1?template=true
-
-{
- "id": 1,
- "name": "Test",
- "currency": {
- "code": "USD",
- "name": "US Dollar",
- "decimalPlaces": 2,
- "displaySymbol": "$",
- "nameCode": "currency.USD",
- "displayLabel": "US Dollar ($)"
- },
- "digitsAfterDecimal": 2,
- "interestRate": 12,
- "minInterestRate": 6,
- "maxInterestRate": 12,
- "savingsDepositAmount": 1000,
- "savingProductType": {
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
- "tenureType": {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- "tenure": 12,
- "savingFrequencyType": {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- },
- "interestType": {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- },
- "interestCalculationMethod": {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- "minimumBalanceForWithdrawal": 100,
- "isPartialDepositAllowed": false,
- "isLockinPeriodAllowed": false,
- "lockinPeriod": 0,
- "lockinPeriodType": {
- "id": 2,
- "code": "deposit.interest.compounding.period.periodFrequencyType.months",
- "value": "Months"
- },
- "createdOn": 1360594232000,
- "lastModifedOn": 1360594232000,
- "depositEvery": 3,
"currencyOptions": [
{
"code": "USD",
@@ -8611,172 +6887,600 @@ Content-Type: application/json
"displayLabel": "US Dollar ($)"
}
],
- "savingsProductTypeOptions": [
- {
- "id": 1,
- "code": "savings.product.savingProductType.reccuring",
- "value": "Recurring"
- },
+ "interestRatePeriodFrequencyTypeOptions": [
{
"id": 2,
- "code": "savings.product.savingProductType.regular",
- "value": "Regular"
- }
- ],
- "tenureTypeOptions": [
- {
- "id": 1,
- "code": "savings.tenure.tenureTypeEnum.fixedPeriod",
- "value": "FixedPeriod"
- },
- {
- "id": 2,
- "code": "savings.tenure.tenureTypeEnum.perpetual",
- "value": "Perpetual"
- }
- ],
- "savingFrequencyOptions": [
- {
- "id": 2,
- "code": "saving.product.frequency.period.savingFrequencyType.monthly",
- "value": "Months"
- }
- ],
- "savingsInterestTypeOptions": [
- {
- "id": 1,
- "code": "savings.interest.type.savingsInterestType.simple",
- "value": "Simple"
- },
- {
- "id": 2,
- "code": "savings.interest.type.savingsInterestType.compounding",
- "value": "Compounding"
- }
- ],
- "lockinPeriodTypeOptions": [
- {
- "id": 2,
- "code": "savings.product.lockin.period.type.months",
- "value": "Months"
- }
- ],
- "interestCalculationOptions": [
- {
- "id": 1,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.averagebal",
- "value": "AverageBalance"
- },
- {
- "id": 2,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.minbal",
- "value": "Minimumbalance"
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
},
{
"id": 3,
- "code": "savings.interestCalculation.method.savinginterest.calculation.method.monthlycllection",
- "value": "MonthlyCollection"
+ "code": "savings.interest.rate.periodFrequencyType.years",
+ "value": "Per year"
+ }
+ ],
+ "lockinPeriodFrequencyTypeOptions": [
+ {
+ "id": 0,
+ "code": "savings.lockin.periodFrequencyType.days",
+ "value": "Days"
+ },
+ {
+ "id": 1,
+ "code": "savings.lockin.periodFrequencyType.weeks",
+ "value": "Weeks"
+ },
+ {
+ "id": 2,
+ "code": "savings.lockin.periodFrequencyType.months",
+ "value": "Months"
+ },
+ {
+ "id": 3,
+ "code": "savings.lockin.periodFrequencyType.years",
+ "value": "Years"
}
]
-}
-
-
+}
+
-
-
-
-
-
Create a Saving Product
-
- Mandatory Fields |
- | name, currencyCode, digitsAfterDecimal,interestPostedEvery, minimumBalance,
- |
- |
- tenureInMonths, maturityDefaultInterestRate,maturityMinInterestRate,
- |
- |
- maturityMaxInterestRate,interestCompoundedEvery,preClosureInterestRate.
- |
-
-
-
- POST https://Domain Name/api/v1/savingproducts
- POST savingproducts
+
+
+
+
+
+
Create a Savings Product
+
+ Mandatory Fields |
+ | name, description, currencyCode, digitsAfterDecimal, interestRate, interestRatePeriodFrequencyType |
+
+
+
+ Optional Fields |
+ | minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType |
+
+
+
+ POST https://Domain Name/api/v1/savingsproducts
+ POST savingsproducts
Content-Type: application/json
Request Body:
{
- "locale": "en",
- "interestCalculationMethod": "1",
- "name": "Test",
- "savingProductType": "1",
- "description": "",
- "currencyCode": "USD",
- "digitsAfterDecimal": "2",
- "savingsDepositAmount": "1000",
- "minimumBalanceForWithdrawal": "100",
- "tenure": "12",
- "tenureType": "1",
- "isLockinPeriodAllowed": "false",
- "isPartialDepositAllowed": "false",
- "interestRate": "12",
- "interestType": "2",
- "minInterestRate": "6",
- "maxInterestRate": "12",
- "depositEvery": "3",
- "frequency": "2",
- "lockinPeriod": "0",
- "lockinPeriodType": "2"
+ "name": "individual savings",
+ "description": "An savings product offering for individuals.",
+ "currencyCode": "USD",
+ "digitsAfterDecimal": 2,
+ "locale": "en",
+ "interestRate": "5.65",
+ "interestRatePeriodFrequencyType": 2
}
-
- {
+
+
+{
"resourceId": 1
}
-
-
+
+
+
+
+
+
+
Retrieve a Savings Product
+
Example Requests:
+
savingsproducts/1
+
+
savingsproducts/1?template=true
+
+
savingsproducts/1?fields=name,description
+
+
+ GET https://Domain Name/api/v1/savingsproducts/1
+
+{
+ "id": 1,
+ "name": "individual savings",
+ "description": "An savings product offering for individuals. (updated)",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "interestRate": 5.73,
+ "interestRatePeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ }
+}
+
+
+
-
-
-
-
Update a Saving Product
-
-
-
PUT https://Domain Name/api/v1/savingproducts/{depositId}
-
POST savingproducts/1
+
+
+
+
Update a Savings Product
+
+
+ PUT https://Domain Name/api/v1/savingsproducts/{productId}
+ POST savingsproducts/1
Content-Type: application/json
Request Body:
{
- "locale": "en",
- "description": "Update desc"
+ "description": "An savings product offering for individuals. (updated)",
+ "locale": "en",
+ "interestRate": "5.73"
}
-
- {
- "resourceId": 1
+
+
+{
+ "resourceId": 1,
+ "changes": {
+ "description": "An savings product offering for individuals. (updated)",
+ "interestRate": 5.73,
+ "locale": "en"
+ }
}
-
-
+
+
-
-
-
-
Delete a Saving Product
-
Deletes a Saving Product.
-
-
-
-DELETE https://Domain Name/api/v1/savingproducts/{productId}
-
-
-DELETE savingproducts/1
+
+
+
+
Delete a Savings Product
+
+
+
+DELETE https://Domain Name/api/v1/savingsproducts/{productId}
+
+
+DELETE savingsproducts/1
Content-Type: application/json
-
- { "resourceId": 1 }
-
-
-
+
+
+{
+ "resourceId": 1
+}
+
+
+
-
+
+
+
+
List Savings Products
+
Example Requests:
+
savingsproducts
+
+
savingsproducts?fields=name
+
+
+ GET https://Domain Name/api/v1/savingsproducts
+
+[
+ {
+ "id": 1,
+ "name": "individual savings",
+ "description": "An savings product offering for individuals. (updated)",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "interestRate": 9.85,
+ "interestRatePeriodFrequencyType": {
+ "id": 3,
+ "code": "savings.interest.rate.periodFrequencyType.years",
+ "value": "Per year"
+ },
+ "minRequiredOpeningBalance": 1000,
+ "lockinPeriodFrequency": 3,
+ "lockinPeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ }
+ }
+]
+
+
+
+
+
+
+
+
+
+
Savings Account:
+
An instance of a savings account for a individual or group.
+
+ Field Descriptions |
+
+ | clientId |
+ | The client you are creating the savings account for. Either clientId or groupId must be provided. |
+
+ | groupId |
+ | The group you are creating the savings account for. Either clientId or groupId must be provided. |
+
+ | productId |
+ | The id of the product used for this savings account. The savings account inherits the selected currency of the product and possibly other details if not overridden in the savings account creation request. |
+
+ | accountNo |
+ | The account no. associated with this loan. Is auto generated if not provided at creation time. |
+
+ | externalId |
+ | A place to put an external reference for this savings account e.g. The ID another system uses. If provided, it must be unique. |
+
+ | interestRate |
+ | The default interest rate set when creating savings accounts of this type of product. e.g. 5% Per year |
+
+ | interestRatePeriodFrequencyType |
+ | The default interest rate period type. 2=Per month, 3=Per year e.g. 5% Per year |
+
+ | minRequiredOpeningBalance |
+ | Optional: If provided, sets the minimum deposit amount required to open a savings account e.g. 2,000 |
+
+ | lockinPeriodFrequency |
+ | Optional: If provided, used along with lockinPeriodFrequencyType to indicate the length of time that the savings account is 'locked in' and withdrawals are not allowed. e.g. 6 Months |
+
+ | lockinPeriodFrequencyType |
+ | Optional: If provided, used along with lockinPeriodFrequency to indicate the length of time that the savings account is 'locked in' and withdrawals are not allowed. 0=Days, 1=Weeks, 2=Months, 3=Years
+ e.g. 6 Months |
+
+
+
+
+
+
+
+
Retrieve Savings Account Template:
+
This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all of:
+
+ - Field Defaults
+ - Allowed Value Lists
+
+
+
Arguments
+
+ - clientId
+ - Integer mandatory
+ - productId
+ - Integer optional
+ - If entered, productId, productName and selectedProduct fields are returned.
+
+
Example Requests:
+
savingsaccounts/template?clientId=1
+
+
savingsaccounts/template?clientId=1&productId=1
+
+
+ GET https://Domain Name/api/v1/savingsaccounts/template?clientId={clientId}
+
+{
+ "clientId": 1,
+ "clientName": "Client A AB",
+ "productOptions": [
+ {
+ "id": 1,
+ "name": "First"
+ }
+ ]
+}
+
+
+
+
+ GET https://Domain Name/api/v1/savingsaccounts/template?clientId={clientId}&productId={productId}
+
+{
+ "clientId": 1,
+ "clientName": "Client A AB",
+ "savingsProductId": 1,
+ "savingsProductName": "First",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "interestRate": 12,
+ "interestRatePeriodFrequencyType": {
+ "id": 3,
+ "code": "savings.interest.rate.periodFrequencyType.years",
+ "value": "Per year"
+ },
+ "minRequiredOpeningBalance": 1000,
+ "lockinPeriodFrequency": 3,
+ "lockinPeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ "productOptions": [
+ {
+ "id": 1,
+ "name": "First"
+ }
+ ],
+ "interestRatePeriodFrequencyTypeOptions": [
+ {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ {
+ "id": 3,
+ "code": "savings.interest.rate.periodFrequencyType.years",
+ "value": "Per year"
+ }
+ ],
+ "lockinPeriodFrequencyTypeOptions": [
+ {
+ "id": 0,
+ "code": "savings.lockin.periodFrequencyType.days",
+ "value": "Days"
+ },
+ {
+ "id": 1,
+ "code": "savings.lockin.periodFrequencyType.weeks",
+ "value": "Weeks"
+ },
+ {
+ "id": 2,
+ "code": "savings.lockin.periodFrequencyType.months",
+ "value": "Months"
+ },
+ {
+ "id": 3,
+ "code": "savings.lockin.periodFrequencyType.years",
+ "value": "Years"
+ }
+ ]
+}
+
+
+
+
+
+
+
+
Create a New Savings Account
+
+
+ Mandatory Fields |
+ | clientId or groupId, productId, accountNo, externalId |
+
+
+
+ Optional Fields |
+ | accountNo, externalId |
+
+
+
+ Inherited from Product (if not provided) |
+ | interestRate, interestRatePeriodFrequencyType, minRequiredOpeningBalance, lockinPeriodFrequency, lockinPeriodFrequencyType |
+
+
+
+
Minimal request: accountNo auto generated, remaining details inherited from savings product.
+
POST https://Domain Name/api/v1/savingsaccounts
+
POST savingaccount
+Content-Type: application/json
+Request Body:
+{
+ "clientId": 1,
+ "productId": 1
+}
+
+
Minimal request: accountNo provided (must be unique), remaining details inherited from savings product.
+
POST savingaccount
+Content-Type: application/json
+Request Body:
+{
+ "clientId": 1,
+ "productId": 1,
+ "accountNo": "SA000023",
+ "externalId": "SYS-23"
+}
+
+
Full request: accountNo provided (must be unique), remaining details override details from savings product (except currency).
+
POST savingaccount
+Content-Type: application/json
+Request Body:
+{
+ "clientId": 1,
+ "productId": 1,
+ "accountNo": "SA000023",
+ "externalId": "SYS-23",
+ "locale": "en",
+ "interestRate": "5.65",
+ "interestRatePeriodFrequencyType": 2,
+ "minRequiredOpeningBalance": "1,000",
+ "lockinPeriodFrequency": 6,
+ "lockinPeriodFrequencyType": 2
+}
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "resourceId": 1
+}
+
+
+
+
+
+
+
+
List Savings Accounts
+
Example Requests:
+
savingsaccounts
+
+
savingsaccounts?fields=name
+
+
+ GET https://Domain Name/api/v1/savingsaccounts
+
+[
+ {
+ "id": 1,
+ "accountNo": "SA000023",
+ "externalId": "SYS-23",
+ "groupId": 0,
+ "clientId": 1,
+ "clientName": "Client A AB",
+ "savingsProductId": 1,
+ "savingsProductName": "First",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "interestRate": 5.65,
+ "interestRatePeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ "annualInterestRate": 67.8,
+ "minRequiredOpeningBalance": 1000,
+ "lockinPeriodFrequency": 6,
+ "lockinPeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ }
+ }
+]
+
+
+
+
+
+
+
+
Retrieve a Savings Account:
+
Arguments
+
+ - associations
+ - optional, Either 'all' or a comma separated list of savings 'associations' (itemised below).
+
Associations are just extra pieces of data that you might or might not want to retrieve.
+ - 'all': Gets data related to all associations e.g. ?associations=all.
+ - 'transactions': Gets data related to transactions on the account e.g. ?associations=transactions
+
+
Example Requests :
+
savingsaccounts/1
+
+
savingsaccounts/1?associations=all
+
+
+ GET https://DomainName/api/v1/savingsaccounts/{accountId}
+
+{
+ "id": 1,
+ "accountNo": "SA000023",
+ "externalId": "SYS-23",
+ "groupId": 0,
+ "clientId": 1,
+ "clientName": "Client A AB",
+ "savingsProductId": 1,
+ "savingsProductName": "First",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "interestRate": 5.65,
+ "interestRatePeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ "annualInterestRate": 67.8,
+ "minRequiredOpeningBalance": 1000,
+ "lockinPeriodFrequency": 6,
+ "lockinPeriodFrequencyType": {
+ "id": 2,
+ "code": "savings.interest.rate.periodFrequencyType.months",
+ "value": "Per month"
+ }
+}
+
+
+
+
+
+
+
+
Update a Savings Account
+
Will most likely have a restriction to only allow 'inactive' savings accounts to be updated.
+
As other updates like change of interest rate are possibly special cases for savings.
+
+
+ PUT https://Domain Name/api/v1/savingsaccounts/{accountsId}
+ PUT savingsaccounts/1
+Content-Type: application/json
+No Request Body:
+{
+ "locale": "en",
+ "interestRate": "5.2323"
+}
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "resourceId": 1,
+ "changes": {
+ "interestRate": 5.2323,
+ "locale": "en"
+ }
+}
+
+
+
+
+
+
+
+
Delete a Savings Account
+
At present we support hard delete of savings account but this is likely to change to a savings account closure or de-activation process/command.
+
+
+ DELETE https://Domain Name/api/v1/savingsaccounts/{accountsId}
+ DELETE savingsaccounts/1
+Content-Type: application/json
+No Request Body:
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "resourceId": 1
+}
+
+
+
+
+
+
@@ -9252,9 +7956,7 @@ Request Body:
Group
-
Deposit Account
-
-
Saving Account
+
Savings Account
@@ -12421,6 +11123,23 @@ Content-Type: application/json
|
+
+ | Loan Product |
+ loanproducts |
+ Create a Loan Product |
+ List Loan Products |
+ |
+ |
+
+
+ |
+ loanproducts/{productId} |
+ |
+ Retrieve a Loan
+ Product |
+ Update a Loan Product |
+ |
+
| Loans |
loans?calculateLoanSchedule |
@@ -12560,7 +11279,39 @@ Content-Type: application/json
Delete a Guarantor |
- | OFFICE |
+ Savings Product |
+ savingsproducts |
+ Create a Savings product |
+ List Savings products |
+ |
+ |
+
+
+ |
+ savingsproducts/{productId} |
+ |
+ Retrieve a Savings product |
+ Update a Savings product |
+ Delete a Savings product |
+
+
+ | Savings Accounts |
+ savingsaccounts |
+ Create new Savings Account |
+ List Savings Accounts |
+ |
+ |
+
+
+ |
+ savingsaccounts/{accountId} |
+ |
+ Retrieve a Savings Account |
+ Update a Savings Account |
+ Delete a Savings Account |
+
+
+ | Office |
offices |
Create an Office |
List Offices |
@@ -12575,23 +11326,7 @@ Content-Type: application/json
Update an Office |
|
-
- | LOAN PRODUCT |
- loanproducts |
- Create a Loan Product |
- List Loan Products |
- |
- |
-
-
- |
- loanproducts/{productId} |
- |
- Retrieve a Loan
- Product |
- Update a Loan Product |
- |
-
+
| CURRENCY |
currencies |
@@ -12908,87 +11643,10 @@ Content-Type: application/json
PERMISSION |
permissions |
|
- List Application
- Permissions |
+ List Permissions |
|
|
-
-
- | DEPOSIT PRODUCT |
- depositproducts |
- Create a Deposit product |
- List Deposit products |
- |
- |
-
-
- |
- depositproducts/{prodcutId} |
- |
- Retrieve a Deposit product |
- Update a Deposit product |
- Delete a Deposit product |
-
-
- | SAVING PRODUCT |
- savingproducts |
- Create a Saving product |
- List Saving products |
- |
- |
-
-
- |
- savingproducts/{prodcutId} |
- |
- Retrieve a Saving procduct |
- Update a Saving product |
- Delete a Saving product |
-
-
-
- | FIXED DEPOSITS |
- depositaccounts |
- Create a New Deposit
- Application |
- |
- |
- |
-
-
- |
- depositaccounts/{accountId} |
- Approve, Undo Approve,
- Interest withdraw, Reject a Deposit Application or Withdraw a
- Deposit Application |
- Retrieve a Deposit
- Application |
- |
- Delete a Deposit
- Application |
-
-
-
- | SAVING ACCOUNTS |
- savingaccounts |
- Create a New Saving
- Application |
- |
- |
- |
-
-
- |
- savingaccounts/{accountId} |
- Approve, Undo Approve,
- Interest withdraw, Reject a Saving Application or Withdraw a
- Saving Application |
- Retrieve a Saving
- Application |
- |
- Delete a Saving
- Application |
-
+
diff --git a/mifosng-db/patches/3-drop-hugo-savings-schema-replace-with-basic-savings-schema.sql b/mifosng-db/patches/3-drop-hugo-savings-schema-replace-with-basic-savings-schema.sql
new file mode 100644
index 000000000..06b9d43eb
--- /dev/null
+++ b/mifosng-db/patches/3-drop-hugo-savings-schema-replace-with-basic-savings-schema.sql
@@ -0,0 +1,66 @@
+ALTER TABLE `mifostenant-default`.`m_note`
+DROP FOREIGN KEY `FK_m_note_m_saving_account`,
+DROP FOREIGN KEY `FK_m_note_m_deposit_account`;
+
+ALTER TABLE `mifostenant-default`.`m_note`
+DROP COLUMN `saving_account_id`,
+DROP COLUMN `deposit_account_id`,
+DROP INDEX `FK_m_note_m_saving_account`,
+DROP INDEX `FK_m_note_m_deposit_account`;
+
+
+drop table `mifostenant-default`.`m_saving_account_transaction`;
+drop table `mifostenant-default`.`m_saving_schedule`;
+drop table `mifostenant-default`.`m_saving_account`;
+
+drop table `mifostenant-default`.`m_deposit_account_transaction`;
+drop table `mifostenant-default`.`m_deposit_account`;
+
+drop table `mifostenant-default`.`m_product_savings`;
+drop table `mifostenant-default`.`m_product_deposit`;
+
+
+
+DROP TABLE IF EXISTS `m_savings_account`;
+DROP TABLE IF EXISTS `m_savings_product`;
+
+CREATE TABLE `m_savings_product` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `description` varchar(500) NOT NULL,
+ `currency_code` varchar(3) NOT NULL,
+ `currency_digits` smallint(5) NOT NULL,
+ `nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
+ `nominal_interest_rate_period_frequency_enum` smallint(5) NOT NULL,
+ `min_required_opening_balance` decimal(19,6) DEFAULT NULL,
+ `lockin_period_frequency` decimal(19,6) DEFAULT NULL,
+ `lockin_period_frequency_enum` smallint(5) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `sp_unq_name` (`name`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+CREATE TABLE `m_savings_account` (
+ `id` bigint(20) NOT NULL AUTO_INCREMENT,
+ `account_no` varchar(20) NOT NULL,
+ `external_id` varchar(100) DEFAULT NULL,
+ `client_id` bigint(20) DEFAULT NULL,
+ `group_id` bigint(20) DEFAULT NULL,
+ `product_id` bigint(20) DEFAULT NULL,
+ `currency_code` varchar(3) NOT NULL,
+ `currency_digits` smallint(5) NOT NULL,
+ `nominal_interest_rate_per_period` decimal(19,6) NOT NULL,
+ `nominal_interest_rate_period_frequency_enum` smallint(5) NOT NULL,
+ `annual_nominal_interest_rate` decimal(19,6) NOT NULL,
+ `min_required_opening_balance` decimal(19,6) DEFAULT NULL,
+ `lockin_period_frequency` decimal(19,6) DEFAULT NULL,
+ `lockin_period_frequency_enum` smallint(5) DEFAULT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `sa_account_no_UNIQUE` (`account_no`),
+ UNIQUE KEY `sa_externalid_UNIQUE` (`external_id`),
+ KEY `FKSA00000000000001` (`client_id`),
+ KEY `FKSA00000000000002` (`group_id`),
+ KEY `FKSA00000000000003` (`product_id`),
+ CONSTRAINT `FKSA00000000000001` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
+ CONSTRAINT `FKSA00000000000002` FOREIGN KEY (`group_id`) REFERENCES `m_group` (`id`),
+ CONSTRAINT `FKSA00000000000003` FOREIGN KEY (`product_id`) REFERENCES `m_savings_product` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
index c2b1e1ce6..7979cef59 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/CommandWrapperBuilder.java
@@ -27,7 +27,8 @@ public class CommandWrapperBuilder {
public CommandWrapper build() {
return new CommandWrapper(this.officeId, this.groupId, this.clientId, this.loanId, this.actionName, this.entityName, this.entityId,
- this.apptableId, this.datatableId, this.codeId, this.supportedEntityType, this.supportedEntityId, this.href, this.json, this.transactionId);
+ this.apptableId, this.datatableId, this.codeId, this.supportedEntityType, this.supportedEntityId, this.href, this.json,
+ this.transactionId);
}
// public CommandWrapperBuilder withEntityId(final Long withId) {
@@ -372,7 +373,7 @@ public class CommandWrapperBuilder {
return this;
}
- public CommandWrapperBuilder updateLoanCharge(final Long loanId, Long loanChargeId) {
+ public CommandWrapperBuilder updateLoanCharge(final Long loanId, final Long loanChargeId) {
this.actionName = "UPDATE";
this.entityName = "LOANCHARGE";
this.entityId = loanChargeId;
@@ -568,7 +569,7 @@ public class CommandWrapperBuilder {
return this;
}
- public CommandWrapperBuilder updateCodeValue(Long codeId, final Long codeValueId) {
+ public CommandWrapperBuilder updateCodeValue(final Long codeId, final Long codeValueId) {
this.actionName = "UPDATE";
this.entityName = "CODEVALUE";
this.entityId = codeValueId;
@@ -633,7 +634,7 @@ public class CommandWrapperBuilder {
this.href = "/glaccounts/" + glAccountId;
return this;
}
-
+
public CommandWrapperBuilder createJournalEntry() {
this.actionName = "CREATE";
this.entityName = "JOURNALENTRY";
@@ -641,16 +642,16 @@ public class CommandWrapperBuilder {
this.href = "/journalentries/template";
return this;
}
-
+
public CommandWrapperBuilder reverseJournalEntry(final String transactionId) {
this.actionName = "REVERSE";
this.entityName = "JOURNALENTRY";
this.entityId = null;
this.transactionId = transactionId;
- this.href = "/journalentries/"+transactionId;
+ this.href = "/journalentries/" + transactionId;
return this;
}
-
+
public CommandWrapperBuilder createDepositProduct() {
this.actionName = "CREATE";
this.entityName = "DEPOSITPRODUCT";
@@ -659,198 +660,166 @@ public class CommandWrapperBuilder {
return this;
}
- public CommandWrapperBuilder updateDepositProduct(final Long productId) {
- this.actionName = "UPDATE";
+ public CommandWrapperBuilder updateDepositProduct(final Long productId) {
+ this.actionName = "UPDATE";
this.entityName = "DEPOSITPRODUCT";
this.entityId = productId;
- this.href = "/depositproducts/"+productId;
+ this.href = "/depositproducts/" + productId;
return this;
- }
-
- public CommandWrapperBuilder deleteDepositProduct(final Long productId) {
- this.actionName = "DELETE";
- this.entityName = "DEPOSITPRODUCT";
- this.entityId = productId;
- this.href = "/depositproducts/"+productId;
- return this;
- }
+ }
- public CommandWrapperBuilder createDepositAccount() {
- this.actionName = "CREATE";
+ public CommandWrapperBuilder deleteDepositProduct(final Long productId) {
+ this.actionName = "DELETE";
+ this.entityName = "DEPOSITPRODUCT";
+ this.entityId = productId;
+ this.href = "/depositproducts/" + productId;
+ return this;
+ }
+
+ public CommandWrapperBuilder createDepositAccount() {
+ this.actionName = "CREATE";
this.entityName = "DEPOSITACCOUNT";
this.entityId = null;
this.href = "/depositaccounts/template";
return this;
- }
+ }
- public CommandWrapperBuilder updateDepositAccount(Long accountId) {
- this.actionName = "UPDATE";
+ public CommandWrapperBuilder updateDepositAccount(final Long accountId) {
+ this.actionName = "UPDATE";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder deleteDepositAccount(Long accountId) {
- this.actionName = "DELETE";
+ public CommandWrapperBuilder deleteDepositAccount(final Long accountId) {
+ this.actionName = "DELETE";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder approveDepositApplication(Long accountId) {
- this.actionName = "APPROVE";
+ public CommandWrapperBuilder approveDepositApplication(final Long accountId) {
+ this.actionName = "APPROVE";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder withdrawDepositAmount(Long accountId) {
- this.actionName = "WITHDRAWAL";
+ public CommandWrapperBuilder withdrawDepositAmount(final Long accountId) {
+ this.actionName = "WITHDRAWAL";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder withdrawInterestDepositAmount(Long accountId) {
- this.actionName = "INTEREST";
+ public CommandWrapperBuilder withdrawInterestDepositAmount(final Long accountId) {
+ this.actionName = "INTEREST";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder renewDepositAccount(Long accountId) {
- this.actionName = "RENEW";
+ public CommandWrapperBuilder renewDepositAccount(final Long accountId) {
+ this.actionName = "RENEW";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder rejectDepositAccount(Long accountId) {
- this.actionName = "REJECT";
+ public CommandWrapperBuilder rejectDepositAccount(final Long accountId) {
+ this.actionName = "REJECT";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder withdrawDepositApplication(Long accountId) {
- this.actionName = "WITHDRAW";
+ public CommandWrapperBuilder withdrawDepositApplication(final Long accountId) {
+ this.actionName = "WITHDRAW";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder undoDepositApplicationApproval(Long accountId) {
- this.actionName = "APPROVALUNDO";
+ public CommandWrapperBuilder undoDepositApplicationApproval(final Long accountId) {
+ this.actionName = "APPROVALUNDO";
this.entityName = "DEPOSITACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/depositaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder createSavingProduct() {
- this.actionName = "CREATE";
+ public CommandWrapperBuilder createSavingProduct() {
+ this.actionName = "CREATE";
this.entityName = "SAVINGSPRODUCT";
this.entityId = null;
- this.href = "/savingproducts/template";
+ this.href = "/savingsproducts/template";
return this;
- }
+ }
- public CommandWrapperBuilder updateSavingProduct(Long productId) {
- this.actionName = "UPDATE";
+ public CommandWrapperBuilder updateSavingProduct(final Long productId) {
+ this.actionName = "UPDATE";
this.entityName = "SAVINGSPRODUCT";
this.entityId = productId;
- this.href = "/savingproducts/"+productId;
+ this.href = "/savingsproducts/" + productId;
return this;
- }
+ }
- public CommandWrapperBuilder deleteSavingProduct(Long productId) {
- this.actionName = "DELETE";
+ public CommandWrapperBuilder deleteSavingProduct(final Long productId) {
+ this.actionName = "DELETE";
this.entityName = "SAVINGSPRODUCT";
this.entityId = productId;
- this.href = "/savingproducts/"+productId;
+ this.href = "/savingsproducts/" + productId;
return this;
- }
+ }
- public CommandWrapperBuilder createSavingAccount() {
- this.actionName = "CREATE";
+ public CommandWrapperBuilder createSavingsAccount() {
+ this.actionName = "CREATE";
this.entityName = "SAVINGSACCOUNT";
this.entityId = null;
- this.href = "/savingaccounts/template";
+ this.href = "/savingsaccounts/template";
return this;
- }
+ }
- public CommandWrapperBuilder updateSavingAccount(Long accountId) {
- this.actionName = "UPDATE";
+ public CommandWrapperBuilder updateSavingsAccount(final Long accountId) {
+ this.actionName = "UPDATE";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/savingproducts/"+accountId;
+ this.href = "/savingsaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder deleteSavingAccount(Long accountId) {
- this.actionName = "DELETE";
+ public CommandWrapperBuilder deleteSavingsAccount(final Long accountId) {
+ this.actionName = "DELETE";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/savingproducts/"+accountId;
+ this.href = "/savingsaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder approveSavingAccountApplication(Long accountId) {
- this.actionName = "APPROVE";
+ public CommandWrapperBuilder depositOfSavingAmount(final Long accountId) {
+ this.actionName = "DEPOSIT";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/savingsaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder depositOfSavingAmount(Long accountId) {
- this.actionName = "DEPOSIT";
+ public CommandWrapperBuilder withdrawSavingAmount(final Long accountId) {
+ this.actionName = "WITHDRAWAL";
this.entityName = "SAVINGSACCOUNT";
this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
+ this.href = "/savingsaccounts/" + accountId;
return this;
- }
+ }
- public CommandWrapperBuilder withdrawSavingAmount(Long accountId) {
- this.actionName = "WITHDRAWAL";
- this.entityName = "SAVINGSACCOUNT";
- this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
- return this;
- }
-
- public CommandWrapperBuilder rejectSavingApplication(Long accountId) {
- this.actionName = "REJECT";
- this.entityName = "SAVINGSACCOUNT";
- this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
- return this;
- }
-
- public CommandWrapperBuilder withdrawSavingApplication(Long accountId) {
- this.actionName = "WITHDRAW";
- this.entityName = "SAVINGSACCOUNT";
- this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
- return this;
- }
-
- public CommandWrapperBuilder undoApprovalOfSavingApplication(Long accountId) {
- this.actionName = "APPROVALUNDO";
- this.entityName = "SAVINGSACCOUNT";
- this.entityId = accountId;
- this.href = "/depositaccounts/"+accountId;
- return this;
- }
-
public CommandWrapperBuilder createCalendar(final String supportedEntityType, final Long supportedEntityId) {
this.actionName = "CREATE";
this.entityName = "CALENDAR";
@@ -875,10 +844,11 @@ public class CommandWrapperBuilder {
this.href = "/" + supportedEntityType + "/" + supportedEntityId + "/calendars/" + calendarId;
return this;
}
-
+
public CommandWrapperBuilder createNote(final String entityName, final String resourceType, final Long resourceId) {
this.actionName = "CREATE";
- this.entityName = entityName;//Note supports multiple resources. Note Permissions are set for each resource.
+ this.entityName = entityName;// Note supports multiple resources. Note
+ // Permissions are set for each resource.
this.supportedEntityType = resourceType;
this.supportedEntityId = resourceId;
this.href = "/" + resourceType + "/" + resourceId + "/notes/template";
@@ -887,7 +857,8 @@ public class CommandWrapperBuilder {
public CommandWrapperBuilder updateNote(final String entityName, final String resourceType, final Long resourceId, final Long noteId) {
this.actionName = "UPDATE";
- this.entityName = entityName;//Note supports multiple resources. Note Permissions are set for each resource.
+ this.entityName = entityName;// Note supports multiple resources. Note
+ // Permissions are set for each resource.
this.entityId = noteId;
this.supportedEntityType = resourceType;
this.supportedEntityId = resourceId;
@@ -897,21 +868,22 @@ public class CommandWrapperBuilder {
public CommandWrapperBuilder deleteNote(final String entityName, final String resourceType, final Long resourceId, final Long noteId) {
this.actionName = "DELETE";
- this.entityName = entityName;//Note supports multiple resources. Note Permissions are set for each resource.
+ this.entityName = entityName;// Note supports multiple resources. Note
+ // Permissions are set for each resource.
this.entityId = noteId;
this.supportedEntityType = resourceType;
this.supportedEntityId = resourceId;
this.href = "/" + resourceType + "/" + resourceId + "/calendars/" + noteId;
return this;
}
-
+
public CommandWrapperBuilder createGroup() {
this.actionName = "CREATE";
this.entityName = "GROUP";
this.href = "/groups/template";
return this;
}
-
+
public CommandWrapperBuilder updateGroup(final Long groupId) {
this.actionName = "UPDATE";
this.entityName = "GROUP";
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
index dc539f5cb..1f5af54a9 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/SynchronousCommandProcessingService.java
@@ -375,33 +375,21 @@ public class SynchronousCommandProcessingService implements CommandProcessingSer
}
} else if (wrapper.isSavingProductResource()) {
if (wrapper.isCreate()) {
- handler = applicationContext.getBean("createSavingProductCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("createSavingsProductCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isUpdate()) {
- handler = applicationContext.getBean("updateSavingProductCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("updateSavingsProductCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDelete()) {
- handler = applicationContext.getBean("deleteSavingProductCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("deleteSavingsProductCommandHandler", NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
} else if (wrapper.isSavingAccountResource()) {
if (wrapper.isCreate()) {
- handler = applicationContext.getBean("createSavingAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("createSavingsAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isUpdate()) {
- handler = applicationContext.getBean("updateSavingAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("updateSavingsAccountCommandHandler", NewCommandSourceHandler.class);
} else if (wrapper.isDelete()) {
- handler = applicationContext.getBean("deleteSavingAccountCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isApprovalOfSaving()) {
- handler = applicationContext.getBean("approveSavingAccountCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isSavingAccountDeposit()) {
- handler = applicationContext.getBean("depositSavingAmountCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isRejectOfSavingAccount()) {
- handler = applicationContext.getBean("rejectSavingAccountCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isWithdrawSavingAmount()) {
- handler = applicationContext.getBean("withdrawSavingAmountCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isWithdrawOfSavingApplicatin()) {
- handler = applicationContext.getBean("withdrawSavingApplicationCommandHandler", NewCommandSourceHandler.class);
- } else if (wrapper.isUndoApprovalOfSavingAccount()) {
- handler = applicationContext.getBean("undoApprovalSavingAccountCommandHandler", NewCommandSourceHandler.class);
+ handler = applicationContext.getBean("deleteSavingsAccountCommandHandler", NewCommandSourceHandler.class);
} else {
throw new UnsupportedCommandException(wrapper.commandName());
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
index 11d618210..0261af630 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java
@@ -42,6 +42,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.jdbc.support.rowset.SqlRowSetMetaData;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import com.google.gson.reflect.TypeToken;
@@ -103,6 +104,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
logger.error(dve.getMessage(), dve);
}
+ @Transactional
@Override
public void registerDatatable(final String dataTableName, final String applicationTableName) {
@@ -176,6 +178,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
}
+ @Transactional
@Override
public void deregisterDatatable(final String datatable) {
final String permissionList = "('CREATE_" + datatable + "', 'CREATE_" + datatable + "_CHECKER', 'READ_" + datatable + "', 'UPDATE_"
@@ -192,6 +195,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
this.jdbcTemplate.batchUpdate(sqlArray);
}
+ @Transactional
@Override
public void createNewDatatableEntry(final String dataTableName, final Long appTableId, final JsonCommand command) {
@@ -230,6 +234,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
}
}
+ @Transactional
@Override
public Map
updateDatatableEntryOneToOne(final String datatable, final Long appTableId, final JsonCommand command) {
@@ -258,6 +263,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
return changes;
}
+ @Transactional
@Override
public Map updateDatatableEntryOneToMany(final String datatable, final Long appTableId, final Long datatableId,
final JsonCommand command) {
@@ -284,6 +290,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
return changes;
}
+ @Transactional
@Override
public void deleteDatatableEntries(final String datatable, final Long appTableId) {
@@ -295,6 +302,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ
if (rowsDeleted < 1) { throw new DatatableNotFoundException(datatable, appTableId); }
}
+ @Transactional
@Override
public void deleteDatatableEntry(final String datatable, final Long appTableId, final Long datatableId) {
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/AccountNumberGeneratorFactory.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/AccountNumberGeneratorFactory.java
index e00094c44..d73ca7923 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/AccountNumberGeneratorFactory.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/AccountNumberGeneratorFactory.java
@@ -17,4 +17,8 @@ public class AccountNumberGeneratorFactory {
public AccountNumberGenerator determineLoanAccountNoGenerator(final Long loanId) {
return new ZeroPaddedAccountNumberGenerator(loanId, 9);
}
+
+ public AccountNumberGenerator determineSavingsAccountNoGenerator(final Long savingsAccountId) {
+ return new ZeroPaddedAccountNumberGenerator(savingsAccountId, 9);
+ }
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java
index 29e676db1..3f7f59cae 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java
@@ -37,7 +37,7 @@ import org.mifosplatform.portfolio.group.domain.Group;
import org.springframework.data.jpa.domain.AbstractPersistable;
@Entity
-@Table(name = "m_client", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "account_no_UNIQUE")})
+@Table(name = "m_client", uniqueConstraints = { @UniqueConstraint(columnNames = { "account_no" }, name = "account_no_UNIQUE") })
public class Client extends AbstractPersistable {
@Column(name = "account_no", length = 20, unique = true, nullable = false)
@@ -79,11 +79,11 @@ public class Client extends AbstractPersistable {
@ManyToMany
@JoinTable(name = "m_group_client", joinColumns = @JoinColumn(name = "client_id"), inverseJoinColumns = @JoinColumn(name = "group_id"))
private Set parentGroups;
-
+
@Transient
private boolean accountNumberRequiresAutoGeneration = false;
- public static Client fromJson(final Office clientOffice, final Group clientParentGroup , final JsonCommand command) {
+ public static Client fromJson(final Office clientOffice, final Group clientParentGroup, final JsonCommand command) {
final String accountNo = command.stringValueOfParameterNamed("accountNo");
final String firstname = command.stringValueOfParameterNamed("firstname");
@@ -93,15 +93,15 @@ public class Client extends AbstractPersistable {
final LocalDate joiningDate = command.localDateValueOfParameterNamed("joinedDate");
final String externalId = command.stringValueOfParameterNamed("externalId");
- return new Client(clientOffice, clientParentGroup ,accountNo, firstname, middlename, lastname, fullname, joiningDate, externalId);
+ return new Client(clientOffice, clientParentGroup, accountNo, firstname, middlename, lastname, fullname, joiningDate, externalId);
}
protected Client() {
-
+
}
- private Client(final Office office, final Group clientParentGroup, final String accountNo, final String firstname, final String middlename, final String lastname,
- final String fullname, final LocalDate openingDate, final String externalId) {
+ private Client(final Office office, final Group clientParentGroup, final String accountNo, final String firstname,
+ final String middlename, final String lastname, final String fullname, final LocalDate openingDate, final String externalId) {
if (StringUtils.isBlank(accountNo)) {
this.accountNumber = new RandomPasswordGenerator(19).generate();
this.accountNumberRequiresAutoGeneration = true;
@@ -139,11 +139,11 @@ public class Client extends AbstractPersistable {
this.fullname = null;
}
- if(clientParentGroup != null){
+ if (clientParentGroup != null) {
this.parentGroups = new HashSet();
this.parentGroups.add(clientParentGroup);
}
-
+
deriveDisplayName();
validateNameParts();
}
@@ -152,7 +152,7 @@ public class Client extends AbstractPersistable {
return this.accountNumberRequiresAutoGeneration;
}
- public void setAccountNumberRequiresAutoGeneration(boolean accountNumberRequiresAutoGeneration) {
+ public void setAccountNumberRequiresAutoGeneration(final boolean accountNumberRequiresAutoGeneration) {
this.accountNumberRequiresAutoGeneration = accountNumberRequiresAutoGeneration;
}
@@ -160,7 +160,7 @@ public class Client extends AbstractPersistable {
return identifier.equalsIgnoreCase(this.externalId);
}
- public boolean identifiedBy(Long clientId) {
+ public boolean identifiedBy(final Long clientId) {
return getId().equals(clientId);
}
@@ -346,7 +346,11 @@ public class Client extends AbstractPersistable {
return imageKey;
}
- public void setImageKey(String imageKey) {
+ public void setImageKey(final String imageKey) {
this.imageKey = imageKey;
}
+
+ public Long officeId() {
+ return this.office.getId();
+ }
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java
index 884506537..b2d019f89 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java
@@ -216,31 +216,35 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
List preclosedDepositAccounts = new ArrayList();
List maturedDepositAccounts = new ArrayList();
- ClientDespoitAccountSummaryDataMapper depositAccountMapper = new ClientDespoitAccountSummaryDataMapper();
-
- String depositAccountsSql = "select " + depositAccountMapper.schema() + " where da.client_id = ? and da.is_deleted=0";
- List depositAccountResults = this.jdbcTemplate.query(depositAccountsSql, depositAccountMapper,
- new Object[] { clientId });
- if (depositAccountResults != null) {
- for (ClientAccountSummaryData row : depositAccountResults) {
-
- if (row.accountStatusId() == 100) {
- pendingApprovalDepositAccounts.add(row);
- } else if (row.accountStatusId() == 300) {
- approvedDepositAccounts.add(row);
- } else if (row.accountStatusId() == 400) {
- withdrawnByClientDespositAccounts.add(row);
- } else if (row.accountStatusId() == 500) {
- rejectedDepositAccounts.add(row);
- } else if (row.accountStatusId() == 600) {
- closedDepositAccounts.add(row);
- } else if (row.accountStatusId() == 700) {
- maturedDepositAccounts.add(row);
- } else if (row.accountStatusId() == 800) {
- preclosedDepositAccounts.add(row);
- }
- }
- }
+ // ClientDespoitAccountSummaryDataMapper depositAccountMapper = new
+ // ClientDespoitAccountSummaryDataMapper();
+ //
+ // String depositAccountsSql = "select " +
+ // depositAccountMapper.schema() +
+ // " where da.client_id = ? and da.is_deleted=0";
+ // List depositAccountResults =
+ // this.jdbcTemplate.query(depositAccountsSql, depositAccountMapper,
+ // new Object[] { clientId });
+ // if (depositAccountResults != null) {
+ // for (ClientAccountSummaryData row : depositAccountResults) {
+ //
+ // if (row.accountStatusId() == 100) {
+ // pendingApprovalDepositAccounts.add(row);
+ // } else if (row.accountStatusId() == 300) {
+ // approvedDepositAccounts.add(row);
+ // } else if (row.accountStatusId() == 400) {
+ // withdrawnByClientDespositAccounts.add(row);
+ // } else if (row.accountStatusId() == 500) {
+ // rejectedDepositAccounts.add(row);
+ // } else if (row.accountStatusId() == 600) {
+ // closedDepositAccounts.add(row);
+ // } else if (row.accountStatusId() == 700) {
+ // maturedDepositAccounts.add(row);
+ // } else if (row.accountStatusId() == 800) {
+ // preclosedDepositAccounts.add(row);
+ // }
+ // }
+ // }
List pendingApprovalSavingAccounts = new ArrayList();
List approvedSavingAccounts = new ArrayList();
@@ -248,25 +252,30 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
List rejectedSavingAccounts = new ArrayList();
List closedSavingAccounts = new ArrayList();
- ClientSavingAccountSummaryDataMapper clientSavingAccountSummaryDataMapper = new ClientSavingAccountSummaryDataMapper();
- String savingAccountsSql = "select " + clientSavingAccountSummaryDataMapper.schema()
- + " where sa.client_id=? and sa.is_deleted=0";
- List savingAccountsResults = this.jdbcTemplate.query(savingAccountsSql,
- clientSavingAccountSummaryDataMapper, new Object[] { clientId });
-
- if (savingAccountsResults != null) {
- for (ClientAccountSummaryData account : savingAccountsResults) {
- if (account.accountStatusId() == 100)
- pendingApprovalSavingAccounts.add(account);
- else if (account.accountStatusId() == 300)
- approvedSavingAccounts.add(account);
- else if (account.accountStatusId() == 400)
- withdrawnByClientSavingAccounts.add(account);
- else if (account.accountStatusId() == 500)
- rejectedSavingAccounts.add(account);
- else if (account.accountStatusId() == 600) closedSavingAccounts.add(account);
- }
- }
+ // ClientSavingAccountSummaryDataMapper
+ // clientSavingAccountSummaryDataMapper = new
+ // ClientSavingAccountSummaryDataMapper();
+ // String savingAccountsSql = "select " +
+ // clientSavingAccountSummaryDataMapper.schema()
+ // + " where sa.client_id=? and sa.is_deleted=0";
+ // List savingAccountsResults =
+ // this.jdbcTemplate.query(savingAccountsSql,
+ // clientSavingAccountSummaryDataMapper, new Object[] { clientId });
+ //
+ // if (savingAccountsResults != null) {
+ // for (ClientAccountSummaryData account : savingAccountsResults) {
+ // if (account.accountStatusId() == 100)
+ // pendingApprovalSavingAccounts.add(account);
+ // else if (account.accountStatusId() == 300)
+ // approvedSavingAccounts.add(account);
+ // else if (account.accountStatusId() == 400)
+ // withdrawnByClientSavingAccounts.add(account);
+ // else if (account.accountStatusId() == 500)
+ // rejectedSavingAccounts.add(account);
+ // else if (account.accountStatusId() == 600)
+ // closedSavingAccounts.add(account);
+ // }
+ // }
return new ClientAccountSummaryCollectionData(pendingApprovalLoans, awaitingDisbursalLoans, openLoans, closedLoans,
pendingApprovalDepositAccounts, approvedDepositAccounts, withdrawnByClientDespositAccounts, rejectedDepositAccounts,
@@ -320,30 +329,6 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
}
}
- private static final class ClientDespoitAccountSummaryDataMapper implements RowMapper {
-
- public String schema() {
-
- StringBuilder accountsSummary = new StringBuilder("da.id as id, da.external_id as externalId,");
- accountsSummary.append("da.product_id as productId, dp.name as productName,").append("da.status_enum as statusId ")
- .append("from m_deposit_account da ").append("LEFT JOIN m_product_deposit AS dp ON dp.id = da.product_id ");
-
- return accountsSummary.toString();
- }
-
- @Override
- public ClientAccountSummaryData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
-
- Long id = JdbcSupport.getLong(rs, "id");
- String externalId = rs.getString("externalId");
- Long productId = JdbcSupport.getLong(rs, "productId");
- String productName = rs.getString("productName");
- Integer accountStatusId = JdbcSupport.getInteger(rs, "statusId");
-
- return new ClientAccountSummaryData(id, externalId, productId, productName, accountStatusId);
- }
- }
-
@Override
public ClientData retrieveClientByIdentifier(final Long identifierTypeId, final String identifierKey) {
try {
@@ -383,29 +368,4 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService
return ClientData.clientIdentifier(id, accountNo, firstname, middlename, lastname, fullname, displayName, officeId, officeName);
}
}
-
- private static final class ClientSavingAccountSummaryDataMapper implements RowMapper {
-
- public String schema() {
-
- StringBuilder accountsSummary = new StringBuilder("sa.id as id, sa.external_id as externalId,");
- accountsSummary.append("sa.product_id as productId, sp.name as productName,").append("sa.status_enum as statusId ")
- .append("from m_saving_account sa ").append("LEFT JOIN m_product_savings AS sp ON sp.id = sa.product_id ");
-
- return accountsSummary.toString();
- }
-
- @Override
- public ClientAccountSummaryData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
-
- Long id = JdbcSupport.getLong(rs, "id");
- String externalId = rs.getString("externalId");
- Long productId = JdbcSupport.getLong(rs, "productId");
- String productName = rs.getString("productName");
- Integer accountStatusId = JdbcSupport.getInteger(rs, "statusId");
-
- return new ClientAccountSummaryData(id, externalId, productId, productName, accountStatusId);
- }
- }
-
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java
index 947729131..8a4177ffb 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java
@@ -215,4 +215,7 @@ public class Group extends AbstractPersistable {
return this.office.identifiedBy(officeId);
}
-}
+ public Long officeId() {
+ return this.office.getId();
+ }
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java
index 58181e9af..5838507d4 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java
@@ -191,8 +191,6 @@ public class LoansApiResource {
final boolean feeChargesOnly = false;
chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
- // chargeTemplate =
- // this.loanChargeReadPlatformService.retrieveLoanChargeTemplate();
}
LoanAccountData newLoanAccount = null;
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
index 61d288758..7f84811a6 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java
@@ -441,7 +441,7 @@ public class Loan extends AbstractPersistable {
* @param suppliedTransactionDate
* @return
*/
- private LoanTransaction getChargeAppliedTransaction(final LoanCharge loanCharge, LocalDate suppliedTransactionDate) {
+ private LoanTransaction getChargeAppliedTransaction(final LoanCharge loanCharge, final LocalDate suppliedTransactionDate) {
final Money chargeAmount = loanCharge.getAmount(getCurrency());
Money feeCharges = chargeAmount;
Money penaltyCharges = Money.zero(loanCurrency());
@@ -2165,9 +2165,9 @@ public class Loan extends AbstractPersistable {
public Long getOfficeId() {
Long officeId = null;
if (this.client != null) {
- officeId = this.client.getOffice().getId();
+ officeId = this.client.officeId();
} else {
- // officeId = this.group.getOffice().getId();
+ officeId = this.group.officeId();
}
return officeId;
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AprCalculator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AprCalculator.java
index 33a2e5031..1f7ec822c 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AprCalculator.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AprCalculator.java
@@ -13,10 +13,11 @@ import org.springframework.stereotype.Component;
@Component
public class AprCalculator {
- public BigDecimal calculateFrom(PeriodFrequencyType interestPeriodFrequencyType, BigDecimal interestRatePerPeriod) {
+ public BigDecimal calculateFrom(final PeriodFrequencyType interestPeriodFrequencyType, final BigDecimal interestRatePerPeriod) {
BigDecimal defaultAnnualNominalInterestRate = BigDecimal.ZERO;
switch (interestPeriodFrequencyType) {
case DAYS:
+ defaultAnnualNominalInterestRate = interestRatePerPeriod.multiply(BigDecimal.valueOf(365));
break;
case WEEKS:
defaultAnnualNominalInterestRate = interestRatePerPeriod.multiply(BigDecimal.valueOf(52));
@@ -33,5 +34,4 @@ public class AprCalculator {
return defaultAnnualNominalInterestRate;
}
-
-}
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java
index 4b58f51ba..5fabdf8ff 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java
@@ -69,13 +69,14 @@ public class NotesApiResource {
@Produces({ MediaType.APPLICATION_JSON })
public String retrieveNotesByResource(@PathParam("resourceType") final String resourceType,
@PathParam("resourceId") final Long resourceId, @Context final UriInfo uriInfo) {
-
+
NoteType noteType = NoteType.fromApiUrl(resourceType);
-
- if(noteType == null){ throw new NoteResourceNotSupportedException(resourceType); };
-
+
+ if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); }
+ ;
+
this.context.authenticatedUser().validateHasReadPermission(getResourceNameForPermissions(noteType));
-
+
final Integer noteTypeId = noteType.getValue();
final Collection notes = this.readPlatformService.retrieveNotesByResource(resourceId, noteTypeId);
@@ -92,9 +93,10 @@ public class NotesApiResource {
@PathParam("noteId") final Long noteId, @Context final UriInfo uriInfo) {
NoteType noteType = NoteType.fromApiUrl(resourceType);
-
- if(noteType == null){ throw new NoteResourceNotSupportedException(resourceType); };
-
+
+ if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); }
+ ;
+
this.context.authenticatedUser().validateHasReadPermission(getResourceNameForPermissions(noteType));
final Integer noteTypeId = noteType.getValue();
@@ -112,9 +114,10 @@ public class NotesApiResource {
final String apiRequestBodyAsJson) {
NoteType noteType = NoteType.fromApiUrl(resourceType);
-
- if(noteType == null){ throw new NoteResourceNotSupportedException(resourceType); };
-
+
+ if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); }
+ ;
+
final String resourceNameForPermissions = getResourceNameForPermissions(noteType);
final CommandWrapper commandRequest = new CommandWrapperBuilder().createNote(resourceNameForPermissions, resourceType, resourceId)
.withJson(apiRequestBodyAsJson).build();
@@ -130,20 +133,22 @@ public class NotesApiResource {
@Produces({ MediaType.APPLICATION_JSON })
public String updateNote(@PathParam("resourceType") final String resourceType, @PathParam("resourceId") final Long resourceId,
@PathParam("noteId") final Long noteId, final String apiRequestBodyAsJson) {
-
+
NoteType noteType = NoteType.fromApiUrl(resourceType);
-
- if(noteType == null){ throw new NoteResourceNotSupportedException(resourceType); };
-
+
+ if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); }
+ ;
+
final String resourceNameForPermissions = getResourceNameForPermissions(noteType);
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder().updateNote(resourceNameForPermissions, resourceType, resourceId, noteId).withJson(apiRequestBodyAsJson).build();
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder()
+ .updateNote(resourceNameForPermissions, resourceType, resourceId, noteId).withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
-
+
@DELETE
@Path("{noteId}")
@Consumes({ MediaType.APPLICATION_JSON })
@@ -152,42 +157,41 @@ public class NotesApiResource {
@PathParam("noteId") final Long noteId) {
NoteType noteType = NoteType.fromApiUrl(resourceType);
-
- if(noteType == null){ throw new NoteResourceNotSupportedException(resourceType); };
-
+
+ if (noteType == null) { throw new NoteResourceNotSupportedException(resourceType); }
+ ;
+
final String resourceNameForPermissions = getResourceNameForPermissions(noteType);
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteNote(resourceNameForPermissions, resourceType, resourceId, noteId).build();
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteNote(resourceNameForPermissions, resourceType, resourceId,
+ noteId).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
}
-
- private String getResourceNameForPermissions(NoteType type){
+
+ private String getResourceNameForPermissions(final NoteType type) {
String resourceNameForPermissions = "INVALIDNOTE";
- switch(type){
+ switch (type) {
case CLIENT:
resourceNameForPermissions = "CLIENTNOTE";
- break;
+ break;
case LOAN:
resourceNameForPermissions = "LOANNOTE";
- break;
+ break;
case LOAN_TRANSACTION:
resourceNameForPermissions = "LOANTRANSACTIONNOTE";
- break;
- case DEPOSIT:
- resourceNameForPermissions = "DEPOSITNOTE";
- break;
- case SAVING:
+ break;
+ case SAVING_ACCOUNT:
resourceNameForPermissions = "SAVINGNOTE";
- break;
+ break;
case GROUP:
resourceNameForPermissions = "GROUPNOTE";
- break;
-
+ break;
+
}
-
+
return resourceNameForPermissions;
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java
index d7aa09835..6f6242e94 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java
@@ -21,8 +21,6 @@ import org.mifosplatform.portfolio.client.domain.Client;
import org.mifosplatform.portfolio.group.domain.Group;
import org.mifosplatform.portfolio.loanaccount.domain.Loan;
import org.mifosplatform.portfolio.loanaccount.domain.LoanTransaction;
-import org.mifosplatform.portfolio.savingsaccount.domain.SavingAccount;
-import org.mifosplatform.portfolio.savingsdepositaccount.domain.DepositAccount;
import org.mifosplatform.useradministration.domain.AppUser;
@Entity
@@ -55,15 +53,10 @@ public class Note extends AbstractAuditableCustom {
@Column(name = "note_type_enum")
private final Integer noteTypeId;
- @SuppressWarnings("unused")
- @ManyToOne
- @JoinColumn(name = "deposit_account_id", nullable = true)
- private DepositAccount depositAccount;
-
- @SuppressWarnings("unused")
- @ManyToOne
- @JoinColumn(name = "saving_account_id", nullable = true)
- private SavingAccount savingAccount;
+ // @SuppressWarnings("unused")
+ // @ManyToOne
+ // @JoinColumn(name = "saving_account_id", nullable = true)
+ // private SavingAccount savingAccount;
public static Note clientNoteFromJson(final Client client, final JsonCommand command) {
final String note = command.stringValueOfParameterNamed("note");
@@ -83,13 +76,10 @@ public class Note extends AbstractAuditableCustom {
return new Note(loan, loanTransaction, note);
}
- public static Note depositNote(final DepositAccount account, final String note) {
- return new Note(account, note);
- }
-
- public static Note savingNote(final SavingAccount account, final String note) {
- return new Note(account, note);
- }
+ // public static Note savingNote(final SavingAccount account, final String
+ // note) {
+ // return new Note(account, note);
+ // }
private Note(final Client client, final String note) {
this.client = client;
@@ -128,19 +118,12 @@ public class Note extends AbstractAuditableCustom {
this.noteTypeId = null;
}
- public Note(final DepositAccount account, final String note) {
- this.depositAccount = account;
- this.client = account.client();
- this.note = note;
- this.noteTypeId = NoteType.DEPOSIT.getValue();
- }
-
- public Note(final SavingAccount account, final String note) {
- this.savingAccount = account;
- this.client = account.getClient();
- this.note = note;
- this.noteTypeId = NoteType.SAVING.getValue();
- }
+ // public Note(final SavingAccount account, final String note) {
+ // this.savingAccount = account;
+ // this.client = account.getClient();
+ // this.note = note;
+ // this.noteTypeId = NoteType.SAVING_ACCOUNT.getValue();
+ // }
public Map update(final JsonCommand command) {
final Map actualChanges = new LinkedHashMap(7);
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteRepository.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteRepository.java
index 9066b45cc..e68bb16f9 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteRepository.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteRepository.java
@@ -24,7 +24,7 @@ public interface NoteRepository extends JpaRepository, JpaSpecificat
Note findByLoanTransactionIdAndId(Long loanTransactionId, Long id);
- Note findByDepositAccountIdAndId(Long depositAccountId, Long id);
+ // Note findByDepositAccountIdAndId(Long depositAccountId, Long id);
- Note findBySavingAccountIdAndId(Long savingAccountId, Long id);
+ // Note findBySavingAccountIdAndId(Long savingAccountId, Long id);
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java
index f7016669c..edbc3f558 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java
@@ -5,9 +5,11 @@ import java.util.Map;
public enum NoteType {
- CLIENT(100, "noteType.client", "clients"), LOAN(200, "noteType.loan", "loans"), LOAN_TRANSACTION(300, "noteType.loan.transaction",
- "loanTransactions"), DEPOSIT(400, "noteType.deposit", "deposits"), SAVING(500, "noteType.saving", "savings"), GROUP(600,
- "noteType.group", "groups");
+ CLIENT(100, "noteType.client", "clients"), //
+ LOAN(200, "noteType.loan", "loans"), //
+ LOAN_TRANSACTION(300, "noteType.loan.transaction", "loanTransactions"), //
+ SAVING_ACCOUNT(500, "noteType.saving", "savings"), //
+ GROUP(600, "noteType.group", "groups");
private Integer value;
private String code;
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteEnumerations.java
index 5d05ff7a9..c53b17dde 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteEnumerations.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteEnumerations.java
@@ -26,11 +26,8 @@ public class NoteEnumerations {
case LOAN_TRANSACTION:
optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Loan transaction note");
break;
- case DEPOSIT:
- optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Deposit transaction note");
- break;
- case SAVING:
- optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Saving transaction note");
+ case SAVING_ACCOUNT:
+ optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Saving account note");
break;
case GROUP:
optionData = new EnumOptionData(type.getValue().longValue(), type.getCode(), "Group note");
@@ -41,5 +38,5 @@ public class NoteEnumerations {
}
return optionData;
}
-
+
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java
index ffedcf599..82d415f4e 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteReadPlatformServiceImpl.java
@@ -31,8 +31,8 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
private static final class NoteMapper implements RowMapper {
public String schema() {
- return " select n.id as id, n.client_id as clientId, n.group_id as groupId, n.loan_id as loanId, n.loan_transaction_id as transactionId, n.deposit_account_id as depositAccountId, "
- + " n.saving_account_id as savingAccountId, n.note_type_enum as noteTypeEnum, n.note as note, n.created_date as createdDate, n.createdby_id as createdById, "
+ return " select n.id as id, n.client_id as clientId, n.group_id as groupId, n.loan_id as loanId, n.loan_transaction_id as transactionId, "
+ + " n.note_type_enum as noteTypeEnum, n.note as note, n.created_date as createdDate, n.createdby_id as createdById, "
+ " cb.username as createdBy, n.lastmodified_date as lastModifiedDate, n.lastmodifiedby_id as lastModifiedById, mb.username as modifiedBy "
+ " from m_note n left join m_appuser cb on cb.id=n.createdby_id left join m_appuser mb on mb.id=n.lastmodifiedby_id ";
}
@@ -45,8 +45,10 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
final Long groupId = JdbcSupport.getLong(rs, "groupId");
final Long loanId = JdbcSupport.getLong(rs, "loanId");
final Long transactionId = JdbcSupport.getLong(rs, "transactionId");
- final Long depositAccountId = JdbcSupport.getLong(rs, "depositAccountId");
- final Long savingAccountId = JdbcSupport.getLong(rs, "savingAccountId");
+ // final Long depositAccountId = JdbcSupport.getLong(rs,
+ // "depositAccountId");
+ // final Long savingAccountId = JdbcSupport.getLong(rs,
+ // "savingAccountId");
final Integer noteTypeId = JdbcSupport.getInteger(rs, "noteTypeEnum");
final EnumOptionData noteType = NoteEnumerations.noteType(noteTypeId);
final String note = rs.getString("note");
@@ -56,7 +58,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
final Long lastModifiedById = JdbcSupport.getLong(rs, "lastModifiedById");
final String createdByUsername = rs.getString("createdBy");
final String updatedByUsername = rs.getString("modifiedBy");
- return new NoteData(id, clientId, groupId, loanId, transactionId, depositAccountId, savingAccountId, noteType, note,
+ return new NoteData(id, clientId, groupId, loanId, transactionId, null, null, noteType, note,
createdDate, createdById, createdByUsername, lastModifiedDate, lastModifiedById, updatedByUsername);
}
}
@@ -84,7 +86,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
final NoteType noteType = NoteType.fromInt(noteTypeId);
final NoteMapper rm = new NoteMapper();
String conditionSql = getResourceCondition(noteType);
-
+
final String sql = rm.schema() + " where " + conditionSql + " order by n.created_date DESC";
return this.jdbcTemplate.query(sql, rm, new Object[] { resourceId });
@@ -102,10 +104,7 @@ public class NoteReadPlatformServiceImpl implements NoteReadPlatformService {
case LOAN_TRANSACTION:
conditionSql = " n.loan_transaction_id = ? ";
break;
- case DEPOSIT:
- conditionSql = " n.deposit_account_id = ? ";
- break;
- case SAVING:
+ case SAVING_ACCOUNT:
conditionSql = " n.saving_account_id = ? ";
break;
case GROUP:
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java
index eb3d4e13d..448d3a133 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/service/NoteWritePlatformServiceJpaRepositoryImpl.java
@@ -28,12 +28,6 @@ import org.mifosplatform.portfolio.note.domain.NoteType;
import org.mifosplatform.portfolio.note.exception.NoteNotFoundException;
import org.mifosplatform.portfolio.note.exception.NoteResourceNotSupportedException;
import org.mifosplatform.portfolio.note.serialization.NoteCommandFromApiJsonDeserializer;
-import org.mifosplatform.portfolio.savingsaccount.domain.SavingAccount;
-import org.mifosplatform.portfolio.savingsaccount.domain.SavingAccountRepository;
-import org.mifosplatform.portfolio.savingsaccount.exception.SavingAccountNotFoundException;
-import org.mifosplatform.portfolio.savingsdepositaccount.domain.DepositAccount;
-import org.mifosplatform.portfolio.savingsdepositaccount.domain.DepositAccountRepository;
-import org.mifosplatform.portfolio.savingsdepositaccount.exception.DepositAccountNotFoundException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -43,22 +37,21 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
private final NoteRepository noteRepository;
private final ClientRepository clientRepository;
private final GroupRepository groupRepository;
- private final DepositAccountRepository depositAccountRepository;
- private final SavingAccountRepository savingAccountRepository;
+ // private final SavingAccountRepository savingAccountRepository;
private final LoanRepository loanRepository;
private final LoanTransactionRepository loanTransactionRepository;
private final NoteCommandFromApiJsonDeserializer fromApiJsonDeserializer;
@Autowired
public NoteWritePlatformServiceJpaRepositoryImpl(final NoteRepository noteRepository, final ClientRepository clientRepository,
- final GroupRepository groupRepository, final DepositAccountRepository depositAccountRepository,
- final SavingAccountRepository savingAccountRepository, final LoanRepository loanRepository,
- final LoanTransactionRepository loanTransactionRepository, final NoteCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
+ final GroupRepository groupRepository,
+ // final SavingAccountRepository savingAccountRepository,
+ final LoanRepository loanRepository, final LoanTransactionRepository loanTransactionRepository,
+ final NoteCommandFromApiJsonDeserializer fromApiJsonDeserializer) {
this.noteRepository = noteRepository;
this.clientRepository = clientRepository;
this.groupRepository = groupRepository;
- this.depositAccountRepository = depositAccountRepository;
- this.savingAccountRepository = savingAccountRepository;
+ // this.savingAccountRepository = savingAccountRepository;
this.loanRepository = loanRepository;
this.loanTransactionRepository = loanTransactionRepository;
this.fromApiJsonDeserializer = fromApiJsonDeserializer;
@@ -145,41 +138,26 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
.build();
}
- private CommandProcessingResult createDepositAccountNote(final JsonCommand command) {
-
- final Long resourceId = command.getSupportedEntityId();
-
- final DepositAccount depositAccount = this.depositAccountRepository.findOne(resourceId);
- if (depositAccount == null) { throw new DepositAccountNotFoundException(resourceId); }
-
- final String note = command.stringValueOfParameterNamed("note");
- final Note newNote = Note.depositNote(depositAccount, note);
-
- this.noteRepository.save(newNote);
-
- return new CommandProcessingResultBuilder() //
- .withCommandId(command.commandId()) //
- .withEntityId(newNote.getId()) //
- .withClientId(depositAccount.client().getId()).withOfficeId(depositAccount.client().getOffice().getId()).build();
- }
-
- private CommandProcessingResult createSavingAccountNote(final JsonCommand command) {
-
- final Long resourceId = command.getSupportedEntityId();
-
- final SavingAccount savingAccount = this.savingAccountRepository.findOne(resourceId);
- if (savingAccount == null) { throw new SavingAccountNotFoundException(resourceId); }
-
- final String note = command.stringValueOfParameterNamed("note");
- final Note newNote = Note.savingNote(savingAccount, note);
-
- this.noteRepository.save(newNote);
-
- return new CommandProcessingResultBuilder() //
- .withCommandId(command.commandId()) //
- .withEntityId(newNote.getId()) //
- .withClientId(savingAccount.getClient().getId()).withOfficeId(savingAccount.getClient().getOffice().getId()).build();
- }
+ // private CommandProcessingResult createSavingAccountNote(final JsonCommand
+ // command) {
+ //
+ // final Long resourceId = command.getSupportedEntityId();
+ //
+ // final SavingAccount savingAccount =
+ // this.savingAccountRepository.findOne(resourceId);
+ // if (savingAccount == null) { throw new
+ // SavingAccountNotFoundException(resourceId); }
+ //
+ // final String note = command.stringValueOfParameterNamed("note");
+ // final Note newNote = Note.savingNote(savingAccount, note);
+ //
+ // this.noteRepository.save(newNote);
+ //
+ // return new CommandProcessingResultBuilder() //
+ // .withCommandId(command.commandId()) //
+ // .withEntityId(newNote.getId()) //
+ // .withClientId(savingAccount.getClient().getId()).withOfficeId(savingAccount.getClient().getOffice().getId()).build();
+ // }
@Override
public CommandProcessingResult createNote(final JsonCommand command) {
@@ -192,9 +170,6 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
case CLIENT: {
return createClientNote(command);
}
- case DEPOSIT: {
- return createDepositAccountNote(command);
- }
case GROUP: {
return createGroupNote(command);
}
@@ -204,9 +179,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
case LOAN_TRANSACTION: {
return createLoanTransactionNote(command);
}
- case SAVING: {
- return createSavingAccountNote(command);
- }
+ // case SAVING_ACCOUNT: {
+ // return createSavingAccountNote(command);
+ // }
default:
throw new NoteResourceNotSupportedException(resourceUrl);
}
@@ -236,40 +211,10 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.withEntityId(noteForUpdate.getId()) //
- .withClientId(client.getId()).withOfficeId(client.getOffice().getId())
- .with(changes)
- .build();
+ .withClientId(client.getId()).withOfficeId(client.getOffice().getId()).with(changes).build();
}
- private CommandProcessingResult updateDepositAccountNote(final JsonCommand command) {
-
- final Long resourceId = command.getSupportedEntityId();
- final Long noteId = command.entityId();
- final String resourceUrl = command.getSupportedEntityType();
-
- final NoteType type = NoteType.fromApiUrl(resourceUrl);
-
- final DepositAccount depositAccount = this.depositAccountRepository.findOne(resourceId);
- if (depositAccount == null) { throw new DepositAccountNotFoundException(resourceId); }
- final Note noteForUpdate = this.noteRepository.findByDepositAccountIdAndId(resourceId, noteId);
-
- if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); }
-
- final Map changes = noteForUpdate.update(command);
-
- if (!changes.isEmpty()) {
- this.noteRepository.saveAndFlush(noteForUpdate);
- }
-
- return new CommandProcessingResultBuilder() //
- .withCommandId(command.commandId()) //
- .withEntityId(noteForUpdate.getId()) //
- .withClientId(depositAccount.client().getId()).withOfficeId(depositAccount.client().getOffice().getId())
- .with(changes)
- .build();
- }
-
private CommandProcessingResult updateGroupNote(final JsonCommand command) {
final Long resourceId = command.getSupportedEntityId();
@@ -293,9 +238,7 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.withEntityId(noteForUpdate.getId()) //
- .withGroupId(group.getId()).withOfficeId(group.getOfficeId())
- .with(changes)
- .build();
+ .withGroupId(group.getId()).withOfficeId(group.getOfficeId()).with(changes).build();
}
private CommandProcessingResult updateLoanNote(final JsonCommand command) {
@@ -320,8 +263,7 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(noteForUpdate.getId())
.withClientId(loan.getClientId()).withLoanId(loan.getId()).withGroupId(loan.getGroupId()).withOfficeId(loan.getOfficeId())
- .with(changes)
- .build();
+ .with(changes).build();
}
private CommandProcessingResult updateLoanTransactionNote(final JsonCommand command) {
@@ -348,38 +290,44 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(noteForUpdate.getId())
.withClientId(loan.getClientId()).withLoanId(loan.getId()).withGroupId(loan.getGroupId()).withOfficeId(loan.getOfficeId())
- .with(changes)
- .build();
+ .with(changes).build();
}
- private CommandProcessingResult updateSavingAccountNote(final JsonCommand command) {
-
- final Long resourceId = command.getSupportedEntityId();
- final Long noteId = command.entityId();
- final String resourceUrl = command.getSupportedEntityType();
-
- final NoteType type = NoteType.fromApiUrl(resourceUrl);
-
- final SavingAccount savingAccount = this.savingAccountRepository.findOne(resourceId);
- if (savingAccount == null) { throw new SavingAccountNotFoundException(resourceId); }
-
- final Note noteForUpdate = this.noteRepository.findBySavingAccountIdAndId(resourceId, noteId);
-
- if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); }
-
- final Map changes = noteForUpdate.update(command);
-
- if (!changes.isEmpty()) {
- this.noteRepository.saveAndFlush(noteForUpdate);
- }
-
- return new CommandProcessingResultBuilder() //
- .withCommandId(command.commandId()) //
- .withEntityId(noteForUpdate.getId()) //
- .withClientId(savingAccount.getClient().getId()).withOfficeId(savingAccount.getClient().getOffice().getId())
- .with(changes)
- .build();
- }
+ // private CommandProcessingResult updateSavingAccountNote(final JsonCommand
+ // command) {
+ //
+ // final Long resourceId = command.getSupportedEntityId();
+ // final Long noteId = command.entityId();
+ // final String resourceUrl = command.getSupportedEntityType();
+ //
+ // final NoteType type = NoteType.fromApiUrl(resourceUrl);
+ //
+ // final SavingAccount savingAccount =
+ // this.savingAccountRepository.findOne(resourceId);
+ // if (savingAccount == null) { throw new
+ // SavingAccountNotFoundException(resourceId); }
+ //
+ // final Note noteForUpdate =
+ // this.noteRepository.findBySavingAccountIdAndId(resourceId, noteId);
+ //
+ // if (noteForUpdate == null) { throw new NoteNotFoundException(noteId,
+ // resourceId, type.name().toLowerCase()); }
+ //
+ // final Map changes = noteForUpdate.update(command);
+ //
+ // if (!changes.isEmpty()) {
+ // this.noteRepository.saveAndFlush(noteForUpdate);
+ // }
+ //
+ // return new CommandProcessingResultBuilder()
+ // //
+ // .withCommandId(command.commandId())
+ // //
+ // .withEntityId(noteForUpdate.getId())
+ // //
+ // .withClientId(savingAccount.getClient().getId()).withOfficeId(savingAccount.getClient().getOffice().getId()).with(changes)
+ // .build();
+ // }
@Override
public CommandProcessingResult updateNote(final JsonCommand command) {
@@ -393,9 +341,6 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
case CLIENT: {
return updateClientNote(command);
}
- case DEPOSIT: {
- return updateDepositAccountNote(command);
- }
case GROUP: {
return updateGroupNote(command);
}
@@ -405,9 +350,9 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
case LOAN_TRANSACTION: {
return updateLoanTransactionNote(command);
}
- case SAVING: {
- return updateSavingAccountNote(command);
- }
+ // case SAVING_ACCOUNT: {
+ // return updateSavingAccountNote(command);
+ // }
default:
throw new NoteResourceNotSupportedException(resourceUrl);
}
@@ -436,10 +381,6 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
noteForUpdate = this.noteRepository.findByClientIdAndId(resourceId, noteId);
}
break;
- case DEPOSIT: {
- noteForUpdate = this.noteRepository.findByDepositAccountIdAndId(resourceId, noteId);
- }
- break;
case GROUP: {
noteForUpdate = this.noteRepository.findByGroupIdAndId(resourceId, noteId);
}
@@ -452,9 +393,12 @@ public class NoteWritePlatformServiceJpaRepositoryImpl implements NoteWritePlatf
noteForUpdate = this.noteRepository.findByLoanTransactionIdAndId(resourceId, noteId);
}
break;
- case SAVING: {
- noteForUpdate = this.noteRepository.findBySavingAccountIdAndId(resourceId, noteId);
- }
+ // case SAVING_ACCOUNT: {
+ // noteForUpdate =
+ // this.noteRepository.findBySavingAccountIdAndId(resourceId, noteId);
+ // }
+ // break;
+ case SAVING_ACCOUNT:
break;
}
if (noteForUpdate == null) { throw new NoteNotFoundException(noteId, resourceId, type.name().toLowerCase()); }
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java
new file mode 100644
index 000000000..358af459a
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java
@@ -0,0 +1,168 @@
+/**
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.mifosplatform.portfolio.savings.api;
+
+import java.util.Collection;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.mifosplatform.commands.domain.CommandWrapper;
+import org.mifosplatform.commands.service.CommandWrapperBuilder;
+import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService;
+import org.mifosplatform.infrastructure.core.api.ApiRequestParameterHelper;
+import org.mifosplatform.infrastructure.core.data.CommandProcessingResult;
+import org.mifosplatform.infrastructure.core.data.EnumOptionData;
+import org.mifosplatform.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
+import org.mifosplatform.infrastructure.core.serialization.DefaultToApiJsonSerializer;
+import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
+import org.mifosplatform.portfolio.savings.data.SavingsAccountData;
+import org.mifosplatform.portfolio.savings.data.SavingsProductData;
+import org.mifosplatform.portfolio.savings.service.SavingsAccountReadPlatformService;
+import org.mifosplatform.portfolio.savings.service.SavingsDropdownReadPlatformService;
+import org.mifosplatform.portfolio.savings.service.SavingsProductReadPlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Path("/savingsaccounts")
+@Component
+@Scope("singleton")
+public class SavingsAccountsApiResource {
+
+ private final SavingsAccountReadPlatformService savingsAccountReadPlatformService;
+ private final SavingsProductReadPlatformService savingsProductReadPlatformService;
+ private final SavingsDropdownReadPlatformService dropdownReadPlatformService;
+ private final PlatformSecurityContext context;
+ private final DefaultToApiJsonSerializer toApiJsonSerializer;
+ private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ private final ApiRequestParameterHelper apiRequestParameterHelper;
+
+ @Autowired
+ public SavingsAccountsApiResource(final SavingsAccountReadPlatformService savingsAccountReadPlatformService,
+ final SavingsProductReadPlatformService savingsProductReadPlatformService,
+ final SavingsDropdownReadPlatformService dropdownReadPlatformService, final PlatformSecurityContext context,
+ final DefaultToApiJsonSerializer toApiJsonSerializer,
+ final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
+ final ApiRequestParameterHelper apiRequestParameterHelper) {
+ this.savingsAccountReadPlatformService = savingsAccountReadPlatformService;
+ this.savingsProductReadPlatformService = savingsProductReadPlatformService;
+ this.dropdownReadPlatformService = dropdownReadPlatformService;
+ this.context = context;
+ this.toApiJsonSerializer = toApiJsonSerializer;
+ this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
+ this.apiRequestParameterHelper = apiRequestParameterHelper;
+ }
+
+ @POST
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String create(final String apiRequestBodyAsJson) {
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingsAccount().withJson(apiRequestBodyAsJson).build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+ return this.toApiJsonSerializer.serialize(result);
+ }
+
+ @PUT
+ @Path("{accountId}")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String update(@PathParam("accountId") final Long accountId, final String apiRequestBodyAsJson) {
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSavingsAccount(accountId).withJson(apiRequestBodyAsJson)
+ .build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+ return this.toApiJsonSerializer.serialize(result);
+
+ }
+
+ @GET
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String retrieveAll(@Context final UriInfo uriInfo) {
+
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
+
+ final Collection products = this.savingsAccountReadPlatformService.retrieveAll();
+
+ final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+ return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ }
+
+ @GET
+ @Path("{accountId}")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String retrieveOne(@PathParam("accountId") final Long accountId, @Context final UriInfo uriInfo) {
+
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
+
+ SavingsAccountData savingsAccount = this.savingsAccountReadPlatformService.retrieveOne(accountId);
+
+ final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+
+ if (settings.isTemplate()) {
+ savingsAccount = populateTemplateOptions(savingsAccount);
+ }
+
+ return this.toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ }
+
+ private SavingsAccountData populateTemplateOptions(final SavingsAccountData savingsAccount) {
+
+ final Collection productOptions = this.savingsProductReadPlatformService.retrieveAllForLookup();
+ final Collection interestRatePeriodFrequencyTypeOptions = this.dropdownReadPlatformService
+ .retrieveInterestRatePeriodFrequencyTypeOptions();
+ final Collection lockinPeriodFrequencyTypeOptions = this.dropdownReadPlatformService
+ .retrieveLockinPeriodFrequencyTypeOptions();
+
+ return SavingsAccountData.withTemplateOptions(savingsAccount, productOptions, interestRatePeriodFrequencyTypeOptions,
+ lockinPeriodFrequencyTypeOptions);
+ }
+
+ @GET
+ @Path("template")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String retrieveTemplate(@QueryParam("clientId") final Long clientId, @QueryParam("groupId") final Long groupId,
+ @QueryParam("productId") final Long productId, @Context final UriInfo uriInfo) {
+
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME);
+
+ final SavingsAccountData savingsAccount = this.savingsAccountReadPlatformService.retrieveTemplate(clientId, groupId, productId);
+
+ final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+ return this.toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS);
+ }
+
+ @DELETE
+ @Path("{accountId}")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String delete(@PathParam("accountId") final Long accountId) {
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingsAccount(accountId).build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+ return this.toApiJsonSerializer.serialize(result);
+ }
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsApiConstants.java
new file mode 100644
index 000000000..0f8b0b384
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsApiConstants.java
@@ -0,0 +1,63 @@
+package org.mifosplatform.portfolio.savings.api;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.mifosplatform.portfolio.savings.data.SavingsAccountData;
+import org.mifosplatform.portfolio.savings.data.SavingsProductData;
+
+public class SavingsApiConstants {
+
+ public static final String SAVINGS_PRODUCT_RESOURCE_NAME = "savingsproduct";
+ public static final String SAVINGS_ACCOUNT_RESOURCE_NAME = "savingsaccount";
+
+ public static final String localeParamName = "locale";
+ public static final String idParamName = "id";
+ public static final String accountNoParamName = "accountNo";
+ public static final String externalIdParamName = "externalId";
+ public static final String clientIdParamName = "clientId";
+ public static final String groupIdParamName = "groupId";
+ public static final String productIdParamName = "productId";
+ public static final String nameParamName = "name";
+ public static final String descriptionParamName = "description";
+ public static final String currencyCodeParamName = "currencyCode";
+ public static final String digitsAfterDecimalParamName = "digitsAfterDecimal";
+ public static final String interestRateParamName = "interestRate";
+ public static final String interestRatePeriodFrequencyTypeParamName = "interestRatePeriodFrequencyType";
+ public static final String minRequiredOpeningBalanceParamName = "minRequiredOpeningBalance";
+ public static final String lockinPeriodFrequencyParamName = "lockinPeriodFrequency";
+ public static final String lockinPeriodFrequencyTypeParamName = "lockinPeriodFrequencyType";
+
+ public static final Set SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName,
+ nameParamName, descriptionParamName, currencyCodeParamName, digitsAfterDecimalParamName, interestRateParamName,
+ interestRatePeriodFrequencyTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
+ lockinPeriodFrequencyTypeParamName));
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsProductData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+ public static final Set SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName,
+ nameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, interestRateParamName,
+ interestRatePeriodFrequencyTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
+ lockinPeriodFrequencyTypeParamName, "currencyOptions", "interestRatePeriodFrequencyTypeOptions",
+ "lockinPeriodFrequencyTypeOptions"));
+
+ public static final Set SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName,
+ accountNoParamName, externalIdParamName, clientIdParamName, groupIdParamName, productIdParamName, interestRateParamName,
+ interestRatePeriodFrequencyTypeParamName, minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName,
+ lockinPeriodFrequencyTypeParamName));
+
+ /**
+ * These parameters will match the class level parameters of
+ * {@link SavingsAccountData}. Where possible, we try to get response
+ * parameters to match those of request parameters.
+ */
+ public static final Set SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName,
+ accountNoParamName, externalIdParamName, clientIdParamName, "clientName", groupIdParamName, "groupName", "savingsProductId",
+ "savingsProductName", "currency", interestRateParamName, interestRatePeriodFrequencyTypeParamName, "annualInterestRate",
+ minRequiredOpeningBalanceParamName, lockinPeriodFrequencyParamName, lockinPeriodFrequencyTypeParamName, "productOptions",
+ "interestRatePeriodFrequencyTypeOptions", "lockinPeriodFrequencyTypeOptions"));
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsdepositproduct/api/DepositProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java
similarity index 52%
rename from mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsdepositproduct/api/DepositProductsApiResource.java
rename to mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java
index ad13c33a7..9d1e8ed62 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsdepositproduct/api/DepositProductsApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java
@@ -3,13 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-package org.mifosplatform.portfolio.savingsdepositproduct.api;
+package org.mifosplatform.portfolio.savings.api;
-import java.util.Arrays;
import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -35,44 +31,38 @@ import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext
import org.mifosplatform.organisation.monetary.data.CurrencyData;
import org.mifosplatform.organisation.monetary.service.CurrencyReadPlatformService;
import org.mifosplatform.portfolio.loanproduct.domain.PeriodFrequencyType;
-import org.mifosplatform.portfolio.savingsaccountproduct.service.SavingsDepositEnumerations;
-import org.mifosplatform.portfolio.savingsdepositproduct.data.DepositProductData;
-import org.mifosplatform.portfolio.savingsdepositproduct.service.DepositProductReadPlatformService;
+import org.mifosplatform.portfolio.savings.data.SavingsProductData;
+import org.mifosplatform.portfolio.savings.service.SavingsDropdownReadPlatformService;
+import org.mifosplatform.portfolio.savings.service.SavingsEnumerations;
+import org.mifosplatform.portfolio.savings.service.SavingsProductReadPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
-@Path("/depositproducts")
+@Path("/savingsproducts")
@Component
@Scope("singleton")
-public class DepositProductsApiResource {
+public class SavingsProductsApiResource {
- private final Set DEPOSIT_PRODUCT_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "externalId", "name",
- "description", "currencyCode", "digitsAfterDecimal", "minDeposit", "defaultDeposit", "maxDeposit", "tenureInMonths",
- "defaultInterestRate", "minInterestRate", "maxInterestRate", "interestCompoundedEvery",
- "interestCompoundedEveryPeriodType", "renewalAllowed", "preClosureAllowed", "preClosureInterestRate",
- "interestCompoundingAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currency", "currencyOptions",
- "interestCompoundedEveryPeriodTypeOptions"));
-
- private final String entityType = "DEPOSITPRODUCT";
-
- private final PlatformSecurityContext context;
- private final DepositProductReadPlatformService depositProductReadPlatformService;
+ private final SavingsProductReadPlatformService savingProductReadPlatformService;
+ private final SavingsDropdownReadPlatformService dropdownReadPlatformService;
private final CurrencyReadPlatformService currencyReadPlatformService;
- private final DefaultToApiJsonSerializer toApiJsonSerializer;
+ private final PlatformSecurityContext context;
+ private final DefaultToApiJsonSerializer toApiJsonSerializer;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
private final ApiRequestParameterHelper apiRequestParameterHelper;
@Autowired
- public DepositProductsApiResource(final PlatformSecurityContext context,
- final DepositProductReadPlatformService depositProductReadPlatformService,
- final CurrencyReadPlatformService currencyReadPlatformService,
- final DefaultToApiJsonSerializer toApiJsonSerializer,
+ public SavingsProductsApiResource(final SavingsProductReadPlatformService savingProductReadPlatformService,
+ final SavingsDropdownReadPlatformService dropdownReadPlatformService,
+ final CurrencyReadPlatformService currencyReadPlatformService, final PlatformSecurityContext context,
+ final DefaultToApiJsonSerializer toApiJsonSerializer,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService,
final ApiRequestParameterHelper apiRequestParameterHelper) {
- this.context = context;
- this.depositProductReadPlatformService = depositProductReadPlatformService;
+ this.savingProductReadPlatformService = savingProductReadPlatformService;
+ this.dropdownReadPlatformService = dropdownReadPlatformService;
this.currencyReadPlatformService = currencyReadPlatformService;
+ this.context = context;
this.toApiJsonSerializer = toApiJsonSerializer;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
this.apiRequestParameterHelper = apiRequestParameterHelper;
@@ -81,9 +71,9 @@ public class DepositProductsApiResource {
@POST
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String createDepositProduct(final String apiRequestBodyAsJson) {
+ public String create(final String apiRequestBodyAsJson) {
- final CommandWrapper commandRequest = new CommandWrapperBuilder().createDepositProduct().withJson(apiRequestBodyAsJson).build();
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().createSavingProduct().withJson(apiRequestBodyAsJson).build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
@@ -94,79 +84,97 @@ public class DepositProductsApiResource {
@Path("{productId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String updateDepositProduct(@PathParam("productId") final Long productId, final String apiRequestBodyAsJson) {
+ public String update(@PathParam("productId") final Long productId, final String apiRequestBodyAsJson) {
- final CommandWrapper commandRequest = new CommandWrapperBuilder().updateDepositProduct(productId).withJson(apiRequestBodyAsJson)
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().updateSavingProduct(productId).withJson(apiRequestBodyAsJson)
.build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
return this.toApiJsonSerializer.serialize(result);
- }
- @DELETE
- @Path("{productId}")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- public String deleteDepositProduct(@PathParam("productId") final Long productId) {
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteDepositProduct(productId).build();
-
- final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
-
- return this.toApiJsonSerializer.serialize(result);
}
@GET
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String retrieveAllDepositProducts(@Context final UriInfo uriInfo) {
- context.authenticatedUser().validateHasReadPermission(entityType);
- Collection products = this.depositProductReadPlatformService.retrieveAllDepositProducts();
+ public String retrieveAll(@Context final UriInfo uriInfo) {
+
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME);
+
+ final Collection products = this.savingProductReadPlatformService.retrieveAll();
+
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, products, DEPOSIT_PRODUCT_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, products, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("{productId}")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String retrieveDepositProductDetails(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
+ public String retrieveOne(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) {
+
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME);
+
+ SavingsProductData savingProduct = this.savingProductReadPlatformService.retrieveOne(productId);
- context.authenticatedUser().validateHasReadPermission(entityType);
- DepositProductData productData = this.depositProductReadPlatformService.retrieveDepositProductData(productId);
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
if (settings.isTemplate()) {
- productData = handleTemplateRelatedData(productData);
+ savingProduct = handleTemplateRelatedData(savingProduct);
}
- return this.toApiJsonSerializer.serialize(settings, productData, DEPOSIT_PRODUCT_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingProduct, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
@GET
@Path("template")
@Consumes({ MediaType.APPLICATION_JSON })
@Produces({ MediaType.APPLICATION_JSON })
- public String retrieveNewDepositProductDetails(@Context final UriInfo uriInfo) {
+ public String retrieveTemplate(@Context final UriInfo uriInfo) {
- context.authenticatedUser().validateHasReadPermission(entityType);
+ context.authenticatedUser().validateHasReadPermission(SavingsApiConstants.SAVINGS_PRODUCT_RESOURCE_NAME);
- DepositProductData depositProduct = this.depositProductReadPlatformService.retrieveNewDepositProductDetails();
-
- depositProduct = handleTemplateRelatedData(depositProduct);
+ SavingsProductData savingProduct = handleTemplateRelatedData(null);
final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, depositProduct, DEPOSIT_PRODUCT_DATA_PARAMETERS);
+ return this.toApiJsonSerializer.serialize(settings, savingProduct, SavingsApiConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS);
}
- private DepositProductData handleTemplateRelatedData(final DepositProductData productData) {
+ private SavingsProductData handleTemplateRelatedData(final SavingsProductData savingsProduct) {
- Collection allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
+ final EnumOptionData interestRatePeriodFrequencyType = SavingsEnumerations
+ .interestRatePeriodFrequencyType(PeriodFrequencyType.YEARS);
- EnumOptionData monthly = SavingsDepositEnumerations.interestCompoundingPeriodType(PeriodFrequencyType.MONTHS);
- List interestCompoundedEveryPeriodTypeOptions = Arrays.asList(monthly);
+ final Collection currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
+ final Collection interestRatePeriodFrequencyTypeOptions = this.dropdownReadPlatformService
+ .retrieveInterestRatePeriodFrequencyTypeOptions();
+ final Collection lockinPeriodFrequencyTypeOptions = this.dropdownReadPlatformService
+ .retrieveLockinPeriodFrequencyTypeOptions();
+
+ SavingsProductData savingsProductToReturn = null;
+ if (savingsProduct != null) {
+ savingsProductToReturn = SavingsProductData.withTemplate(savingsProduct, currencyOptions,
+ interestRatePeriodFrequencyTypeOptions, lockinPeriodFrequencyTypeOptions);
+ } else {
+ savingsProductToReturn = SavingsProductData.template(CurrencyData.blank(), interestRatePeriodFrequencyType, currencyOptions,
+ interestRatePeriodFrequencyTypeOptions, lockinPeriodFrequencyTypeOptions);
+ }
+
+ return savingsProductToReturn;
+ }
+
+ @DELETE
+ @Path("{productId}")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ public String delete(@PathParam("productId") final Long productId) {
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteSavingProduct(productId).build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+ return this.toApiJsonSerializer.serialize(result);
- return new DepositProductData(productData, allowedCurrencies, interestCompoundedEveryPeriodTypeOptions);
}
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountData.java
new file mode 100644
index 000000000..6ccfd7368
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountData.java
@@ -0,0 +1,123 @@
+/**
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+package org.mifosplatform.portfolio.savings.data;
+
+import java.math.BigDecimal;
+import java.util.Collection;
+
+import org.mifosplatform.infrastructure.core.data.EnumOptionData;
+import org.mifosplatform.organisation.monetary.data.CurrencyData;
+
+/**
+ * Immutable data object representing a savings account.
+ */
+@SuppressWarnings("unused")
+public class SavingsAccountData {
+
+ private final Long id;
+ private final String accountNo;
+ private final String externalId;
+ private final Long groupId;
+ private final String groupName;
+ private final Long clientId;
+ private final String clientName;
+ private final Long savingsProductId;
+ private final String savingsProductName;
+ private final CurrencyData currency;
+ private final BigDecimal interestRate;
+ private final EnumOptionData interestRatePeriodFrequencyType;
+ private final BigDecimal annualInterestRate;
+ private final BigDecimal minRequiredOpeningBalance;
+ private final Integer lockinPeriodFrequency;
+ private final EnumOptionData lockinPeriodFrequencyType;
+
+ // template
+ private final Collection productOptions;
+ private final Collection interestRatePeriodFrequencyTypeOptions;
+ private final Collection lockinPeriodFrequencyTypeOptions;
+
+ public static SavingsAccountData instance(final Long id, final String accountNo, final String externalId, final Long groupId,
+ final String groupName, final Long clientId, final String clientName, final Long productId, final String productName,
+ final CurrencyData currency, final BigDecimal interestRate, final EnumOptionData interestRatePeriodFrequencyType,
+ final BigDecimal annualInterestRate, final BigDecimal minRequiredOpeningBalance, final Integer lockinPeriodFrequency,
+ final EnumOptionData lockinPeriodFrequencyType) {
+
+ final Collection productOptions = null;
+ final Collection interestRatePeriodFrequencyTypeOptions = null;
+ final Collection lockinPeriodFrequencyTypeOptions = null;
+
+ return new SavingsAccountData(id, accountNo, externalId, groupId, groupName, clientId, clientName, productId, productName,
+ currency, interestRate, interestRatePeriodFrequencyType, annualInterestRate, minRequiredOpeningBalance,
+ lockinPeriodFrequency, lockinPeriodFrequencyType, productOptions, interestRatePeriodFrequencyTypeOptions,
+ lockinPeriodFrequencyTypeOptions);
+ }
+
+ public static SavingsAccountData withTemplateOptions(final SavingsAccountData account,
+ final Collection productOptions, final Collection interestRatePeriodFrequencyTypeOptions,
+ final Collection lockinPeriodFrequencyTypeOptions) {
+
+ return new SavingsAccountData(account.id, account.accountNo, account.externalId, account.groupId, account.groupName,
+ account.clientId, account.clientName, account.savingsProductId, account.savingsProductName, account.currency,
+ account.interestRate, account.interestRatePeriodFrequencyType, account.annualInterestRate,
+ account.minRequiredOpeningBalance, account.lockinPeriodFrequency, account.lockinPeriodFrequencyType, productOptions,
+ interestRatePeriodFrequencyTypeOptions, lockinPeriodFrequencyTypeOptions);
+ }
+
+ public static SavingsAccountData withClientTemplate(final Long clientId, final String clientName, final Long groupId,
+ final String groupName) {
+
+ final Long id = null;
+ final String accountNo = null;
+ final String externalId = null;
+ final Long productId = null;
+ final String productName = null;
+ final CurrencyData currency = null;
+ final BigDecimal interestRate = null;
+ final EnumOptionData interestRatePeriodFrequencyType = null;
+ final BigDecimal annualInterestRate = null;
+ final BigDecimal minRequiredOpeningBalance = null;
+ final Integer lockinPeriodFrequency = null;
+ final EnumOptionData lockinPeriodFrequencyType = null;
+ final Collection productOptions = null;
+ final Collection currencyOptions = null;
+ final Collection interestRatePeriodFrequencyTypeOptions = null;
+ final Collection lockinPeriodFrequencyTypeOptions = null;
+
+ return new SavingsAccountData(id, accountNo, externalId, groupId, groupName, clientId, clientName, productId, productName,
+ currency, interestRate, interestRatePeriodFrequencyType, annualInterestRate, minRequiredOpeningBalance,
+ lockinPeriodFrequency, lockinPeriodFrequencyType, productOptions, interestRatePeriodFrequencyTypeOptions,
+ lockinPeriodFrequencyTypeOptions);
+ }
+
+ private SavingsAccountData(final Long id, final String accountNo, final String externalId, final Long groupId, final String groupName,
+ final Long clientId, final String clientName, final Long productId, final String productName, final CurrencyData currency,
+ final BigDecimal interestRate, final EnumOptionData interestRatePeriodFrequencyType, final BigDecimal annualInterestRate,
+ final BigDecimal minRequiredOpeningBalance, final Integer lockinPeriodFrequency,
+ final EnumOptionData lockinPeriodFrequencyType, final Collection productOptions,
+ final Collection interestRatePeriodFrequencyTypeOptions,
+ final Collection lockinPeriodFrequencyTypeOptions) {
+ this.id = id;
+ this.accountNo = accountNo;
+ this.externalId = externalId;
+ this.groupId = groupId;
+ this.groupName = groupName;
+ this.clientId = clientId;
+ this.clientName = clientName;
+ this.savingsProductId = productId;
+ this.savingsProductName = productName;
+ this.currency = currency;
+ this.interestRate = interestRate;
+ this.interestRatePeriodFrequencyType = interestRatePeriodFrequencyType;
+ this.annualInterestRate = annualInterestRate;
+ this.minRequiredOpeningBalance = minRequiredOpeningBalance;
+ this.lockinPeriodFrequency = lockinPeriodFrequency;
+ this.lockinPeriodFrequencyType = lockinPeriodFrequencyType;
+
+ this.productOptions = productOptions;
+ this.interestRatePeriodFrequencyTypeOptions = interestRatePeriodFrequencyTypeOptions;
+ this.lockinPeriodFrequencyTypeOptions = lockinPeriodFrequencyTypeOptions;
+ }
+}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java
new file mode 100644
index 000000000..e6525ab33
--- /dev/null
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java
@@ -0,0 +1,244 @@
+package org.mifosplatform.portfolio.savings.data;
+
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.accountNoParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.clientIdParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.externalIdParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.groupIdParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.interestRateParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.interestRatePeriodFrequencyTypeParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.lockinPeriodFrequencyParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.lockinPeriodFrequencyTypeParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.minRequiredOpeningBalanceParamName;
+import static org.mifosplatform.portfolio.savings.api.SavingsApiConstants.productIdParamName;
+
+import java.lang.reflect.Type;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.mifosplatform.infrastructure.core.data.ApiParameterError;
+import org.mifosplatform.infrastructure.core.data.DataValidatorBuilder;
+import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
+import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
+import org.mifosplatform.infrastructure.core.serialization.FromJsonHelper;
+import org.mifosplatform.portfolio.savings.api.SavingsApiConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+
+@Component
+public class SavingsAccountDataValidator {
+
+ private final FromJsonHelper fromApiJsonHelper;
+
+ @Autowired
+ public SavingsAccountDataValidator(final FromJsonHelper fromApiJsonHelper) {
+ this.fromApiJsonHelper = fromApiJsonHelper;
+ }
+
+ public void validateForCreate(final String json) {
+
+ if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
+
+ final Type typeOfMap = new TypeToken