To handle any error coming from the BAAS, the integration must handle it and throw an exception. This exception will have a message and a code that will be propagated to the integration hub and to the Toqio frontend.
It is important that the error message provided by the BAAS is somehow conveyed to the Toqio frontend. This means that the integration should map those messages sent by the BAAS in the exception handling and sent to the Integration Hub has a similar or related message to the one sent by the BAAS.
As an example of this flow, the below would be the error response in the financial provider side:
[{
"field": "sourceAccount",
"code": "BUSINESSRULE",
"errorCode": "INSUFFICIENT_BALANCE",
"message": "Source does not have enough balance"
}]
And you should process this error to send it as a response to the Integration Hub request, to format it as in this example:
{
"data": [
{
"field": "sourceAccount",
"code": "BUSINESSRULE",
"message": "Your account does not have enough balance"
}
],
"code": "REMOTE_COMMUNICATION_ERROR",
"errorSeverity": "ERROR",
"message": "Error on modulr communication",
"httpStatus": 500,
"requestId": "8a68b3ad-b0b8-4f25-b813-ef01947c4ad7",
"date": "2024-06-20T09:10:02.673Z",
"errorOrigin": "bank-connector-hub"
}
The error message will be within the data label will be shown to the enduser so you can handle how the errors are shown to the merchants in the front-end.