SajidAbbasMalek | 2019-07-02 10:06:29 UTC | #1
Hello @Jason_Mathison,
Need your help again. Let me give you some background first.
We are using a secure data action to call a payment web service with session id and the otp to process a payment.
Below is what Postman has returned.
{
"errors": [ { "userMessage": "OTP_INVALID", "code": "400", "riskFactorResponse": { "merchantReferenceCode": "492864", "requestId": "5620607391906473604009", "reasonCode": "100", "requestToken": "AhjzbwSTMLGYw69IHnOpEQFRp+zEm7+IENbYj34ZNJMq6PSYM3ApAAAAyxUV", "afsResult": "96", "afsDecision": "ACCEPT" } } ] }
Whereas what PureCloud UI shows is as below
{
"status": 500, "code": "internal.server.error", "message": "The server encountered an unexpected condition which prevented it from fulfilling the request.", "messageParams": {}, "contextId": "9843f539-c020-4ba3-b08b-cc9f46d041a3", "details": [ { "errorCode": "ACTION.REMOTEENDPOINT" } ], "errors": [ { "status": 500, "code": "INTERNALSERVERERROR", "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: { \"errors\" : [ { \"userMessage\" : \"OTPINVALID\", \"code\" : \"400\", \"riskFactorResponse\" : { \"merchantReferenceCode\" : \"492864\", \"requestId\" : \"5620607391906473604009\", \"reasonCode\" : \"100\", \"requestToken\" : \"AhjzbwSTMLGYw69IHnOpEQFRp+zEm7+IENbYj34ZNJMq6PSYM3ApAAAAyxUV\", \"afsResult\" : \"96\", \"afsDecision\" : \"ACCEPT\" } } ]} [9843f539-c020-4ba3-b08b-cc9f46d041a3]", "messageParams": {}, "details": [], "errors": [] } ] }
In case of error, we need $.errors.userMessage field to identify whether payment was failed due to an incorrect OTP or some other reason e.g. insufficient funds etc.
I am attaching snapshots and the data action. Would you be able to help me find a way to extract $.errors.userMessage from error response using translation matrix etc?
<a class="attachment" href="/forum/uploads/db6296/original/2X/b/bba1a5f7ae1b34f44f5c6374bae082c5261f1193.json">FZVerifyOTP2-20190702140113.custom.json</a> (2.2 KB)
Jason_Mathison | 2019-07-02 12:25:27 UTC | #2
Hi SajidAbbasMalek,
Assuming that you are using this Data Action from Architect for a call flow, as far as I know there is no direct solution to what you want to do. When the remote web service returns a non-2xx return code the data action will take the failure path. Last I knew, the error that the data action returns doesn't actually make it back to the error path in an architect call flow for you to be able to check against.
For Architect call flows the only short term solution that comes to mind is to create an intermediate web service that can return a 200 and indicate if the transaction succeeded, and if not what type of failure happened.
You can also post your need to get the error back to an architect call flow as an idea at https://purecloud.ideas.aha.io
For other media types the "Failure Outputs" should include the text of the error, which I would guess you could do a string search on.
--Jason
SajidAbbasMalek | 2019-07-21 10:39:21 UTC | #3
Thank you so much Jason. You are always helpful.
system | 2019-08-21 10:39:24 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 5473