diff --git a/APIFolder/api.htm b/APIFolder/api.htm index 5cd85c554..8c991688e 100644 --- a/APIFolder/api.htm +++ b/APIFolder/api.htm @@ -34,9 +34,10 @@ var jqxhr = $.ajax({ if (jqXHR.status === 400) { errJSON = eval("(" + jqXHR.responseText + ')'); - var mandFields = "" + var mandFields = ""; + if (resultDiv == 'loans_mandatory') mandFields = "clientId, productId, inArrearsTolerance, submittedOnDate, "; for ( var i in errJSON.errors) { - if (i == 0) mandFields = errJSON.errors[i].parameterName; + if (i == 0) mandFields += errJSON.errors[i].parameterName; else mandFields += ", " + errJSON.errors[i].parameterName; } $('#' + resultDiv).html(mandFields); @@ -1767,19 +1768,41 @@ Request Body:
command
String Optional, case-insensitive
-
The default action is to Submit a New Loan Application. If the value is 'calculateLoanSchedule' then a new loan entry is created without entering the loan life cycle.
+
The default action is to Submit a New Loan Application ("Submitted and awaiting approval" status).
+
If "?command=calculateLoanSchedule" is added to the URL then no update is made but the loan schedule (as would have been if the loan + had been submitted) is returned. This gives the ability to try out various loan options and 'preview' the schedule before committing + to it.
POST https://thedomainname/api/v1/loans - https://localhost:8443/mifosng-provider/api/v1/loans - - - Content-Type: application/json - Request Body: - new json here + POST https://localhost:8443/mifosng-provider/api/v1/loans +Content-Type: application/json +Request Body: +{ + "clientId": 1, + "productId": 1, + "currencyCode": "USD", + "digitsAfterDecimal": "2", + "locale": "en_GB", + "principal": "100,000.00", + "inArrearsTolerance": "1,000.00", + "repaymentFrequencyType": 2, + "repaymentEvery": "1", + "numberOfRepayments": "12", + "interestRatePerPeriod": "1.75", + "interestRateFrequencyType": 2, + "amortizationType": 1, + "interestCalculationPeriodType": 1, + "interestType": 0, + "dateFormat": "dd MMMM yyyy", + "expectedDisbursementDate": "01 July 2007", + "submittedOnDate": "25 June 2007" +} - {"entityId": 2} + { + "entityId": 42 +}
@@ -1810,7 +1833,7 @@ Request Body: new json here { - "entityId": 2 +"entityId": 1 } @@ -1819,18 +1842,18 @@ Request Body:

Delete a Loan

+

+ Note: Only loans in "Submitted and awaiting approval" status can be deleted. +

DELETE https://thedomainname/api/v1/loans/{loanId} - https://localhost:8443/mifosng-provider/api/v1/loans/1 - - - Content-Type: application/json - Request Body: - new json here + DELETE https://localhost:8443/mifosng-provider/api/v1/loans/1 +Content-Type: application/json +No Request Body: { - "entityId": 2 +"entityId": 1 }
diff --git a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java index f3905999a..2db33bdd4 100644 --- a/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosng/platform/loan/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -123,7 +123,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.loanRepository.delete(loanId); - return new EntityIdentifier(clientId); + return new EntityIdentifier(loanId); } @Transactional