API – Escrow Calculators

Creating Escrow Calculators

Escrow calculators are useful for tracking escrow on a loan. Since escrow calculators are subentities of loans and are referenced in loan setups. Consequently, to create escrow calculators for a loan, it requires sending a PUT request to the loan where the escrow calculator will be added. For example, to create escrow for the loan with id 625 the request might look like:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(625)
{
"LoanSetup": {
"__metadata": {
"uri": "https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanSetup(id=625)",
"type": "Entity.LoanSetup"
},
"escrows": {
"1": {
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.full",
"extendFinal": 0,
"term": 128
},
"2": {
"percent": "12",
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.none",
"term": 128,
"extendFinal": 0,
"total": "0.00"
}
},
"escrowExtendFinal": 0,
"showDiscPerc": false,
"__id": 625,
"__update": true
},
"EscrowCalculators": {
"results": [
{
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.full",
"extendFinal": 0,
"term": 128,
"subset": "1",
"__update": true
},
{
"percent": "12",
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.none",
"term": 128,
"extendFinal": 0,
"total": "0.00",
"subset": "2",
"__update": true
}
]
},
"EscrowSubsets": {
"results": []
}
}

Below is a list of values that are used.

  • subset – The ID of the escrow bucket (found in loan settings)
  • term – The term of the escrow
  • total – The calculated total of the escrow
  • percent – The percentage to used to calculate the total
  • percentBase – The percentage base used to calculate the escrow; formatted “loan.escrowPercentBase.<base>”. Values for “<base>” are as follows:
    • basePayment – The base payment for the loan
    • loanAmount – The amount of the loan
    • salesPrice – The sales price for the loan
  • proRate1st – How to pro-rate the first period. formatted “loan.escrowProrateFirst.<prorate>”. Values for “<prorate>” are as follows:
    • full – Full pro-rate
    • none – No pro-rate
    • shortOnly – Short Only pro-rate
  • extendFinal – Set to “1” to extend final, set to “0” to not extend final
  • disclosureLnAmtAdd – Set to “1” to add to the disclosed loan amount, set to “0” to not add to the disclosed loan amount

It should be remembered that since escrows are referenced in the LoanSetup, both the EscrowCalculators under Loan and escrows under LoanSetup should match (ie. the totals, percents, terms, subsets, etc. should be the same). The reason for this is so the system can know which escrow to reference once the ids are created. If the numbers don’t match, then the system will either throw an error or will match the wrong escrows.

A sample plunk that performs escrow setup (as well as LoanSetup) is found at http://plnkr.co/edit/m7gSQr?p=info. After opening the plunk, navigate to the request_module.js to view the request sent to LoanPro. This request sets the escrow values for two escrow subsets on a sample loan.

Please note that escrows need to match for the LoanSetup.escrows and the EscrowCalculators!

Updating EscrowCalculators

To update escrow calculators, send a PUT request to a loan. Make sure that for every escrow object that you include the “__id” and “__update” fields. Below is an example for updating loan 625:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(625)
{
"LoanSetup": {
"__metadata": {
"uri": "https://loanpro.simnang.com/api/public/api/1/odata.svc/LoanSetup(id=625)",
"type": "Entity.LoanSetup"
},
"escrows": {
"1": {
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.full",
"extendFinal": 0,
"term": 128,
"id":13,
"__id":13,
"__update":true
},
"2": {
"percent": "12",
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.none",
"term": 128,
"extendFinal": 0,
"total": "0.00",
"id":14,
"__id":14,
"__update":true
}
},
"escrowExtendFinal": 0,
"showDiscPerc": false,
"__id": 625,
"__update": true
},
"EscrowCalculators": {
"results": [
{
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.full",
"extendFinal": 0,
"term": 128,
"subset": "1",
"id":13,
"__id":13,
"__update":true
},
{
"percent": "12",
"percentBase": "loan.escrowPercentBase.loanAmount",
"proRate1st": "loan.escrowProrateFirst.none",
"term": 128,
"extendFinal": 0,
"total": "0.00",
"subset": "2",
"id":14,
"__id":14,
"__update":true
}
]
},
"EscrowSubsets": {
"results": []
}
}

As you can see, each escrow field has an “__id” and an “__update” value.

Another item about updating escrow values is it is not required to specify an update in the LoanSetup, only for the EscrowCalculators object. This is because once the escrow calculators are created, the LoanSetup understands which escrow to reference based on the id. This id is created when the escrow calculator is created, but since it exists for update requests the system can keep track of everything based on the id. Below is another sample for updating the escrow for loan 625:

PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(625)
{
  "EscrowCalculators": {
    "results": [
      {
        "percentBase": "loan.escrowPercentBase.loanAmount",
        "proRate1st": "loan.escrowProrateFirst.full",
        "extendFinal": 0,
        "term": 128,
        "subset": "1",
        "__update": true
      },
      {
        "percent": "12",
        "percentBase": "loan.escrowPercentBase.loanAmount",
        "proRate1st": "loan.escrowProrateFirst.none",
        "term": 128,
        "extendFinal": 0,
        "total": "0.00",
        "subset": "2",
        "__update": true
      },
      {
        "percent": "0.00",
        "percentBase": null,
        "proRate1st": "loan.escrowProrateFirst.shortOnly",
        "term": 45,
        "extendFinal": 1,
        "total": "23.00",
        "subset": "3",
        "__update": true
      },
      {
        "percent": "0.13",
        "percentBase": "loan.escrowPercentBase.loanAmount",
        "proRate1st": "loan.escrowProrateFirst.none",
        "term": 128,
        "extendFinal": 1,
        "total": "321.00",
        "subset": "4",
        "__update": true
      },
      {
        "percent": "0.00",
        "percentBase": null,
        "proRate1st": "loan.escrowProrateFirst.full",
        "term": 128,
        "extendFinal": 0,
        "total": "1323.00",
        "subset": "8",
        "__update": true,
"__id": 183
      },
      {
        "percent": "12",
        "percentBase": "loan.escrowPercentBase.loanAmount",
        "proRate1st": "loan.escrowProrateFirst.none",
        "term": 128,
        "extendFinal": 0,
        "total": "29549.52",
        "subset": "12",
        "__update": true,
"__id": 184
      }
    ]
  },
  "EscrowSubsets": {
    "results": []
  }
}


How did we do?


Powered by HelpDocs (opens in a new tab)