API – Modifying a Loan

General

To complete a loan modification, follow these steps:

  • Look for transactions that are after the modification date (optional)
  • Complete the initial modification
  • Get the new setup ID
  • Update the loan setup
  • Roll the payment amount (optional)
  • Activate the loan

This article will go over how to complete these steps.

Transactions After the Modification Date (Optional)

Sometimes you will modify a loan previous to payments or other transactions, and may want those transactions to apply after the modification. LoanPro provides an endpoint that will show you which loan transactions apply after the modification date.

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. This endpoint will return 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.

Modify the Loan

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

POST https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.CreateModification({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. If you are choosing 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").

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 get it 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. 

Update the Loan Setup

To update the new loan setup, send a PUT request to a URL formatted as follows

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 this:

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

The example below demonstrates how to update the loan setup:

Roll the Payment (Optional)

You may want to roll the payment for the customer so it matches the original payment amount. This is done best through 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 this:

{
"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.

Activate the Loan

To activate the loan, send a 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. No payload is required. You are done!

Cancel a Modification

To cancel a modification, send a POST request to a URL formatted as follows:

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 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.

The response should look something like this:

{
"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 POST https://loanpro.simnang.com/api/public/api/1/Loans({loanId})/Autopal.CancelModification() endpoint. The payload should look something like this:

{  
"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)