diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index 7102c41b4..781539785 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -470,6 +470,22 @@
Loan charges can be fees or penalities. They can be defined using the charges api and associated with loan products.
- -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. | -
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: -
Example Request:
-
-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
-}
-}
-
- 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
-}
-
-
-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 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
-}
-
-
-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
-}
-
- Its typical for MFIs to add extra costs for their loan products. They + can be either Fees or Penalties.
+Loan Charges are instances of Charges and + represent either fees and penalties for loan products. Refer Charges + for documentation of the various properties of a charge, Only additional properties ( + specific to the context of a Charge being associated with a Loan) are + described here
+Field Descriptions |
+
| amountPaid | +
| The Total amount which has been paid for this Charge + | +
| amountWaived | +
| The Total amount that has been waived for this Charge + | +
| amountWrittenOff | +
| Total amount written off from this Charge + | +
| amountOutstanding | +
| The Total outstanding amount for this Charge + | +
Example Requests:
+
+GET https://DomainName/api/v1/loans/{loanId}/charges
+
+
+[
+ {
+ "id": 1,
+ "chargeId": 1,
+ "name": "Loan Processing fee",
+ "chargeTimeType": {
+ "id": 1,
+ "code": "chargeTimeType.disbursement",
+ "value": "Disbursement"
+ },
+ "chargeCalculationType": {
+ "id": 1,
+ "code": "chargeCalculationType.flat",
+ "value": "Flat"
+ },
+ "percentage": 0,
+ "amountPercentageAppliedTo": 0,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 100,
+ "amountPaid": 0,
+ "amountWaived": 0,
+ "amountWrittenOff": 0,
+ "amountOutstanding": 100,
+ "amountOrPercentage": 100,
+ "penalty": false
+ },
+ {
+ "id": 7,
+ "chargeId": 2,
+ "name": "Collection Fee",
+ "chargeTimeType": {
+ "id": 2,
+ "code": "chargeTimeType.specifiedDueDate",
+ "value": "Specified due date"
+ },
+ "dueDate": [
+ 2013,
+ 3,
+ 29
+ ],
+ "chargeCalculationType": {
+ "id": 1,
+ "code": "chargeCalculationType.flat",
+ "value": "Flat"
+ },
+ "percentage": 0,
+ "amountPercentageAppliedTo": 0,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 100,
+ "amountPaid": 0,
+ "amountWaived": 0,
+ "amountWrittenOff": 0,
+ "amountOutstanding": 100,
+ "amountOrPercentage": 100,
+ "penalty": false
+ }
+]
+
+ 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: +
Example Request:
+
+GET https://DomainName/api/v1/loans/{loanId}/charges/template
+
+
+{
+ "amountPaid": 0,
+ "amountWaived": 0,
+ "amountWrittenOff": 0,
+ "chargeOptions": [
+ {
+ "id": 2,
+ "name": "Collection Fee",
+ "active": true,
+ "penalty": false,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 100,
+ "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"
+ }
+ },
+ {
+ "id": 3,
+ "name": "Late payment penalty",
+ "active": true,
+ "penalty": true,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 1,
+ "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"
+ }
+ },
+ {
+ "id": 1,
+ "name": "Loan Processing fee",
+ "active": true,
+ "penalty": false,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 100,
+ "chargeTimeType": {
+ "id": 1,
+ "code": "chargeTimeType.disbursement",
+ "value": "Disbursement"
+ },
+ "chargeAppliesTo": {
+ "id": 1,
+ "code": "chargeAppliesTo.loan",
+ "value": "Loan"
+ },
+ "chargeCalculationType": {
+ "id": 1,
+ "code": "chargeCalculationType.flat",
+ "value": "Flat"
+ }
+ }
+ ],
+ "penalty": false
+}
+
+ Example Requests:
+
+GET https://DomainName/api/v1/loans/{loanId}/charges/{chargeId}
+
+
+{
+ "id": 1,
+ "chargeId": 1,
+ "name": "Loan Processing fee",
+ "chargeTimeType": {
+ "id": 1,
+ "code": "chargeTimeType.disbursement",
+ "value": "Disbursement"
+ },
+ "chargeCalculationType": {
+ "id": 1,
+ "code": "chargeCalculationType.flat",
+ "value": "Flat"
+ },
+ "percentage": 0,
+ "amountPercentageAppliedTo": 0,
+ "currency": {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ },
+ "amount": 100,
+ "amountPaid": 0,
+ "amountWaived": 0,
+ "amountWrittenOff": 0,
+ "amountOutstanding": 100,
+ "amountOrPercentage": 100,
+ "penalty": false
+}
+ Mandatory Fields
+ for Loan Charges |
+
| chargeId, amount, dueDate | +
+POST https://DomainName/api/v1/loans/{loanId}/charges
+
+
+POST /loans/1/charges
+Content-Type: application/json
+Request Body:
+{
+ "chargeId": "2",
+ "locale": "en",
+ "amount": "100",
+ "dateFormat": "dd MMMM yyyy",
+ "dueDate": "29 April 2013"
+}
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "loanId": 1,
+ "resourceId": 31
+}
+
+ Currently Loan Charges may be updated only if the Loan + is not yet approved +
+
+PUT https://DomainName/api/v1/loans/{loanId}/charges/{chargeId}
+
+
+PUT loans/1/charges/12
+Content-Type: application/json
+Request Body:
+{
+ "dateFormat": "dd MMMM yyyy",
+ "locale": "en",
+ "amount": "60",
+ "dueDate": "27 March 2013"
+}
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "loanId": 1,
+ "resourceId": 6,
+ "changes": {
+ "dueDate": "27 March 2013",
+ "dateFormat": "dd MMMM yyyy",
+ "locale": "en",
+ "amount": 60.0
+ }
+}
+
+ + Note:Currently, A Loan Charge may only be removed from Loans that are not + yet approved. +
+
+DELETE https://DomainName/api/v1/loans/{loanId}/charges/{chargeId}
+
+
+DELETE loans/1/charges/2
+Content-Type: application/json
+No Request Body:
+
+
+{
+ "officeId": 1,
+ "clientId": 1,
+ "loanId": 1,
+ "resourceId": 2
+}
+
+ Allows you to model staff members. At present the key role - of signifigance is whether this staff member is a loan officer or + of significance is whether this staff member is a loan officer or not.
- Its typical for MFIs to add extra costs to their financial - products. There are typically Fees or Penalites. + Its typical for MFIs to add extra costs for their financial + products. There are typically Fees or Penalties.
-Charges is what we use to model both fees and penalities. +
Charges is what we use to model both fees and penalties. For now charges can only be associated with loan products / loans.
+Field Descriptions |
+
| name | +
| Name associated with this charge. | +
| active | +
| Boolean flag determines if the Charge is currently active. | +
| penalty | +
| Boolean flag determines if the Charge is a penalty. | +
| currency | +
| Details of the currency associated with this charge. + Refer Charges Template for additional details | +
| amount | +
| Field holds the details of the actual amount to be collected + in the case of "Flat Charges" or the percentage amount to be collected in + case of "Percentage Amount Charges". Refer Charges Template + for details of the Available Charge Types | +
| chargeTimeType | +
| The time at which the charge becomes Due. + Refer Charges Template for additional details | +
| chargeAppliesTo | +
| The Entity for which the charge can be applied (Loans etc). + Refer Charges Template for additional details | +
| chargeCalculationType | +
| Rules for calculating the amount for a particular Charge. + Refer Charges Template for additional details | +
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: +
Example Request:
+
+GET https://DomainName/api/v1/charges/template
+
+
+{
+ "active": false,
+ "penalty": false,
+ "currencyOptions":
+ [
+ {
+ "code": "USD",
+ "name": "US Dollar",
+ "decimalPlaces": 2,
+ "displaySymbol": "$",
+ "nameCode": "currency.USD",
+ "displayLabel": "US Dollar ($)"
+ }
+ ],
+ "chargeCalculationTypeOptions":
+ [
+ {
+ "id": 1,
+ "code": "chargeCalculationType.flat",
+ "value": "Flat"
+ },
+ {
+ "id": 2,
+ "code": "chargeCalculationType.percent.of.amount",
+ "value": "% Amount"
+ }
+ ],
+ "chargeAppliesToOptions":
+ [
+ {
+ "id": 1,
+ "code": "chargeAppliesTo.loan",
+ "value": "Loan"
+ }
+ ],
+ "chargeTimeTypeOptions":
+ [
+ {
+ "id": 1,
+ "code": "chargeTimeType.disbursement",
+ "value": "Disbursement"
+ },
+ {
+ "id": 2,
+ "code": "chargeTimeType.specifiedDueDate",
+ "value": "Specified due date"
+ }
+ ]
+}
+
+ { "resourceId": 1 }
+
+{
+ "resourceId": 1
+}
+
+
+POST charges
+Content-Type: application/json
+Request Body:
+{
+ "locale": "en",
+ "name": "Default Penalty",
+ "amount": "2",
+ "currencyCode": "USD",
+ "chargeAppliesTo": "1",
+ "chargeTimeType": "2",
+ "chargeCalculationType": "2",
+ "active": "true",
+ "penalty": "true"
+}
+
+
+{
+ "resourceId": 4
+}
+
An MFIs savings product offerings are modelled using this API.
-When creating savings accounts, the details from the savings product are used to autofill details of savings account.
+An MFIs savings product offerings are modeled using this API.
+When creating savings accounts, the details from the savings product are used to auto fill details of savings account.
Field Descriptions | ||||||
| A description of the product offering. | ||||||
| currencyCode | ||||||
| Three letter ISO code reprsenting currency. | ||||||
| Three letter ISO code representing currency. | ||||||
| digitsAfterDecimal | ||||||
| Override the currency default value for digitsAfterDecimal. | ||||||
| Loan Charges | loans/{loanId}/charges | -Add a loan charge | +Add a Loan Charge | 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 ee4fb02a9..a0734d319 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 @@ -77,6 +77,19 @@ public class LoanChargesApiResource { return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); } + @GET + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + public String retrieveAllLoanCharges(@PathParam("loanId") final Long loanId, @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions); + + final Collection |