FTOS_CB_AddUpdateReturnedAmountOrGoods
Adds or updates a contract event record representing an event for a returned amount or goods for 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_AddUpdateReturnedAmountOrGoods 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_AddUpdateReturnedAmountOrGoods
Content-Type: application/json
{
"contractName":"<contract_number>",
"eventName":"<event_number>",
"baseAmount":<amount_to_return>,
"returnDate":"<yyyy-mm-dd>",
"decreaseInstallment":<true_or_false>,
"feeValueToPrincipal":<true_or_false>,
"externalIdentifier":"<external_identifier_for_event>"
}
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 returned amount or goods event. |
| returnDate | The date of the return. By default = Activation Date. It is validated against Activation Date and Current Date (it cannot be before Activation Date and after Current Date). |
| baseAmount | Mandatory. The plain returned amount that needs to be inserted in the contract. |
| decreaseInstallment | Possible values: true or false. Passing true keeps the contract period length, passing false decreases the contract period length. |
| feeValueToPrincipal | Possible values: true or false. Passing true applies the value of the return fee to the principal, diminishing the outstanding capital. |
| externalIdentifier | Optional, string. The external identifier of the transaction. |
Response
The response indicates the result of the code execution, specifically the result of creating or updating a contract event record. The entire repayment schedule is recalculated considering this event.
Example
To create a new contract event record, do not send the eventName with the request.
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateReturnedAmountOrGoods
Content-Type: application/json
{
"contractName":"5601",
"eventName":"",
"baseAmount":2000,
"returnDate":"",
"decreaseInstallment":false,
"feeValueToPrincipal":false,
"externalIdentifier":"ReturnedAmountOrGoods"
}
Response
{
"eventName": "ECB4293",
"warningMessage": "Warning - base amount is lower than minimum early repayment amount set on product"
}
To update an existing contract event record, the eventName must be sent with the request.
Request
POST https://FintechOSStudio/ftosapi/automation-processors/actions/FTOS_CB_AddUpdateReturnedAmountOrGoods
Content-Type: application/json
{
"contractName":"5601",
"eventName":"ECB4293",
"baseAmount":2001,
"returnDate":"",
"decreaseInstallment":false,
"feeValueToPrincipal":false,
"externalIdentifier":"ReturnedAmountOrGoods"
}
Response
{
"eventName": "ECB4293",
"warningMessage": "Warning - base amount is lower than minimum early repayment amount set on product"
}
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 returned amount; -
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.