Reversing Loan Disbursal Transactions
Description / Purpose
This web service is used to reverse disbursements. It reverses Loan Disbursal Transactions (loan__Loan_Disbursal_Transaction__c) on the Loan Account object and commits them to the database.
Caller
This API is called by a Salesforce user.
Definition
https://<domain>/services/apexrest/peer/v1/loanAccounts/disbursement/reversal
HTTP Method | Endpoint URL |
---|---|
POST | https://<domain>/services/apexrest/peer/v1/loanAccounts/disbursement/reversal |
Authentication
Bearer <Access Token>
HTTP Header Parameters
The following table provides the details of the header parameters used by this API:
Key | Value |
---|---|
Content-Type | application/json |
Authorization | Bearer <Access Token> |
Path Parameters
There are no path parameters required for this REST API.
Request Body Parameters
The following table provides details of the request body parameters used by this web service:
Field | Type | Description |
---|---|---|
loanDisbursementTxnIds | String |
This key in the key-value pair of the response body is a string value, which is used to identify the disbursement transaction records IDs. This must be passed in the body of the request as specified in the Sample Request. An example of the value of this key could be a record ID such as the following: a96am0000001QN3 |
Response Error Messages
Error Code | Error Message | System.Label | Reason | HTTP Status Code |
---|---|---|---|---|
INVALID_INPUT | Unable to parse the Request parameters. | UNABLE_PARSE_REQ_PARAMS | If error occurs while parsing request parameters. | 400 |
INVALID_INPUT | Disbursement Records not found on these contracts | LOAN_DISBURSEMENT_IDS_NULL | Loan disbursement Ids for loans is not specified in the request parameters | 400 |
API_EXCEPTION |
<exception_message> For example, the following error message would be displayed for this error code: Script-thrown exception |
Not applicable |
If any validation fails or any unexpected error occurs during the processing of the request, the system raises this exception. For example, if you are trying to reverse an already reversed disbursement by passing the record ID of a disbursement that is reversed. |
500 |
Sample Request
Here is a sample request sent to reverse the disbursements of different contracts:
POST https://<domain>/services/apexrest/peer/v1/loanAccounts/disbursement/reversal
Sample request body
{
"loanDisbursementTxnIds" : [ "a8MHs000000eWpZ" ,"a8MHs000000eWpj" ,"a8MHs000000eWpZMAU" ]
}
Where:
a8MHs000000eWpZ : Latest disbursal trasction record ID of Contract 1
a8MHs000000eWpj : Latest disbursal trasction record ID of Contract 2
a8MHs000000eWpk : Latest disbursal trasction record ID of a Contract 3
When a single contract has multiple disbursements or disbursement IDs, then the latest disbursal transaction record of that contract is to be passed in the request body.
Sample Response
On sending the request, a response is received that has the details of whether the request was successfull or not and an error code with an error message.
Sample response with status as Success
Here is a sample response received that states that the request was successfull:
Sample response with a success
{
"status": "SUCCESS",
"rowNumber" : -1,
"response": [],
"errorNumber" : 0,
"errorMessage" : null,
"errorCode" : "NO_ERROR",
"content" : []
}
This response also provides the status of the request as success.
Sample response with status as Error
Here is a sample response that states that the request was not successful:
Sample response with an error
{
"status" : "ERROR",
"rowNumber" : -1,
"response" : [ ],
"errorNumber" : 0,
"errorMessage" : "Script-thrown exception",
"errorCode" : "API_EXCEPTION",
"content" : [ ]
}
This response also provides the error message and the error code to understand the reason of the failure.