@Test public void testConverterForPaymentResponse() { when(saleToPoiResponse.getPaymentResponse()).thenReturn(paymentResponse); PaymentsResponse paymentsResponse = posPaymentResponseConverter.convert(saleToPoiResponse); assertNotNull(paymentsResponse); assertEquals("psp", paymentsResponse.getPspReference()); assertEquals(shouldExpectAdditionalData, paymentsResponse.getAdditionalData() != null); if(shouldExpectAdditionalData) { assertEquals((int) expectedAdditionalDataSize, paymentsResponse.getAdditionalData().size()); assertEquals(expectedAuthCode, paymentsResponse.getAuthCode()); } }
@Override public PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse) { String pspReference = null; Map<String, String> additionalData = null; String additionalResponse = null; if (saleToPOIResponse != null && saleToPOIResponse.getPaymentResponse() != null) { pspReference = saleToPOIResponse.getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getPaymentResponse() .getResponse() .getAdditionalResponse(); } else if (saleToPOIResponse != null && saleToPOIResponse.getTransactionStatusResponse() != null) { pspReference = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getAdditionalResponse(); } if (additionalResponse != null) { additionalData = parseAdditionalResponse(additionalResponse); } PaymentsResponse paymentsResponse = new PaymentsResponse(); paymentsResponse.setPspReference(pspReference); paymentsResponse.setAdditionalData(additionalData); return paymentsResponse; }
PosPaymentResponseConverter implements Converter<SaleToPOIResponse, PaymentsResponse> { @Override public PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse) { String pspReference = null; Map<String, String> additionalData = null; String additionalResponse = null; if (saleToPOIResponse != null && saleToPOIResponse.getPaymentResponse() != null) { pspReference = saleToPOIResponse.getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getPaymentResponse() .getResponse() .getAdditionalResponse(); } else if (saleToPOIResponse != null && saleToPOIResponse.getTransactionStatusResponse() != null) { pspReference = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getAdditionalResponse(); } if (additionalResponse != null) { additionalData = parseAdditionalResponse(additionalResponse); } PaymentsResponse paymentsResponse = new PaymentsResponse(); paymentsResponse.setPspReference(pspReference); paymentsResponse.setAdditionalData(additionalData); return paymentsResponse; } }
PosPaymentResponseConverter implements Converter<SaleToPOIResponse, PaymentsResponse> { @Override public PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse) { String pspReference = null; Map<String, String> additionalData = null; String additionalResponse = null; if (saleToPOIResponse != null && saleToPOIResponse.getPaymentResponse() != null) { pspReference = saleToPOIResponse.getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getPaymentResponse() .getResponse() .getAdditionalResponse(); } else if (saleToPOIResponse != null && saleToPOIResponse.getTransactionStatusResponse() != null) { pspReference = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getAdditionalResponse(); } if (additionalResponse != null) { additionalData = parseAdditionalResponse(additionalResponse); } PaymentsResponse paymentsResponse = new PaymentsResponse(); paymentsResponse.setPspReference(pspReference); paymentsResponse.setAdditionalData(additionalData); return paymentsResponse; }  }
PosPaymentResponseConverter implements Converter<SaleToPOIResponse, PaymentsResponse> { @Override public PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse) { String pspReference = null; Map<String, String> additionalData = null; String additionalResponse = null; if (saleToPOIResponse != null && saleToPOIResponse.getPaymentResponse() != null) { pspReference = saleToPOIResponse.getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getPaymentResponse() .getResponse() .getAdditionalResponse(); } else if (saleToPOIResponse != null && saleToPOIResponse.getTransactionStatusResponse() != null) { pspReference = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getAdditionalResponse(); } if (additionalResponse != null) { additionalData = parseAdditionalResponse(additionalResponse); } PaymentsResponse paymentsResponse = new PaymentsResponse(); paymentsResponse.setPspReference(pspReference); paymentsResponse.setAdditionalData(additionalData); return paymentsResponse; }  @Override PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse); }
PosPaymentResponseConverter implements Converter<SaleToPOIResponse, PaymentsResponse> { @Override public PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse) { String pspReference = null; Map<String, String> additionalData = null; String additionalResponse = null; if (saleToPOIResponse != null && saleToPOIResponse.getPaymentResponse() != null) { pspReference = saleToPOIResponse.getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getPaymentResponse() .getResponse() .getAdditionalResponse(); } else if (saleToPOIResponse != null && saleToPOIResponse.getTransactionStatusResponse() != null) { pspReference = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getPaymentResult() .getPaymentAcquirerData() .getAcquirerTransactionID() .getTransactionID(); additionalResponse = saleToPOIResponse.getTransactionStatusResponse() .getRepeatedMessageResponse() .getRepeatedResponseMessageBody() .getPaymentResponse() .getResponse() .getAdditionalResponse(); } if (additionalResponse != null) { additionalData = parseAdditionalResponse(additionalResponse); } PaymentsResponse paymentsResponse = new PaymentsResponse(); paymentsResponse.setPspReference(pspReference); paymentsResponse.setAdditionalData(additionalData); return paymentsResponse; }  @Override PaymentsResponse convert(SaleToPOIResponse saleToPOIResponse);  }