diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 2b85eda6e..1b7b3b4b1 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -348,7 +348,7 @@ - LOAN + Loans loans?calculateLoanSchedule Calculate Loan Repayment Schedule @@ -369,9 +369,9 @@ Retrieve a Loan - Delete a Loan + Delete a Loan Application - + loans/{loanId}?command=approve Approve Loan Application @@ -387,7 +387,7 @@ - + loans/{loanId}?command=reject Reject Loan Application @@ -403,7 +403,7 @@ - + loans/{loanId}?command=disburse Disburse Loan @@ -419,11 +419,18 @@ + + Loan Transactions + loans/{loanId}/transactions?command=repayment + Enter a repayment + + + + - loans/{loanId}/transactions - Make a Repayment / - Loan Waiver + loans/{loanId}/transactions?command=waiveInterest + Waive Interest @@ -431,33 +438,18 @@ loans/{loanId}/transactions/{transactionId} - Adjust a - Repayment or Waiver - Retrieve a - Repayment or Waiver Details + + Retrieve a transactions details - - Guarantors - loans/{loanId}/guarantors - Create a Guarantor - - List Guarantors - + + + loans/{loanId}/transactions/{transactionId} + Adjust a Transaction - - - loans/{loanId}/guarantors/{guarantorId} - - Retrieve a Guarantor - - Update a Guarantor - - Delete a Guarantor - @@ -1027,8 +1019,7 @@ loans/{loanId}/transactions/template - Retrieve - Loan Repayment/Loan Waiver Template + Retrieve Loan Transaction Template offices/template @@ -2459,7 +2450,6 @@ DELETE groups/7 -  
@@ -2584,7 +2574,6 @@ DELETE groups/7
-  
@@ -3175,7 +3164,6 @@ Request Body:
-  
@@ -3490,7 +3478,7 @@ Content-Type: application/json  
-

Delete a Loan

+

Delete a Loan Application

Note: Only loans in "Submitted and awaiting approval" status can be deleted. @@ -3516,11 +3504,37 @@ No Request Body:

+ +   +
+
+

Loan Transactions

+

Capabilities include loan repayment's, interest waivers and the ability to 'adjust' an existing transaction. An 'adjust'ment of a transaction is really a 'reversal' of existing transaction followed by creation of a new transaction with the provided details.

+ + + + + + + + + + + + + + + + +
Field Descriptions
transactionAmount
The amount of the transaction.
transactionDate
The date of the transaction.
+
+
+  
-

Retrieve Loan Repayment/Loan Waiver Template

+

Retrieve Loan Transaction Template

This is a convenience resource. It can be useful when building maintenance user interface screens for client applications. The template data returned consists of any or all @@ -3582,47 +3596,91 @@ GET https://DomainName/api/v1/loans/{loanId}/transactions/template"

-   + +  
-

Make a Repayment / Loan Waiver

-
-
command
-
- String Optional, case-insensitive -
-
'repayment' : Make Loan Repayment.
-
'waiver' : Loan Waiver.
-
+

Make a Repayment

-POST https://DomainName/api/v1/loans/{loanId}/transactions +POST https://DomainName/api/v1/loans/{loanId}/transactions?command=repayment -POST loans/1/transactions?command=repayment -Content-Type: application/json +POST loans/5/transactions?command=repayment +Content-Type: application/json Request Body: { + "locale": "en_GB", + "dateFormat": "dd MMMM yyyy", + "transactionDate": "14 May 2012", + "transactionAmount": "559.88", + "note": "Optional note related to the transaction." +} + + +{ + "officeId": 1, + "clientId": 1, + "loanId": 5, + "resourceId": 3, + "changes": { + "transactionDate": "14 May 2012", + "transactionAmount": "559.88", "locale": "en_GB", "dateFormat": "dd MMMM yyyy", - "transactionDate": "14 May 2012", - "transactionAmount": "559.88", - "note": "Repayment at branch" + "note": "Optional note related to the transaction." + } } - { "resourceId": 37 }
-   +  
-

Retrieve a Repayment or Waiver Details

+

Waive Interest

+
+
+ +POST https://DomainName/api/v1/loans/{loanId}/transactions?command=waiveInterest + + +POST loans/5/transactions?command=waiveInterest +Content-Type: application/json +Request Body: +{ + "locale": "en_GB", + "dateFormat": "dd MMMM yyyy", + "transactionDate": "14 May 2012", + "transactionAmount": "400", + "note": "Optional note related to the waiving of interest." +} + + +{ + "officeId": 1, + "clientId": 1, + "loanId": 5, + "resourceId": 5, + "changes": { + "transactionDate": "14 May 2012", + "transactionAmount": "400", + "locale": "en_GB", + "dateFormat": "dd MMMM yyyy", + "note": "Optional note related to the interest waiver." + } +} + +
+
+ +   +
+
+

