Handle errors returned by Trustly
According to the JSON RPC 1.1 specification, the Procedure Return object must contain the error number when a remote procedure call fails.
Example of a JSON object returned by Trustly when an error occurs:
{
"version": "1.1",
"error": {
"name": "JSONRPCError",
"code": 616,
"message": "ERROR_INVALID_CREDENTIALS",
"error": {
"signature": "R9+hjuMqbsH0Ku ... S16VbzRsw==",
"uuid": "258a2184-2842-b485-25ca-293525152425",
"method": "Deposit",
"data": {
"code" : 616,
"message" : "ERROR_INVALID_CREDENTIALS"
}
}
}
The message returned is not in a suitable format to present for customers.
If the error is JSON-RPC specific (for example invalid JSON-format), uuid and method will be "null".