@Test public void testGetErrorConditionForPaymentFromStatusResponse() throws IOException { TerminalAPIResponse terminalAPIResponse = createResponseFromFile(TEST_RESPONSE_DIR+"SaleToPOIResponseStatusCancelled.json"); assertNotNull(terminalAPIResponse); ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalAPIResponse); assertNotNull(errorCondition); assertEquals(ErrorConditionType.CANCEL, errorCondition); }
public static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse) { if (terminalApiResponse != null && terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse().getResponse() != null) { return terminalApiResponse.getSaleToPOIResponse() .getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getErrorCondition(); } return null; }
TerminalAPIUtil { public static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse) { if (terminalApiResponse != null && terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse().getResponse() != null) { return terminalApiResponse.getSaleToPOIResponse() .getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getErrorCondition(); } return null; } }
TerminalAPIUtil { public static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse) { if (terminalApiResponse != null && terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse().getResponse() != null) { return terminalApiResponse.getSaleToPOIResponse() .getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getErrorCondition(); } return null; }  }
TerminalAPIUtil { public static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse) { if (terminalApiResponse != null && terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse().getResponse() != null) { return terminalApiResponse.getSaleToPOIResponse() .getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getErrorCondition(); } return null; }  static ResultType getStatusResultFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForPaymentResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForStatusFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ResultType getPaymentResultFromStatusOrPaymentResponse(TerminalAPIResponse terminalApiResponse); static String getReceiptFromPaymentResponse(TerminalAPIResponse terminalApiResponse); static String getReceiptFromStatusResponse(TerminalAPIResponse terminalApiResponse); static String formatTerminalAPIReceipt(List<PaymentReceipt> paymentReceipts); static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse); static String getErrorMessageByPosErrorCondition(ErrorConditionType errorCondition); }
TerminalAPIUtil { public static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse) { if (terminalApiResponse != null && terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse().getRepeatedMessageResponse().getRepeatedResponseMessageBody().getPaymentResponse().getResponse() != null) { return terminalApiResponse.getSaleToPOIResponse() .getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getErrorCondition(); } return null; }  static ResultType getStatusResultFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForPaymentFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForPaymentResponse(TerminalAPIResponse terminalApiResponse); static ErrorConditionType getErrorConditionForStatusFromStatusResponse(TerminalAPIResponse terminalApiResponse); static ResultType getPaymentResultFromStatusOrPaymentResponse(TerminalAPIResponse terminalApiResponse); static String getReceiptFromPaymentResponse(TerminalAPIResponse terminalApiResponse); static String getReceiptFromStatusResponse(TerminalAPIResponse terminalApiResponse); static String formatTerminalAPIReceipt(List<PaymentReceipt> paymentReceipts); static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse); static String getErrorMessageByPosErrorCondition(ErrorConditionType errorCondition); static final Logger LOGGER; }