API – Modifying a Loan

Introduction

You can modify a loan either within the UI or through the API. To modify a loan in the API, follow these steps:

  1. Look for transactions that are after the modification date (optional)
  2. Complete the initial modification
  3. Get the new setup ID
  4. Update the loan setup
  5. Roll the payment amount (optional)
  6. Activate the loan

Below, we'll explain what is required in each of these steps.

Modifying a Loan

1. Transactions After the Modification Date (Optional)

At times, it may be necessary to modify a loan previous to payments or other transactions, and you may want those transactions to apply after the modification. There is an available endpoint that will show you which loan transactions apply after the modification date. To see this information, send a GET request to the following endpoint:

GET https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.PreModTestLoan({modificationDate})

Make sure the replace {loanId} with the ID of the loan you're modifying and {modificationDate} with the modification date you will use. The date should be formatted as YYYY-MM-DD. A successful request will result in a response similar to this:

{  
"d":{
"payments":[
{
"id":"2928",
"displayId":"5557",
"date":"2019-04-17",
"amount":100,
"info":"04/17/2019 Credit/Debit Card"
}
],
"charges":[],
"advancements":[],
"credits":[]
}
}

The arrays for each transaction type will contain IDs and information about transactions that currently apply after the modification date.

2. Modify the Loan

To create a loan modification, send a POST request to the following endpoint:

POST  https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.CreateModification({modificationDate})

Make sure to replace {loanId} with the ID of the loan you're modifying, and {modificationDate} with the modification date you will use. The date should be formatted as YYYY-MM-DD. If you are opting to have transactions apply after the modification date, you should include a payload that looks something like this:

{  
"persistentTransactions":{
"payments": ["2928"]
},
"modificationDate":"2018-12-28"
}

The persistentTransactions object should contain an array for each transaction type. The array should contain IDs as strings separated by commas (e.g. "1","2","3").

3. Get Loan Setup ID

Creating a modification will create new loanSetup entity and assign it to the loan. In order to update the new loan setup, you will need the ID. To receive the ID, send a GET request to the following endpoint:

GET https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans({loanId})?$expand=LoanSetup

Be sure to replace {loanId} with the ID for the loan. The response should look something like this:

{  
"d":{
"__metadata":{
"uri":"https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(id=702)",
"type":"Entity.Loan"
},
"LoanSetup": {
"__metadata": {
"uri": "https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanSetup(id=861)",
"type": "Entity.LoanSetup"
},
"id":702,
"displayId":"LOAN597f93726b19f",
"title":"LN - PHP SDK597f933a295d6",
"settingsId":661,
"setupId":861,
"insurancePolicyId":null,
"collateralId":433,
"linkedLoan":null,
"modId":null,
"modTotal":0,
"humanActivityDate":"/Date(1555459200)/",
"created":"/Date(1501532986)/",
"lastMaintRun":"/Date(1555489226)/",
"createdBy":806,
"active":1,
"archived":0,
"loanAlert":null,
"temporaryAccount":0,
"deleted":0,
"deletedAt":null,
"_relatedMetadata":null,
"_dynamicProperties":null
}
}

In the example above, the setupId is 861. Once you have the loanSetup ID, you are ready to set the loan terms of the modification. 

4. Update the Loan Setup

To update the new loan setup, send a PUT request to the following endpoint:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans({loanId})

Be sure to replace {loanId} with the ID of the loan.

Your payload should look something like the following:

{  
"LoanSetup":{
"id":861, //loan setup id
"loanId":702,
"loanAmount":12345.67,
"payment":500,
"loanRate":5.9,
"contractDate":"2019-02-19",
"firstPaymentDate":"2019-03-20",
"loanTerm":12,
"__id":861, //loan setup id
"__update":true
},
"__id":702, //loan id
"__update":true
}

5. Roll the Payment (Optional)

You may want to roll the payment for the customer so it matches the original payment amount. This achieved by sending a POST request to the following endpoint:

POST https://loanpro.simnang.com/api/public/api/1/Loans({loanID})

Make sure to replace {loanId} with the ID of the loan. Your payload should look something like the following:

{
"amount": "100.00",
"method": "loan.rollPayment.termExact"
}

The amount is your target payment amount and the method specifies which loan term you want to change to get to the target payment amount. We recommend using term exact value like shown above.

6. Activate the Loan

The last step is to activate the loan. To activate it, send a POST request to the following endpoint:

POST https://loanpro.simnang.com/api/public/api/1/Loans({loanID})/AutoPal.Activate()

Make sure to replace {loanId} with the ID of the loan. No payload is required for this request. If this request is successful, the process of modifying a loan is now complete.

At this point, the process is complete; but if you'd like to learn how to cancel a modification, continue reading.

Cancel a Modification

To cancel a modification, send a POST request to the following endpoint:

POST https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.CancelModification()

Make sure to replace {loanId} with the ID of the loan.

If transactions have occurred after the modification date and you want to keep them, the process is similar to having transactions persist through the modification date. First, you can get a list of the transactions for the current modification using the following endpoint:

GET https://loanpro.simnang.com/api/public/api/1/Loans({id})/Autopal.GetCurrentModActivity()

You will need to replace {id} with the ID of the loan for which you are pulling transactions.

A successful request will result in a response similar to the following:

{
"d": {
"payments": [
{
"id": "786",
"displayId": "3019",
"date": "2019-06-27",
"amount": 10,
"info": "06/27/2019 Cash"
}
],
"charges": [],
"advancements": [],
"credits": [],
"stopInterestDates": [],
"APDAdjustments": [],
"dueDateChanges": [],
"escrowAdjustments": []
}
}

Use the IDs from the response to build a payload to submit to the following endpoint:

POST https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.CancelModification() 

The payload for the request should look something like the following:

{  
"persistentTransactions":{
"payments":[
"786", "787"
]
}
}

The transaction IDs should be in separate arrays with the same labels as the response. Each ID should be a string, and they should be separated by commas.


How did we do?


Powered by HelpDocs (opens in a new tab)