@Test public void shouldBuildTokenReplyWithUATP() { final Token token = new Token(); final List<Object> tokenElements = token.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); final PaymentInstrument paymentInstrument = new PaymentInstrument(); paymentInstrument.getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().add(createCardDetails("UATP", null)); tokenElements.add(paymentInstrument); final TokenReply tokenReply = testObj.buildTokenReply(token); assertThat(tokenReply.getPaymentInstrument().getPaymentType()).isEqualTo(PaymentType.UATP); }
@Override public TokenReply buildTokenReply(final Token intToken) { final TokenReply tokenReply = new TokenReply(); tokenReply.setAuthenticatedShopperID(intToken.getAuthenticatedShopperID()); tokenReply.setTokenEventReference(intToken.getTokenEventReference()); final List<Object> tokenInformationFields = intToken.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); for (final Object tokenInformationField : tokenInformationFields) { if (tokenInformationField instanceof TokenReason) { tokenReply.setTokenReason(((TokenReason) tokenInformationField).getvalue()); } else if (tokenInformationField instanceof TokenDetails) { final com.worldpay.service.model.token.TokenDetails tokenDetails = transformTokenDetails((TokenDetails) tokenInformationField); tokenReply.setTokenDetails(tokenDetails); } else if (tokenInformationField instanceof PaymentInstrument) { final Object paymentInstrument = ((PaymentInstrument) tokenInformationField).getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().get(0); if (paymentInstrument instanceof CardDetails) { final com.worldpay.service.model.payment.Card card = transformCard((CardDetails) paymentInstrument); tokenReply.setPaymentInstrument(card); } else if (paymentInstrument instanceof Paypal) { tokenReply.setPaypalDetails(((Paypal) paymentInstrument).getvalue()); } } else if (tokenInformationField instanceof Error) { tokenReply.setError(buildErrorDetail((Error) tokenInformationField)); } } return tokenReply; }
DefaultServiceResponseTransformerHelper implements ServiceResponseTransformerHelper { @Override public TokenReply buildTokenReply(final Token intToken) { final TokenReply tokenReply = new TokenReply(); tokenReply.setAuthenticatedShopperID(intToken.getAuthenticatedShopperID()); tokenReply.setTokenEventReference(intToken.getTokenEventReference()); final List<Object> tokenInformationFields = intToken.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); for (final Object tokenInformationField : tokenInformationFields) { if (tokenInformationField instanceof TokenReason) { tokenReply.setTokenReason(((TokenReason) tokenInformationField).getvalue()); } else if (tokenInformationField instanceof TokenDetails) { final com.worldpay.service.model.token.TokenDetails tokenDetails = transformTokenDetails((TokenDetails) tokenInformationField); tokenReply.setTokenDetails(tokenDetails); } else if (tokenInformationField instanceof PaymentInstrument) { final Object paymentInstrument = ((PaymentInstrument) tokenInformationField).getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().get(0); if (paymentInstrument instanceof CardDetails) { final com.worldpay.service.model.payment.Card card = transformCard((CardDetails) paymentInstrument); tokenReply.setPaymentInstrument(card); } else if (paymentInstrument instanceof Paypal) { tokenReply.setPaypalDetails(((Paypal) paymentInstrument).getvalue()); } } else if (tokenInformationField instanceof Error) { tokenReply.setError(buildErrorDetail((Error) tokenInformationField)); } } return tokenReply; } }
DefaultServiceResponseTransformerHelper implements ServiceResponseTransformerHelper { @Override public TokenReply buildTokenReply(final Token intToken) { final TokenReply tokenReply = new TokenReply(); tokenReply.setAuthenticatedShopperID(intToken.getAuthenticatedShopperID()); tokenReply.setTokenEventReference(intToken.getTokenEventReference()); final List<Object> tokenInformationFields = intToken.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); for (final Object tokenInformationField : tokenInformationFields) { if (tokenInformationField instanceof TokenReason) { tokenReply.setTokenReason(((TokenReason) tokenInformationField).getvalue()); } else if (tokenInformationField instanceof TokenDetails) { final com.worldpay.service.model.token.TokenDetails tokenDetails = transformTokenDetails((TokenDetails) tokenInformationField); tokenReply.setTokenDetails(tokenDetails); } else if (tokenInformationField instanceof PaymentInstrument) { final Object paymentInstrument = ((PaymentInstrument) tokenInformationField).getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().get(0); if (paymentInstrument instanceof CardDetails) { final com.worldpay.service.model.payment.Card card = transformCard((CardDetails) paymentInstrument); tokenReply.setPaymentInstrument(card); } else if (paymentInstrument instanceof Paypal) { tokenReply.setPaypalDetails(((Paypal) paymentInstrument).getvalue()); } } else if (tokenInformationField instanceof Error) { tokenReply.setError(buildErrorDetail((Error) tokenInformationField)); } } return tokenReply; }  }
DefaultServiceResponseTransformerHelper implements ServiceResponseTransformerHelper { @Override public TokenReply buildTokenReply(final Token intToken) { final TokenReply tokenReply = new TokenReply(); tokenReply.setAuthenticatedShopperID(intToken.getAuthenticatedShopperID()); tokenReply.setTokenEventReference(intToken.getTokenEventReference()); final List<Object> tokenInformationFields = intToken.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); for (final Object tokenInformationField : tokenInformationFields) { if (tokenInformationField instanceof TokenReason) { tokenReply.setTokenReason(((TokenReason) tokenInformationField).getvalue()); } else if (tokenInformationField instanceof TokenDetails) { final com.worldpay.service.model.token.TokenDetails tokenDetails = transformTokenDetails((TokenDetails) tokenInformationField); tokenReply.setTokenDetails(tokenDetails); } else if (tokenInformationField instanceof PaymentInstrument) { final Object paymentInstrument = ((PaymentInstrument) tokenInformationField).getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().get(0); if (paymentInstrument instanceof CardDetails) { final com.worldpay.service.model.payment.Card card = transformCard((CardDetails) paymentInstrument); tokenReply.setPaymentInstrument(card); } else if (paymentInstrument instanceof Paypal) { tokenReply.setPaypalDetails(((Paypal) paymentInstrument).getvalue()); } } else if (tokenInformationField instanceof Error) { tokenReply.setError(buildErrorDetail((Error) tokenInformationField)); } } return tokenReply; }  @Override boolean checkForError(final ServiceResponse response, final Reply reply); @Override PaymentReply buildPaymentReply(final Payment intPayment); @Override UpdateTokenReply buildUpdateTokenReply(final UpdateTokenReceived intUpdateTokenReceived); @Override DeleteTokenReply buildDeleteTokenReply(final DeleteTokenReceived intDeleteTokenReceived); @Override TokenReply buildTokenReply(final Token intToken); @Override WebformRefundReply buildWebformRefundReply(final ShopperWebformRefundDetails intShopperWebformRefundDetails); @Override JournalReply buildJournalReply(final Journal intJournal); }
DefaultServiceResponseTransformerHelper implements ServiceResponseTransformerHelper { @Override public TokenReply buildTokenReply(final Token intToken) { final TokenReply tokenReply = new TokenReply(); tokenReply.setAuthenticatedShopperID(intToken.getAuthenticatedShopperID()); tokenReply.setTokenEventReference(intToken.getTokenEventReference()); final List<Object> tokenInformationFields = intToken.getTokenReasonOrTokenDetailsOrPaymentInstrumentOrSchemeResponseOrError(); for (final Object tokenInformationField : tokenInformationFields) { if (tokenInformationField instanceof TokenReason) { tokenReply.setTokenReason(((TokenReason) tokenInformationField).getvalue()); } else if (tokenInformationField instanceof TokenDetails) { final com.worldpay.service.model.token.TokenDetails tokenDetails = transformTokenDetails((TokenDetails) tokenInformationField); tokenReply.setTokenDetails(tokenDetails); } else if (tokenInformationField instanceof PaymentInstrument) { final Object paymentInstrument = ((PaymentInstrument) tokenInformationField).getCardDetailsOrPaypalOrSepaOrEmvcoTokenDetailsOrSAMSUNGPAYSSL().get(0); if (paymentInstrument instanceof CardDetails) { final com.worldpay.service.model.payment.Card card = transformCard((CardDetails) paymentInstrument); tokenReply.setPaymentInstrument(card); } else if (paymentInstrument instanceof Paypal) { tokenReply.setPaypalDetails(((Paypal) paymentInstrument).getvalue()); } } else if (tokenInformationField instanceof Error) { tokenReply.setError(buildErrorDetail((Error) tokenInformationField)); } } return tokenReply; }  @Override boolean checkForError(final ServiceResponse response, final Reply reply); @Override PaymentReply buildPaymentReply(final Payment intPayment); @Override UpdateTokenReply buildUpdateTokenReply(final UpdateTokenReceived intUpdateTokenReceived); @Override DeleteTokenReply buildDeleteTokenReply(final DeleteTokenReceived intDeleteTokenReceived); @Override TokenReply buildTokenReply(final Token intToken); @Override WebformRefundReply buildWebformRefundReply(final ShopperWebformRefundDetails intShopperWebformRefundDetails); @Override JournalReply buildJournalReply(final Journal intJournal);  }