Retrieve a Transaction Details

Example Request:

-
loans/1/transactions/2
+
loans/5/transactions/3
@@ -3630,37 +3688,45 @@ GET https://DomainName/api/v1/loans/{loanId}/transactions/{transactionId} { - "id": 10, - "date": [ - 2009, - 1, - 29 - ], - "total": { - "currencyCode": "XOF", - "digitsAfterDecimal": 0, - "amount": 300000, - "defaultName": "CFA Franc BCEAO", - "nameCode": "currency.XOF", - "displaySymbol": "CFA", - "zero": false, - "greaterThanZero": true, - "displaySymbolValue": "300000 CFA" - }, - "transactionOffsetFromToday": -1218 + "id": 3, + "type": { + "id": 2, + "code": "loanTransactionType.repayment", + "value": "Repayment", + "disbursement": false, + "repaymentAtDisbursement": false, + "repayment": true, + "contra": false, + "waiveInterest": false, + "waiveCharges": false, + "writeOff": false, + "recoveryRepayment": false + }, + "date": [ + 2012, + 5, + 14 + ], + "currency": { + "code": "USD", + "name": "US Dollar", + "decimalPlaces": 2, + "displaySymbol": "$", + "nameCode": "currency.USD", + "displayLabel": "US Dollar ($)" + }, + "amount": 559.88, + "interestPortion": 559.88 }
-   + +  
-

Adjust a Repayment or Waiver

-

- Note: there is no need to specify command={transactionType} - parameter. -

+

Adjust a Transaction

+

Note: there is no need to specify command={transactionType} parameter.

@@ -3683,15 +3749,267 @@ Request Body: "dateFormat": "dd MMMM yyyy", "transactionDate": "25 May 2012", "transactionAmount": "50,000.00", - "note": "adj note" + "note": "An optional note about why your adjusting or changing the transaction." } - { "resourceId": 16 } +{ + "resourceId": 16 +} + +   +
+
+

Loan Charges

+

Loan charges can be fees or penalities. They can be defined using the charges api and associated with loan products.

+

+
Mandatory Fields
+ + + + + + + + + + + + + + + + + + + + + +
Field Descriptions
chargeId
The id of the charge definition.
amount
The flat amount or percenatge amount of the charge. (depending on its type)
dueDate
The date the loan charge is due for collection. Relevant for charges defined as specified due date.
+
+
+ +   +
+
+

Retrieve Loan Charge Template

+

This is a convenience resource. It can be useful when + building maintenance user interface screens for client + applications. The template data returned consists of any or all + of: +

    +
  • Field Defaults
  • +
  • Allowed Value Lists
  • +
+

+

Example Request:

+
loans/1/charges/template
+
+
+ +GET https://DomainName/api/v1/loans/{loanId}/charges/template + + +{ + { + "amountPaid": 0, + "amountWaived": 0, + "amountWrittenOff": 0, + "chargeOptions": [ + { + "id": 1, + "name": "Bank Fee (per installment)", + "active": true, + "penalty": false, + "currency": { + "code": "UGX", + "name": "Uganda Shilling", + "decimalPlaces": 2, + "displaySymbol": "USh", + "nameCode": "currency.UGX", + "displayLabel": "Uganda Shilling (USh)" + }, + "amount": 1500, + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "chargeAppliesTo": { + "id": 1, + "code": "chargeAppliesTo.loan", + "value": "Loan" + }, + "chargeCalculationType": { + "id": 1, + "code": "chargeCalculationType.flat", + "value": "Flat" + } + } + ], + "penalty": false +} +} + +
+
+ +   +
+
+

Create a Loan Charge

+ + + + + + + +
Mandatory Fields
chargeId, amount, dueDate (depending on chargeTimeType of charge definition)
+
+
+ +POST https://DomainName/api/v1//loans/{loanId}/charges + + +POST /loans/1/charges +Content-Type: application/json +Request Body: +{ + "locale": "en", + "dateFormat": "dd MMMM yyyy", + "chargeId": 1, + "amount": "333", + "dueDate": "21 November 2011" +} + + +{ + "officeId": 1, + "clientId": 1, + "loanId": 1, + "resourceId": 14 +} + +
+
+ +   +
+
+

Update a Loan Charge

