diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm
index c829ba5bf..9fe3f5f2b 100644
--- a/api-docs/apiLive.htm
+++ b/api-docs/apiLive.htm
@@ -1921,6 +1921,10 @@ Request Body:
|
Example Values: Same as repayment period, Daily |
+ | accountingType |
+ |
+ Example Values:NONE(1), CASH_BASED(2), ACCRUAL_BASED(3) |
+
@@ -1936,120 +1940,57 @@ Request Body:
GET https://Domain Name/api/v1/loanproducts
- [ {
- "id" : 1,
- "name" : "Agricultural Loan",
- "description" : "An agricultural loan given to farmers to help buy crop, stock and machinery. With an arrears tolerance setting of 1,000 CFA, loans are not marked as 'in arrears' or 'in bad standing' if the amount outstanding is less than this. Interest rate is described using monthly percentage rate (MPR) even though the loan typically lasts a year and requires one repayment (typically at time when farmer sells crop)",
- "principal" : {
- "currencyCode" : "XOF",
- "digitsAfterDecimal" : 0,
- "amount" : 100000,
- "defaultName" : "CFA Franc BCEAO",
- "nameCode" : "currency.XOF",
- "displaySymbol" : "CFA",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "100000 CFA"
- },
- "inArrearsTolerance" : {
- "currencyCode" : "XOF",
- "digitsAfterDecimal" : 0,
- "amount" : 1000,
- "defaultName" : "CFA Franc BCEAO",
- "nameCode" : "currency.XOF",
- "displaySymbol" : "CFA",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "1000 CFA"
- },
- "numberOfRepayments" : 1,
- "repaymentEvery" : 12,
- "interestRatePerPeriod" : 1.750000,
- "annualInterestRate" : 21.000000,
- "repaymentFrequencyType" : {
- "id" : 2,
- "code" : "repaymentFrequency.periodFrequencyType.months",
- "value" : "Months"
- },
- "interestRateFrequencyType" : {
- "id" : 2,
- "code" : "interestRateFrequency.periodFrequencyType.months",
- "value" : "Per month"
- },
- "amortizationType" : {
- "id" : 1,
- "code" : "amortizationType.equal.installments",
- "value" : "Equal installments"
- },
- "interestType" : {
- "id" : 0,
- "code" : "interestType.declining.balance",
- "value" : "Declining Balance"
- },
- "interestCalculationPeriodType" : {
- "id" : 1,
- "code" : "interestCalculationPeriodType.same.as.repayment.period",
- "value" : "Same as repayment period"
- },
- "createdOn" : 1334232874000,
- "lastModifedOn" : 1334232874000
-}, {
- "id" : 2,
- "name" : "Brunei Loan",
- "principal" : {
- "currencyCode" : "BND",
- "digitsAfterDecimal" : 2,
- "amount" : 76000.00,
- "defaultName" : "Brunei Dollar",
- "nameCode" : "currency.BND",
- "displaySymbol" : "BND",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "76000.00 BND"
- },
- "inArrearsTolerance" : {
- "currencyCode" : "BND",
- "digitsAfterDecimal" : 2,
- "amount" : 50.00,
- "defaultName" : "Brunei Dollar",
- "nameCode" : "currency.BND",
- "displaySymbol" : "BND",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "50.00 BND"
- },
- "numberOfRepayments" : 10,
- "repaymentEvery" : 1,
- "interestRatePerPeriod" : 6.000000,
- "annualInterestRate" : 72.000000,
- "repaymentFrequencyType" : {
- "id" : 1,
- "code" : "repaymentFrequency.periodFrequencyType.weeks",
- "value" : "Weeks"
- },
- "interestRateFrequencyType" : {
- "id" : 2,
- "code" : "interestRateFrequency.periodFrequencyType.months",
- "value" : "Per month"
- },
- "amortizationType" : {
- "id" : 1,
- "code" : "amortizationType.equal.installments",
- "value" : "Equal installments"
- },
- "interestType" : {
- "id" : 0,
- "code" : "interestType.declining.balance",
- "value" : "Declining Balance"
- },
- "interestCalculationPeriodType" : {
- "id" : 1,
- "code" : "interestCalculationPeriodType.same.as.repayment.period",
- "value" : "Same as repayment period"
- },
- "createdOn" : 1334513601000,
- "lastModifedOn" : 1334513601000
-}...]
+ [
+ {
+ "id": 1,
+ "name": "A new loan product for me",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "principal": 100000,
+ "numberOfRepayments": 12,
+ "loanTermFrequency": 12,
+ "repaymentEvery": 1,
+ "interestRatePerPeriod": 1.75,
+ "annualInterestRate": 21,
+ "accountingType": 1,
+ "loanTermFrequencyType": {
+ "id": 2,
+ "code": "loanTermFrequency.periodFrequencyType.months",
+ "value": "Months"
+ },
+ "repaymentFrequencyType": {
+ "id": 2,
+ "code": "repaymentFrequency.periodFrequencyType.months",
+ "value": "Months"
+ },
+ "interestRateFrequencyType": {
+ "id": 2,
+ "code": "interestRateFrequency.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ "amortizationType": {
+ "id": 0,
+ "code": "amortizationType.equal.principal",
+ "value": "Equal principle payments"
+ },
+ "interestType": {
+ "id": 0,
+ "code": "interestType.declining.balance",
+ "value": "Declining Balance"
+ },
+ "interestCalculationPeriodType": {
+ "id": 1,
+ "code": "interestCalculationPeriodType.same.as.repayment.period",
+ "value": "Same as repayment period"
+ }
+ }
+]
@@ -2070,147 +2011,164 @@ Request Body:
GET https://Domain Name/api/v1/loanproducts/template
{
- "principal" : {
- "currencyCode" : "KES",
- "digitsAfterDecimal" : 2,
- "amount" : 0.00,
- "defaultName" : "Kenyan Shilling",
- "nameCode" : "currency.KES",
- "displaySymbol" : "KSh",
- "zero" : true,
- "greaterThanZero" : false,
- "displaySymbolValue" : "0.00 KSh"
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
},
- "inArrearsTolerance" : {
- "currencyCode" : "KES",
- "digitsAfterDecimal" : 2,
- "amount" : 0.00,
- "defaultName" : "Kenyan Shilling",
- "nameCode" : "currency.KES",
- "displaySymbol" : "KSh",
- "zero" : true,
- "greaterThanZero" : false,
- "displaySymbolValue" : "0.00 KSh"
+ "accountingType": 1,
+ "loanTermFrequencyType": {
+ "id": 2,
+ "code": "loanTermFrequency.periodFrequencyType.months",
+ "value": "Months"
},
- "interestRatePerPeriod" : 0,
- "annualInterestRate" : 0,
- "repaymentFrequencyType" : {
- "id" : 2,
- "code" : "repaymentFrequency.periodFrequencyType.months",
- "value" : "Months"
+ "repaymentFrequencyType": {
+ "id": 2,
+ "code": "repaymentFrequency.periodFrequencyType.months",
+ "value": "Months"
},
- "interestRateFrequencyType" : {
- "id" : 2,
- "code" : "interestRateFrequency.periodFrequencyType.months",
- "value" : "Per month"
+ "interestRateFrequencyType": {
+ "id": 2,
+ "code": "interestRateFrequency.periodFrequencyType.months",
+ "value": "Per month"
},
- "amortizationType" : {
- "id" : 1,
- "code" : "amortizationType.equal.installments",
- "value" : "Equal installments"
+ "amortizationType": {
+ "id": 1,
+ "code": "amortizationType.equal.installments",
+ "value": "Equal installments"
},
- "interestType" : {
- "id" : 0,
- "code" : "interestType.declining.balance",
- "value" : "Declining Balance"
+ "interestType": {
+ "id": 0,
+ "code": "interestType.declining.balance",
+ "value": "Declining Balance"
},
- "interestCalculationPeriodType" : {
- "id" : 1,
- "code" : "interestCalculationPeriodType.same.as.repayment.period",
- "value" : "Same as repayment period"
+ "interestCalculationPeriodType": {
+ "id": 1,
+ "code": "interestCalculationPeriodType.same.as.repayment.period",
+ "value": "Same as repayment period"
},
- "currencyOptions" : [ {
- "code" : "KES",
- "name" : "Kenyan Shilling",
- "decimalPlaces" : 2,
- "displaySymbol" : "KSh",
- "nameCode" : "currency.KES",
- "displayLabel" : "Kenyan Shilling (KSh)"
- }, {
- "code" : "BND",
- "name" : "Brunei Dollar",
- "decimalPlaces" : 2,
- "displaySymbol" : "BND",
- "nameCode" : "currency.BND",
- "displayLabel" : "Brunei Dollar (BND)"
- }, {
- "code" : "LBP",
- "name" : "Lebanese Pound",
- "decimalPlaces" : 2,
- "displaySymbol" : "L£",
- "nameCode" : "currency.LBP",
- "displayLabel" : "Lebanese Pound (L£)"
- }, {
- "code" : "GHC",
- "name" : "Ghana Cedi",
- "decimalPlaces" : 2,
- "displaySymbol" : "GHC",
- "nameCode" : "currency.GHC",
- "displayLabel" : "Ghana Cedi (GHC)"
- }, {
- "code" : "USD",
- "name" : "US Dollar",
- "decimalPlaces" : 2,
- "displaySymbol" : "$",
- "nameCode" : "currency.USD",
- "displayLabel" : "US Dollar ($)"
- }, {
- "code" : "XOF",
- "name" : "CFA Franc BCEAO",
- "decimalPlaces" : 0,
- "displaySymbol" : "CFA",
- "nameCode" : "currency.XOF",
- "displayLabel" : "CFA Franc BCEAO (CFA)"
- } ],
- "amortizationTypeOptions" : [ {
- "id" : 1,
- "code" : "amortizationType.equal.installments",
- "value" : "Equal installments"
- }, {
- "id" : 0,
- "code" : "amortizationType.equal.principal",
- "value" : "Equal principle payments"
- } ],
- "interestTypeOptions" : [ {
- "id" : 1,
- "code" : "interestType.flat",
- "value" : "Flat"
- }, {
- "id" : 0,
- "code" : "interestType.declining.balance",
- "value" : "Declining Balance"
- } ],
- "interestCalculationPeriodTypeOptions" : [ {
- "id" : 0,
- "code" : "interestCalculationPeriodType.daily",
- "value" : "Daily"
- }, {
- "id" : 1,
- "code" : "interestCalculationPeriodType.same.as.repayment.period",
- "value" : "Same as repayment period"
- } ],
- "repaymentFrequencyTypeOptions" : [ {
- "id" : 0,
- "code" : "repaymentFrequency.periodFrequencyType.days",
- "value" : "Days"
- }, {
- "id" : 1,
- "code" : "repaymentFrequency.periodFrequencyType.weeks",
- "value" : "Weeks"
- }, {
- "id" : 2,
- "code" : "repaymentFrequency.periodFrequencyType.months",
- "value" : "Months"
- } ],
- "interestRateFrequencyTypeOptions" : [ {
- "id" : 2,
- "code" : "interestRateFrequency.periodFrequencyType.months",
- "value" : "Per month"
- }, {
- "id" : 3,
- "code" : "interestRateFrequency.periodFrequencyType.years",
- "value" : "Per year"
- } ]
+ "currencyOptions": [
+ {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ }
+ ],
+ "transactionProcessingStrategyOptions": [
+ {
+ "id": 1,
+ "code": "mifos-standard-strategy",
+ "name": "Mifos style"
+ },
+ {
+ "id": 2,
+ "code": "heavensfamily-strategy",
+ "name": "Heavensfamily"
+ },
+ {
+ "id": 3,
+ "code": "creocore-strategy",
+ "name": "Creocore"
+ },
+ {
+ "id": 4,
+ "code": "rbi-india-strategy",
+ "name": "RBI (India)"
+ }
+ ],
+ "amortizationTypeOptions": [
+ {
+ "id": 1,
+ "code": "amortizationType.equal.installments",
+ "value": "Equal installments"
+ },
+ {
+ "id": 0,
+ "code": "amortizationType.equal.principal",
+ "value": "Equal principle payments"
+ }
+ ],
+ "interestTypeOptions": [
+ {
+ "id": 1,
+ "code": "interestType.flat",
+ "value": "Flat"
+ },
+ {
+ "id": 0,
+ "code": "interestType.declining.balance",
+ "value": "Declining Balance"
+ }
+ ],
+ "interestCalculationPeriodTypeOptions": [
+ {
+ "id": 0,
+ "code": "interestCalculationPeriodType.daily",
+ "value": "Daily"
+ },
+ {
+ "id": 1,
+ "code": "interestCalculationPeriodType.same.as.repayment.period",
+ "value": "Same as repayment period"
+ }
+ ],
+ "repaymentFrequencyTypeOptions": [
+ {
+ "id": 0,
+ "code": "repaymentFrequency.periodFrequencyType.days",
+ "value": "Days"
+ },
+ {
+ "id": 1,
+ "code": "repaymentFrequency.periodFrequencyType.weeks",
+ "value": "Weeks"
+ },
+ {
+ "id": 2,
+ "code": "repaymentFrequency.periodFrequencyType.months",
+ "value": "Months"
+ }
+ ],
+ "interestRateFrequencyTypeOptions": [
+ {
+ "id": 2,
+ "code": "interestRateFrequency.periodFrequencyType.months",
+ "value": "Per month"
+ },
+ {
+ "id": 3,
+ "code": "interestRateFrequency.periodFrequencyType.years",
+ "value": "Per year"
+ }
+ ],
+ "loanTermFrequencyTypeOptions": [
+ {
+ "id": 0,
+ "code": "loanTermFrequency.periodFrequencyType.days",
+ "value": "Days"
+ },
+ {
+ "id": 1,
+ "code": "loanTermFrequency.periodFrequencyType.weeks",
+ "value": "Weeks"
+ },
+ {
+ "id": 2,
+ "code": "loanTermFrequency.periodFrequencyType.months",
+ "value": "Months"
+ },
+ {
+ "id": 3,
+ "code": "loanTermFrequency.periodFrequencyType.years",
+ "value": "Years"
+ }
+ ]
}
@@ -2230,62 +2188,54 @@ Request Body:
GET https://Domain Name/api/v1/loanproducts/{productId}
{
- "id" : 1,
- "name" : "Agricultural Loan",
- "description" : "An agricultural loan given to farmers to help buy crop, stock and machinery. With an arrears tolerance setting of 1,000 CFA, loans are not marked as 'in arrears' or 'in bad standing' if the amount outstanding is less than this. Interest rate is described using monthly percentage rate (MPR) even though the loan typically lasts a year and requires one repayment (typically at time when farmer sells crop)",
- "principal" : {
- "currencyCode" : "XOF",
- "digitsAfterDecimal" : 0,
- "amount" : 100000,
- "defaultName" : "CFA Franc BCEAO",
- "nameCode" : "currency.XOF",
- "displaySymbol" : "CFA",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "100000 CFA"
+ "id": 1,
+ "name": "A new loan product for me",
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
},
- "inArrearsTolerance" : {
- "currencyCode" : "XOF",
- "digitsAfterDecimal" : 0,
- "amount" : 1000,
- "defaultName" : "CFA Franc BCEAO",
- "nameCode" : "currency.XOF",
- "displaySymbol" : "CFA",
- "zero" : false,
- "greaterThanZero" : true,
- "displaySymbolValue" : "1000 CFA"
+ "principal": 100000,
+ "numberOfRepayments": 12,
+ "loanTermFrequency": 12,
+ "repaymentEvery": 1,
+ "interestRatePerPeriod": 1.75,
+ "annualInterestRate": 21,
+ "accountingType": 1,
+ "loanTermFrequencyType": {
+ "id": 2,
+ "code": "loanTermFrequency.periodFrequencyType.months",
+ "value": "Months"
},
- "numberOfRepayments" : 1,
- "repaymentEvery" : 12,
- "interestRatePerPeriod" : 1.750000,
- "annualInterestRate" : 21.000000,
- "repaymentFrequencyType" : {
- "id" : 2,
- "code" : "repaymentFrequency.periodFrequencyType.months",
- "value" : "Months"
+ "repaymentFrequencyType": {
+ "id": 2,
+ "code": "repaymentFrequency.periodFrequencyType.months",
+ "value": "Months"
},
- "interestRateFrequencyType" : {
- "id" : 2,
- "code" : "interestRateFrequency.periodFrequencyType.months",
- "value" : "Per month"
+ "interestRateFrequencyType": {
+ "id": 2,
+ "code": "interestRateFrequency.periodFrequencyType.months",
+ "value": "Per month"
},
- "amortizationType" : {
- "id" : 1,
- "code" : "amortizationType.equal.installments",
- "value" : "Equal installments"
+ "amortizationType": {
+ "id": 0,
+ "code": "amortizationType.equal.principal",
+ "value": "Equal principle payments"
},
- "interestType" : {
- "id" : 0,
- "code" : "interestType.declining.balance",
- "value" : "Declining Balance"
+ "interestType": {
+ "id": 0,
+ "code": "interestType.declining.balance",
+ "value": "Declining Balance"
},
- "interestCalculationPeriodType" : {
- "id" : 1,
- "code" : "interestCalculationPeriodType.same.as.repayment.period",
- "value" : "Same as repayment period"
+ "interestCalculationPeriodType": {
+ "id": 1,
+ "code": "interestCalculationPeriodType.same.as.repayment.period",
+ "value": "Same as repayment period"
},
- "createdOn" : 1334232874000,
- "lastModifedOn" : 1334232874000
+ "charges": []
}
@@ -2299,7 +2249,7 @@ Request Body:
Mandatory Fields |
| name, currencyCode, digitsAfterDecimal, principal, inArrearsTolerance, repaymentFrequencyType, repaymentEvery,
numberOfRepayments, interestRatePerPeriod, interestRateFrequencyType, amortizationType,
- interestType, interestCalculationPeriodType |
+ interestType, interestCalculationPeriodType, accountingType
@@ -2308,25 +2258,24 @@ Request Body:
Content-Type: application/json
Request Body:
{
- "name": "A new loan product for me",
- "description": "A description not exceeding 500 characters.",
- "currencyCode": "USD",
- "digitsAfterDecimal": "2",
- "locale": "en_GB",
- "principal": "100,000.00",
- "inArrearsTolerance": "1,000.00",
- "repaymentFrequencyType": 2,
- "repaymentEvery": "1",
- "numberOfRepayments": "12",
- "interestRatePerPeriod": "1.75",
- "interestRateFrequencyType": 2,
- "amortizationType": 1,
- "interestType": 0,
- "interestCalculationPeriodType": 1
+ "name": "A new loan product for me",
+ "currencyCode": "USD",
+ "locale": "en_GB",
+ "digitsAfterDecimal": "2",
+ "principal": "100,000.00",
+ "repaymentFrequencyType": 2,
+ "repaymentEvery": "1",
+ "numberOfRepayments": "12",
+ "interestRatePerPeriod": "1.75",
+ "interestRateFrequencyType": 2,
+ "amortizationType": 1,
+ "interestType": 0,
+ "interestCalculationPeriodType": 1,
+ "accountingType": 1
}
{
- "resourceId": 9
+ "resourceId": 1
}
@@ -2338,18 +2287,21 @@ Request Body:
Update a Loan Product
- POST https://Domain Name/api/v1/loanproducts/{loanId}
-POST loanproducts/1
+ PUT https://Domain Name/api/v1/loanproducts/{loanId}
+PUT loanproducts/1
Content-Type: application/json
Request Body:
{
"locale": "en_GB",
- "principal": "100,000.00",
- "inArrearsTolerance": "5,000.00"
+ "principal": "70,000.00"
}
{
- "resourceId": 1
+ "resourceId": 1,
+ "changes": {
+ "principal": 70000,
+ "locale": "en_GB"
+ }
}
diff --git a/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql b/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql
index d0fdfd78e..a7e00e104 100644
--- a/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql
+++ b/mifosng-db/0001a-mifosplatform-core-ddl-latest.sql
@@ -470,19 +470,11 @@ CREATE TABLE `m_product_loan` (
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`accounting_type` smallint(5) NOT NULL,
- `createdby_id` bigint(20) DEFAULT NULL,
- `created_date` datetime DEFAULT NULL,
- `lastmodified_date` datetime DEFAULT NULL,
- `lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
- KEY `FKAUD0000000000003` (`createdby_id`),
- KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
KEY `FKA6A8A7D77240145` (`fund_id`),
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
- CONSTRAINT `FKAUD0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
- CONSTRAINT `FKAUD0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
diff --git a/mifosng-db/multi-tenant-demo-backups/bare-bones-demo/bk_bare_bones_demo.sql b/mifosng-db/multi-tenant-demo-backups/bare-bones-demo/bk_bare_bones_demo.sql
index b770464f7..3c62eb9bd 100644
--- a/mifosng-db/multi-tenant-demo-backups/bare-bones-demo/bk_bare_bones_demo.sql
+++ b/mifosng-db/multi-tenant-demo-backups/bare-bones-demo/bk_bare_bones_demo.sql
@@ -429,19 +429,11 @@ CREATE TABLE `m_client` (
`display_name` varchar(100) NOT NULL,
`image_key` varchar(500) DEFAULT NULL,
`joined_date` date DEFAULT NULL,
- `createdby_id` bigint(20) DEFAULT NULL,
- `created_date` datetime DEFAULT NULL,
- `lastmodified_date` datetime DEFAULT NULL,
- `lastmodifiedby_id` bigint(20) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `account_no_UNIQUE` (`account_no`),
UNIQUE KEY `external_id` (`external_id`),
KEY `FKCE00CAB3E0DD567A` (`office_id`),
- KEY `FKAUD0000000000001` (`createdby_id`),
- KEY `FKAUD0000000000002` (`lastmodifiedby_id`),
- CONSTRAINT `FKAUD0000000000001` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
- CONSTRAINT `FKAUD0000000000002` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FKCE00CAB3E0DD567A` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -813,18 +805,10 @@ CREATE TABLE `m_group` (
`name` varchar(100) DEFAULT NULL,
`external_id` varchar(100) DEFAULT NULL,
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
- `createdby_id` bigint(20) DEFAULT NULL,
- `created_date` datetime DEFAULT NULL,
- `lastmodified_date` datetime DEFAULT NULL,
- `lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `external_id` (`external_id`),
- KEY `FKJPWG000000000003` (`createdby_id`),
- KEY `FKJPWG000000000004` (`lastmodifiedby_id`),
KEY `office_id` (`office_id`),
- CONSTRAINT `FKJPWG000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
- CONSTRAINT `FKJPWG000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `m_group_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -1471,19 +1455,11 @@ CREATE TABLE `m_product_loan` (
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`accounting_type` smallint(5) NOT NULL,
- `createdby_id` bigint(20) DEFAULT NULL,
- `created_date` datetime DEFAULT NULL,
- `lastmodified_date` datetime DEFAULT NULL,
- `lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
- KEY `FKAUD0000000000003` (`createdby_id`),
- KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
KEY `FKA6A8A7D77240145` (`fund_id`),
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
- CONSTRAINT `FKAUD0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
- CONSTRAINT `FKAUD0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -2058,4 +2034,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2013-01-29 12:54:03
+-- Dump completed on 2013-01-29 20:18:19
diff --git a/mifosng-db/multi-tenant-demo-backups/bk_mifostenant_default.sql b/mifosng-db/multi-tenant-demo-backups/bk_mifostenant_default.sql
index 818f7927e..9276d8e69 100644
--- a/mifosng-db/multi-tenant-demo-backups/bk_mifostenant_default.sql
+++ b/mifosng-db/multi-tenant-demo-backups/bk_mifostenant_default.sql
@@ -1475,19 +1475,11 @@ CREATE TABLE `m_product_loan` (
`number_of_repayments` smallint(5) NOT NULL,
`amortization_method_enum` smallint(5) NOT NULL,
`accounting_type` smallint(5) NOT NULL,
- `createdby_id` bigint(20) DEFAULT NULL,
- `created_date` datetime DEFAULT NULL,
- `lastmodified_date` datetime DEFAULT NULL,
- `lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
- KEY `FKAUD0000000000003` (`createdby_id`),
- KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
KEY `FKA6A8A7D77240145` (`fund_id`),
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
- CONSTRAINT `FKAUD0000000000003` FOREIGN KEY (`createdby_id`) REFERENCES `m_appuser` (`id`),
- CONSTRAINT `FKAUD0000000000004` FOREIGN KEY (`lastmodifiedby_id`) REFERENCES `m_appuser` (`id`),
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
@@ -1498,7 +1490,7 @@ CREATE TABLE `m_product_loan` (
LOCK TABLES `m_product_loan` WRITE;
/*!40000 ALTER TABLE `m_product_loan` DISABLE KEYS */;
-INSERT INTO `m_product_loan` VALUES (1,'HKD',2,'700000.000000',NULL,'PORetailLoan',NULL,4,'5.000000',2,'21.000000',0,1,1,2,120,1,1,1,'2012-04-12 22:14:34','2012-12-12 08:10:01',24,1),(2,'LBP',2,'35000.000000','10.000000','Different Loan Type',NULL,NULL,'1.000000',2,'12.000000',0,1,2,1,10,1,1,1,'2012-07-17 03:20:34','2012-07-17 03:20:34',1,1),(3,'BND',2,'5000.000000','10.000000','Further Loan Product',NULL,2,'1.500000',2,'18.000000',0,1,1,2,6,0,1,1,'2012-07-17 03:21:38','2012-07-17 03:21:38',1,1),(4,'MMK',0,'50000.000000','0.000000','General','General micro-loan',3,'1.250000',2,'36.000000',1,1,1,2,12,1,1,1,'2012-07-19 15:34:27','2012-07-19 17:13:59',1,1),(5,'MMK',0,'50000.000000','0.000000','Agricultural','Agricultural micro-loan',4,'1.250000',2,'36.000000',1,1,12,2,2,1,1,1,'2012-07-19 15:36:16','2012-07-19 17:14:15',1,1),(6,'MMK',2,'100.000000','10.000000','testloan','testloan from client app',4,'10.000000',2,'120.000000',0,1,1,2,10,0,1,1,'2012-08-01 07:35:46','2012-08-01 07:35:46',1,1),(7,'XOF',0,'500.000000','2000.000000','new-lp-test-1','test creating new lp',3,'2.000000',2,'24.000000',0,1,1,2,12,1,1,1,'2012-09-02 10:47:10','2012-09-02 10:47:20',1,NULL),(8,'GHC',2,'30000.000000','0.000000','another-test-lp','another test updated.',1,'2.000000',2,'24.000000',0,1,1,2,12,1,1,1,'2012-09-02 11:04:41','2012-09-02 11:08:24',1,NULL),(9,'XOF',0,'120000.000000','0.000000','loan product1','loan product1',1,'8.000000',2,'96.000000',0,1,3,2,1233,0,1,1,'2012-09-25 09:31:22','2012-09-25 09:31:22',1,NULL),(10,'BND',2,'120000.000000','0.000000','loan product1','loan product1',2,'8.000000',2,'96.000000',0,1,3,2,1233,0,1,1,'2012-09-25 09:31:22','2012-09-25 09:35:17',1,NULL),(11,'XOF',2,'3333333.000000','0.000000','Collection100','aaa',4,'30.000000',2,'360.000000',0,1,1,2,2,1,1,11,'2012-09-25 09:44:52','2012-09-25 09:44:52',11,NULL),(12,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1,'2012-11-02 22:37:14','2012-11-02 22:37:14',1,1),(13,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1,'2012-11-02 22:37:14','2012-11-02 22:37:14',1,1),(14,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1,'2012-11-02 22:37:14','2012-11-02 22:37:14',1,1),(15,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1,'2012-11-02 22:37:14','2012-11-02 22:37:14',1,1),(16,'HKD',2,'10000.000000','10.000000','PlusOne Education Loan','Education loan for higher studies',4,'8.000000',3,'18.000000',0,1,1,2,24,1,1,1,'2012-11-15 05:15:40','2012-12-12 07:32:41',1,NULL),(17,'KES',2,'100000.000000',NULL,'Intrasoft Business Loan','Individual Business Loan',4,'10.000000',2,'24.000000',1,1,1,2,1,1,1,1,'2012-12-07 11:03:57','2013-01-14 10:46:42',25,1),(18,'HKD',2,'1000000.000000',NULL,'POInstalmentLoan','Instalment Loan',4,'5.000000',3,'60.000000',0,1,1,2,120,1,1,1,'2012-12-12 07:30:32','2012-12-12 07:36:04',1,1);
+INSERT INTO `m_product_loan` VALUES (1,'HKD',2,'700000.000000',NULL,'PORetailLoan',NULL,4,'5.000000',2,'21.000000',0,1,1,2,120,1,1,1),(2,'LBP',2,'35000.000000','10.000000','Different Loan Type',NULL,NULL,'1.000000',2,'12.000000',0,1,2,1,10,1,1,1),(3,'BND',2,'5000.000000','10.000000','Further Loan Product',NULL,2,'1.500000',2,'18.000000',0,1,1,2,6,0,1,1),(4,'MMK',0,'50000.000000','0.000000','General','General micro-loan',3,'1.250000',2,'36.000000',1,1,1,2,12,1,1,1),(5,'MMK',0,'50000.000000','0.000000','Agricultural','Agricultural micro-loan',4,'1.250000',2,'36.000000',1,1,12,2,2,1,1,1),(6,'MMK',2,'100.000000','10.000000','testloan','testloan from client app',4,'10.000000',2,'120.000000',0,1,1,2,10,0,1,1),(7,'XOF',0,'500.000000','2000.000000','new-lp-test-1','test creating new lp',3,'2.000000',2,'24.000000',0,1,1,2,12,1,1,NULL),(8,'GHC',2,'30000.000000','0.000000','another-test-lp','another test updated.',1,'2.000000',2,'24.000000',0,1,1,2,12,1,1,NULL),(9,'XOF',0,'120000.000000','0.000000','loan product1','loan product1',1,'8.000000',2,'96.000000',0,1,3,2,1233,0,1,NULL),(10,'BND',2,'120000.000000','0.000000','loan product1','loan product1',2,'8.000000',2,'96.000000',0,1,3,2,1233,0,1,NULL),(11,'XOF',2,'3333333.000000','0.000000','Collection100','aaa',4,'30.000000',2,'360.000000',0,1,1,2,2,1,1,NULL),(12,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1),(13,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1),(14,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1),(15,'INR',2,'10000.000000',NULL,'A Flat Loan',NULL,3,'10.000000',3,'10.000000',1,1,1,2,10,1,1,1),(16,'HKD',2,'10000.000000','10.000000','PlusOne Education Loan','Education loan for higher studies',4,'8.000000',3,'18.000000',0,1,1,2,24,1,1,NULL),(17,'KES',2,'100000.000000',NULL,'Intrasoft Business Loan','Individual Business Loan',4,'10.000000',2,'24.000000',1,1,1,2,1,1,1,1),(18,'HKD',2,'1000000.000000',NULL,'POInstalmentLoan','Instalment Loan',4,'5.000000',3,'60.000000',0,1,1,2,120,1,1,1);
/*!40000 ALTER TABLE `m_product_loan` ENABLE KEYS */;
UNLOCK TABLES;
@@ -2071,4 +2063,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
--- Dump completed on 2013-01-29 12:55:44
+-- Dump completed on 2013-01-29 20:20:02
diff --git a/mifosng-db/patches/08-drop-audit-columns-of-products.sql b/mifosng-db/patches/08-drop-audit-columns-of-products.sql
new file mode 100644
index 000000000..9966266c8
--- /dev/null
+++ b/mifosng-db/patches/08-drop-audit-columns-of-products.sql
@@ -0,0 +1,11 @@
+ALTER TABLE `m_product_loan`
+DROP FOREIGN KEY `FKAUD0000000000004` ,
+DROP FOREIGN KEY `FKAUD0000000000003` ;
+
+ALTER TABLE `m_product_loan`
+DROP COLUMN `lastmodifiedby_id` ,
+DROP COLUMN `lastmodified_date` ,
+DROP COLUMN `created_date` ,
+DROP COLUMN `createdby_id` ,
+DROP INDEX `FKAUD0000000000004`,
+DROP INDEX `FKAUD0000000000003`;
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java
index 69f4c439a..d66240a85 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java
@@ -34,10 +34,11 @@ import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
import org.mifosplatform.organisation.office.data.OfficeLookup;
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
+import org.mifosplatform.portfolio.client.command.ClientCommand;
import org.mifosplatform.portfolio.client.data.ClientAccountSummaryCollectionData;
import org.mifosplatform.portfolio.client.data.ClientData;
+import org.mifosplatform.portfolio.client.serialization.ClientCommandFromApiJsonDeserializer;
import org.mifosplatform.portfolio.client.service.ClientReadPlatformService;
-import org.mifosplatform.portfolio.savingsaccount.PortfolioApiDataConversionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
@@ -47,8 +48,9 @@ import org.springframework.stereotype.Component;
@Scope("singleton")
public class ClientsApiResource {
- private final Set CLIENT_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "accountNo", "officeId", "officeName", "externalId",
- "firstname", "middlename", "lastname", "fullname", "joinedDate", "displayName", "clientOrBusinessName", "allowedOffices", "imagePresent"));
+ private final Set CLIENT_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "accountNo", "officeId", "officeName",
+ "externalId", "firstname", "middlename", "lastname", "fullname", "joinedDate", "displayName", "clientOrBusinessName",
+ "allowedOffices", "imagePresent"));
private final PlatformSecurityContext context;
private final ClientReadPlatformService clientReadPlatformService;
@@ -56,24 +58,25 @@ public class ClientsApiResource {
private final ToApiJsonSerializer toApiJsonSerializer;
private final ToApiJsonSerializer clientAccountSummaryToApiJsonSerializer;
private final ApiRequestParameterHelper apiRequestParameterHelper;
- private final PortfolioApiDataConversionService apiDataConversionService;
private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService;
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ private final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer;
@Autowired
public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
final OfficeReadPlatformService officeReadPlatformService, final ToApiJsonSerializer toApiJsonSerializer,
+ final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer,
final ToApiJsonSerializer clientAccountSummaryToApiJsonSerializer,
- final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioApiDataConversionService apiDataConversionService,
+ final ApiRequestParameterHelper apiRequestParameterHelper,
final PortfolioCommandsReadPlatformService commandsReadPlatformService,
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
this.context = context;
this.clientReadPlatformService = readPlatformService;
this.officeReadPlatformService = officeReadPlatformService;
this.toApiJsonSerializer = toApiJsonSerializer;
+ this.clientCommandFromApiJsonDeserializer = clientCommandFromApiJsonDeserializer;
this.clientAccountSummaryToApiJsonSerializer = clientAccountSummaryToApiJsonSerializer;
this.apiRequestParameterHelper = apiRequestParameterHelper;
- this.apiDataConversionService = apiDataConversionService;
this.commandSourceReadPlatformService = commandsReadPlatformService;
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
}
@@ -173,7 +176,10 @@ public class ClientsApiResource {
private ClientData handleRequestToIntegrateProposedChangesFromCommand(final Long clientId, final Long commandId,
final ClientData clientData) {
final CommandSourceData entry = this.commandSourceReadPlatformService.retrieveById(commandId);
- final ClientData currentChange = this.apiDataConversionService.convertInternalJsonFormatToClientDataChange(clientId, entry.json());
+
+ final ClientCommand command = this.clientCommandFromApiJsonDeserializer.commandFromApiJson(entry.json());
+ final ClientData currentChange = ClientData.dataChangeInstance(clientId, command.getOfficeId(), command.getExternalId(),
+ command.getFirstname(), command.getMiddlename(), command.getLastname(), command.getFullname(), command.getJoiningDate());
final Collection dataChanges = null; // retrieveAllUnprocessedDataChanges(clientId);
return ClientData.integrateChanges(clientData, currentChange, dataChanges);
@@ -185,8 +191,10 @@ public class ClientsApiResource {
Collection unprocessedChanges = this.commandSourceReadPlatformService.retrieveUnprocessChangesByEntityNameAndId(
"CLIENT", clientId);
for (CommandSourceData commandSourceData : unprocessedChanges) {
- ClientData change = this.apiDataConversionService.convertInternalJsonFormatToClientDataChange(clientId,
- commandSourceData.json());
+ final ClientCommand command = this.clientCommandFromApiJsonDeserializer.commandFromApiJson(commandSourceData.json());
+ final ClientData change = ClientData
+ .dataChangeInstance(clientId, command.getOfficeId(), command.getExternalId(), command.getFirstname(),
+ command.getMiddlename(), command.getLastname(), command.getFullname(), command.getJoiningDate());
dataChanges.add(change);
}
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java
index e4baf343b..0eeca66b4 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java
@@ -176,6 +176,9 @@ public class LoanProductsApiResource {
final boolean feeChargesOnly = true;
Collection chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
chargeOptions.removeAll(productData.charges());
+ if (chargeOptions.isEmpty()) {
+ chargeOptions = null;
+ }
final Collection currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
final List amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
@@ -187,14 +190,26 @@ public class LoanProductsApiResource {
final List interestRateFrequencyTypeOptions = dropdownReadPlatformService
.retrieveInterestRateFrequencyTypeOptions();
- final Collection fundOptions = this.fundReadPlatformService.retrieveAllFunds();
+ Collection fundOptions = this.fundReadPlatformService.retrieveAllFunds();
+ if (fundOptions.isEmpty()) {
+ fundOptions = null;
+ }
final Collection transactionProcessingStrategyOptions = this.dropdownReadPlatformService
.retreiveTransactionProcessingStrategies();
- final List assetAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
- final List incomeAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.INCOME);;
- final List expenseAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.EXPENSE);;
-
+ List assetAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
+ if (assetAccountOptions.isEmpty()) {
+ assetAccountOptions = null;
+ }
+ List incomeAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.INCOME);
+ if (incomeAccountOptions.isEmpty()) {
+ incomeAccountOptions = null;
+ }
+ List expenseAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.EXPENSE);
+ if (expenseAccountOptions.isEmpty()) {
+ expenseAccountOptions = null;
+ }
+
return new LoanProductData(productData, chargeOptions, currencyOptions, amortizationTypeOptions, interestTypeOptions,
interestCalculationPeriodTypeOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
interestRateFrequencyTypeOptions, fundOptions, transactionProcessingStrategyOptions,
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java
index d54e02331..ce3d29d3c 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java
@@ -5,7 +5,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.joda.time.DateTime;
import org.mifosplatform.accounting.api.data.GLAccountData;
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
import org.mifosplatform.organisation.monetary.data.CurrencyData;
@@ -52,9 +51,6 @@ public class LoanProductData {
private final Collection charges;
- private final DateTime createdOn;
- private final DateTime lastModifedOn;
-
private final Collection currencyOptions;
private final Collection fundOptions;
private final Collection transactionProcessingStrategyOptions;
@@ -87,8 +83,6 @@ public class LoanProductData {
* Used when returning lookup information about loan product for dropdowns.
*/
public static LoanProductData lookup(final Long id, final String name) {
- final DateTime createdOn = null;
- final DateTime lastModifedOn = null;
final String description = null;
final CurrencyData currency = null;
final BigDecimal principal = null;
@@ -111,16 +105,13 @@ public class LoanProductData {
final Collection charges = null;
final Integer accountingType = null;
- return new LoanProductData(createdOn, lastModifedOn, id, name, description, currency, principal, tolerance, numberOfRepayments,
- loanTermFrequency, repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType,
- repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId,
- fundName, transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
+ return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
+ repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
+ interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
+ transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
}
public static LoanProductData sensibleDefaultsForNewLoanProductCreation() {
-
- final DateTime createdOn = null;
- final DateTime lastModifedOn = null;
final Long id = null;
final String name = null;
final String description = null;
@@ -146,22 +137,20 @@ public class LoanProductData {
final Collection charges = null;
final Integer accountingType = 1;
- return new LoanProductData(createdOn, lastModifedOn, id, name, description, currency, principal, tolerance, numberOfRepayments,
- loanTermFrequency, repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType,
- repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId,
- fundName, transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
+ return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
+ repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
+ interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
+ transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
}
- public LoanProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String name,
- final String description, final CurrencyData currency, final BigDecimal principal, final BigDecimal tolerance,
- final Integer numberOfRepayments, final Integer loanTermFrequency, final Integer repaymentEvery,
- final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate, final EnumOptionData loanTermFrequencyType,
- final EnumOptionData repaymentFrequencyType, final EnumOptionData interestRateFrequencyType,
- final EnumOptionData amortizationType, final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
- final Long fundId, final String fundName, final Long transactionProcessingStrategyId,
- final String transactionProcessingStrategyName, final Collection charges, final Integer accountingType) {
- this.createdOn = createdOn;
- this.lastModifedOn = lastModifedOn;
+ public LoanProductData(final Long id, final String name, final String description, final CurrencyData currency,
+ final BigDecimal principal, final BigDecimal tolerance, final Integer numberOfRepayments, final Integer loanTermFrequency,
+ final Integer repaymentEvery, final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate,
+ final EnumOptionData loanTermFrequencyType, final EnumOptionData repaymentFrequencyType,
+ final EnumOptionData interestRateFrequencyType, final EnumOptionData amortizationType, final EnumOptionData interestType,
+ final EnumOptionData interestCalculationPeriodType, final Long fundId, final String fundName,
+ final Long transactionProcessingStrategyId, final String transactionProcessingStrategyName,
+ final Collection charges, final Integer accountingType) {
this.id = id;
this.name = name;
this.description = description;
@@ -210,8 +199,6 @@ public class LoanProductData {
final Collection transactionProcessingStrategyOptions,
final List assetAccountOptions, final List incomeAccountOptions,
final List expenseAccountOptions) {
- this.createdOn = productData.createdOn;
- this.lastModifedOn = productData.lastModifedOn;
this.id = productData.id;
this.name = productData.name;
this.description = productData.description;
@@ -232,7 +219,7 @@ public class LoanProductData {
this.fundName = productData.fundName;
this.transactionProcessingStrategyId = productData.transactionProcessingStrategyId;
this.transactionProcessingStrategyName = productData.transactionProcessingStrategyName;
- this.charges = productData.charges();
+ this.charges = nullIfEmpty(productData.charges());
this.accountingType = productData.accountingType;
this.chargeOptions = chargeOptions;
@@ -256,6 +243,14 @@ public class LoanProductData {
this.expenseAccountOptions = expenseAccountOptions;
}
+ private Collection nullIfEmpty(final Collection charges) {
+ Collection chargesLocal = charges;
+ if (charges == null || charges.isEmpty()) {
+ chargesLocal = null;
+ }
+ return chargesLocal;
+ }
+
public Collection charges() {
Collection chargesLocal = new ArrayList();
if (this.charges != null) {
@@ -348,14 +343,6 @@ public class LoanProductData {
return interestCalculationPeriodType;
}
- public DateTime getCreatedOn() {
- return createdOn;
- }
-
- public DateTime getLastModifedOn() {
- return lastModifedOn;
- }
-
public Collection getFundOptions() {
return fundOptions;
}
@@ -479,5 +466,4 @@ public class LoanProductData {
public Integer getAccountingType() {
return this.accountingType;
}
-
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
index ef0f5d067..0d121eac1 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java
@@ -17,12 +17,11 @@ import javax.persistence.Table;
import org.apache.commons.lang.StringUtils;
import org.mifosplatform.infrastructure.core.api.JsonCommand;
-import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
import org.mifosplatform.portfolio.charge.domain.Charge;
import org.mifosplatform.portfolio.fund.domain.Fund;
import org.mifosplatform.portfolio.loanaccount.loanschedule.domain.AprCalculator;
-import org.mifosplatform.useradministration.domain.AppUser;
+import org.springframework.data.jpa.domain.AbstractPersistable;
/**
* Loan products allow for categorisation of an organisations loans into
@@ -35,7 +34,7 @@ import org.mifosplatform.useradministration.domain.AppUser;
*/
@Entity
@Table(name = "m_product_loan")
-public class LoanProduct extends AbstractAuditableCustom {
+public class LoanProduct extends AbstractPersistable {
@ManyToOne
@JoinColumn(name = "fund_id", nullable = true)
@@ -220,12 +219,12 @@ public class LoanProduct extends AbstractAuditableCustom {
public boolean isAccountingEnabled() {
return !AccountingRuleType.NONE.getValue().equals(this.accountingType);
}
-
- public boolean isCashBasedAccountingEnabled(){
+
+ public boolean isCashBasedAccountingEnabled() {
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingType);
}
-
- public boolean isAccrualBasedAccountingEnabled(){
+
+ public boolean isAccrualBasedAccountingEnabled() {
return AccountingRuleType.ACCRUAL_BASED.getValue().equals(this.accountingType);
}
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
index 0c54bc210..d43e3d4f3 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java
@@ -5,7 +5,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Collection;
-import org.joda.time.DateTime;
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
@@ -24,168 +23,156 @@ import org.springframework.stereotype.Service;
@Service
public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatformService {
- private final PlatformSecurityContext context;
- private final JdbcTemplate jdbcTemplate;
+ private final PlatformSecurityContext context;
+ private final JdbcTemplate jdbcTemplate;
private final ChargeReadPlatformService chargeReadPlatformService;
- @Autowired
- public LoanProductReadPlatformServiceImpl(
- final PlatformSecurityContext context,
- final ChargeReadPlatformService chargeReadPlatformService,
- final TenantAwareRoutingDataSource dataSource) {
- this.context = context;
+ @Autowired
+ public LoanProductReadPlatformServiceImpl(final PlatformSecurityContext context,
+ final ChargeReadPlatformService chargeReadPlatformService, final TenantAwareRoutingDataSource dataSource) {
+ this.context = context;
this.chargeReadPlatformService = chargeReadPlatformService;
- this.jdbcTemplate = new JdbcTemplate(dataSource);
- }
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
+ }
- @Override
- public LoanProductData retrieveLoanProduct(final Long loanProductId) {
+ @Override
+ public LoanProductData retrieveLoanProduct(final Long loanProductId) {
- try {
- final Collection charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId);
-
- final LoanProductMapper rm = new LoanProductMapper(charges);
- final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
+ try {
+ final Collection charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId);
-
- return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
-
- } catch (EmptyResultDataAccessException e) {
- throw new LoanProductNotFoundException(loanProductId);
- }
- }
+ final LoanProductMapper rm = new LoanProductMapper(charges);
+ final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
- @Override
- public Collection retrieveAllLoanProducts() {
+ return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
- this.context.authenticatedUser();
+ } catch (EmptyResultDataAccessException e) {
+ throw new LoanProductNotFoundException(loanProductId);
+ }
+ }
- final LoanProductMapper rm = new LoanProductMapper(null);
+ @Override
+ public Collection retrieveAllLoanProducts() {
- final String sql = "select " + rm.loanProductSchema();
+ this.context.authenticatedUser();
- return this.jdbcTemplate.query(sql, rm, new Object[] {});
- }
+ final LoanProductMapper rm = new LoanProductMapper(null);
- @Override
- public Collection retrieveAllLoanProductsForLookup() {
+ final String sql = "select " + rm.loanProductSchema();
- this.context.authenticatedUser();
+ return this.jdbcTemplate.query(sql, rm, new Object[] {});
+ }
- final LoanProductLookupMapper rm = new LoanProductLookupMapper();
+ @Override
+ public Collection retrieveAllLoanProductsForLookup() {
- final String sql = "select " + rm.loanProductLookupSchema();
+ this.context.authenticatedUser();
- return this.jdbcTemplate.query(sql, rm, new Object[] {});
- }
+ final LoanProductLookupMapper rm = new LoanProductLookupMapper();
- @Override
- public LoanProductData retrieveNewLoanProductDetails() {
- return LoanProductData.sensibleDefaultsForNewLoanProductCreation();
- }
+ final String sql = "select " + rm.schema();
- private static final class LoanProductMapper implements
- RowMapper {
+ return this.jdbcTemplate.query(sql, rm, new Object[] {});
+ }
- private final Collection charges;
+ @Override
+ public LoanProductData retrieveNewLoanProductDetails() {
+ return LoanProductData.sensibleDefaultsForNewLoanProductCreation();
+ }
- public LoanProductMapper(final Collection charges) {
- this.charges = charges;
- }
+ private static final class LoanProductMapper implements RowMapper {
- public String loanProductSchema() {
- return "lp.id as id, lp.fund_id as fundId, f.name as fundName, lp.loan_transaction_strategy_id as transactionStrategyId, ltps.name as transactionStrategyName, "
- + "lp.name as name, lp.description as description, "
- + "lp.principal_amount as principal, lp.currency_code as currencyCode, lp.currency_digits as currencyDigits, "
- + "lp.nominal_interest_rate_per_period as interestRatePerPeriod, lp.interest_period_frequency_enum as interestRatePerPeriodFreq, "
- + "lp.annual_nominal_interest_rate as annualInterestRate, lp.interest_method_enum as interestMethod, lp.interest_calculated_in_period_enum as interestCalculationInPeriodMethod,"
- + "lp.repay_every as repaidEvery, lp.repayment_period_frequency_enum as repaymentPeriodFrequency, lp.number_of_repayments as numberOfRepayments, "
- + "lp.amortization_method_enum as amortizationMethod, lp.arrearstolerance_amount as tolerance, "
- + "lp.created_date as createdon, lp.lastmodified_date as modifiedon, lp.accounting_type as accountingType, "
- + "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol "
- + " from m_product_loan lp "
- + " left join m_fund f on f.id = lp.fund_id"
- + " left join ref_loan_transaction_processing_strategy ltps on ltps.id = lp.loan_transaction_strategy_id"
- + " join m_currency curr on curr.code = lp.currency_code";
- }
+ private final Collection charges;
- @Override
- public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
- throws SQLException {
+ public LoanProductMapper(final Collection charges) {
+ this.charges = charges;
+ }
- final Long id = rs.getLong("id");
- final String name = rs.getString("name");
- final String description = rs.getString("description");
- final Long fundId = JdbcSupport.getLong(rs, "fundId");
- final String fundName = rs.getString("fundName");
- final Long transactionStrategyId = JdbcSupport.getLong(rs, "transactionStrategyId");
- final String transactionStrategyName = rs.getString("transactionStrategyName");
+ public String loanProductSchema() {
+ return "lp.id as id, lp.fund_id as fundId, f.name as fundName, lp.loan_transaction_strategy_id as transactionStrategyId, ltps.name as transactionStrategyName, "
+ + "lp.name as name, lp.description as description, "
+ + "lp.principal_amount as principal, lp.currency_code as currencyCode, lp.currency_digits as currencyDigits, "
+ + "lp.nominal_interest_rate_per_period as interestRatePerPeriod, lp.interest_period_frequency_enum as interestRatePerPeriodFreq, "
+ + "lp.annual_nominal_interest_rate as annualInterestRate, lp.interest_method_enum as interestMethod, lp.interest_calculated_in_period_enum as interestCalculationInPeriodMethod,"
+ + "lp.repay_every as repaidEvery, lp.repayment_period_frequency_enum as repaymentPeriodFrequency, lp.number_of_repayments as numberOfRepayments, "
+ + "lp.amortization_method_enum as amortizationMethod, lp.arrearstolerance_amount as tolerance, "
+ + "lp.accounting_type as accountingType, "
+ + "curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, curr.display_symbol as currencyDisplaySymbol "
+ + " from m_product_loan lp "
+ + " left join m_fund f on f.id = lp.fund_id"
+ + " left join ref_loan_transaction_processing_strategy ltps on ltps.id = lp.loan_transaction_strategy_id"
+ + " join m_currency curr on curr.code = lp.currency_code";
+ }
- final String currencyCode = rs.getString("currencyCode");
- final String currencyName = rs.getString("currencyName");
- final String currencyNameCode = rs.getString("currencyNameCode");
- final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
- final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
+ @Override
+ public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
- final CurrencyData currency = new CurrencyData(currencyCode,
- currencyName, currencyDigits, currencyDisplaySymbol,
- currencyNameCode);
+ final Long id = rs.getLong("id");
+ final String name = rs.getString("name");
+ final String description = rs.getString("description");
+ final Long fundId = JdbcSupport.getLong(rs, "fundId");
+ final String fundName = rs.getString("fundName");
+ final Long transactionStrategyId = JdbcSupport.getLong(rs, "transactionStrategyId");
+ final String transactionStrategyName = rs.getString("transactionStrategyName");
- final BigDecimal principal = rs.getBigDecimal("principal");
- final BigDecimal tolerance = rs.getBigDecimal("tolerance");
+ final String currencyCode = rs.getString("currencyCode");
+ final String currencyName = rs.getString("currencyName");
+ final String currencyNameCode = rs.getString("currencyNameCode");
+ final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
+ final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
- final Integer numberOfRepayments = JdbcSupport.getInteger(rs,"numberOfRepayments");
- final Integer repaymentEvery = JdbcSupport.getInteger(rs, "repaidEvery");
- final Integer accountingType = JdbcSupport.getInteger(rs, "accountingType");
- final Integer loanTermFrequency = repaymentEvery * numberOfRepayments;
- final BigDecimal interestRatePerPeriod = rs.getBigDecimal("interestRatePerPeriod");
- final BigDecimal annualInterestRate = rs.getBigDecimal("annualInterestRate");
+ final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
+ currencyNameCode);
- final int repaymentFrequencyTypeId = JdbcSupport.getInteger(rs, "repaymentPeriodFrequency");
- final EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeId);
-
- final EnumOptionData loanTermFrequencyType = LoanEnumerations.loanTermFrequencyType(repaymentFrequencyTypeId);
+ final BigDecimal principal = rs.getBigDecimal("principal");
+ final BigDecimal tolerance = rs.getBigDecimal("tolerance");
- final int amortizationTypeId = JdbcSupport.getInteger(rs, "amortizationMethod");
- final EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeId);
+ final Integer numberOfRepayments = JdbcSupport.getInteger(rs, "numberOfRepayments");
+ final Integer repaymentEvery = JdbcSupport.getInteger(rs, "repaidEvery");
+ final Integer accountingType = JdbcSupport.getInteger(rs, "accountingType");
+ final Integer loanTermFrequency = repaymentEvery * numberOfRepayments;
+ final BigDecimal interestRatePerPeriod = rs.getBigDecimal("interestRatePerPeriod");
+ final BigDecimal annualInterestRate = rs.getBigDecimal("annualInterestRate");
- final int interestRateFrequencyTypeId = JdbcSupport.getInteger(rs,"interestRatePerPeriodFreq");
- final EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeId);
+ final int repaymentFrequencyTypeId = JdbcSupport.getInteger(rs, "repaymentPeriodFrequency");
+ final EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeId);
- final int interestTypeId = JdbcSupport.getInteger(rs, "interestMethod");
- final EnumOptionData interestType = LoanEnumerations.interestType(interestTypeId);
+ final EnumOptionData loanTermFrequencyType = LoanEnumerations.loanTermFrequencyType(repaymentFrequencyTypeId);
- final int interestCalculationPeriodTypeId = JdbcSupport.getInteger(rs,"interestCalculationInPeriodMethod");
- final EnumOptionData interestCalculationPeriodType = LoanEnumerations.interestCalculationPeriodType(interestCalculationPeriodTypeId);
+ final int amortizationTypeId = JdbcSupport.getInteger(rs, "amortizationMethod");
+ final EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeId);
- final DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
- final DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
+ final int interestRateFrequencyTypeId = JdbcSupport.getInteger(rs, "interestRatePerPeriodFreq");
+ final EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeId);
- return new LoanProductData(createdOn, lastModifedOn, id, name,
- description, currency, principal, tolerance,
- numberOfRepayments, loanTermFrequency, repaymentEvery, interestRatePerPeriod,
- annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
- interestRateFrequencyType, amortizationType, interestType,
- interestCalculationPeriodType, fundId, fundName, transactionStrategyId, transactionStrategyName, this.charges, accountingType);
- }
+ final int interestTypeId = JdbcSupport.getInteger(rs, "interestMethod");
+ final EnumOptionData interestType = LoanEnumerations.interestType(interestTypeId);
- }
+ final int interestCalculationPeriodTypeId = JdbcSupport.getInteger(rs, "interestCalculationInPeriodMethod");
+ final EnumOptionData interestCalculationPeriodType = LoanEnumerations
+ .interestCalculationPeriodType(interestCalculationPeriodTypeId);
- private static final class LoanProductLookupMapper implements
- RowMapper {
+ return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
+ repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
+ interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
+ transactionStrategyId, transactionStrategyName, this.charges, accountingType);
+ }
- public String loanProductLookupSchema() {
- return "lp.id as id, lp.name as name from m_product_loan lp";
- }
+ }
- @Override
- public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
- throws SQLException {
+ private static final class LoanProductLookupMapper implements RowMapper {
- final Long id = rs.getLong("id");
- final String name = rs.getString("name");
+ public String schema() {
+ return "lp.id as id, lp.name as name from m_product_loan lp";
+ }
- return LoanProductData.lookup(id, name);
- }
- }
+ @Override
+ public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
+
+ final Long id = rs.getLong("id");
+ final String name = rs.getString("name");
+
+ return LoanProductData.lookup(id, name);
+ }
+ }
}
\ No newline at end of file
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionService.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionService.java
index d56512144..95f3b346b 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionService.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionService.java
@@ -1,6 +1,5 @@
package org.mifosplatform.portfolio.savingsaccount;
-import org.mifosplatform.portfolio.client.data.ClientData;
import org.mifosplatform.portfolio.group.command.GroupCommand;
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
@@ -21,8 +20,6 @@ public interface PortfolioApiDataConversionService {
DepositProductCommand convertJsonToDepositProductCommand(Long resourceIdentifier, String json);
- ClientData convertInternalJsonFormatToClientDataChange(Long clientId, String json);
-
GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json);
DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json);
diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionServiceImpl.java
index 4a90d8880..bc3cad18c 100644
--- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionServiceImpl.java
+++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savingsaccount/PortfolioApiDataConversionServiceImpl.java
@@ -21,9 +21,6 @@ import org.mifosplatform.infrastructure.core.data.ApiParameterError;
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException;
-import org.mifosplatform.portfolio.client.command.ClientCommand;
-import org.mifosplatform.portfolio.client.data.ClientData;
-import org.mifosplatform.portfolio.client.serialization.ClientCommandFromApiJsonDeserializer;
import org.mifosplatform.portfolio.group.command.GroupCommand;
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
@@ -37,7 +34,6 @@ import org.mifosplatform.portfolio.savingsdepositaccount.command.DepositAccountW
import org.mifosplatform.portfolio.savingsdepositaccount.command.DepositStateTransitionApprovalCommand;
import org.mifosplatform.portfolio.savingsdepositaccount.command.DepositStateTransitionCommand;
import org.mifosplatform.portfolio.savingsdepositproduct.command.DepositProductCommand;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.number.NumberFormatter;
import org.springframework.stereotype.Service;
@@ -56,23 +52,10 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
*/
private final Gson gsonConverter;
- private final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer;
-
- @Autowired
- public PortfolioApiDataConversionServiceImpl(final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer) {
- this.clientCommandFromApiJsonDeserializer = clientCommandFromApiJsonDeserializer;
+ public PortfolioApiDataConversionServiceImpl() {
this.gsonConverter = new Gson();
}
- @Override
- public ClientData convertInternalJsonFormatToClientDataChange(final Long resourceIdentifier, final String json) {
-
- final ClientCommand command = this.clientCommandFromApiJsonDeserializer.commandFromApiJson(json);
-
- return ClientData.dataChangeInstance(resourceIdentifier, command.getOfficeId(), command.getExternalId(), command.getFirstname(),
- command.getMiddlename(), command.getLastname(), command.getFullname(), command.getJoiningDate());
- }
-
@Override
public GroupCommand convertJsonToGroupCommand(final Long resourceIdentifier, final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
@@ -815,9 +798,9 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
// currencyCode, currencyDigits
Set supportedParams = new HashSet(Arrays.asList("clientId", "productId", "externalId", "currencyCode",
"digitsAfterDecimal", "savingsDepositAmountPerPeriod", "recurringInterestRate", "savingInterestRate", "tenure",
- "commencementDate", "locale", "dateFormat", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType",
- "tenureType", "depositfrequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal",
- "isPartialDepositAllowed", "depositEvery","interestPostEvery","interestPostFrequency"));
+ "commencementDate", "locale", "dateFormat", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "tenureType",
+ "depositfrequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed",
+ "depositEvery", "interestPostEvery", "interestPostFrequency"));
checkForUnsupportedParameters(requestMap, supportedParams);
Set modifiedParameters = new HashSet();
@@ -843,21 +826,20 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
BigDecimal minimumBalanceForWithdrawal = extractBigDecimalParameter("minimumBalanceForWithdrawal", requestMap, modifiedParameters);
boolean isPartialDepositAllowed = extractBooleanParameter("isPartialDepositAllowed", requestMap, modifiedParameters);
Integer depositEvery = extractIntegerParameter("depositEvery", requestMap, modifiedParameters);
-
+
Integer interestPostEvery = extractIntegerParameter("interestPostEvery", requestMap, modifiedParameters);
Integer interestPostFrequency = extractIntegerParameter("interestPostFrequency", requestMap, modifiedParameters);
return new SavingAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId, externalId, currencyCode,
digitsAfterDecimalValue, savingsDepositAmount, recurringInterestRate, savingInterestRate, tenure, commencementDate,
- tenureType, depositfrequency, interestType, minimumBalanceForWithdrawal, interestCalculationMethod,
- isLockinPeriodAllowed, isPartialDepositAllowed, lockinPeriod, lockinPeriodType, depositEvery, interestPostEvery, interestPostFrequency);
+ tenureType, depositfrequency, interestType, minimumBalanceForWithdrawal, interestCalculationMethod, isLockinPeriodAllowed,
+ isPartialDepositAllowed, lockinPeriod, lockinPeriodType, depositEvery, interestPostEvery, interestPostFrequency);
}
+ @Override
+ public SavingStateTransitionsCommand convertJsonToSavingStateTransitionCommand(Long accountId, String json) {
- @Override
- public SavingStateTransitionsCommand convertJsonToSavingStateTransitionCommand( Long accountId, String json) {
-
- if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
+ if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
Type typeOfMap = new TypeToken