Creating a loan account (CL Contract)
Description
This web service creates a Loan Account for the marketplace. It commits an object of type Loan Account(loan__Loan_Account__c) to the database.
Definition
POST https://<domain>/services/apexrest/peer/v1/loanAccounts
Parameters
The table given below provides details of the request parameters used by this web service:
Fields |
Type |
Description |
---|---|---|
borrowerId* |
String |
|
loanProductId* | String |
|
loanAmount* |
Decimal |
|
firstInstallmentDate* |
Date |
|
expectedDisbursalDate* |
Date |
|
term* |
Integer |
|
interestRate |
Decimal |
|
purpose |
String |
|
frequencyOfPayment |
String |
|
interestOnlyPeriod | Integer |
|
balloonPayment | Decimal |
|
ach | Boolean |
|
bankId | String |
|
eodAccrualType | String |
|
eodFeeAccrual | Boolean |
|
Error messages
When you use this 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 an error occurs while parsing Request parameters. |
400 |
INVALID_INPUT |
Account Id is null |
ACCOUNT_ID_NULL |
You will receive this error if the Borrower Account Id (borrowerId) is not specified in the Request Parameters. |
400 |
INVALID_INPUT |
Unable to find the Account |
ACCOUNT_NOT_FOUND |
You will receive this error if no record exists in the system for the Borrower Account Id (borrowerId) specified in the Request Parameters. |
400 |
INVALID_INPUT |
Loan Product Id is null. |
LOAN_PRODUCT_ID_NULL |
You will receive this error if no record exists in the system for the Loan Product Id (loanProductId) specified in the Request Parameters. |
400 |
INVALID_INPUT |
Loan amount is not valid |
LOAN_AMOUNT_NOT_VALID |
You will receive this error if the Loan amount is either null or a nonpositive number. |
400 |
INVALID_INPUT |
Term is not valid |
TERM_NOT_VALID |
You will receive this error if the Term is either null or a nonpositive number. |
400 |
INVALID_INPUT | One of the dates is null | DATE_NULL | You will receive this error if the first payment date(firstInstallmentDate) and/or expected disbursal date(expectedDisbursalDate) is/are null. | |
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/loanAccounts
{ "borrowerId" : "001G000001KY8by", "loanProductId":"a1gG00000019OFe", "loanAmount":10000, "term":12, "expectedDisbursalDate":"2012-12-22", "firstInstallmentDate":"2013-01-09"}
{ "borrowerId" : "0016g000007sR4d", "loanProductId" : "a8B6g000000gKyS", "loanAmount" : 10000, "term" : 10, "interestRate" : 10, "purpose" : "a8D6g000000PVfJ", "expectedDisbursalDate" : "2017-08-01", "firstInstallmentDate" : "2017-09-01", "eodAccrualType" : "Accrual To Date", "eodFeeAccrual" : true }
Sample response
This sample response contains the newly created loan account for the given borrower. The sample response that you will receive 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/a1WG00000050d9yMAA" }, "loan__First_Installment_Date__c": "2013-01-09", "RecordTypeId": "012G0000000rvE4IAI", "loan__Fee_Set__c": "a12G0000001MbEDIA0", "loan__Repayment_Procedure__c": "Equal Monthly Installments", "peer__Origination_Fee__c": 200, "loan__Disbursal_Date__c": "2012-12-22", "loan__Interest_Type__c": "Fixed", "loan__Loan_Status__c": "Partial Application", "loan__Expected_Disbursal_Date__c": "2012-12-22", "loan__Expected_Repayment_Start_Date__c": "2013-01-09", "loan__Loan_Amount__c": 10200, "loan__Account__c": "001G000001KY8byIAD", "peer__Note_Type__c": "a3PG00000000iBbMAI", "loan__Last_Installment_Date__c": "2013-12-09", "loan__LA_Amortization_Enabled__c": false, "loan__Contractual_Interest_Rate__c": 9.1, "loan__Pre_Bill_Days__c": 0, "loan__Interest_Rate__c": 9.1, "loan__Number_of_Installments__c": 12, "loan__Frequency_of_Loan_Payment__c": "Monthly", "loan__Contractual_Due_Day__c": 9, "loan__Overdue_Interest_Rate__c": null, "loan__Loan_Product_Name__c": "a1gG00000019OFeIAM", "loan__Write_off_Tolerance_Amount__c": 0, "loan__Grace_Period_for_Repayments__c": 0, "loan__Branch__c": "a1zG0000000LezuIAC", "Id": "a1WG00000050d9yMAA", "loan__Interest_Calculation_Method__c": "Declining Balance", "loan__Delinquency_Grace_Days__c": 0, "loan__Time_Counting_Method__c": "Month and Days", "loan__Interest_Only_Period__c": null, "loan__Balloon_Payment__c": 0 } ] }