FTOS_CB_AddUpdateEarlyRepayment
Adds or updates a record in the FTOS_CB_ContractEvent entity representing an event for an early repayment of a contract. The entire repayment schedule is recalculated considering this event. The set of parameters sent via the request body determines the operation performed at the database level.
Syntax
The FTOS_CB_AddUpdateEarlyRepayment custom endpoint is called from within the callAction endpoint. Visit the callAction page for more details.
POST <host_address>/api/openApi/CallAction
Content-Type: application/json
{
"Request": {
"ActionName":"FTOS_CB_AddUpdateEarlyRepayment",
"Data": {
"contractName":"<contract_number>",
"eventName":"<event_number>",
"baseAmount":<base_amount>,
"decreaseInstallment":<true_or_false>,
"repaymentFeeValue":<repayment_value>,
"repaymentFeePercent":<repayment_fee_percent>,
"externalIdentifier":"<the_external_identifier_of_the_transaction>",
"collectAccruedInterest": <true_or_false>
}
}
"ApiInfo":{
"UserName":"<user_name>",
"Token":"<access_token>"
}
}
Here's a list of the available parameters:
| Parameter | Description |
|---|---|
| host_address | URL of the High Productivity Fintech Infrastructure server. |
| access_token | Access token used to connect to the API endpoint. For details, see GetToken. |
| user_name | The username of an existing user account on the High Productivity Fintech Infrastructure, previously used to get the access token. |
| Data | Key-value pairs of any input parameters to be passed to the internal endpoint in JSON format. Double quotes that enclose string parameter values must be escaped with backslash characters, eg.: \"string value\". |
| contractName | Mandatory. The number of the contract, from the FTOS_CB_Contract entity (attribute: FTOS_CB_ContractId). |
| eventName | Mandatory only for update operations. Do not send it for add operations. The number of the early payment event. |
| baseAmount | Mandatory. The plain early repayment amount that needs to be inserted in the contract. |
| decreaseInstallment | Mandatory. Possible values: true or false. Passing true keeps the contract period length, passing false decreases the contract period length. |
| repaymentFeeValue | The value of the repayment fee, used to calculate the final early repayment value. If the value is not sent and the banking product has a Repayment Fee type commission, the system calculates it based on the repaymentFeePercent, which is mandatory in this case. If there is no Repayment Fee type commission at the banking product level, then an error is returned saying You do not have any repayment fee registered on the banking product. |
| repaymentFeePercent | The percent of the repayment fee, used to calculate the final early repayment value. If the percentage is not sent and the banking product has a Repayment Fee type commission, the system calculates it based on the repaymentFeeValue, which is mandatory in this case. If there is no Repayment Fee type commission at the banking product level, then an error is returned saying You do not have any repayment fee registered on the banking product. |
| externalIdentifier | Optional, string. The external identifier of the transaction. This parameter is available starting with version 3.2. |
| collectAccruedInterest | Optional, boolean. For True value, Core Banking collects the accrued interest. The default value when the value of the parameter is not sent is False. This parameter is available starting with version 3.2. |
Response
The response indicates the result of the code execution, specifically the result of creating or updating a record in the FTOS_CB_ContractEvent entity . The entire repayment schedule is recalculated considering this event.
Example
To create a new record in the FTOS_CB_ContractEvent entity, do not send the eventName with the request.
Request
POST https://FintechOSStudio/api/openApi/CallAction
Content-Type: application/json
{
"Request": {
"ActionName":"FTOS_CB_AddUpdateEarlyRepayment",
"Data": {
"contractName":"3271",
"baseAmount":1100,
"decreaseInstallment":false,
"repaymentFeePercent":4.5,
"externalIdentifier":"TR99990077963",
"collectAccruedInterest":false
}
}
},
"ApiInfo":{
"UserName":"host",
"Token":"e4fa9110-4cd4-46e0-a6bb-86e6de919590"
}
}
Response
{
"UIResult": {
"NavigateToEntityPage": false,
"NavigateToEntityPageOnEdit": false,
"NavigateToEntityFormName": null,
"NavigateToEntityName": null,
"NavigateToEntityId": null,
"NavigateToEntityInsertDefaults": null,
"NavigateToUrl": null,
"DownloadFile": null,
"ReloadPage": false,
"Message": null,
"IsSuccess": false,
"Data": "{
"MinimumPrincipal":1100.00,
"RepaymentFee":49.50,
"RepaymentFeePercent":4.5000,
"MaxInstallmentNo":11,
"InterestValue":0.00,
"OtherFees":0.00,
"TotalRepaymentValue":1149.50,
"UnpaidDepts":0.00,
"CustomerUnpaidDepts":20451.64,
"FeeIsPercent":false,
"MaxPrincipal":6613.44,
"IsEqualInstallment":true,
"InstallmentValue":513.67,
"Nper":1,
"PrincipalValue":0.00,
"FuturePrincipal":6613.44,
"MinDueDate":"2021-11-11T00:00:00Z",
"RepaymentFeeId":null,
"eventId":"008b701a-6fe7-45f5-8de0-035f583e2d0b",
"eventName":"ECB2205",
"repaymentSchedule":null,
"warningMessage":"Warning - base amount is lower than minimum early repayment amount set on product"
}",
"Message": null,
"IsSuccess": true,
"ClientScript": null,
"Serialized": null,
"ErrorCode": 0
}
To update an existing record in the FTOS_CB_ContractEvent entity, the eventName must be sent with the request.
Request
POST https://FintechOSStudio/api/openApi/CallAction
Content-Type: application/json
{
"Request": {
"ActionName":"FTOS_CB_AddUpdateEarlyRepayment",
"Data": {
"contractName":"3271",
"eventName":"ECB2205",
"baseAmount":1500,
"decreaseInstallment":false,
"repaymentFeePercent":4.5
}
},
"ApiInfo":{
"UserName":"host",
"Token":"e4fa9110-4cd4-46e0-a6bb-86e6de919590"
}
}
Response
{
"UIResult": {
"NavigateToEntityPage": false,
"NavigateToEntityPageOnEdit": false,
"NavigateToEntityFormName": null,
"NavigateToEntityName": null,
"NavigateToEntityId": null,
"NavigateToEntityInsertDefaults": null,
"NavigateToUrl": null,
"DownloadFile": null,
"ReloadPage": false,
"Message": null,
"IsSuccess": false,
"Data": "{
"MinimumPrincipal":1500.00,
"RepaymentFee":67.50,
"RepaymentFeePercent":4.5000,
"MaxInstallmentNo":11,
"InterestValue":0.00,
"OtherFees":0.00,
"TotalRepaymentValue":1567.50,
"UnpaidDepts":0.00,
"CustomerUnpaidDepts":20451.64,
"FeeIsPercent":false,
"MaxPrincipal":6613.44,
"IsEqualInstallment":true,
"InstallmentValue":476.40,
"Nper":1,
"PrincipalValue":0.00,
"FuturePrincipal":6613.44,
"MinDueDate":"2021-11-11T00:00:00Z",
"RepaymentFeeId":null,
"repaymentSchedule":null,
"warningMessage":"Warning - base amount is lower than minimum early repayment amount set on product"
}",
"Message": null,
"IsSuccess": true,
"ClientScript": null,
"Serialized": null,
"ErrorCode": 0
}
Error Responses
-
Bad Request - Contract name is null- the request does not contain a contract number; -
Bad Request - Base amount is null- the request does not contain a repayment amount; -
Bad Request - fee value and fee percent are both defined but they do not match- fee value and percent do not match; -
Event is already approved and cannot be modified- you cannot update already approved contract event records; -
No contract found for contract name:- the contract number sent with the request cannot be found in the system. -
You do not have any repayment fee registered on the banking product- there is noRepayment Feetype commission defined at the banking product level, but the request contains arepaymentFeeValueand/ or arepaymentFeePercentparameter different than zero.