@Test public void testGetErrorMessageForNonAuthorizedPosPayment() throws IOException { TerminalAPIResponse terminalAPIResponse = createResponseFromFile(TEST_RESPONSE_DIR+"SaleToPOIResponsePaymentCancelled.json"); assertNotNull(terminalAPIResponse); String errorMessage = TerminalAPIUtil.getErrorMessageForNonAuthorizedPosPayment(terminalAPIResponse); assertNotNull(errorMessage); assertEquals("checkout.error.authorization.payment.cancelled", errorMessage); }
public static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse) { String errorMessage; if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getPaymentResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else { errorMessage = "checkout.error.authorization.pos.configuration"; } return errorMessage; }
TerminalAPIUtil { public static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse) { String errorMessage; if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getPaymentResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else { errorMessage = "checkout.error.authorization.pos.configuration"; } return errorMessage; } }
TerminalAPIUtil { public static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse) { String errorMessage; if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getPaymentResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else { errorMessage = "checkout.error.authorization.pos.configuration"; } return errorMessage; }  }
TerminalAPIUtil { public static String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse) { String errorMessage; if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getPaymentResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else { errorMessage = "checkout.error.authorization.pos.configuration"; } return errorMessage; }  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 String getErrorMessageForNonAuthorizedPosPayment(TerminalAPIResponse terminalApiResponse) { String errorMessage; if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getPaymentResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else if (terminalApiResponse.getSaleToPOIResponse() != null && terminalApiResponse.getSaleToPOIResponse().getTransactionStatusResponse() != null) { ErrorConditionType errorCondition = TerminalAPIUtil.getErrorConditionForPaymentFromStatusResponse(terminalApiResponse); errorMessage = TerminalAPIUtil.getErrorMessageByPosErrorCondition(errorCondition); } else { errorMessage = "checkout.error.authorization.pos.configuration"; } return errorMessage; }  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; }