update api docs and comments on joda usuage in loan officer history.

This commit is contained in:
Keith Woodlock
2013-03-08 16:51:25 +00:00
parent 7ad92a0330
commit 458d2a303c
3 changed files with 676 additions and 443 deletions
+488 -268
View File
@@ -1008,13 +1008,11 @@
</tr> </tr>
<tr class="alt"> <tr class="alt">
<td>clients/template</td> <td>clients/template</td>
<td><a href="#clients_template">Retrieve Client Details <td><a href="#clients_template">Retrieve Client Details Template</a></td>
Template</a></td>
</tr> </tr>
<tr> <tr>
<td>loans/template</td> <td>loans/template?clientId={clientId}</td>
<td><a href="#loans_template">Retrieve Loan Details <td><a href="#loans_template">Retrieve Loan Details Template</a></td>
Template</a></td>
</tr> </tr>
<tr class="alt"> <tr class="alt">
<td>loans/{loanId}/transactions/template</td> <td>loans/{loanId}/transactions/template</td>
@@ -2323,15 +2321,16 @@ DELETE groups/7
<div class="method-section"> <div class="method-section">
<div class="method-description"> <div class="method-description">
<h3>Loans</h3> <h3>Loans</h3>
<p>The API concept of <b>loans</b> models the <b>loan application process</b> and the <b>loan contract/monitoring process</b>.</p>
<table class=matrixHeading> <table class=matrixHeading>
<tr class="matrixHeadingBG"> <tr class="matrixHeadingBG">
<td><div class="mifosXHeading2">Field Descriptions</div></td> <td><div class="mifosXHeading2">Field Descriptions</div></td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>principal</td> <td>accountNo</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>The amount to be provided in the loan.</td> <td class=fielddesc>The account no. associated with this loan. Is auto generated if not provided at loan application creation time.</td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>externalId</td> <td>externalId</td>
@@ -2342,6 +2341,141 @@ DELETE groups/7
it must be unique. it must be unique.
</td> </td>
</tr> </tr>
<tr class=alt>
<td>fundId</td>
</tr>
<tr>
<td class=fielddesc>Optional: For associating a loan with a given fund.</td>
</tr>
<tr class=alt>
<td>loanOfficerId</td>
</tr>
<tr>
<td class=fielddesc>Optional: For associating a loan with a given staff member who is a loan officer.</td>
</tr>
<tr class=alt>
<td>loanPurposeId</td>
</tr>
<tr>
<td class=fielddesc>Optional: For marking a loan with a given loan purpose option. Loan purposes are configurable and can be setup by system admin through code/code values screens.</td>
</tr>
<tr class=alt>
<td>currencyCode</td>
</tr>
<tr>
<td class=fielddesc>A three letter ISO code of currency.</td>
</tr>
<tr class=alt>
<td>digitsAfterDecimal</td>
</tr>
<tr>
<td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td>
</tr>
<tr class=alt>
<td>principal</td>
</tr>
<tr>
<td class=fielddesc>The loan amount to be disbursed to through loan.</td>
</tr>
<tr class=alt>
<td>loanTermFrequency</td>
</tr>
<tr>
<td class=fielddesc>The length of loan term<br> Used like:
<b>loanTermFrequency</b> loanTermFrequencyType<br> e.g. <b>12</b> Months
</td>
</tr>
<tr class=alt>
<td>loanTermFrequencyType</td>
</tr>
<tr>
<td class=fielddesc>The loan term period to use. Used like:
loanTermFrequency <b>loanTermFrequencyType</b><br> e.g. 12 <b>Months</b>
<span>Example Values:</span> 0=Days, 1=Weeks, 2=Months, 3=Years
</td>
</tr>
<tr class=alt>
<td>numberOfRepayments</td>
</tr>
<tr>
<td class=fielddesc>Number of installments to repay.<br>
Used like: <b>numberOfRepayments</b> Every <i>repaymentEvery</i>
<i>repaymentFrequencyType</i><br> e.g. <b>10</b> (repayments) Every 12 Weeks
</td>
</tr>
<tr class=alt>
<td>repaymentEvery</td>
</tr>
<tr>
<td class=fielddesc>Used like: numberOfRepayments Every
<b>repaymentEvery</b> repaymentFrequencyType<br> e.g. 10
(repayments) Every <b>12</b> Weeks
</td>
</tr>
<tr class=alt>
<td>repaymentFrequencyType</td>
</tr>
<tr>
<td class=fielddesc>Used like: <i>numberOfRepayments</i> Every
repaymentEvery <b>repaymentFrequencyType</b><br> e.g. 10
(repayments) Every 12 <b>Weeks</b> <br>
<span>Example Values:</span> 0=Days, 1=Weeks, 2=Months
</td>
</tr>
<tr class=alt>
<td>interestRatePerPeriod</td>
</tr>
<tr>
<td class=fielddesc>Interest Rate.<br> Used like:
<b>interestRatePerPeriod</b> % interestRateFrequencyType - interestType<br>
e.g. <b>12.0000</b>% Per year - Declining Balance
</td>
</tr>
<tr class=alt>
<td>interestRateFrequencyType</td>
</tr>
<tr>
<td class=fielddesc>Used like: interestRatePerPeriod%
interestRateFrequencyType - interestType<br> e.g. 12.0000%
<b>Per year</b> - Declining Balance <br>
<span>Example Values:</span> 2=Per month, 3=Per year
</td>
</tr>
<tr class=alt>
<td>expectedDisbursementDate</td>
</tr>
<tr>
<td class=fielddesc>The proposed <b>disbursement date</b> of the loan so a proposed repayment schedule can be provided.</td>
</tr>
<tr class=alt>
<td>submittedOnDate</td>
</tr>
<tr>
<td class=fielddesc>The date the <b>loan application</b> was submitted by applicant.</td>
</tr>
<tr class=alt>
<td>amortizationType</td>
</tr>
<tr>
<td class=fielddesc><span>Example Values:</span> 0=Equal
principle payments, 1=Equal installments</td>
</tr>
<tr class=alt>
<td>interestType</td>
</tr>
<tr>
<td class=fielddesc>Used like: interestRatePerPeriod%
interestRateFrequencyType - interestType<br> e.g. 12.0000%
Per year - <b>Declining Balance</b> <br>
<span>Example Values:</span> 0=Declining Balance, 1=Flat
</td>
</tr>
<tr class=alt>
<td>interestCalculationPeriodType</td>
</tr>
<tr>
<td class=fielddesc><span>Example Values:</span> 0=Daily, 1=Same as repayment period</td>
</tr>
<tr class=alt> <tr class=alt>
<td>inArrearsTolerance</td> <td>inArrearsTolerance</td>
</tr> </tr>
@@ -2353,92 +2487,21 @@ DELETE groups/7
</td> </td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>numberOfRepayments</td> <td>transactionProcessingStrategyId</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Number of installments to repay.<br> <td class=fielddesc>The type of transaction processing strategy to be used.<br>
Used like: numberOfRepayments Every repaymentEvery At present some MFI specific ones exist. This is an important point of change for many MFIs.
repaymentFrequencyType<br> e.g. <b>10</b> (repayments) <br>Responsible for things like payment order and how early or late repayments should be processed.<br>
Every 12 Weeks Out of the box, four available:
<ol>
<li>id=1, code=mifos-standard-strategy, name=Mifos style</li>
<li>id=2, code=heavensfamily-strategy, name=Heavensfamily</li>
<li>id=3, code=creocore-strategy, name=Creocore</li>
<li>id=4, code=rbi-india-strategy, name=RBI (India)</li>
</ol>
</td> </td>
</tr> </tr>
<tr class=alt>
<td>interestRatePerPeriod</td>
</tr>
<tr>
<td class=fielddesc>Interest Rate.<br> Used like:
interestRatePerPeriod% interestRateFrequencyType - interestType<br>
e.g. <b>12.0000</b>% Per year - Declining Balance
</td>
</tr>
<tr class=alt>
<td>repaymentEvery</td>
</tr>
<tr>
<td class=fielddesc>Used like: numberOfRepayments Every
repaymentEvery repaymentFrequencyType<br> e.g. 10
(repayments) Every <b>12</b> Weeks
</td>
</tr>
<tr>
<td class=fieldtype>Each of the items below has an id, code
and (english) value.<br> Only the id (integer) is used when
updating. All 3 are returned on GET (read) requests.<br>
The options are fully listed in <a href="#loanproducts_template">Retrieve
Loan Product Details Template</a>.
</td>
</tr>
<tr class=alt>
<td>repaymentFrequencyType</td>
</tr>
<tr>
<td class=fielddesc>Used like: numberOfRepayments Every
repaymentEvery repaymentFrequencyType<br> e.g. 10
(repayments) Every 12 <b>Weeks</b> <br>
<span>Example Values:</span> Days, Weeks, Months
</td>
</tr>
<tr class=alt>
<td>interestRateFrequencyType</td>
</tr>
<tr>
<td class=fielddesc>Used like: interestRatePerPeriod%
interestRateFrequencyType - interestType<br> e.g. 12.0000%
<b>Per year</b> - Declining Balance <br>
<span>Example Values:</span> Per month, Per year
</td>
</tr>
<tr class=alt>
<td>amortizationType</td>
</tr>
<tr>
<td class=fielddesc><span>Example Values:</span> Equal
principle payments, Equal installments</td>
</tr>
</td>
</tr>
<tr class=alt>
<td>interestType</td>
</tr>
<tr>
<td class=fielddesc>Used like: interestRatePerPeriod%
interestRateFrequencyType - interestType<br> e.g. 12.0000%
Per year - <b>Declining Balance</b> <br>
<span>Example Values:</span> Declining Balance, Flat
</td>
</tr>
</td>
</tr>
<tr class=alt>
<td>interestCalculationPeriodType</td>
</tr>
<tr>
<td class=fielddesc><span>Example Values:</span> Same as
repayment period, Daily</td>
</tr>
</td>
</tr>
</tr>
</table> </table>
</div> </div>
</div> </div>
@@ -2470,10 +2533,10 @@ DELETE groups/7
fields are returned.</dd> fields are returned.</dd>
</dl> </dl>
<p>Example Requests:</p> <p>Example Requests:</p>
<div class=apiClick>loans/template?clientId=1&productId=1</div>
<br>
<br>
<div class=apiClick>loans/template?clientId=1</div> <div class=apiClick>loans/template?clientId=1</div>
<br>
<br>
<div class=apiClick>loans/template?clientId=1&productId=1</div>
</div> </div>
<div class="method-example"> <div class="method-example">
<code class="method-declaration"> <code class="method-declaration">
@@ -2482,27 +2545,119 @@ GET https://DomainName/api/v1/loans/template?clientId=1
<code class="method-response"> <code class="method-response">
{ {
"clientId": 1, "clientId": 1,
"clientName": "Petra Yton", "clientName": "Kampala first Client",
"clientOfficeId": 2,
"timeline": {
"expectedDisbursementDate": [ "expectedDisbursementDate": [
2013, 2013,
2, 3,
5 8
], ]
"loanOfficerOptions": [ },
{
"id": 1,
"firstname": "John",
"lastname": "Doe",
"displayName": "Doe, John",
"officeId": 1,
"officeName": "Head Office",
"isLoanOfficer": true
}
],
"productOptions": [ "productOptions": [
{ {
"id": 1, "id": 1,
"name": "A new loan product for me" "name": "Kampala Product (with cash accounting)"
}
]
}
</code>
<code class="method-declaration">
GET https://DomainName/api/v1/loans/template?clientId=1&productId=1
</code>
<code class="method-response">
{
"clientId": 1,
"clientName": "Kampala first Client",
"clientOfficeId": 2,
"loanProductId": 1,
"loanProductName": "Kampala Product (with cash accounting)",
"loanProductDescription": "Typical Kampala loan product with cash accounting enabled for testing.",
"currency": {
"code": "UGX",
"name": "Uganda Shilling",
"decimalPlaces": 2,
"displaySymbol": "USh",
"nameCode": "currency.UGX",
"displayLabel": "Uganda Shilling (USh)"
},
"principal": 1000000,
"termFrequency": 12,
"termPeriodFrequencyType": {
"id": 2,
"code": "repaymentFrequency.periodFrequencyType.months",
"value": "Months"
},
"numberOfRepayments": 12,
"repaymentEvery": 1,
"repaymentFrequencyType": {
"id": 2,
"code": "repaymentFrequency.periodFrequencyType.months",
"value": "Months"
},
"interestRatePerPeriod": 24,
"interestRateFrequencyType": {
"id": 3,
"code": "interestRateFrequency.periodFrequencyType.years",
"value": "Per year"
},
"annualInterestRate": 24,
"amortizationType": {
"id": 1,
"code": "amortizationType.equal.installments",
"value": "Equal installments"
},
"interestType": {
"id": 1,
"code": "interestType.flat",
"value": "Flat"
},
"interestCalculationPeriodType": {
"id": 1,
"code": "interestCalculationPeriodType.same.as.repayment.period",
"value": "Same as repayment period"
},
"transactionProcessingStrategyId": 2,
"timeline": {
"expectedDisbursementDate": [
2013,
3,
8
]
},
"charges": [],
"productOptions": [
{
"id": 1,
"name": "Kampala Product (with cash accounting)"
}
],
"loanOfficerOptions": [
{
"id": 2,
"firstname": "Kampala",
"lastname": "LoanOfficer",
"displayName": "LoanOfficer, Kampala",
"officeId": 2,
"officeName": "Uganda (Kampala)",
"isLoanOfficer": true
}
],
"loanPurposeOptions": [
{
"id": 20,
"name": "option.Agriculture",
"position": 1
},
{
"id": 21,
"name": "option.Manufacturing",
"position": 20
},
{
"id": 22,
"name": "option.HousingImprovement",
"position": 21
} }
], ],
"termFrequencyTypeOptions": [ "termFrequencyTypeOptions": [
@@ -2544,28 +2699,6 @@ GET https://DomainName/api/v1/loans/template?clientId=1
"value": "Months" "value": "Months"
} }
], ],
"repaymentStrategyOptions": [
{
"id": 1,
"code": "mifos-standard-strategy",
"name": "Mifos style"
},
{
"id": 2,
"code": "heavensfamily-strategy",
"name": "Heavensfamily"
},
{
"id": 3,
"code": "creocore-strategy",
"name": "Creocore"
},
{
"id": 4,
"code": "rbi-india-strategy",
"name": "RBI (India)"
}
],
"interestRateFrequencyTypeOptions": [ "interestRateFrequencyTypeOptions": [
{ {
"id": 2, "id": 2,
@@ -2614,31 +2747,32 @@ GET https://DomainName/api/v1/loans/template?clientId=1
"value": "Same as repayment period" "value": "Same as repayment period"
} }
], ],
"fundOptions": [ "transactionProcessingStrategyOptions": [
{ {
"id": 1, "id": 2,
"name": "EU Agri Fund" "code": "heavensfamily-strategy",
"name": "Heavensfamily"
} }
], ],
"chargeOptions": [ "chargeOptions": [
{ {
"id": 1, "id": 1,
"name": "Loan service fee", "name": "Bank Fee (per installment)",
"active": true, "active": true,
"penalty": false, "penalty": false,
"currency": { "currency": {
"code": "USD", "code": "UGX",
"name": "US Dollar", "name": "Uganda Shilling",
"decimalPlaces": 2, "decimalPlaces": 2,
"displaySymbol": "$", "displaySymbol": "USh",
"nameCode": "currency.USD", "nameCode": "currency.UGX",
"displayLabel": "US Dollar ($)" "displayLabel": "Uganda Shilling (USh)"
}, },
"amount": 230.56, "amount": 1500,
"chargeTimeType": { "chargeTimeType": {
"id": 1, "id": 2,
"code": "chargeTimeType.disbursement", "code": "chargeTimeType.specifiedDueDate",
"value": "Disbursement" "value": "Specified due date"
}, },
"chargeAppliesTo": { "chargeAppliesTo": {
"id": 1, "id": 1,
@@ -2652,34 +2786,23 @@ GET https://DomainName/api/v1/loans/template?clientId=1
} }
} }
], ],
"chargeTemplate": { "loanCollateralOptions": [
"active": false,
"penalty": false,
"chargeCalculationTypeOptions": [
{ {
"id": 1, "id": 17,
"code": "chargeCalculationType.flat", "name": "option.House",
"value": "Flat" "position": 1
}, },
{ {
"id": 2, "id": 18,
"code": "chargeCalculationType.percent.of.amount", "name": "option.Television",
"value": "% Amount" "position": 17
}
],
"chargeTimeTypeOptions": [
{
"id": 1,
"code": "chargeTimeType.disbursement",
"value": "Disbursement"
}, },
{ {
"id": 2, "id": 19,
"code": "chargeTimeType.specifiedDueDate", "name": "option.Gold",
"value": "Specified due date" "position": 18
} }
] ]
}
} }
</code> </code>
</div> </div>
@@ -2745,12 +2868,12 @@ GET https://DomainName/api/v1/loans/{loanId}
"id": 1, "id": 1,
"accountNo": "000000001", "accountNo": "000000001",
"status": { "status": {
"id": 100, "id": 300,
"code": "loanStatusType.submitted.and.pending.approval", "code": "loanStatusType.active",
"value": "Submitted and pending approval", "value": "Active",
"pendingApproval": true, "pendingApproval": false,
"waitingForDisbursal": false, "waitingForDisbursal": false,
"active": false, "active": true,
"closedObligationsMet": false, "closedObligationsMet": false,
"closedWrittenOff": false, "closedWrittenOff": false,
"closedRescheduled": false, "closedRescheduled": false,
@@ -2758,19 +2881,24 @@ GET https://DomainName/api/v1/loans/{loanId}
"overpaid": false "overpaid": false
}, },
"clientId": 1, "clientId": 1,
"clientName": "Petra Yton", "clientName": "Kampala first Client",
"clientOfficeId": 1, "clientOfficeId": 2,
"loanProductId": 1, "loanProductId": 1,
"loanProductName": "A new loan product for me", "loanProductName": "Kampala Product (with cash accounting)",
"loanProductDescription": "Typical Kampala loan product with cash accounting enabled for testing.",
"loanPurposeId": 22,
"loanPurposeName": "option.HousingImprovement",
"loanOfficerId": 2,
"loanOfficerName": "LoanOfficer, Kampala",
"currency": { "currency": {
"code": "USD", "code": "UGX",
"name": "US Dollar", "name": "Uganda Shilling",
"decimalPlaces": 2, "decimalPlaces": 2,
"displaySymbol": "$", "displaySymbol": "USh",
"nameCode": "currency.USD", "nameCode": "currency.UGX",
"displayLabel": "US Dollar ($)" "displayLabel": "Uganda Shilling (USh)"
}, },
"principal": 100000, "principal": 1000000,
"termFrequency": 12, "termFrequency": 12,
"termPeriodFrequencyType": { "termPeriodFrequencyType": {
"id": 2, "id": 2,
@@ -2784,47 +2912,110 @@ GET https://DomainName/api/v1/loans/{loanId}
"code": "repaymentFrequency.periodFrequencyType.months", "code": "repaymentFrequency.periodFrequencyType.months",
"value": "Months" "value": "Months"
}, },
"transactionProcessingStrategyId": 1, "interestRatePerPeriod": 24,
"interestRateFrequencyType": {
"id": 3,
"code": "interestRateFrequency.periodFrequencyType.years",
"value": "Per year"
},
"annualInterestRate": 24,
"amortizationType": { "amortizationType": {
"id": 1, "id": 1,
"code": "amortizationType.equal.installments", "code": "amortizationType.equal.installments",
"value": "Equal installments" "value": "Equal installments"
}, },
"interestRatePerPeriod": 2,
"interestRateFrequencyType": {
"id": 2,
"code": "interestRateFrequency.periodFrequencyType.months",
"value": "Per month"
},
"annualInterestRate": 24,
"interestType": { "interestType": {
"id": 0, "id": 1,
"code": "interestType.declining.balance", "code": "interestType.flat",
"value": "Declining Balance" "value": "Flat"
}, },
"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"
}, },
"transactionProcessingStrategyId": 2,
"timeline": { "timeline": {
"submittedOnDate": [ "submittedOnDate": [
2011, 2012,
9, 4,
20 3
], ],
"submittedByUsername": "mifos", "submittedByUsername": "admin",
"submittedByFirstname": "App", "submittedByFirstname": "App",
"submittedByLastname": "Administrator", "submittedByLastname": "Administrator",
"expectedDisbursementDate": [ "approvedOnDate": [
2011,
9,
20
],
"expectedMaturityDate": [
2012, 2012,
9, 4,
20 3
],
"approvedByUsername": "admin",
"approvedByFirstname": "App",
"approvedByLastname": "Administrator",
"expectedDisbursementDate": [
2012,
4,
10
],
"actualDisbursementDate": [
2012,
4,
10
],
"disbursedByUsername": "admin",
"disbursedByFirstname": "App",
"disbursedByLastname": "Administrator",
"expectedMaturityDate": [
2013,
4,
10
]
},
"summary": {
"currency": {
"code": "UGX",
"name": "Uganda Shilling",
"decimalPlaces": 2,
"displaySymbol": "USh",
"nameCode": "currency.UGX",
"displayLabel": "Uganda Shilling (USh)"
},
"principalDisbursed": 1000000,
"principalPaid": 0,
"principalWrittenOff": 0,
"principalOutstanding": 1000000,
"principalOverdue": 833333.3,
"interestCharged": 240000,
"interestPaid": 0,
"interestWaived": 0,
"interestWrittenOff": 0,
"interestOutstanding": 240000,
"interestOverdue": 200000,
"feeChargesCharged": 18000,
"feeChargesDueAtDisbursementCharged": 0,
"feeChargesPaid": 0,
"feeChargesWaived": 0,
"feeChargesWrittenOff": 0,
"feeChargesOutstanding": 18000,
"feeChargesOverdue": 15000,
"penaltyChargesCharged": 0,
"penaltyChargesPaid": 0,
"penaltyChargesWaived": 0,
"penaltyChargesWrittenOff": 0,
"penaltyChargesOutstanding": 0,
"penaltyChargesOverdue": 0,
"totalExpectedRepayment": 1258000,
"totalRepayment": 0,
"totalExpectedCostOfLoan": 258000,
"totalCostOfLoan": 0,
"totalWaived": 0,
"totalWrittenOff": 0,
"totalOutstanding": 1258000,
"totalOverdue": 1048333.3,
"overdueSinceDate": [
2012,
5,
10
] ]
} }
} }
@@ -2879,7 +3070,6 @@ Request Body:
</code> </code>
<code class="method-response"> <code class="method-response">
{ {
"loanTermInDays": 366,
"currency": { "currency": {
"code": "UGX", "code": "UGX",
"name": "Uganda Shilling", "name": "Uganda Shilling",
@@ -2888,18 +3078,18 @@ Request Body:
"nameCode": "currency.UGX", "nameCode": "currency.UGX",
"displayLabel": "Uganda Shilling (USh)" "displayLabel": "Uganda Shilling (USh)"
}, },
"cumulativePrincipalDisbursed": 100000, "loanTermInDays": 366,
"cumulativePrincipalDue": 100000, "totalPrincipalDisbursed": 100000,
"cumulativePrincipalOutstanding": 0, "totalPrincipalExpected": 100000,
"cumulativeInterestExpected": 13471.52, "totalPrincipalPaid": 0,
"cumulativeFeeChargesToDate": 0, "totalInterestCharged": 13471.52,
"totalCostOfLoan": 13471.52, "totalFeeChargesCharged": 0,
"totalExpectedRepayment": 113471.52, "totalPenaltyChargesCharged": 0,
"totalPaidToDate": 0, "totalWaived": 0,
"totalWaivedToDate": 0, "totalWrittenOff": 0,
"totalWrittenOffToDate": 0, "totalRepaymentExpected": 113471.52,
"totalOutstanding": 113471.52, "totalRepayment": 0,
"totalInArrears": 0, "totalOutstanding": 0,
"periods": [ "periods": [
{ {
"period": 0, "period": 0,
@@ -2948,10 +3138,19 @@ Request Body:
"totalActualCostOfLoanForPeriod": 2000 "totalActualCostOfLoanForPeriod": 2000
}, },
... ...
...
{ {
"period": 12, "period": 12,
"fromDate": [2012,8,20], "fromDate": [
"dueDate": [2012,9,20], 2012,
8,
20
],
"dueDate": [
2012,
9,
20
],
"daysInPeriod": 31, "daysInPeriod": 31,
"principalOriginalDue": 9270.56, "principalOriginalDue": 9270.56,
"principalDue": 9270.56, "principalDue": 9270.56,
@@ -2988,8 +3187,8 @@ Request Body:
loanTermFrequencyType, numberOfRepayments, repaymentEvery, loanTermFrequencyType, numberOfRepayments, repaymentEvery,
repaymentFrequencyType, interestRatePerPeriod, repaymentFrequencyType, interestRatePerPeriod,
interestRateFrequencyType, amortizationType, interestType, interestRateFrequencyType, amortizationType, interestType,
interestCalculationPeriodType, expectedDisbursementDate, interestCalculationPeriodType, transactionProcessingStrategyId,
submittedOnDate, transactionProcessingStrategyId</td> expectedDisbursementDate, submittedOnDate</td>
</tr> </tr>
</table> </table>
</div> </div>
@@ -3017,9 +3216,9 @@ Request Body:
"amortizationType": 1, "amortizationType": 1,
"interestType": 0, "interestType": 0,
"interestCalculationPeriodType": 1, "interestCalculationPeriodType": 1,
"transactionProcessingStrategyId": 1,
"expectedDisbursementDate": "20 September 2011", "expectedDisbursementDate": "20 September 2011",
"submittedOnDate": "20 September 2011", "submittedOnDate": "20 September 2011"
"transactionProcessingStrategyId": 1
} }
</code> </code>
<code class="method-response"> <code class="method-response">
@@ -5263,50 +5462,54 @@ Request Body:
<p>A Loan product is a template that is used when creating a <p>A Loan product is a template that is used when creating a
loan. Much of the template definition can be overridden during loan. Much of the template definition can be overridden during
loan creation.</p> loan creation.</p>
<table class=matrixHeading> <table class=matrixHeading>
<tr class="matrixHeadingBG"> <tr class="matrixHeadingBG">
<td><div class="mifosXHeading2">Field Descriptions</div></td> <td><div class="mifosXHeading2">Field Descriptions</div></td>
</tr> </tr>
<tr class=alt>
<td>name</td>
</tr>
<tr>
<td class=fielddesc>Name associated with loan product on system.</td>
</tr>
<tr class=alt>
<td>description</td>
</tr>
<tr>
<td class=fielddesc>For providing helpful description of product offering.</td>
</tr>
<tr class=alt>
<td>fundId</td>
</tr>
<tr>
<td class=fielddesc>For associating a loan product with a given fund by default.</td>
</tr>
<tr class=alt>
<td>currencyCode</td>
</tr>
<tr>
<td class=fielddesc>A three letter ISO code of currency.</td>
</tr>
<tr class=alt> <tr class=alt>
<td>digitsAfterDecimal</td> <td>digitsAfterDecimal</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Override the currency default value for <td class=fielddesc>Override the currency default value for digitsAfterDecimal.</td>
digitsAfterDecimal.</td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>principal</td> <td>principal</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Loan amount.</td> <td class=fielddesc>The loan amount to be disbursed to through loan.</td>
</tr>
<tr class=alt>
<td>inArrearsTolerance</td>
</tr>
<tr>
<td class=fielddesc>The amount that can be 'waived' at end
of all loan payments because it is too small to worry about.<br>
This is also the tolerance amount assessed when determining if a
loan is in arrears.
</td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>numberOfRepayments</td> <td>numberOfRepayments</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Number of installments to repay.<br> <td class=fielddesc>Number of installments to repay.<br>
Used like: numberOfRepayments Every repaymentEvery Used like: <b>numberOfRepayments</b> Every <i>repaymentEvery</i>
repaymentFrequencyType<br> e.g. <b>10</b> (repayments) <i>repaymentFrequencyType</i><br> e.g. <b>10</b> (repayments) Every 12 Weeks
Every 12 Weeks
</td>
</tr>
<tr class=alt>
<td>interestRatePerPeriod</td>
</tr>
<tr>
<td class=fielddesc>Interest Rate.<br> Used like:
interestRatePerPeriod% interestRateFrequencyType - interestType<br>
e.g. <b>12.0000</b>% Per year - Declining Balance
</td> </td>
</tr> </tr>
<tr class=alt> <tr class=alt>
@@ -5314,28 +5517,29 @@ Request Body:
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Used like: numberOfRepayments Every <td class=fielddesc>Used like: numberOfRepayments Every
repaymentEvery repaymentFrequencyType<br> e.g. 10 <b>repaymentEvery</b> repaymentFrequencyType<br> e.g. 10
(repayments) Every <b>12</b> Weeks (repayments) Every <b>12</b> Weeks
</td> </td>
</tr> </tr>
<tr>
<td class=fieldtype>Each of the items below has an id, code
and (english) value.<br> Only the id (integer) is used when
updating. All 3 are returned on GET (read) requests.<br>
The options are fully listed in <a href="#loanproducts_template">Retrieve
Loan Product Details Template</a>.
</td>
</tr>
<tr class=alt> <tr class=alt>
<td>repaymentFrequencyType</td> <td>repaymentFrequencyType</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc>Used like: numberOfRepayments Every <td class=fielddesc>Used like: <i>numberOfRepayments</i> Every
repaymentEvery repaymentFrequencyType<br> e.g. 10 repaymentEvery <b>repaymentFrequencyType</b><br> e.g. 10
(repayments) Every 12 <b>Weeks</b> <br> (repayments) Every 12 <b>Weeks</b> <br>
<span>Example Values:</span> 0=Days, 1=Weeks, 2=Months <span>Example Values:</span> 0=Days, 1=Weeks, 2=Months
</td> </td>
</tr> </tr>
<tr class=alt>
<td>interestRatePerPeriod</td>
</tr>
<tr>
<td class=fielddesc>Interest Rate.<br> Used like:
<b>interestRatePerPeriod</b> % interestRateFrequencyType - interestType<br>
e.g. <b>12.0000</b>% Per year - Declining Balance
</td>
</tr>
<tr class=alt> <tr class=alt>
<td>interestRateFrequencyType</td> <td>interestRateFrequencyType</td>
</tr> </tr>
@@ -5353,8 +5557,6 @@ Request Body:
<td class=fielddesc><span>Example Values:</span> 0=Equal <td class=fielddesc><span>Example Values:</span> 0=Equal
principle payments, 1=Equal installments</td> principle payments, 1=Equal installments</td>
</tr> </tr>
</td>
</tr>
<tr class=alt> <tr class=alt>
<td>interestType</td> <td>interestType</td>
</tr> </tr>
@@ -5365,17 +5567,37 @@ Request Body:
<span>Example Values:</span> 0=Declining Balance, 1=Flat <span>Example Values:</span> 0=Declining Balance, 1=Flat
</td> </td>
</tr> </tr>
</td>
</tr>
<tr class=alt> <tr class=alt>
<td>interestCalculationPeriodType</td> <td>interestCalculationPeriodType</td>
</tr> </tr>
<tr> <tr>
<td class=fielddesc><span>Example Values:</span> 0=Daily, <td class=fielddesc><span>Example Values:</span> 0=Daily, 1=Same as repayment period</td>
1=Same as repayment period</td>
</tr> </tr>
<tr class=alt>
<td>inArrearsTolerance</td>
</tr>
<tr>
<td class=fielddesc>The amount that can be 'waived' at end
of all loan payments because it is too small to worry about.<br>
This is also the tolerance amount assessed when determining if a
loan is in arrears.
</td> </td>
</tr> </tr>
<tr class=alt>
<td>transactionProcessingStrategyId</td>
</tr>
<tr>
<td class=fielddesc>The type of transaction processing strategy to be used.<br>
At present some MFI specific ones exist. This is an important point of change for many MFIs.
<br>Responsible for things like payment order and how early or late repayments should be processed.<br>
Out of the box, four available:
<ol>
<li>id=1, code=mifos-standard-strategy, name=Mifos style</li>
<li>id=2, code=heavensfamily-strategy, name=Heavensfamily</li>
<li>id=3, code=creocore-strategy, name=Creocore</li>
<li>id=4, code=rbi-india-strategy, name=RBI (India)</li>
</ol>
</td>
</tr> </tr>
<tr class=alt> <tr class=alt>
<td>accountingRule</td> <td>accountingRule</td>
@@ -5985,7 +6207,7 @@ Request Body:
"interestCalculationPeriodType": 1, "interestCalculationPeriodType": 1,
"inArrearsTolerance": "0", "inArrearsTolerance": "0",
"transactionProcessingStrategyId": 1, "transactionProcessingStrategyId": 1,
"charges":[{"id":"1"},{"id":"1"}], "charges":[{"id":"1"}],
"accountingRule": 1 "accountingRule": 1
} }
</code> </code>
@@ -11476,13 +11698,11 @@ Content-Type: application/json
</tr> </tr>
<tr class="alt"> <tr class="alt">
<td>clients/template</td> <td>clients/template</td>
<td><a href="#clients_template">Retrieve Client Details <td><a href="#clients_template">Retrieve Client Details Template</a></td>
Template</a></td>
</tr> </tr>
<tr> <tr>
<td>loans/template</td> <td>loans/template?clientId={clientId}</td>
<td><a href="#loans_template">Retrieve Loan Details <td><a href="#loans_template">Retrieve Loan Details Template</a></td>
Template</a></td>
</tr> </tr>
<tr class="alt"> <tr class="alt">
<td>loans/{loanId}/transactions/template</td> <td>loans/{loanId}/transactions/template</td>
@@ -1238,8 +1238,7 @@ public class Loan extends AbstractPersistable<Long> {
final Money totalFeeChargesDueAtDisbursement = this.summary.getTotalFeeChargesDueAtDisbursement(loanCurrency()); final Money totalFeeChargesDueAtDisbursement = this.summary.getTotalFeeChargesDueAtDisbursement(loanCurrency());
if (totalFeeChargesDueAtDisbursement.isGreaterThanZero()) { if (totalFeeChargesDueAtDisbursement.isGreaterThanZero()) {
LoanTransaction chargesPayment = LoanTransaction.repaymentAtDisbursement(totalFeeChargesDueAtDisbursement, LoanTransaction chargesPayment = LoanTransaction.repaymentAtDisbursement(totalFeeChargesDueAtDisbursement, disbursedOn);
disbursedOn);
Money zero = Money.zero(getCurrency()); Money zero = Money.zero(getCurrency());
chargesPayment.updateComponents(zero, zero, totalFeeChargesDueAtDisbursement, zero); chargesPayment.updateComponents(zero, zero, totalFeeChargesDueAtDisbursement, zero);
chargesPayment.updateLoan(this); chargesPayment.updateLoan(this);
@@ -1324,8 +1323,8 @@ public class Loan extends AbstractPersistable<Long> {
updateLoanSummaryDerivedFields(); updateLoanSummaryDerivedFields();
} }
public LoanTransaction waiveInterest(final JsonCommand command, final LoanLifecycleStateMachine loanLifecycleStateMachine,final List<Long> existingTransactionIds, public LoanTransaction waiveInterest(final JsonCommand command, final LoanLifecycleStateMachine loanLifecycleStateMachine,
final List<Long> existingReversedTransactionIds) { final List<Long> existingTransactionIds, final List<Long> existingReversedTransactionIds) {
final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate"); final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate");
final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount"); final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount");
@@ -1702,7 +1701,8 @@ public class Loan extends AbstractPersistable<Long> {
final Money totalOutstanding = this.summary.getTotalOutstanding(loanCurrency()); final Money totalOutstanding = this.summary.getTotalOutstanding(loanCurrency());
if (totalOutstanding.isGreaterThanZero() && getInArrearsTolerance().isGreaterThanOrEqualTo(totalOutstanding)) { if (totalOutstanding.isGreaterThanZero() && getInArrearsTolerance().isGreaterThanOrEqualTo(totalOutstanding)) {
final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.REPAID_IN_FULL, LoanStatus.fromInt(this.loanStatus)); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.REPAID_IN_FULL,
LoanStatus.fromInt(this.loanStatus));
if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) { if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) {
this.loanStatus = statusEnum.getValue(); this.loanStatus = statusEnum.getValue();
changes.put("status", LoanEnumerations.status(this.loanStatus)); changes.put("status", LoanEnumerations.status(this.loanStatus));
@@ -1727,7 +1727,8 @@ public class Loan extends AbstractPersistable<Long> {
updateLoanSummaryDerivedFields(); updateLoanSummaryDerivedFields();
} else if (totalOutstanding.isGreaterThanZero()) { } else if (totalOutstanding.isGreaterThanZero()) {
final String errorMessage = "A loan with money outstanding cannot be closed"; final String errorMessage = "A loan with money outstanding cannot be closed";
throw new InvalidLoanStateTransitionException("close", "loan.has.money.outstanding", errorMessage, totalOutstanding.toString()); throw new InvalidLoanStateTransitionException("close", "loan.has.money.outstanding", errorMessage,
totalOutstanding.toString());
} }
} }
@@ -1737,7 +1738,8 @@ public class Loan extends AbstractPersistable<Long> {
// TODO - KW - technically should set somewhere that this loan // TODO - KW - technically should set somewhere that this loan
// has // has
// 'overpaid' amount // 'overpaid' amount
final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.REPAID_IN_FULL, LoanStatus.fromInt(this.loanStatus)); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.REPAID_IN_FULL,
LoanStatus.fromInt(this.loanStatus));
if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) { if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) {
this.loanStatus = statusEnum.getValue(); this.loanStatus = statusEnum.getValue();
changes.put("status", LoanEnumerations.status(this.loanStatus)); changes.put("status", LoanEnumerations.status(this.loanStatus));
@@ -1975,14 +1977,22 @@ public class Loan extends AbstractPersistable<Long> {
// assignment date should not be less than loan submitted date // assignment date should not be less than loan submitted date
if (getSubmittedOnDate().isAfter(assignmentDate)) { if (getSubmittedOnDate().isAfter(assignmentDate)) {
final String errorMessage = "The Loan Officer assignment date (" + assignmentDate.toString() + ") cannot be before loan submitted date (" + getSubmittedOnDate().toString() + ")."; final String errorMessage = "The Loan Officer assignment date (" + assignmentDate.toString()
throw new LoanOfficerAssignmentDateException("cannot.be.before.loan.submittal.date", errorMessage, assignmentDate, getSubmittedOnDate()); + ") cannot be before loan submitted date (" + getSubmittedOnDate().toString() + ").";
throw new LoanOfficerAssignmentDateException("cannot.be.before.loan.submittal.date", errorMessage, assignmentDate,
getSubmittedOnDate());
// assignment date should not be less than latest unassignment date // assignment date should not be less than latest unassignment date
// FIXME - rather then fetching the data from the object all the
// time e.g
// getEndDate() and asking questions of it - move the operation to
// the object e.g. obj.isEndDateAfter(date)
} else if (lastAssignmentRecordWithNoEndDate != null && lastAssignmentRecordWithNoEndDate.getEndDate() != null } else if (lastAssignmentRecordWithNoEndDate != null && lastAssignmentRecordWithNoEndDate.getEndDate() != null
&& lastAssignmentRecordWithNoEndDate.getEndDate().isAfter(assignmentDate)) { && lastAssignmentRecordWithNoEndDate.getEndDate().isAfter(assignmentDate)) {
final String errorMessage = "The Loan Officer assignment date (" + assignmentDate + ") cannot be before previous Loan Officer unassigned date (" + lastAssignmentRecordWithNoEndDate.getEndDate() + ")."; final String errorMessage = "The Loan Officer assignment date (" + assignmentDate
throw new LoanOfficerAssignmentDateException("cannot.be.before.previous.unassignement.date", errorMessage, assignmentDate, lastAssignmentRecordWithNoEndDate.getEndDate()); + ") cannot be before previous Loan Officer unassigned date (" + lastAssignmentRecordWithNoEndDate.getEndDate() + ").";
throw new LoanOfficerAssignmentDateException("cannot.be.before.previous.unassignement.date", errorMessage, assignmentDate,
lastAssignmentRecordWithNoEndDate.getEndDate());
// assignment date should not be in the future // assignment date should not be in the future
} else if (DateUtils.getLocalDateOfTenant().isBefore(assignmentDate)) { } else if (DateUtils.getLocalDateOfTenant().isBefore(assignmentDate)) {
@@ -5,10 +5,7 @@
*/ */
package org.mifosplatform.portfolio.loanaccount.domain; package org.mifosplatform.portfolio.loanaccount.domain;
import org.joda.time.LocalDate; import java.util.Date;
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
import org.mifosplatform.organisation.staff.domain.Staff;
import org.mifosplatform.useradministration.domain.AppUser;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
@@ -17,7 +14,11 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import java.util.Date;
import org.joda.time.LocalDate;
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom;
import org.mifosplatform.organisation.staff.domain.Staff;
import org.mifosplatform.useradministration.domain.AppUser;
@Entity @Entity
@Table(name = "m_loan_officer_assignment_history") @Table(name = "m_loan_officer_assignment_history")
@@ -56,15 +57,15 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom<AppUse
this.endDate = endDate; this.endDate = endDate;
} }
public void updateLoanOfficer(Staff loanOfficer) { public void updateLoanOfficer(final Staff loanOfficer) {
this.loanOfficer = loanOfficer; this.loanOfficer = loanOfficer;
} }
public void updateStartDate(LocalDate startDate) { public void updateStartDate(final LocalDate startDate) {
this.startDate = startDate.toDate(); this.startDate = startDate.toDate();
} }
public void updateEndDate(LocalDate endDate) { public void updateEndDate(final LocalDate endDate) {
this.endDate = endDate.toDate(); this.endDate = endDate.toDate();
} }
@@ -85,6 +86,8 @@ public class LoanOfficerAssignmentHistory extends AbstractAuditableCustom<AppUse
} }
public LocalDate getEndDate() { public LocalDate getEndDate() {
// FIXME - new LocalDate(null) will return todays date and endDate is
// likely to be null so you need to test for it.
return new LocalDate(endDate); return new LocalDate(endDate);
} }
} }