FTOS_CB_AddUpdateWriteOff
Adds a new record to the Contract Event entity representing a contract write-off event.
This endpoint is available starting with Loan Management v4.1.
Syntax
The FTOS_CB_AddUpdateWriteOff 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_AddUpdateWriteOff
Content-Type: application/json
{
"contractName": "<contract_number>",
"eventName": "<event_number>",
"isPartialWriteOff": <true_or_false>,
"writeOffReason": "<reason_for_write_off_transaction>",
"writeOffDetails": {
"Remaining Principal": <remaining_principal_amount_on_contract>,
"Management Fee": <management_fee>,
...
}
}
Here's a list of the available parameters:
| Parameter | Description |
|---|---|
| host_address | URL of the FintechOS Platform server. |
| contractName | Mandatory. The number of the contract. |
| eventName | Mandatory only for update operations. Do not send it for add operations. The number of the write-off event. |
| externalIdentifier | Optional, string. The external identifier of the transaction. |
| isPartialWriteOff | Optional, boolean. If false then the write-off transaction is performed for full amount. Default value: false |
| writeOffDetails | Object with values for write-off details. Optional on add when isPartialWriteOff= false. Mandatory on update. |
| writeOffReason | Mandatory. The reason for performing the write-off transaction. |
Response
The response indicates the number of the write-off event record from the Contract Event entity, as well as an object containing the write-off details with the values of each operation item.
{
"EventName": "EventName",
"WriteOffDetails": null
}
Example
To create a new record, do not send the eventName with the request. Send the isPartialWriteOff parameter as false.
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateWriteOff
Content-Type: application/json
{
"contractName": "14752",
"isPartialWriteOff": false,
"writeOffReason": "full write-off tests via API"
}
Response
{
"EventName": "ECB11144",
"WriteOffDetails": {
"Remaining Principal": {
"MaxValue": 10000,
"ActualValue": 0
},
"Overdue Principal": {
"MaxValue": 1.07,
"ActualValue": 0
},
"Overdue Interest": {
"MaxValue": 0.05,
"ActualValue": 0
},
"Loan Interest": {
"MaxValue": 50,
"ActualValue": 0
},
"Management Fee": {
"MaxValue": 10,
"ActualValue": 0
},
"Loan Principal": {
"MaxValue": 810.66,
"ActualValue": 0
}
}
}
To create a new record, do not send the eventName with the request. Send the isPartialWriteOff parameter as true.
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateWriteOff
Content-Type: application/json
{
"contractName": "14752",
"isPartialWriteOff": true,
"writeOffReason": "partial write-off tests via API"
}
Response
{
"EventName": "ECB11144",
"WriteOffDetails": {
"Remaining Principal": {
"MaxValue": 10000,
"ActualValue": 0
},
"Overdue Principal": {
"MaxValue": 1.07,
"ActualValue": 0
},
"Overdue Interest": {
"MaxValue": 0.05,
"ActualValue": 0
},
"Loan Interest": {
"MaxValue": 50,
"ActualValue": 0
},
"Management Fee": {
"MaxValue": 10,
"ActualValue": 0
},
"Loan Principal": {
"MaxValue": 810.66,
"ActualValue": 0
}
}
}
To update an existing contract event record, the eventName must be sent with the request. For partial write-offs, also send the writeOffDetails object containing the operation items and their respective actual value for performing the write-off.
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateWriteOff
Content-Type: application/json
{
"contractName": "14752",
"eventName": "ECB11144",
"isPartialWriteOff": true,
"writeOffReason": "write-off tests via API",
"writeOffDetails": {
"Remaining Principal": 5000,
"Management Fee": 10
}
}
Response
{
"EventName": "ECB11144",
"WriteOffDetails": {
"Remaining Principal": {
"MaxValue": 10000,
"ActualValue": 5000
},
"Overdue Principal": {
"MaxValue": 1.07,
"ActualValue": 0
},
"Overdue Interest": {
"MaxValue": 0.05,
"ActualValue": 0
},
"Loan Interest": {
"MaxValue": 50,
"ActualValue": 0
},
"Management Fee": {
"MaxValue": 10,
"ActualValue": 10
},
"Loan Principal": {
"MaxValue": 810.66,
"ActualValue": 0
}
}
}
Error Responses
-
Values could not be calculated!- the values of the event couldn't be calculated; -
Insufficient funds for current transaction!- the write-off internal account doesn't have sufficient funds to process this write-off transaction; -
Please cancel this event and operate another one!- you should cancel the event and create another one; -
Bad Request - Contract name is null- the request does not contain a contract number; -
writeOffDetails is mandatory for Write Off update!- you should send the WriteOffDetails object with the operation item values for the update request; -
Event is already approved.- you cannot update already approved contract event records; -
Bad Request - writeOffReason is mandatory for Add!- you should send the reason for write-off with the add request; -
No contract found for contract name:- the contract number sent with the request cannot be found in the system.