+
+
+ +PUT https://DomainName/api/v1//loans/{loanId}/charges/{loanChargeId} + + +PUT /loans/1/charges/14 +Content-Type: application/json +Request Body: +{ + "locale": "en", + "amount": "650" +} + + +{ + "officeId": 1, + "clientId": 1, + "loanId": 1, + "resourceId": 14, + "changes": { + "amount": 650, + "locale": "en" + } +} + +
+
+ +   +
+
+

Delete a Loan Charge

+
+
+ +DELETE https://DomainName/api/v1//loans/{loanId}/charges/{loanChargeId} + + +DELETE /loans/1/charges/14 +Content-Type: application/json + + +{ + "officeId": 1, + "clientId": 1, + "loanId": 1, + "resourceId": 14 +} + +
+
+ +   +
+
+

Retrieve a Loan Charge

+
+
+ +GET https://DomainName/api/v1//loans/{loanId}/charges/{loanChargeId} + + +GET /loans/1/charges/1 +Content-Type: application/json + + +{ + "id": 14, + "chargeId": 1, + "name": "Bank Fee (per installment)", + "chargeTimeType": { + "id": 2, + "code": "chargeTimeType.specifiedDueDate", + "value": "Specified due date" + }, + "dueDate": [ + 2011, + 11, + 21 + ], + "chargeCalculationType": { + "id": 1, + "code": "chargeCalculationType.flat", + "value": "Flat" + }, + "percentage": 0, + "amountPercentageAppliedTo": 0, + "currency": { + "code": "UGX", + "name": "Uganda Shilling", + "decimalPlaces": 2, + "displaySymbol": "USh", + "nameCode": "currency.UGX", + "displayLabel": "Uganda Shilling (USh)" + }, + "amount": 650, + "amountPaid": 0, + "amountWaived": 0, + "amountWrittenOff": 0, + "amountOutstanding": 650, + "amountOrPercentage": 650, + "penalty": false +} + +
+
+  
@@ -10526,8 +10844,7 @@ Content-Type: application/json
POST
-
create/complex - update
+
create/complex update
@@ -10556,7 +10873,7 @@ Content-Type: application/json
- CLIENT + Clients clients Create a Client List Clients @@ -10596,15 +10913,16 @@ Content-Type: application/json Update a Client Note + - LOAN + Loans loans?calculateLoanSchedule Calculate Loan Repayment Schedule - + loans Submit a new Loan Application @@ -10618,9 +10936,9 @@ Content-Type: application/json Retrieve a Loan - Delete a Loan + Delete a Loan Application - + loans/{loanId}?command=approve Approve Loan Application @@ -10636,7 +10954,7 @@ Content-Type: application/json - + loans/{loanId}?command=reject Reject Loan Application @@ -10652,7 +10970,7 @@ Content-Type: application/json - + loans/{loanId}?command=disburse Disburse Loan @@ -10668,11 +10986,18 @@ Content-Type: application/json + + Loan Transactions + loans/{loanId}/transactions?command=repayment + Enter a repayment + + + + - loans/{loanId}/transactions - Make a Repayment / Loan - Waiver + loans/{loanId}/transactions?command=waiveInterest + Waive Interest @@ -10680,13 +11005,54 @@ Content-Type: application/json loans/{loanId}/transactions/{transactionId} - Adjust a - Repayment or Waiver - Retrieve a - Repayment or Waiver Details + + Retrieve a transactions details + + + loans/{loanId}/transactions/{transactionId} + Adjust a Transaction + + + + + + Loan Charges + loans/{loanId}/charges + Add a loan charge + + + + + + + loans/{loanId}/charges/{loanChargeId} + + Retrieve a Loan Charge + Modify a Loan Charge + Delete a Loan Charge + + + Loan Guarantors + loans/{loanId}/guarantors + Create a Guarantor + + List Guarantors + + + + + + + loans/{loanId}/guarantors/{guarantorId} + + Retrieve a Guarantor + Update a Guarantor + Delete a Guarantor + + OFFICE offices @@ -10957,8 +11323,7 @@ Content-Type: application/json loans/{loanId}/transactions/template - Retrieve Loan - Repayment/Loan Waiver Template + Retrieve Tranaction Template offices/template diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java index 73dc6e03b..ee4fb02a9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java @@ -81,7 +81,7 @@ public class LoanChargesApiResource { @Path("template") @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) - public String retrieveNewLoanChargeDetails(@Context final UriInfo uriInfo) { + public String retrieveTemplate(@Context final UriInfo uriInfo) { context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);