update loan products api docs
This commit is contained in:
+271
-319
@@ -1921,6 +1921,10 @@ Request Body:
|
|||||||
<tr><td class=fielddesc>
|
<tr><td class=fielddesc>
|
||||||
<span>Example Values:</span> Same as repayment period, Daily</td></tr></td></tr>
|
<span>Example Values:</span> Same as repayment period, Daily</td></tr></td></tr>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class=alt><td>accountingType</td></tr>
|
||||||
|
<tr><td class=fielddesc>
|
||||||
|
<span>Example Values:</span>NONE(1), CASH_BASED(2), ACCRUAL_BASED(3)</td></tr></td></tr>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1936,120 +1940,57 @@ Request Body:
|
|||||||
</div>
|
</div>
|
||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts</code>
|
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts</code>
|
||||||
<code class="method-response">[ {
|
<code class="method-response">[
|
||||||
"id" : 1,
|
{
|
||||||
"name" : "Agricultural Loan",
|
"id": 1,
|
||||||
"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)",
|
"name": "A new loan product for me",
|
||||||
"principal" : {
|
"currency": {
|
||||||
"currencyCode" : "XOF",
|
"code": "USD",
|
||||||
"digitsAfterDecimal" : 0,
|
"name": "US Dollar",
|
||||||
"amount" : 100000,
|
"decimalPlaces": 2,
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
"displaySymbol": "$",
|
||||||
"nameCode" : "currency.XOF",
|
"nameCode": "currency.USD",
|
||||||
"displaySymbol" : "CFA",
|
"displayLabel": "US Dollar ($)"
|
||||||
"zero" : false,
|
},
|
||||||
"greaterThanZero" : true,
|
"principal": 100000,
|
||||||
"displaySymbolValue" : "100000 CFA"
|
"numberOfRepayments": 12,
|
||||||
},
|
"loanTermFrequency": 12,
|
||||||
"inArrearsTolerance" : {
|
"repaymentEvery": 1,
|
||||||
"currencyCode" : "XOF",
|
"interestRatePerPeriod": 1.75,
|
||||||
"digitsAfterDecimal" : 0,
|
"annualInterestRate": 21,
|
||||||
"amount" : 1000,
|
"accountingType": 1,
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
"loanTermFrequencyType": {
|
||||||
"nameCode" : "currency.XOF",
|
"id": 2,
|
||||||
"displaySymbol" : "CFA",
|
"code": "loanTermFrequency.periodFrequencyType.months",
|
||||||
"zero" : false,
|
"value": "Months"
|
||||||
"greaterThanZero" : true,
|
},
|
||||||
"displaySymbolValue" : "1000 CFA"
|
"repaymentFrequencyType": {
|
||||||
},
|
"id": 2,
|
||||||
"numberOfRepayments" : 1,
|
"code": "repaymentFrequency.periodFrequencyType.months",
|
||||||
"repaymentEvery" : 12,
|
"value": "Months"
|
||||||
"interestRatePerPeriod" : 1.750000,
|
},
|
||||||
"annualInterestRate" : 21.000000,
|
"interestRateFrequencyType": {
|
||||||
"repaymentFrequencyType" : {
|
"id": 2,
|
||||||
"id" : 2,
|
"code": "interestRateFrequency.periodFrequencyType.months",
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.months",
|
"value": "Per month"
|
||||||
"value" : "Months"
|
},
|
||||||
},
|
"amortizationType": {
|
||||||
"interestRateFrequencyType" : {
|
"id": 0,
|
||||||
"id" : 2,
|
"code": "amortizationType.equal.principal",
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.months",
|
"value": "Equal principle payments"
|
||||||
"value" : "Per month"
|
},
|
||||||
},
|
"interestType": {
|
||||||
"amortizationType" : {
|
"id": 0,
|
||||||
"id" : 1,
|
"code": "interestType.declining.balance",
|
||||||
"code" : "amortizationType.equal.installments",
|
"value": "Declining Balance"
|
||||||
"value" : "Equal installments"
|
},
|
||||||
},
|
"interestCalculationPeriodType": {
|
||||||
"interestType" : {
|
"id": 1,
|
||||||
"id" : 0,
|
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
||||||
"code" : "interestType.declining.balance",
|
"value": "Same as repayment period"
|
||||||
"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
|
|
||||||
}...]
|
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2070,147 +2011,164 @@ Request Body:
|
|||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts/template</code>
|
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts/template</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"principal" : {
|
"currency": {
|
||||||
"currencyCode" : "KES",
|
"code": "USD",
|
||||||
"digitsAfterDecimal" : 2,
|
"name": "US Dollar",
|
||||||
"amount" : 0.00,
|
"decimalPlaces": 2,
|
||||||
"defaultName" : "Kenyan Shilling",
|
"displaySymbol": "$",
|
||||||
"nameCode" : "currency.KES",
|
"nameCode": "currency.USD",
|
||||||
"displaySymbol" : "KSh",
|
"displayLabel": "US Dollar ($)"
|
||||||
"zero" : true,
|
|
||||||
"greaterThanZero" : false,
|
|
||||||
"displaySymbolValue" : "0.00 KSh"
|
|
||||||
},
|
},
|
||||||
"inArrearsTolerance" : {
|
"accountingType": 1,
|
||||||
"currencyCode" : "KES",
|
"loanTermFrequencyType": {
|
||||||
"digitsAfterDecimal" : 2,
|
"id": 2,
|
||||||
"amount" : 0.00,
|
"code": "loanTermFrequency.periodFrequencyType.months",
|
||||||
"defaultName" : "Kenyan Shilling",
|
"value": "Months"
|
||||||
"nameCode" : "currency.KES",
|
|
||||||
"displaySymbol" : "KSh",
|
|
||||||
"zero" : true,
|
|
||||||
"greaterThanZero" : false,
|
|
||||||
"displaySymbolValue" : "0.00 KSh"
|
|
||||||
},
|
},
|
||||||
"interestRatePerPeriod" : 0,
|
"repaymentFrequencyType": {
|
||||||
"annualInterestRate" : 0,
|
"id": 2,
|
||||||
"repaymentFrequencyType" : {
|
"code": "repaymentFrequency.periodFrequencyType.months",
|
||||||
"id" : 2,
|
"value": "Months"
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.months",
|
|
||||||
"value" : "Months"
|
|
||||||
},
|
},
|
||||||
"interestRateFrequencyType" : {
|
"interestRateFrequencyType": {
|
||||||
"id" : 2,
|
"id": 2,
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.months",
|
"code": "interestRateFrequency.periodFrequencyType.months",
|
||||||
"value" : "Per month"
|
"value": "Per month"
|
||||||
},
|
},
|
||||||
"amortizationType" : {
|
"amortizationType": {
|
||||||
"id" : 1,
|
"id": 1,
|
||||||
"code" : "amortizationType.equal.installments",
|
"code": "amortizationType.equal.installments",
|
||||||
"value" : "Equal installments"
|
"value": "Equal installments"
|
||||||
},
|
},
|
||||||
"interestType" : {
|
"interestType": {
|
||||||
"id" : 0,
|
"id": 0,
|
||||||
"code" : "interestType.declining.balance",
|
"code": "interestType.declining.balance",
|
||||||
"value" : "Declining Balance"
|
"value": "Declining Balance"
|
||||||
},
|
},
|
||||||
"interestCalculationPeriodType" : {
|
"interestCalculationPeriodType": {
|
||||||
"id" : 1,
|
"id": 1,
|
||||||
"code" : "interestCalculationPeriodType.same.as.repayment.period",
|
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
||||||
"value" : "Same as repayment period"
|
"value": "Same as repayment period"
|
||||||
},
|
},
|
||||||
"currencyOptions" : [ {
|
"currencyOptions": [
|
||||||
"code" : "KES",
|
{
|
||||||
"name" : "Kenyan Shilling",
|
"code": "USD",
|
||||||
"decimalPlaces" : 2,
|
"name": "US Dollar",
|
||||||
"displaySymbol" : "KSh",
|
"decimalPlaces": 2,
|
||||||
"nameCode" : "currency.KES",
|
"displaySymbol": "$",
|
||||||
"displayLabel" : "Kenyan Shilling (KSh)"
|
"nameCode": "currency.USD",
|
||||||
}, {
|
"displayLabel": "US Dollar ($)"
|
||||||
"code" : "BND",
|
}
|
||||||
"name" : "Brunei Dollar",
|
],
|
||||||
"decimalPlaces" : 2,
|
"transactionProcessingStrategyOptions": [
|
||||||
"displaySymbol" : "BND",
|
{
|
||||||
"nameCode" : "currency.BND",
|
"id": 1,
|
||||||
"displayLabel" : "Brunei Dollar (BND)"
|
"code": "mifos-standard-strategy",
|
||||||
}, {
|
"name": "Mifos style"
|
||||||
"code" : "LBP",
|
},
|
||||||
"name" : "Lebanese Pound",
|
{
|
||||||
"decimalPlaces" : 2,
|
"id": 2,
|
||||||
"displaySymbol" : "L£",
|
"code": "heavensfamily-strategy",
|
||||||
"nameCode" : "currency.LBP",
|
"name": "Heavensfamily"
|
||||||
"displayLabel" : "Lebanese Pound (L£)"
|
},
|
||||||
}, {
|
{
|
||||||
"code" : "GHC",
|
"id": 3,
|
||||||
"name" : "Ghana Cedi",
|
"code": "creocore-strategy",
|
||||||
"decimalPlaces" : 2,
|
"name": "Creocore"
|
||||||
"displaySymbol" : "GHC",
|
},
|
||||||
"nameCode" : "currency.GHC",
|
{
|
||||||
"displayLabel" : "Ghana Cedi (GHC)"
|
"id": 4,
|
||||||
}, {
|
"code": "rbi-india-strategy",
|
||||||
"code" : "USD",
|
"name": "RBI (India)"
|
||||||
"name" : "US Dollar",
|
}
|
||||||
"decimalPlaces" : 2,
|
],
|
||||||
"displaySymbol" : "$",
|
"amortizationTypeOptions": [
|
||||||
"nameCode" : "currency.USD",
|
{
|
||||||
"displayLabel" : "US Dollar ($)"
|
"id": 1,
|
||||||
}, {
|
"code": "amortizationType.equal.installments",
|
||||||
"code" : "XOF",
|
"value": "Equal installments"
|
||||||
"name" : "CFA Franc BCEAO",
|
},
|
||||||
"decimalPlaces" : 0,
|
{
|
||||||
"displaySymbol" : "CFA",
|
"id": 0,
|
||||||
"nameCode" : "currency.XOF",
|
"code": "amortizationType.equal.principal",
|
||||||
"displayLabel" : "CFA Franc BCEAO (CFA)"
|
"value": "Equal principle payments"
|
||||||
} ],
|
}
|
||||||
"amortizationTypeOptions" : [ {
|
],
|
||||||
"id" : 1,
|
"interestTypeOptions": [
|
||||||
"code" : "amortizationType.equal.installments",
|
{
|
||||||
"value" : "Equal installments"
|
"id": 1,
|
||||||
}, {
|
"code": "interestType.flat",
|
||||||
"id" : 0,
|
"value": "Flat"
|
||||||
"code" : "amortizationType.equal.principal",
|
},
|
||||||
"value" : "Equal principle payments"
|
{
|
||||||
} ],
|
"id": 0,
|
||||||
"interestTypeOptions" : [ {
|
"code": "interestType.declining.balance",
|
||||||
"id" : 1,
|
"value": "Declining Balance"
|
||||||
"code" : "interestType.flat",
|
}
|
||||||
"value" : "Flat"
|
],
|
||||||
}, {
|
"interestCalculationPeriodTypeOptions": [
|
||||||
"id" : 0,
|
{
|
||||||
"code" : "interestType.declining.balance",
|
"id": 0,
|
||||||
"value" : "Declining Balance"
|
"code": "interestCalculationPeriodType.daily",
|
||||||
} ],
|
"value": "Daily"
|
||||||
"interestCalculationPeriodTypeOptions" : [ {
|
},
|
||||||
"id" : 0,
|
{
|
||||||
"code" : "interestCalculationPeriodType.daily",
|
"id": 1,
|
||||||
"value" : "Daily"
|
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
||||||
}, {
|
"value": "Same as repayment period"
|
||||||
"id" : 1,
|
}
|
||||||
"code" : "interestCalculationPeriodType.same.as.repayment.period",
|
],
|
||||||
"value" : "Same as repayment period"
|
"repaymentFrequencyTypeOptions": [
|
||||||
} ],
|
{
|
||||||
"repaymentFrequencyTypeOptions" : [ {
|
"id": 0,
|
||||||
"id" : 0,
|
"code": "repaymentFrequency.periodFrequencyType.days",
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.days",
|
"value": "Days"
|
||||||
"value" : "Days"
|
},
|
||||||
}, {
|
{
|
||||||
"id" : 1,
|
"id": 1,
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.weeks",
|
"code": "repaymentFrequency.periodFrequencyType.weeks",
|
||||||
"value" : "Weeks"
|
"value": "Weeks"
|
||||||
}, {
|
},
|
||||||
"id" : 2,
|
{
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.months",
|
"id": 2,
|
||||||
"value" : "Months"
|
"code": "repaymentFrequency.periodFrequencyType.months",
|
||||||
} ],
|
"value": "Months"
|
||||||
"interestRateFrequencyTypeOptions" : [ {
|
}
|
||||||
"id" : 2,
|
],
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.months",
|
"interestRateFrequencyTypeOptions": [
|
||||||
"value" : "Per month"
|
{
|
||||||
}, {
|
"id": 2,
|
||||||
"id" : 3,
|
"code": "interestRateFrequency.periodFrequencyType.months",
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.years",
|
"value": "Per month"
|
||||||
"value" : "Per year"
|
},
|
||||||
} ]
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2230,62 +2188,54 @@ Request Body:
|
|||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts/{productId}</code>
|
<code class="method-declaration">GET https://Domain Name/api/v1/loanproducts/{productId}</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"id" : 1,
|
"id": 1,
|
||||||
"name" : "Agricultural Loan",
|
"name": "A new loan product for me",
|
||||||
"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)",
|
"currency": {
|
||||||
"principal" : {
|
"code": "USD",
|
||||||
"currencyCode" : "XOF",
|
"name": "US Dollar",
|
||||||
"digitsAfterDecimal" : 0,
|
"decimalPlaces": 2,
|
||||||
"amount" : 100000,
|
"displaySymbol": "$",
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
"nameCode": "currency.USD",
|
||||||
"nameCode" : "currency.XOF",
|
"displayLabel": "US Dollar ($)"
|
||||||
"displaySymbol" : "CFA",
|
|
||||||
"zero" : false,
|
|
||||||
"greaterThanZero" : true,
|
|
||||||
"displaySymbolValue" : "100000 CFA"
|
|
||||||
},
|
},
|
||||||
"inArrearsTolerance" : {
|
"principal": 100000,
|
||||||
"currencyCode" : "XOF",
|
"numberOfRepayments": 12,
|
||||||
"digitsAfterDecimal" : 0,
|
"loanTermFrequency": 12,
|
||||||
"amount" : 1000,
|
"repaymentEvery": 1,
|
||||||
"defaultName" : "CFA Franc BCEAO",
|
"interestRatePerPeriod": 1.75,
|
||||||
"nameCode" : "currency.XOF",
|
"annualInterestRate": 21,
|
||||||
"displaySymbol" : "CFA",
|
"accountingType": 1,
|
||||||
"zero" : false,
|
"loanTermFrequencyType": {
|
||||||
"greaterThanZero" : true,
|
"id": 2,
|
||||||
"displaySymbolValue" : "1000 CFA"
|
"code": "loanTermFrequency.periodFrequencyType.months",
|
||||||
|
"value": "Months"
|
||||||
},
|
},
|
||||||
"numberOfRepayments" : 1,
|
"repaymentFrequencyType": {
|
||||||
"repaymentEvery" : 12,
|
"id": 2,
|
||||||
"interestRatePerPeriod" : 1.750000,
|
"code": "repaymentFrequency.periodFrequencyType.months",
|
||||||
"annualInterestRate" : 21.000000,
|
"value": "Months"
|
||||||
"repaymentFrequencyType" : {
|
|
||||||
"id" : 2,
|
|
||||||
"code" : "repaymentFrequency.periodFrequencyType.months",
|
|
||||||
"value" : "Months"
|
|
||||||
},
|
},
|
||||||
"interestRateFrequencyType" : {
|
"interestRateFrequencyType": {
|
||||||
"id" : 2,
|
"id": 2,
|
||||||
"code" : "interestRateFrequency.periodFrequencyType.months",
|
"code": "interestRateFrequency.periodFrequencyType.months",
|
||||||
"value" : "Per month"
|
"value": "Per month"
|
||||||
},
|
},
|
||||||
"amortizationType" : {
|
"amortizationType": {
|
||||||
"id" : 1,
|
"id": 0,
|
||||||
"code" : "amortizationType.equal.installments",
|
"code": "amortizationType.equal.principal",
|
||||||
"value" : "Equal installments"
|
"value": "Equal principle payments"
|
||||||
},
|
},
|
||||||
"interestType" : {
|
"interestType": {
|
||||||
"id" : 0,
|
"id": 0,
|
||||||
"code" : "interestType.declining.balance",
|
"code": "interestType.declining.balance",
|
||||||
"value" : "Declining Balance"
|
"value": "Declining Balance"
|
||||||
},
|
},
|
||||||
"interestCalculationPeriodType" : {
|
"interestCalculationPeriodType": {
|
||||||
"id" : 1,
|
"id": 1,
|
||||||
"code" : "interestCalculationPeriodType.same.as.repayment.period",
|
"code": "interestCalculationPeriodType.same.as.repayment.period",
|
||||||
"value" : "Same as repayment period"
|
"value": "Same as repayment period"
|
||||||
},
|
},
|
||||||
"createdOn" : 1334232874000,
|
"charges": []
|
||||||
"lastModifedOn" : 1334232874000
|
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2299,7 +2249,7 @@ Request Body:
|
|||||||
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
<tr class="matrixHeadingBG"><td><div class="mifosXHeading2">Mandatory Fields</div></td></tr>
|
||||||
<tr class=alt><td>name, currencyCode, digitsAfterDecimal, principal, inArrearsTolerance, repaymentFrequencyType, repaymentEvery,
|
<tr class=alt><td>name, currencyCode, digitsAfterDecimal, principal, inArrearsTolerance, repaymentFrequencyType, repaymentEvery,
|
||||||
numberOfRepayments, interestRatePerPeriod, interestRateFrequencyType, amortizationType,
|
numberOfRepayments, interestRatePerPeriod, interestRateFrequencyType, amortizationType,
|
||||||
interestType, interestCalculationPeriodType</td></tr>
|
interestType, interestCalculationPeriodType, accountingType</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
@@ -2308,25 +2258,24 @@ Request Body:
|
|||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Request Body:
|
Request Body:
|
||||||
{
|
{
|
||||||
"name": "A new loan product for me",
|
"name": "A new loan product for me",
|
||||||
"description": "A description not exceeding 500 characters.",
|
"currencyCode": "USD",
|
||||||
"currencyCode": "USD",
|
"locale": "en_GB",
|
||||||
"digitsAfterDecimal": "2",
|
"digitsAfterDecimal": "2",
|
||||||
"locale": "en_GB",
|
"principal": "100,000.00",
|
||||||
"principal": "100,000.00",
|
"repaymentFrequencyType": 2,
|
||||||
"inArrearsTolerance": "1,000.00",
|
"repaymentEvery": "1",
|
||||||
"repaymentFrequencyType": 2,
|
"numberOfRepayments": "12",
|
||||||
"repaymentEvery": "1",
|
"interestRatePerPeriod": "1.75",
|
||||||
"numberOfRepayments": "12",
|
"interestRateFrequencyType": 2,
|
||||||
"interestRatePerPeriod": "1.75",
|
"amortizationType": 1,
|
||||||
"interestRateFrequencyType": 2,
|
"interestType": 0,
|
||||||
"amortizationType": 1,
|
"interestCalculationPeriodType": 1,
|
||||||
"interestType": 0,
|
"accountingType": 1
|
||||||
"interestCalculationPeriodType": 1
|
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"resourceId": 9
|
"resourceId": 1
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
@@ -2338,18 +2287,21 @@ Request Body:
|
|||||||
<h4>Update a Loan Product</h4>
|
<h4>Update a Loan Product</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="method-example">
|
<div class="method-example">
|
||||||
<code class="method-declaration">POST https://Domain Name/api/v1/loanproducts/{loanId}</code>
|
<code class="method-declaration">PUT https://Domain Name/api/v1/loanproducts/{loanId}</code>
|
||||||
<code class="method-request">POST loanproducts/1
|
<code class="method-request">PUT loanproducts/1
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
Request Body:
|
Request Body:
|
||||||
{
|
{
|
||||||
"locale": "en_GB",
|
"locale": "en_GB",
|
||||||
"principal": "100,000.00",
|
"principal": "70,000.00"
|
||||||
"inArrearsTolerance": "5,000.00"
|
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
<code class="method-response">{
|
<code class="method-response">{
|
||||||
"resourceId": 1
|
"resourceId": 1,
|
||||||
|
"changes": {
|
||||||
|
"principal": 70000,
|
||||||
|
"locale": "en_GB"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</code>
|
</code>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -470,19 +470,11 @@ CREATE TABLE `m_product_loan` (
|
|||||||
`number_of_repayments` smallint(5) NOT NULL,
|
`number_of_repayments` smallint(5) NOT NULL,
|
||||||
`amortization_method_enum` smallint(5) NOT NULL,
|
`amortization_method_enum` smallint(5) NOT NULL,
|
||||||
`accounting_type` 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,
|
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `FKAUD0000000000003` (`createdby_id`),
|
|
||||||
KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
|
|
||||||
KEY `FKA6A8A7D77240145` (`fund_id`),
|
KEY `FKA6A8A7D77240145` (`fund_id`),
|
||||||
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
||||||
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`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`)
|
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|||||||
@@ -429,19 +429,11 @@ CREATE TABLE `m_client` (
|
|||||||
`display_name` varchar(100) NOT NULL,
|
`display_name` varchar(100) NOT NULL,
|
||||||
`image_key` varchar(500) DEFAULT NULL,
|
`image_key` varchar(500) DEFAULT NULL,
|
||||||
`joined_date` date 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',
|
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `account_no_UNIQUE` (`account_no`),
|
UNIQUE KEY `account_no_UNIQUE` (`account_no`),
|
||||||
UNIQUE KEY `external_id` (`external_id`),
|
UNIQUE KEY `external_id` (`external_id`),
|
||||||
KEY `FKCE00CAB3E0DD567A` (`office_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`)
|
CONSTRAINT `FKCE00CAB3E0DD567A` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB AUTO_INCREMENT=347 DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
@@ -813,18 +805,10 @@ CREATE TABLE `m_group` (
|
|||||||
`name` varchar(100) DEFAULT NULL,
|
`name` varchar(100) DEFAULT NULL,
|
||||||
`external_id` varchar(100) DEFAULT NULL,
|
`external_id` varchar(100) DEFAULT NULL,
|
||||||
`is_deleted` tinyint(1) NOT NULL DEFAULT '0',
|
`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`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `name` (`name`),
|
UNIQUE KEY `name` (`name`),
|
||||||
UNIQUE KEY `external_id` (`external_id`),
|
UNIQUE KEY `external_id` (`external_id`),
|
||||||
KEY `FKJPWG000000000003` (`createdby_id`),
|
|
||||||
KEY `FKJPWG000000000004` (`lastmodifiedby_id`),
|
|
||||||
KEY `office_id` (`office_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`)
|
CONSTRAINT `m_group_ibfk_1` FOREIGN KEY (`office_id`) REFERENCES `m_office` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
@@ -1471,19 +1455,11 @@ CREATE TABLE `m_product_loan` (
|
|||||||
`number_of_repayments` smallint(5) NOT NULL,
|
`number_of_repayments` smallint(5) NOT NULL,
|
||||||
`amortization_method_enum` smallint(5) NOT NULL,
|
`amortization_method_enum` smallint(5) NOT NULL,
|
||||||
`accounting_type` 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,
|
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `FKAUD0000000000003` (`createdby_id`),
|
|
||||||
KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
|
|
||||||
KEY `FKA6A8A7D77240145` (`fund_id`),
|
KEY `FKA6A8A7D77240145` (`fund_id`),
|
||||||
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
||||||
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`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`)
|
CONSTRAINT `FK_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
@@ -2058,4 +2034,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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
|
||||||
|
|||||||
@@ -1475,19 +1475,11 @@ CREATE TABLE `m_product_loan` (
|
|||||||
`number_of_repayments` smallint(5) NOT NULL,
|
`number_of_repayments` smallint(5) NOT NULL,
|
||||||
`amortization_method_enum` smallint(5) NOT NULL,
|
`amortization_method_enum` smallint(5) NOT NULL,
|
||||||
`accounting_type` 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,
|
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `FKAUD0000000000003` (`createdby_id`),
|
|
||||||
KEY `FKAUD0000000000004` (`lastmodifiedby_id`),
|
|
||||||
KEY `FKA6A8A7D77240145` (`fund_id`),
|
KEY `FKA6A8A7D77240145` (`fund_id`),
|
||||||
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
KEY `FK_ltp_strategy` (`loan_transaction_strategy_id`),
|
||||||
CONSTRAINT `FKA6A8A7D77240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`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`)
|
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;
|
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
@@ -1498,7 +1490,7 @@ CREATE TABLE `m_product_loan` (
|
|||||||
|
|
||||||
LOCK TABLES `m_product_loan` WRITE;
|
LOCK TABLES `m_product_loan` WRITE;
|
||||||
/*!40000 ALTER TABLE `m_product_loan` DISABLE KEYS */;
|
/*!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 */;
|
/*!40000 ALTER TABLE `m_product_loan` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@@ -2071,4 +2063,4 @@ UNLOCK TABLES;
|
|||||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
/*!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
|
||||||
|
|||||||
@@ -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`;
|
||||||
+17
-9
@@ -34,10 +34,11 @@ import org.mifosplatform.infrastructure.core.serialization.ToApiJsonSerializer;
|
|||||||
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
import org.mifosplatform.infrastructure.security.service.PlatformSecurityContext;
|
||||||
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
import org.mifosplatform.organisation.office.data.OfficeLookup;
|
||||||
import org.mifosplatform.organisation.office.service.OfficeReadPlatformService;
|
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.ClientAccountSummaryCollectionData;
|
||||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
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.client.service.ClientReadPlatformService;
|
||||||
import org.mifosplatform.portfolio.savingsaccount.PortfolioApiDataConversionService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Scope;
|
import org.springframework.context.annotation.Scope;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -47,8 +48,9 @@ import org.springframework.stereotype.Component;
|
|||||||
@Scope("singleton")
|
@Scope("singleton")
|
||||||
public class ClientsApiResource {
|
public class ClientsApiResource {
|
||||||
|
|
||||||
private final Set<String> CLIENT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "accountNo", "officeId", "officeName", "externalId",
|
private final Set<String> CLIENT_DATA_PARAMETERS = new HashSet<String>(Arrays.asList("id", "accountNo", "officeId", "officeName",
|
||||||
"firstname", "middlename", "lastname", "fullname", "joinedDate", "displayName", "clientOrBusinessName", "allowedOffices", "imagePresent"));
|
"externalId", "firstname", "middlename", "lastname", "fullname", "joinedDate", "displayName", "clientOrBusinessName",
|
||||||
|
"allowedOffices", "imagePresent"));
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final ClientReadPlatformService clientReadPlatformService;
|
private final ClientReadPlatformService clientReadPlatformService;
|
||||||
@@ -56,24 +58,25 @@ public class ClientsApiResource {
|
|||||||
private final ToApiJsonSerializer<ClientData> toApiJsonSerializer;
|
private final ToApiJsonSerializer<ClientData> toApiJsonSerializer;
|
||||||
private final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer;
|
private final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer;
|
||||||
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
private final ApiRequestParameterHelper apiRequestParameterHelper;
|
||||||
private final PortfolioApiDataConversionService apiDataConversionService;
|
|
||||||
private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService;
|
private final PortfolioCommandsReadPlatformService commandSourceReadPlatformService;
|
||||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
||||||
|
private final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
|
public ClientsApiResource(final PlatformSecurityContext context, final ClientReadPlatformService readPlatformService,
|
||||||
final OfficeReadPlatformService officeReadPlatformService, final ToApiJsonSerializer<ClientData> toApiJsonSerializer,
|
final OfficeReadPlatformService officeReadPlatformService, final ToApiJsonSerializer<ClientData> toApiJsonSerializer,
|
||||||
|
final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer,
|
||||||
final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer,
|
final ToApiJsonSerializer<ClientAccountSummaryCollectionData> clientAccountSummaryToApiJsonSerializer,
|
||||||
final ApiRequestParameterHelper apiRequestParameterHelper, final PortfolioApiDataConversionService apiDataConversionService,
|
final ApiRequestParameterHelper apiRequestParameterHelper,
|
||||||
final PortfolioCommandsReadPlatformService commandsReadPlatformService,
|
final PortfolioCommandsReadPlatformService commandsReadPlatformService,
|
||||||
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
this.clientReadPlatformService = readPlatformService;
|
this.clientReadPlatformService = readPlatformService;
|
||||||
this.officeReadPlatformService = officeReadPlatformService;
|
this.officeReadPlatformService = officeReadPlatformService;
|
||||||
this.toApiJsonSerializer = toApiJsonSerializer;
|
this.toApiJsonSerializer = toApiJsonSerializer;
|
||||||
|
this.clientCommandFromApiJsonDeserializer = clientCommandFromApiJsonDeserializer;
|
||||||
this.clientAccountSummaryToApiJsonSerializer = clientAccountSummaryToApiJsonSerializer;
|
this.clientAccountSummaryToApiJsonSerializer = clientAccountSummaryToApiJsonSerializer;
|
||||||
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
this.apiRequestParameterHelper = apiRequestParameterHelper;
|
||||||
this.apiDataConversionService = apiDataConversionService;
|
|
||||||
this.commandSourceReadPlatformService = commandsReadPlatformService;
|
this.commandSourceReadPlatformService = commandsReadPlatformService;
|
||||||
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
|
||||||
}
|
}
|
||||||
@@ -173,7 +176,10 @@ public class ClientsApiResource {
|
|||||||
private ClientData handleRequestToIntegrateProposedChangesFromCommand(final Long clientId, final Long commandId,
|
private ClientData handleRequestToIntegrateProposedChangesFromCommand(final Long clientId, final Long commandId,
|
||||||
final ClientData clientData) {
|
final ClientData clientData) {
|
||||||
final CommandSourceData entry = this.commandSourceReadPlatformService.retrieveById(commandId);
|
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<ClientData> dataChanges = null; // retrieveAllUnprocessedDataChanges(clientId);
|
final Collection<ClientData> dataChanges = null; // retrieveAllUnprocessedDataChanges(clientId);
|
||||||
return ClientData.integrateChanges(clientData, currentChange, dataChanges);
|
return ClientData.integrateChanges(clientData, currentChange, dataChanges);
|
||||||
@@ -185,8 +191,10 @@ public class ClientsApiResource {
|
|||||||
Collection<CommandSourceData> unprocessedChanges = this.commandSourceReadPlatformService.retrieveUnprocessChangesByEntityNameAndId(
|
Collection<CommandSourceData> unprocessedChanges = this.commandSourceReadPlatformService.retrieveUnprocessChangesByEntityNameAndId(
|
||||||
"CLIENT", clientId);
|
"CLIENT", clientId);
|
||||||
for (CommandSourceData commandSourceData : unprocessedChanges) {
|
for (CommandSourceData commandSourceData : unprocessedChanges) {
|
||||||
ClientData change = this.apiDataConversionService.convertInternalJsonFormatToClientDataChange(clientId,
|
final ClientCommand command = this.clientCommandFromApiJsonDeserializer.commandFromApiJson(commandSourceData.json());
|
||||||
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);
|
dataChanges.add(change);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-5
@@ -176,6 +176,9 @@ public class LoanProductsApiResource {
|
|||||||
final boolean feeChargesOnly = true;
|
final boolean feeChargesOnly = true;
|
||||||
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
|
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
|
||||||
chargeOptions.removeAll(productData.charges());
|
chargeOptions.removeAll(productData.charges());
|
||||||
|
if (chargeOptions.isEmpty()) {
|
||||||
|
chargeOptions = null;
|
||||||
|
}
|
||||||
|
|
||||||
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
|
||||||
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
|
||||||
@@ -187,14 +190,26 @@ public class LoanProductsApiResource {
|
|||||||
final List<EnumOptionData> interestRateFrequencyTypeOptions = dropdownReadPlatformService
|
final List<EnumOptionData> interestRateFrequencyTypeOptions = dropdownReadPlatformService
|
||||||
.retrieveInterestRateFrequencyTypeOptions();
|
.retrieveInterestRateFrequencyTypeOptions();
|
||||||
|
|
||||||
final Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
Collection<FundData> fundOptions = this.fundReadPlatformService.retrieveAllFunds();
|
||||||
|
if (fundOptions.isEmpty()) {
|
||||||
|
fundOptions = null;
|
||||||
|
}
|
||||||
final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions = this.dropdownReadPlatformService
|
final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions = this.dropdownReadPlatformService
|
||||||
.retreiveTransactionProcessingStrategies();
|
.retreiveTransactionProcessingStrategies();
|
||||||
|
|
||||||
final List<GLAccountData> assetAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
|
List<GLAccountData> assetAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET);
|
||||||
final List<GLAccountData> incomeAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.INCOME);;
|
if (assetAccountOptions.isEmpty()) {
|
||||||
final List<GLAccountData> expenseAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.EXPENSE);;
|
assetAccountOptions = null;
|
||||||
|
}
|
||||||
|
List<GLAccountData> incomeAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.INCOME);
|
||||||
|
if (incomeAccountOptions.isEmpty()) {
|
||||||
|
incomeAccountOptions = null;
|
||||||
|
}
|
||||||
|
List<GLAccountData> expenseAccountOptions = accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.EXPENSE);
|
||||||
|
if (expenseAccountOptions.isEmpty()) {
|
||||||
|
expenseAccountOptions = null;
|
||||||
|
}
|
||||||
|
|
||||||
return new LoanProductData(productData, chargeOptions, currencyOptions, amortizationTypeOptions, interestTypeOptions,
|
return new LoanProductData(productData, chargeOptions, currencyOptions, amortizationTypeOptions, interestTypeOptions,
|
||||||
interestCalculationPeriodTypeOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
interestCalculationPeriodTypeOptions, loanTermFrequencyTypeOptions, repaymentFrequencyTypeOptions,
|
||||||
interestRateFrequencyTypeOptions, fundOptions, transactionProcessingStrategyOptions,
|
interestRateFrequencyTypeOptions, fundOptions, transactionProcessingStrategyOptions,
|
||||||
|
|||||||
+25
-39
@@ -5,7 +5,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.mifosplatform.accounting.api.data.GLAccountData;
|
import org.mifosplatform.accounting.api.data.GLAccountData;
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
import org.mifosplatform.organisation.monetary.data.CurrencyData;
|
||||||
@@ -52,9 +51,6 @@ public class LoanProductData {
|
|||||||
|
|
||||||
private final Collection<ChargeData> charges;
|
private final Collection<ChargeData> charges;
|
||||||
|
|
||||||
private final DateTime createdOn;
|
|
||||||
private final DateTime lastModifedOn;
|
|
||||||
|
|
||||||
private final Collection<CurrencyData> currencyOptions;
|
private final Collection<CurrencyData> currencyOptions;
|
||||||
private final Collection<FundData> fundOptions;
|
private final Collection<FundData> fundOptions;
|
||||||
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
|
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
|
||||||
@@ -87,8 +83,6 @@ public class LoanProductData {
|
|||||||
* Used when returning lookup information about loan product for dropdowns.
|
* Used when returning lookup information about loan product for dropdowns.
|
||||||
*/
|
*/
|
||||||
public static LoanProductData lookup(final Long id, final String name) {
|
public static LoanProductData lookup(final Long id, final String name) {
|
||||||
final DateTime createdOn = null;
|
|
||||||
final DateTime lastModifedOn = null;
|
|
||||||
final String description = null;
|
final String description = null;
|
||||||
final CurrencyData currency = null;
|
final CurrencyData currency = null;
|
||||||
final BigDecimal principal = null;
|
final BigDecimal principal = null;
|
||||||
@@ -111,16 +105,13 @@ public class LoanProductData {
|
|||||||
final Collection<ChargeData> charges = null;
|
final Collection<ChargeData> charges = null;
|
||||||
final Integer accountingType = null;
|
final Integer accountingType = null;
|
||||||
|
|
||||||
return new LoanProductData(createdOn, lastModifedOn, id, name, description, currency, principal, tolerance, numberOfRepayments,
|
return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
|
||||||
loanTermFrequency, repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType,
|
repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
|
||||||
repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId,
|
interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
|
||||||
fundName, transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
|
transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LoanProductData sensibleDefaultsForNewLoanProductCreation() {
|
public static LoanProductData sensibleDefaultsForNewLoanProductCreation() {
|
||||||
|
|
||||||
final DateTime createdOn = null;
|
|
||||||
final DateTime lastModifedOn = null;
|
|
||||||
final Long id = null;
|
final Long id = null;
|
||||||
final String name = null;
|
final String name = null;
|
||||||
final String description = null;
|
final String description = null;
|
||||||
@@ -146,22 +137,20 @@ public class LoanProductData {
|
|||||||
final Collection<ChargeData> charges = null;
|
final Collection<ChargeData> charges = null;
|
||||||
final Integer accountingType = 1;
|
final Integer accountingType = 1;
|
||||||
|
|
||||||
return new LoanProductData(createdOn, lastModifedOn, id, name, description, currency, principal, tolerance, numberOfRepayments,
|
return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
|
||||||
loanTermFrequency, repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType,
|
repaymentEvery, interestRatePerPeriod, annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
|
||||||
repaymentFrequencyType, interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId,
|
interestRateFrequencyType, amortizationType, interestType, interestCalculationPeriodType, fundId, fundName,
|
||||||
fundName, transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
|
transactionProcessingStrategyId, transactionProcessingStrategyName, charges, accountingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoanProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String name,
|
public LoanProductData(final Long id, final String name, final String description, final CurrencyData currency,
|
||||||
final String description, final CurrencyData currency, final BigDecimal principal, final BigDecimal tolerance,
|
final BigDecimal principal, final BigDecimal tolerance, final Integer numberOfRepayments, final Integer loanTermFrequency,
|
||||||
final Integer numberOfRepayments, final Integer loanTermFrequency, final Integer repaymentEvery,
|
final Integer repaymentEvery, final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate,
|
||||||
final BigDecimal interestRatePerPeriod, final BigDecimal annualInterestRate, final EnumOptionData loanTermFrequencyType,
|
final EnumOptionData loanTermFrequencyType, final EnumOptionData repaymentFrequencyType,
|
||||||
final EnumOptionData repaymentFrequencyType, final EnumOptionData interestRateFrequencyType,
|
final EnumOptionData interestRateFrequencyType, final EnumOptionData amortizationType, final EnumOptionData interestType,
|
||||||
final EnumOptionData amortizationType, final EnumOptionData interestType, final EnumOptionData interestCalculationPeriodType,
|
final EnumOptionData interestCalculationPeriodType, final Long fundId, final String fundName,
|
||||||
final Long fundId, final String fundName, final Long transactionProcessingStrategyId,
|
final Long transactionProcessingStrategyId, final String transactionProcessingStrategyName,
|
||||||
final String transactionProcessingStrategyName, final Collection<ChargeData> charges, final Integer accountingType) {
|
final Collection<ChargeData> charges, final Integer accountingType) {
|
||||||
this.createdOn = createdOn;
|
|
||||||
this.lastModifedOn = lastModifedOn;
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.description = description;
|
this.description = description;
|
||||||
@@ -210,8 +199,6 @@ public class LoanProductData {
|
|||||||
final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions,
|
final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions,
|
||||||
final List<GLAccountData> assetAccountOptions, final List<GLAccountData> incomeAccountOptions,
|
final List<GLAccountData> assetAccountOptions, final List<GLAccountData> incomeAccountOptions,
|
||||||
final List<GLAccountData> expenseAccountOptions) {
|
final List<GLAccountData> expenseAccountOptions) {
|
||||||
this.createdOn = productData.createdOn;
|
|
||||||
this.lastModifedOn = productData.lastModifedOn;
|
|
||||||
this.id = productData.id;
|
this.id = productData.id;
|
||||||
this.name = productData.name;
|
this.name = productData.name;
|
||||||
this.description = productData.description;
|
this.description = productData.description;
|
||||||
@@ -232,7 +219,7 @@ public class LoanProductData {
|
|||||||
this.fundName = productData.fundName;
|
this.fundName = productData.fundName;
|
||||||
this.transactionProcessingStrategyId = productData.transactionProcessingStrategyId;
|
this.transactionProcessingStrategyId = productData.transactionProcessingStrategyId;
|
||||||
this.transactionProcessingStrategyName = productData.transactionProcessingStrategyName;
|
this.transactionProcessingStrategyName = productData.transactionProcessingStrategyName;
|
||||||
this.charges = productData.charges();
|
this.charges = nullIfEmpty(productData.charges());
|
||||||
this.accountingType = productData.accountingType;
|
this.accountingType = productData.accountingType;
|
||||||
|
|
||||||
this.chargeOptions = chargeOptions;
|
this.chargeOptions = chargeOptions;
|
||||||
@@ -256,6 +243,14 @@ public class LoanProductData {
|
|||||||
this.expenseAccountOptions = expenseAccountOptions;
|
this.expenseAccountOptions = expenseAccountOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {
|
||||||
|
Collection<ChargeData> chargesLocal = charges;
|
||||||
|
if (charges == null || charges.isEmpty()) {
|
||||||
|
chargesLocal = null;
|
||||||
|
}
|
||||||
|
return chargesLocal;
|
||||||
|
}
|
||||||
|
|
||||||
public Collection<ChargeData> charges() {
|
public Collection<ChargeData> charges() {
|
||||||
Collection<ChargeData> chargesLocal = new ArrayList<ChargeData>();
|
Collection<ChargeData> chargesLocal = new ArrayList<ChargeData>();
|
||||||
if (this.charges != null) {
|
if (this.charges != null) {
|
||||||
@@ -348,14 +343,6 @@ public class LoanProductData {
|
|||||||
return interestCalculationPeriodType;
|
return interestCalculationPeriodType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateTime getCreatedOn() {
|
|
||||||
return createdOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DateTime getLastModifedOn() {
|
|
||||||
return lastModifedOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<FundData> getFundOptions() {
|
public Collection<FundData> getFundOptions() {
|
||||||
return fundOptions;
|
return fundOptions;
|
||||||
}
|
}
|
||||||
@@ -479,5 +466,4 @@ public class LoanProductData {
|
|||||||
public Integer getAccountingType() {
|
public Integer getAccountingType() {
|
||||||
return this.accountingType;
|
return this.accountingType;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+6
-7
@@ -17,12 +17,11 @@ import javax.persistence.Table;
|
|||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
import org.mifosplatform.infrastructure.core.api.JsonCommand;
|
||||||
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
|
|
||||||
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
import org.mifosplatform.organisation.monetary.domain.MonetaryCurrency;
|
||||||
import org.mifosplatform.portfolio.charge.domain.Charge;
|
import org.mifosplatform.portfolio.charge.domain.Charge;
|
||||||
import org.mifosplatform.portfolio.fund.domain.Fund;
|
import org.mifosplatform.portfolio.fund.domain.Fund;
|
||||||
import org.mifosplatform.portfolio.loanaccount.loanschedule.domain.AprCalculator;
|
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
|
* Loan products allow for categorisation of an organisations loans into
|
||||||
@@ -35,7 +34,7 @@ import org.mifosplatform.useradministration.domain.AppUser;
|
|||||||
*/
|
*/
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "m_product_loan")
|
@Table(name = "m_product_loan")
|
||||||
public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
public class LoanProduct extends AbstractPersistable<Long> {
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "fund_id", nullable = true)
|
@JoinColumn(name = "fund_id", nullable = true)
|
||||||
@@ -220,12 +219,12 @@ public class LoanProduct extends AbstractAuditableCustom<AppUser, Long> {
|
|||||||
public boolean isAccountingEnabled() {
|
public boolean isAccountingEnabled() {
|
||||||
return !AccountingRuleType.NONE.getValue().equals(this.accountingType);
|
return !AccountingRuleType.NONE.getValue().equals(this.accountingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCashBasedAccountingEnabled(){
|
public boolean isCashBasedAccountingEnabled() {
|
||||||
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingType);
|
return AccountingRuleType.CASH_BASED.getValue().equals(this.accountingType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAccrualBasedAccountingEnabled(){
|
public boolean isAccrualBasedAccountingEnabled() {
|
||||||
return AccountingRuleType.ACCRUAL_BASED.getValue().equals(this.accountingType);
|
return AccountingRuleType.ACCRUAL_BASED.getValue().equals(this.accountingType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+112
-125
@@ -5,7 +5,6 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
|
||||||
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
import org.mifosplatform.infrastructure.core.data.EnumOptionData;
|
||||||
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
|
||||||
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
|
||||||
@@ -24,168 +23,156 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatformService {
|
public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatformService {
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
private final PlatformSecurityContext context;
|
||||||
private final JdbcTemplate jdbcTemplate;
|
private final JdbcTemplate jdbcTemplate;
|
||||||
private final ChargeReadPlatformService chargeReadPlatformService;
|
private final ChargeReadPlatformService chargeReadPlatformService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public LoanProductReadPlatformServiceImpl(
|
public LoanProductReadPlatformServiceImpl(final PlatformSecurityContext context,
|
||||||
final PlatformSecurityContext context,
|
final ChargeReadPlatformService chargeReadPlatformService, final TenantAwareRoutingDataSource dataSource) {
|
||||||
final ChargeReadPlatformService chargeReadPlatformService,
|
this.context = context;
|
||||||
final TenantAwareRoutingDataSource dataSource) {
|
|
||||||
this.context = context;
|
|
||||||
this.chargeReadPlatformService = chargeReadPlatformService;
|
this.chargeReadPlatformService = chargeReadPlatformService;
|
||||||
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
this.jdbcTemplate = new JdbcTemplate(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoanProductData retrieveLoanProduct(final Long loanProductId) {
|
public LoanProductData retrieveLoanProduct(final Long loanProductId) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Collection<ChargeData> charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId);
|
final Collection<ChargeData> charges = this.chargeReadPlatformService.retrieveLoanProductCharges(loanProductId);
|
||||||
|
|
||||||
final LoanProductMapper rm = new LoanProductMapper(charges);
|
|
||||||
final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
|
|
||||||
|
|
||||||
|
final LoanProductMapper rm = new LoanProductMapper(charges);
|
||||||
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
|
final String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";
|
||||||
|
|
||||||
} catch (EmptyResultDataAccessException e) {
|
|
||||||
throw new LoanProductNotFoundException(loanProductId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId });
|
||||||
public Collection<LoanProductData> retrieveAllLoanProducts() {
|
|
||||||
|
|
||||||
this.context.authenticatedUser();
|
} catch (EmptyResultDataAccessException e) {
|
||||||
|
throw new LoanProductNotFoundException(loanProductId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final LoanProductMapper rm = new LoanProductMapper(null);
|
@Override
|
||||||
|
public Collection<LoanProductData> 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
|
final String sql = "select " + rm.loanProductSchema();
|
||||||
public Collection<LoanProductData> retrieveAllLoanProductsForLookup() {
|
|
||||||
|
|
||||||
this.context.authenticatedUser();
|
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||||
|
}
|
||||||
|
|
||||||
final LoanProductLookupMapper rm = new LoanProductLookupMapper();
|
@Override
|
||||||
|
public Collection<LoanProductData> retrieveAllLoanProductsForLookup() {
|
||||||
|
|
||||||
final String sql = "select " + rm.loanProductLookupSchema();
|
this.context.authenticatedUser();
|
||||||
|
|
||||||
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
final LoanProductLookupMapper rm = new LoanProductLookupMapper();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
final String sql = "select " + rm.schema();
|
||||||
public LoanProductData retrieveNewLoanProductDetails() {
|
|
||||||
return LoanProductData.sensibleDefaultsForNewLoanProductCreation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final class LoanProductMapper implements
|
return this.jdbcTemplate.query(sql, rm, new Object[] {});
|
||||||
RowMapper<LoanProductData> {
|
}
|
||||||
|
|
||||||
private final Collection<ChargeData> charges;
|
@Override
|
||||||
|
public LoanProductData retrieveNewLoanProductDetails() {
|
||||||
|
return LoanProductData.sensibleDefaultsForNewLoanProductCreation();
|
||||||
|
}
|
||||||
|
|
||||||
public LoanProductMapper(final Collection<ChargeData> charges) {
|
private static final class LoanProductMapper implements RowMapper<LoanProductData> {
|
||||||
this.charges = charges;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String loanProductSchema() {
|
private final Collection<ChargeData> charges;
|
||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
public LoanProductMapper(final Collection<ChargeData> charges) {
|
||||||
public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
|
this.charges = charges;
|
||||||
throws SQLException {
|
}
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
public String loanProductSchema() {
|
||||||
final String name = rs.getString("name");
|
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, "
|
||||||
final String description = rs.getString("description");
|
+ "lp.name as name, lp.description as description, "
|
||||||
final Long fundId = JdbcSupport.getLong(rs, "fundId");
|
+ "lp.principal_amount as principal, lp.currency_code as currencyCode, lp.currency_digits as currencyDigits, "
|
||||||
final String fundName = rs.getString("fundName");
|
+ "lp.nominal_interest_rate_per_period as interestRatePerPeriod, lp.interest_period_frequency_enum as interestRatePerPeriodFreq, "
|
||||||
final Long transactionStrategyId = JdbcSupport.getLong(rs, "transactionStrategyId");
|
+ "lp.annual_nominal_interest_rate as annualInterestRate, lp.interest_method_enum as interestMethod, lp.interest_calculated_in_period_enum as interestCalculationInPeriodMethod,"
|
||||||
final String transactionStrategyName = rs.getString("transactionStrategyName");
|
+ "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");
|
@Override
|
||||||
final String currencyName = rs.getString("currencyName");
|
public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
|
||||||
final String currencyNameCode = rs.getString("currencyNameCode");
|
|
||||||
final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
|
|
||||||
final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
|
|
||||||
|
|
||||||
final CurrencyData currency = new CurrencyData(currencyCode,
|
final Long id = rs.getLong("id");
|
||||||
currencyName, currencyDigits, currencyDisplaySymbol,
|
final String name = rs.getString("name");
|
||||||
currencyNameCode);
|
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 String currencyCode = rs.getString("currencyCode");
|
||||||
final BigDecimal tolerance = rs.getBigDecimal("tolerance");
|
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 CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits, currencyDisplaySymbol,
|
||||||
final Integer repaymentEvery = JdbcSupport.getInteger(rs, "repaidEvery");
|
currencyNameCode);
|
||||||
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 repaymentFrequencyTypeId = JdbcSupport.getInteger(rs, "repaymentPeriodFrequency");
|
final BigDecimal principal = rs.getBigDecimal("principal");
|
||||||
final EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeId);
|
final BigDecimal tolerance = rs.getBigDecimal("tolerance");
|
||||||
|
|
||||||
final EnumOptionData loanTermFrequencyType = LoanEnumerations.loanTermFrequencyType(repaymentFrequencyTypeId);
|
|
||||||
|
|
||||||
final int amortizationTypeId = JdbcSupport.getInteger(rs, "amortizationMethod");
|
final Integer numberOfRepayments = JdbcSupport.getInteger(rs, "numberOfRepayments");
|
||||||
final EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeId);
|
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 int repaymentFrequencyTypeId = JdbcSupport.getInteger(rs, "repaymentPeriodFrequency");
|
||||||
final EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeId);
|
final EnumOptionData repaymentFrequencyType = LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeId);
|
||||||
|
|
||||||
final int interestTypeId = JdbcSupport.getInteger(rs, "interestMethod");
|
final EnumOptionData loanTermFrequencyType = LoanEnumerations.loanTermFrequencyType(repaymentFrequencyTypeId);
|
||||||
final EnumOptionData interestType = LoanEnumerations.interestType(interestTypeId);
|
|
||||||
|
|
||||||
final int interestCalculationPeriodTypeId = JdbcSupport.getInteger(rs,"interestCalculationInPeriodMethod");
|
final int amortizationTypeId = JdbcSupport.getInteger(rs, "amortizationMethod");
|
||||||
final EnumOptionData interestCalculationPeriodType = LoanEnumerations.interestCalculationPeriodType(interestCalculationPeriodTypeId);
|
final EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeId);
|
||||||
|
|
||||||
final DateTime createdOn = JdbcSupport.getDateTime(rs, "createdon");
|
final int interestRateFrequencyTypeId = JdbcSupport.getInteger(rs, "interestRatePerPeriodFreq");
|
||||||
final DateTime lastModifedOn = JdbcSupport.getDateTime(rs, "modifiedon");
|
final EnumOptionData interestRateFrequencyType = LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeId);
|
||||||
|
|
||||||
return new LoanProductData(createdOn, lastModifedOn, id, name,
|
final int interestTypeId = JdbcSupport.getInteger(rs, "interestMethod");
|
||||||
description, currency, principal, tolerance,
|
final EnumOptionData interestType = LoanEnumerations.interestType(interestTypeId);
|
||||||
numberOfRepayments, loanTermFrequency, repaymentEvery, interestRatePerPeriod,
|
|
||||||
annualInterestRate, loanTermFrequencyType, repaymentFrequencyType,
|
|
||||||
interestRateFrequencyType, amortizationType, interestType,
|
|
||||||
interestCalculationPeriodType, fundId, fundName, transactionStrategyId, transactionStrategyName, this.charges, accountingType);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
final int interestCalculationPeriodTypeId = JdbcSupport.getInteger(rs, "interestCalculationInPeriodMethod");
|
||||||
|
final EnumOptionData interestCalculationPeriodType = LoanEnumerations
|
||||||
|
.interestCalculationPeriodType(interestCalculationPeriodTypeId);
|
||||||
|
|
||||||
private static final class LoanProductLookupMapper implements
|
return new LoanProductData(id, name, description, currency, principal, tolerance, numberOfRepayments, loanTermFrequency,
|
||||||
RowMapper<LoanProductData> {
|
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
|
private static final class LoanProductLookupMapper implements RowMapper<LoanProductData> {
|
||||||
public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
|
|
||||||
throws SQLException {
|
|
||||||
|
|
||||||
final Long id = rs.getLong("id");
|
public String schema() {
|
||||||
final String name = rs.getString("name");
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
-3
@@ -1,6 +1,5 @@
|
|||||||
package org.mifosplatform.portfolio.savingsaccount;
|
package org.mifosplatform.portfolio.savingsaccount;
|
||||||
|
|
||||||
import org.mifosplatform.portfolio.client.data.ClientData;
|
|
||||||
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
import org.mifosplatform.portfolio.group.command.GroupCommand;
|
||||||
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
|
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
|
||||||
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
|
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
|
||||||
@@ -21,8 +20,6 @@ public interface PortfolioApiDataConversionService {
|
|||||||
|
|
||||||
DepositProductCommand convertJsonToDepositProductCommand(Long resourceIdentifier, String json);
|
DepositProductCommand convertJsonToDepositProductCommand(Long resourceIdentifier, String json);
|
||||||
|
|
||||||
ClientData convertInternalJsonFormatToClientDataChange(Long clientId, String json);
|
|
||||||
|
|
||||||
GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json);
|
GroupCommand convertJsonToGroupCommand(Long resourceIdentifier, String json);
|
||||||
|
|
||||||
DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json);
|
DepositAccountCommand convertJsonToDepositAccountCommand(Long resourceIdentifier, String json);
|
||||||
|
|||||||
+54
-68
@@ -21,9 +21,6 @@ import org.mifosplatform.infrastructure.core.data.ApiParameterError;
|
|||||||
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
|
import org.mifosplatform.infrastructure.core.exception.InvalidJsonException;
|
||||||
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
import org.mifosplatform.infrastructure.core.exception.PlatformApiDataValidationException;
|
||||||
import org.mifosplatform.infrastructure.core.exception.UnsupportedParameterException;
|
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.group.command.GroupCommand;
|
||||||
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
|
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountApprovalCommand;
|
||||||
import org.mifosplatform.portfolio.savingsaccount.command.SavingAccountCommand;
|
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.DepositStateTransitionApprovalCommand;
|
||||||
import org.mifosplatform.portfolio.savingsdepositaccount.command.DepositStateTransitionCommand;
|
import org.mifosplatform.portfolio.savingsdepositaccount.command.DepositStateTransitionCommand;
|
||||||
import org.mifosplatform.portfolio.savingsdepositproduct.command.DepositProductCommand;
|
import org.mifosplatform.portfolio.savingsdepositproduct.command.DepositProductCommand;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.format.number.NumberFormatter;
|
import org.springframework.format.number.NumberFormatter;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -56,23 +52,10 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
|||||||
*/
|
*/
|
||||||
private final Gson gsonConverter;
|
private final Gson gsonConverter;
|
||||||
|
|
||||||
private final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer;
|
public PortfolioApiDataConversionServiceImpl() {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public PortfolioApiDataConversionServiceImpl(final ClientCommandFromApiJsonDeserializer clientCommandFromApiJsonDeserializer) {
|
|
||||||
this.clientCommandFromApiJsonDeserializer = clientCommandFromApiJsonDeserializer;
|
|
||||||
this.gsonConverter = new Gson();
|
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
|
@Override
|
||||||
public GroupCommand convertJsonToGroupCommand(final Long resourceIdentifier, final String json) {
|
public GroupCommand convertJsonToGroupCommand(final Long resourceIdentifier, final String json) {
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
@@ -815,9 +798,9 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
|||||||
// currencyCode, currencyDigits
|
// currencyCode, currencyDigits
|
||||||
Set<String> supportedParams = new HashSet<String>(Arrays.asList("clientId", "productId", "externalId", "currencyCode",
|
Set<String> supportedParams = new HashSet<String>(Arrays.asList("clientId", "productId", "externalId", "currencyCode",
|
||||||
"digitsAfterDecimal", "savingsDepositAmountPerPeriod", "recurringInterestRate", "savingInterestRate", "tenure",
|
"digitsAfterDecimal", "savingsDepositAmountPerPeriod", "recurringInterestRate", "savingInterestRate", "tenure",
|
||||||
"commencementDate", "locale", "dateFormat", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType",
|
"commencementDate", "locale", "dateFormat", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "tenureType",
|
||||||
"tenureType", "depositfrequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal",
|
"depositfrequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed",
|
||||||
"isPartialDepositAllowed", "depositEvery","interestPostEvery","interestPostFrequency"));
|
"depositEvery", "interestPostEvery", "interestPostFrequency"));
|
||||||
checkForUnsupportedParameters(requestMap, supportedParams);
|
checkForUnsupportedParameters(requestMap, supportedParams);
|
||||||
Set<String> modifiedParameters = new HashSet<String>();
|
Set<String> modifiedParameters = new HashSet<String>();
|
||||||
|
|
||||||
@@ -843,21 +826,20 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
|||||||
BigDecimal minimumBalanceForWithdrawal = extractBigDecimalParameter("minimumBalanceForWithdrawal", requestMap, modifiedParameters);
|
BigDecimal minimumBalanceForWithdrawal = extractBigDecimalParameter("minimumBalanceForWithdrawal", requestMap, modifiedParameters);
|
||||||
boolean isPartialDepositAllowed = extractBooleanParameter("isPartialDepositAllowed", requestMap, modifiedParameters);
|
boolean isPartialDepositAllowed = extractBooleanParameter("isPartialDepositAllowed", requestMap, modifiedParameters);
|
||||||
Integer depositEvery = extractIntegerParameter("depositEvery", requestMap, modifiedParameters);
|
Integer depositEvery = extractIntegerParameter("depositEvery", requestMap, modifiedParameters);
|
||||||
|
|
||||||
Integer interestPostEvery = extractIntegerParameter("interestPostEvery", requestMap, modifiedParameters);
|
Integer interestPostEvery = extractIntegerParameter("interestPostEvery", requestMap, modifiedParameters);
|
||||||
Integer interestPostFrequency = extractIntegerParameter("interestPostFrequency", requestMap, modifiedParameters);
|
Integer interestPostFrequency = extractIntegerParameter("interestPostFrequency", requestMap, modifiedParameters);
|
||||||
|
|
||||||
return new SavingAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId, externalId, currencyCode,
|
return new SavingAccountCommand(modifiedParameters, resourceIdentifier, clientId, productId, externalId, currencyCode,
|
||||||
digitsAfterDecimalValue, savingsDepositAmount, recurringInterestRate, savingInterestRate, tenure, commencementDate,
|
digitsAfterDecimalValue, savingsDepositAmount, recurringInterestRate, savingInterestRate, tenure, commencementDate,
|
||||||
tenureType, depositfrequency, interestType, minimumBalanceForWithdrawal, interestCalculationMethod,
|
tenureType, depositfrequency, interestType, minimumBalanceForWithdrawal, interestCalculationMethod, isLockinPeriodAllowed,
|
||||||
isLockinPeriodAllowed, isPartialDepositAllowed, lockinPeriod, lockinPeriodType, depositEvery, interestPostEvery, interestPostFrequency);
|
isPartialDepositAllowed, lockinPeriod, lockinPeriodType, depositEvery, interestPostEvery, interestPostFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SavingStateTransitionsCommand convertJsonToSavingStateTransitionCommand(Long accountId, String json) {
|
||||||
|
|
||||||
@Override
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
public SavingStateTransitionsCommand convertJsonToSavingStateTransitionCommand( Long accountId, String json) {
|
|
||||||
|
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
|
||||||
|
|
||||||
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
||||||
@@ -872,26 +854,27 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
|||||||
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
||||||
|
|
||||||
return new SavingStateTransitionsCommand(accountId, eventDate, note);
|
return new SavingStateTransitionsCommand(accountId, eventDate, note);
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public SavingAccountApprovalCommand convertJsonToSavingApprovalCommand( Long accountId, String json) {
|
|
||||||
|
@Override
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
public SavingAccountApprovalCommand convertJsonToSavingApprovalCommand(Long accountId, String json) {
|
||||||
|
|
||||||
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
|
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
||||||
|
|
||||||
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "commencementDate", "savingsDepositAmountPerPeriod",
|
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "commencementDate",
|
||||||
"minimumBalanceForWithdrawal", "recurringInterestRate", "savingInterestRate", "interestType", "tenure", "tenureType", "frequency", "payEvery", "note",
|
"savingsDepositAmountPerPeriod", "minimumBalanceForWithdrawal", "recurringInterestRate", "savingInterestRate",
|
||||||
"interestPostEvery", "interestPostFrequency"));
|
"interestType", "tenure", "tenureType", "frequency", "payEvery", "note", "interestPostEvery", "interestPostFrequency"));
|
||||||
|
|
||||||
checkForUnsupportedParameters(requestMap, supportedParams);
|
checkForUnsupportedParameters(requestMap, supportedParams);
|
||||||
Set<String> modifiedParameters = new HashSet<String>();
|
Set<String> modifiedParameters = new HashSet<String>();
|
||||||
|
|
||||||
LocalDate commencementDate = extractLocalDateParameter("commencementDate", requestMap, modifiedParameters);
|
LocalDate commencementDate = extractLocalDateParameter("commencementDate", requestMap, modifiedParameters);
|
||||||
BigDecimal savingsDepositAmountPerPeriod = extractBigDecimalParameter("savingsDepositAmountPerPeriod", requestMap, modifiedParameters);
|
BigDecimal savingsDepositAmountPerPeriod = extractBigDecimalParameter("savingsDepositAmountPerPeriod", requestMap,
|
||||||
|
modifiedParameters);
|
||||||
BigDecimal minimumBalanceForWithdrawal = extractBigDecimalParameter("minimumBalanceForWithdrawal", requestMap, modifiedParameters);
|
BigDecimal minimumBalanceForWithdrawal = extractBigDecimalParameter("minimumBalanceForWithdrawal", requestMap, modifiedParameters);
|
||||||
BigDecimal recurringInterestRate = extractBigDecimalParameter("recurringInterestRate", requestMap, modifiedParameters);
|
BigDecimal recurringInterestRate = extractBigDecimalParameter("recurringInterestRate", requestMap, modifiedParameters);
|
||||||
BigDecimal savingInterestRate = extractBigDecimalParameter("savingInterestRate", requestMap, modifiedParameters);
|
BigDecimal savingInterestRate = extractBigDecimalParameter("savingInterestRate", requestMap, modifiedParameters);
|
||||||
@@ -903,43 +886,46 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
|
|||||||
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
||||||
Integer interestPostEvery = extractIntegerParameter("interestPostEvery", requestMap, modifiedParameters);
|
Integer interestPostEvery = extractIntegerParameter("interestPostEvery", requestMap, modifiedParameters);
|
||||||
Integer interestPostFrequency = extractIntegerParameter("interestPostFrequency", requestMap, modifiedParameters);
|
Integer interestPostFrequency = extractIntegerParameter("interestPostFrequency", requestMap, modifiedParameters);
|
||||||
return new SavingAccountApprovalCommand(accountId, commencementDate, savingsDepositAmountPerPeriod, minimumBalanceForWithdrawal, recurringInterestRate,
|
return new SavingAccountApprovalCommand(accountId, commencementDate, savingsDepositAmountPerPeriod, minimumBalanceForWithdrawal,
|
||||||
savingInterestRate, interestType, tenure, tenureType, frequency, payEvery, note, interestPostEvery, interestPostFrequency);
|
recurringInterestRate, savingInterestRate, interestType, tenure, tenureType, frequency, payEvery, note, interestPostEvery,
|
||||||
}
|
interestPostFrequency);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SavingAccountDepositCommand convertJsonToSavingAccountDepositCommand(Long accountId, String json) {
|
public SavingAccountDepositCommand convertJsonToSavingAccountDepositCommand(Long accountId, String json) {
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
||||||
|
|
||||||
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "depositDate", "savingsDepositAmountPerPeriod", "note"));
|
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "depositDate",
|
||||||
|
"savingsDepositAmountPerPeriod", "note"));
|
||||||
|
|
||||||
checkForUnsupportedParameters(requestMap, supportedParams);
|
checkForUnsupportedParameters(requestMap, supportedParams);
|
||||||
Set<String> modifiedParameters = new HashSet<String>();
|
Set<String> modifiedParameters = new HashSet<String>();
|
||||||
|
|
||||||
LocalDate depositDate = extractLocalDateParameter("depositDate", requestMap, modifiedParameters);
|
LocalDate depositDate = extractLocalDateParameter("depositDate", requestMap, modifiedParameters);
|
||||||
BigDecimal savingsDepositAmountPerPeriod = extractBigDecimalParameter("savingsDepositAmountPerPeriod", requestMap, modifiedParameters);
|
BigDecimal savingsDepositAmountPerPeriod = extractBigDecimalParameter("savingsDepositAmountPerPeriod", requestMap,
|
||||||
|
modifiedParameters);
|
||||||
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
||||||
return new SavingAccountDepositCommand(accountId, savingsDepositAmountPerPeriod, depositDate, note);
|
return new SavingAccountDepositCommand(accountId, savingsDepositAmountPerPeriod, depositDate, note);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SavingAccountWithdrawalCommand convertJsonToSavingAccountWithdrawalCommand(Long accountId, String json) {
|
public SavingAccountWithdrawalCommand convertJsonToSavingAccountWithdrawalCommand(Long accountId, String json) {
|
||||||
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
|
||||||
|
|
||||||
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
|
||||||
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
Map<String, Object> requestMap = gsonConverter.fromJson(json, typeOfMap);
|
||||||
|
|
||||||
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "transactionDate", "amount", "note"));
|
Set<String> supportedParams = new HashSet<String>(Arrays.asList("locale", "dateFormat", "transactionDate", "amount", "note"));
|
||||||
|
|
||||||
checkForUnsupportedParameters(requestMap, supportedParams);
|
checkForUnsupportedParameters(requestMap, supportedParams);
|
||||||
Set<String> modifiedParameters = new HashSet<String>();
|
Set<String> modifiedParameters = new HashSet<String>();
|
||||||
|
|
||||||
LocalDate transactionDate = extractLocalDateParameter("transactionDate", requestMap, modifiedParameters);
|
LocalDate transactionDate = extractLocalDateParameter("transactionDate", requestMap, modifiedParameters);
|
||||||
BigDecimal amount = extractBigDecimalParameter("amount", requestMap, modifiedParameters);
|
BigDecimal amount = extractBigDecimalParameter("amount", requestMap, modifiedParameters);
|
||||||
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
String note = extractStringParameter("note", requestMap, modifiedParameters);
|
||||||
return new SavingAccountWithdrawalCommand(accountId, transactionDate, amount, note);
|
return new SavingAccountWithdrawalCommand(accountId, transactionDate, amount, note);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user