FTOS_CB_AddUpdateContractInterestRate
Adds or updates a record in the Contract Interest Rate entity representing one or more contract interest rates, depending on the parameters received from the API call. First, it performs a series of validations. If passed, then it deletes all the un-notified interest rates (and penalty rates, if such penalties were sent) for the contract and inserts the interest rates (and the penalty rates) sent with the request.
This endpoint is available starting with Loan Management v4.1.
Syntax
The FTOS_CB_AddUpdateContractInterestRate custom endpoint is called from within the Endpoint API endpoint. Visit the Endpoint API page for more details.
POST <host_address>/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateContractInterestRate
Content-Type: application/json
{
"contractNo": "<contract_number>",
"contractID": "<contract_identifier>",
"interestRates":
[
{
"interestName": "<interest_name>",
"interestCode": "<interest_code>",
"startDate":"<interest_start_date_yyyy_mm_dd>",
"jsonInputFormula": {
"interestInput": {
"<formula_Input1>": "<formula_input1_value>",
"<formula_Input2>": <formula_input2_value>,
"<formula_Input3>": <formula_input3_value>
}
},
"endDate":"<interest_end_date_yyyy_mm_dd>",
"startTenor":<interest_applicable_starting_with_tenor_number>,
"endTenor":<interest_applicable_until_tenor_number>,
"fixedRate":<interest_fixed_rate_value>,
"margin":<interest_margin_value>,
"isForOverdraft":<true_or_false>,
"isPenalty":<true_or_false>
}
]
}
Here's a list of the available parameters:
| Parameter | Description |
|---|---|
| host_address | URL of the FintechOS Platform server. |
| contractNo | Mandatory if contractID is not filled. The number of the contract. |
| contractID | Mandatory if contractNo is not filled. The identifier of the contract. |
| interestRates | Mandatory. Array of Interest Rates details (JSON) Object. It contains the following parameters: |
| -- interestName | Mandatory, string. The name of the interest rate. |
| -- interestCode | Mandatory, string. The code of the interest rate. |
| -- startDate | Mandatory, string. The start date of the interest rate, in yyyy-mm-dd format. |
| -- endDate | Mandatory, string. The end date of the interest rate, in yyyy-mm-dd format. |
| -- startTenor | Mandatory, integer. The interest rate is applicable starting with this installment number. |
| -- endTenor | Mandatory, integer. The interest rate is applicable until this installment number. |
| -- fixedRate | Mandatory if margin was not specified, numeric. The fixed rate of the interest, if it's a fixed interest. |
| -- margin | Mandatory if fixedRate was not specified, numeric. The margin of the interest, if it's a variable interest. |
| -- isPenalty | Optional, boolean. If true, then the interest rate is a penalty interest. |
| -- isForOverdraft | Optional, boolean. If true, then the interest rate is an overdraft interest. |
| -- jsonInputFormula | Mandatory only if the formula mapping was not configured in the Banking Product Factory within the Product Formula Engine tab and the Interest is Not Negotiable. If the mapping exists, then the calculations are performed using the configured input parameters. If the interest is Negotiable, the value of the interest = fixedRate and no calculations are performed. |
Response
The response indicates the result of the code execution, specifically the result of creating or updating a record in the Contract Interest Rate entity, as well as array of Interest Rates overview json objects, with some information about the created / updated interest rates on the contract.
{
"ContractInterestRates": [
{
"InterestName": "<interest_name>",
"TotalInterestRate": <calculated_total_interest_rate>,
"IsForOverdraft": <true_or_false>,
"IsPenalty": <true_or_false>
}
],
"IsSuccess": <true_or_false>
}
Example
To create or to update the interest rates at a contract level, send the following request, changing the contractNo parameter and the interestRates json objects according to your needs:
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateContractInterestRate
Content-Type: application/json
{
"contractNo": "15534.2",
"interestRates": [
{
"interestName": "Formula Interest",
"interestCode": "Fix4",
"startDate":"2023-02-13",
"jsonInputFormula": {
"interestInput": {
"Merchant": "A Pallady",
"Amount": 6000.0,
"LoanPeriod": 10.0
}
},
"endDate":"2028-01-05",
"startTenor":1,
"endTenor":10,
"fixedRate":0,
"margin":0
},
{
"interestName": "Fixed 4%",
"interestCode": "Fix4",
"startDate":"2023-02-13",
"endDate":"2028-01-05",
"startTenor":11,
"endTenor":60,
"fixedRate":3,
"margin":""
},
{
"interestName": "PenaltyInterestWithFormula",
"interestCode": "PenaltyInterestWFormula",
"startDate":"2023-01-10",
"endDate":"2028-01-05",
"startTenor":1,
"endTenor":10,
"fixedRate":3,
"margin":"",
"isPenalty":true
}
]
}
Response
{
"ContractInterestRates": [
{
"InterestName": "Fixed 4% (Fix4) ",
"TotalInterestRate": 10,
"IsForOverdraft": false,
"IsPenalty": false
},
{
"InterestName": "Fixed 4% (Fix4) ",
"TotalInterestRate": 10,
"IsForOverdraft": false,
"IsPenalty": false
},
{
"InterestName": "PenaltyInterestWithFormula (PenaltyInterestWFormula) ",
"TotalInterestRate": 3,
"IsForOverdraft": false,
"IsPenalty": true
}
],
"IsSuccess": true
}
Validations
The endpoint performs the add / update operation for the interest rates at the contract level if all the following conditions are met:
-
The status of the contract sent with the request is
DraftorVersionDraft. -
All the interests sent with the request are from the same Interest & Commission Item (Interest List) selected at the contract level.
-
The interest rates sent with the request are for the current rate (next days) and future rates.
-
At the contract level, the interest rates were set as
Negotiableand with aMinimum Interest Rate<= the requested interest rates.
Error Messages
-
Bad Request - One of Contract.contractNo or Contract.contractID mandatory!- you must send the contract name or the contract identifier; -
Bad Request - contractNo not found!- the contract with the requested number was not found; -
Bad Request - interestRates must contain at least one interest!- you must send at least oneinterestRatesobject; -
Bad Request - The contract must be in 'ContractDraft' or 'ContractVersionDraft' status to be able to add a commission!- the status of the contract sent with the request must beDraftorVersionDraft; -
Bad Request - Interest Rate: <interest_name> startTenor, endTenor are mandatory!- you must send thestartTenorandendTenorfor the specified interest; -
Bad Request - Interest Rate: <interest_name> startDate, endDate are mandatory!- you must send thestartDateandendDatefor the specified interest; -
Bad Request - Interest Rate: <interest_name> startTenor must be less or equal to endTenor!- make sure that the sentstartTenor <= endTenor; -
Bad Request - Interest Rate: <interest_name> startDate must be less or equal to endDate!- make sure that the sentstartDate <= endDate; -
Bad Request - isPenalty does not have the correct value for Interest Rate: <interest_name>- the interest must be marked as penalty interest; -
Bad Request - Interest Rate: <interest_name> not Negotiable! You can not change the value({1})- the interest rate is not marked as negotiable.