- if (!flowSequence.contains("transactions")) {
- throw new Exception("No transactions were generated for this request");
+ // check for transactions data
+ if (!flowSequence.contains("transaction-id")) {
+ // check for status data
+ JSONObject statusJson = new JSONObject(output.toString()).optJSONObject("status");
+ if (statusJson != null) {
+ log.info("statusJson=" + statusJson);
+ if (statusJson.has("code")) {
+ // extract code and set into ctx
+ log.info("Setting " + OUTPUT_PARAM_ERROR_CODE + "=" + statusJson.get("code").toString() + " in context ctx");
+ ctx.setAttribute(OUTPUT_PARAM_ERROR_CODE, statusJson.get("code").toString());
+ log.info("Setting " + OUTPUT_PARAM_ERROR_MESSAGE + "=" + statusJson.get("message").toString() + " in context ctx");
+ ctx.setAttribute(OUTPUT_PARAM_ERROR_MESSAGE, statusJson.get("message").toString());
+ }
+ }
+ throw new Exception("Failed to generate the sequence for this request");