Funding Loan Applications
Description
This method funds a loan application. As a part of funding, it disburses the associated loan, and creates corresponding investment orders for bookings that are associated with the loan application. The status of the Loan Application is changed to Funded. Also, the status of the corresponding loan account changes to Active-Good Standing.
In CL Marketplace versions prior to 2.4010, only loan distribution transactions are created while funding the loan application, whereas if the disbursal occurs through CL Loan, all amounts are included in the disbursal distributions, for example, any pre-paid fees applicable on the contract. In CL Marketplace 2.4010 and later releases, the behavior is consistent with CL Loan's disbursal action behavior.
For more information, refer to Disbursement.
Definition
POST https://<domain>/services/apexrest/peer/v1/loanApplications/fund/*
Parameters
The table given below provides details of the request parameters used by this web service:
Fields | Type | Description |
---|---|---|
loanAppId* |
String |
|
amount |
Decimal |
|
fundingDate |
Date |
|
disbursalDate |
Date |
|
term |
Integer |
|
interestRate |
Decimal |
|
firstRepaymentDate |
Date |
|
accountId |
String |
|
sms_Token |
String |
|
sms_Unique_Id |
String |
|
ipaddress |
String |
|
Error messages
When you post a web service, you can receive the possible error messages as shown in the table below:
Error Code |
Error Message |
System.Label |
Reason |
HTTP Status Code |
---|---|---|---|---|
INVALID_INPUT |
Unable to parse the Request parameters |
UNABLE_PARSE_REQ_PARAMS |
You will receive this error if the error occurs while parsing request parameters. |
400 |
INVALID_INPUT |
Loan Application Id is null |
LOAN_APPLICATION_ID_NULL |
You will receive this error if the loan Application Id (loanAppId) is not specified in the URL. |
400 |
INVALID_INPUT |
Unable to find the Loan Application |
LOAN_APPLICATION _NOT_FOUND |
You will receive this error if no record exists in the system for the Loan Application Id (loanAppId) specified in the URL. |
400 |
SMS_ERROR |
SMS Parameters are not provided |
NO_PARAMS_SMS |
You will receive this error if the parameters required for SMS verification are not specified in the request parameters. |
401 |
SMS_ERROR |
SMS verification failed. |
INCORRECT_SMS |
You will receive this error if the SMS verification has failed. |
401 |
SMS_ERROR |
SMS has been resent maximum allowed times |
MAX_RETRY_SMS |
You will receive this error if the maximum limit of SMS retries has been reached. |
401 |
SMS_ERROR |
SMS has already been verified |
VERIFIED_SMS |
You will receive this error if the SMS has been verified already. |
401 |
SMS_ERROR |
SMS verification has been timed out |
TIMEOUT_SMS |
You will receive this error if the SMS has timed out. |
401 |
API_EXCEPTION |
Loan Application cannot be funded |
CANNOT_FUND_LOAN_APP |
You will receive this error if the loan application cannot be funded due to insufficient funding. The Funding threshold can be set using the Minimum Funding Percentage in Auto Portfolio Admin Params custom settings. |
500 |
API_EXCEPTION |
<exception_message> |
NA |
You will receive this error if any validation fails or any unexpected error occurs during the processing of the request, the system will raise the exception. |
500 |
Sample Request
The sample request to be sent is as shown below:
POST https://na11.salesforce.com/services/apexrest/peer/v1/loanApplications/fund/a2qG00000009Ohf
{ "amount":15000 }
Sample Response
This sample response contains the newly created loan application for the given borrower. The sample response is as shown below:
{ "status":"SUCCESS", "response":[ ], "errorMessage":null, "errorCode":"NO_ERROR", "content":[ { "attributes":{ "type":"loan__Loan_Account__c", "url":"/services/data/v30.0/sobjects/loan__Loan_Account__c/a1WG00000050ZueMAE" }, "loan__Ach_Debit_Day__c":23, "loan__First_Installment_Date__c":"2014-07-23", "loan__ACH_Debit_Amount__c":1311.77, "loan__Interest_Rate__c":9, "loan__Fee_Set__c":"a12G0000001MbEDIA0", "peer__Origination_Fee__c":294.11764705882354, "loan__Number_of_Installments__c":12, "loan__ACH_Start_Date__c":"2014-07-23", "peer__VAT__c":true, "Name":"LAI-00012476", "loan__Loan_Status__c":"Approved", "loan__Expected_Disbursal_Date__c":"2014-06-23", "loan__ACH_End_Date__c":"2015-06-23", "loan__Loan_Product_Name__c":"a1gG00000019OFeIAM", "loan__ACH_Next_Debit_Date__c":"2014-07-23", "peer__Disbursement_Schedule__r":{ "totalSize":3, "done":true, "records":[ { "attributes":{ "type":"peer__Disbursement_Schedule__c", "url":"/services/data/v30.0/sobjects/peer__Disbursement_Schedule__c/a3SG00000009SjHMAU" }, "Name":"DST-000000234", "peer__Name_of_Entity__c":"Loan Disbursement", "peer__Reference__c":"Loan Disbursement", "peer__Amount__c":14705.882352941177, "peer__Loan_Account__c":"a1WG00000050ZueMAE", "Id":"a3SG00000009SjHMAU", "peer__Loan_Disbursal_Transaction__c":"a1ZG00000003ehHMAQ" }, { "attributes":{ "type":"peer__Disbursement_Schedule__c", "url":"/services/data/v30.0/sobjects/peer__Disbursement_Schedule__c/a3SG00000009SjIMAU" }, "Name":"DST-000000235", "peer__Name_of_Entity__c":"VAT Deposit", "peer__Reference__c":"VAT Deposit", "peer__Amount__c":44.87, "peer__Loan_Account__c":"a1WG00000050ZueMAE", "Id":"a3SG00000009SjIMAU", "peer__Loan_Disbursal_Transaction__c":"a1ZG00000003ehHMAQ" }, { "attributes":{ "type":"peer__Disbursement_Schedule__c", "url":"/services/data/v30.0/sobjects/peer__Disbursement_Schedule__c/a3SG00000009SjJMAU" }, "Name":"DST-000000236", "peer__Name_of_Entity__c":"Origination Fee Deposit", "peer__Reference__c":"Origination Fee Deposit", "peer__Amount__c":249.24764705882353, "peer__Loan_Account__c":"a1WG00000050ZueMAE", "Id":"a3SG00000009SjJMAU", "peer__Loan_Disbursal_Transaction__c":"a1ZG00000003ehHMAQ" } ] }, "loan__Expected_Repayment_Start_Date__c":"2014-07-23", "Id":"a1WG00000050ZueMAE", "loan__Loan_Amount__c":15000 } ] }