@Test public void transformShouldRaiseErrorWhenRequestIsNull() throws WorldpayModelTransformationException { expectedException.expect(WorldpayModelTransformationException.class); expectedException.expectMessage("Request provided to create token is invalid."); testObj.transform(null); }
@Override public PaymentService transform(final ServiceRequest request) throws WorldpayModelTransformationException { if (request == null) { throw new WorldpayModelTransformationException("Request provided to create token is invalid."); } final CreateTokenServiceRequest tokenRequest = (CreateTokenServiceRequest) request; final PaymentService paymentService = new PaymentService(); paymentService.setMerchantCode(tokenRequest.getMerchantInfo().getMerchantCode()); paymentService.setVersion(configurationService.getConfiguration().getString(WORLDPAY_CONFIG_VERSION)); final PaymentTokenCreate paymentTokenCreate = (PaymentTokenCreate) tokenRequest.getCardTokenRequest().transformToInternalModel(); final Submit submit = new Submit(); submit.getOrderOrOrderBatchOrShopperOrFuturePayAgreementOrMakeFuturePayPaymentOrIdentifyMeRequestOrPaymentTokenCreateOrChallenge().add(paymentTokenCreate); paymentService.getSubmitOrModifyOrInquiryOrReplyOrNotifyOrVerify().add(submit); return paymentService; }
CreateTokenRequestTransformer implements ServiceRequestTransformer { @Override public PaymentService transform(final ServiceRequest request) throws WorldpayModelTransformationException { if (request == null) { throw new WorldpayModelTransformationException("Request provided to create token is invalid."); } final CreateTokenServiceRequest tokenRequest = (CreateTokenServiceRequest) request; final PaymentService paymentService = new PaymentService(); paymentService.setMerchantCode(tokenRequest.getMerchantInfo().getMerchantCode()); paymentService.setVersion(configurationService.getConfiguration().getString(WORLDPAY_CONFIG_VERSION)); final PaymentTokenCreate paymentTokenCreate = (PaymentTokenCreate) tokenRequest.getCardTokenRequest().transformToInternalModel(); final Submit submit = new Submit(); submit.getOrderOrOrderBatchOrShopperOrFuturePayAgreementOrMakeFuturePayPaymentOrIdentifyMeRequestOrPaymentTokenCreateOrChallenge().add(paymentTokenCreate); paymentService.getSubmitOrModifyOrInquiryOrReplyOrNotifyOrVerify().add(submit); return paymentService; } }
CreateTokenRequestTransformer implements ServiceRequestTransformer { @Override public PaymentService transform(final ServiceRequest request) throws WorldpayModelTransformationException { if (request == null) { throw new WorldpayModelTransformationException("Request provided to create token is invalid."); } final CreateTokenServiceRequest tokenRequest = (CreateTokenServiceRequest) request; final PaymentService paymentService = new PaymentService(); paymentService.setMerchantCode(tokenRequest.getMerchantInfo().getMerchantCode()); paymentService.setVersion(configurationService.getConfiguration().getString(WORLDPAY_CONFIG_VERSION)); final PaymentTokenCreate paymentTokenCreate = (PaymentTokenCreate) tokenRequest.getCardTokenRequest().transformToInternalModel(); final Submit submit = new Submit(); submit.getOrderOrOrderBatchOrShopperOrFuturePayAgreementOrMakeFuturePayPaymentOrIdentifyMeRequestOrPaymentTokenCreateOrChallenge().add(paymentTokenCreate); paymentService.getSubmitOrModifyOrInquiryOrReplyOrNotifyOrVerify().add(submit); return paymentService; }  }
CreateTokenRequestTransformer implements ServiceRequestTransformer { @Override public PaymentService transform(final ServiceRequest request) throws WorldpayModelTransformationException { if (request == null) { throw new WorldpayModelTransformationException("Request provided to create token is invalid."); } final CreateTokenServiceRequest tokenRequest = (CreateTokenServiceRequest) request; final PaymentService paymentService = new PaymentService(); paymentService.setMerchantCode(tokenRequest.getMerchantInfo().getMerchantCode()); paymentService.setVersion(configurationService.getConfiguration().getString(WORLDPAY_CONFIG_VERSION)); final PaymentTokenCreate paymentTokenCreate = (PaymentTokenCreate) tokenRequest.getCardTokenRequest().transformToInternalModel(); final Submit submit = new Submit(); submit.getOrderOrOrderBatchOrShopperOrFuturePayAgreementOrMakeFuturePayPaymentOrIdentifyMeRequestOrPaymentTokenCreateOrChallenge().add(paymentTokenCreate); paymentService.getSubmitOrModifyOrInquiryOrReplyOrNotifyOrVerify().add(submit); return paymentService; }  @Override PaymentService transform(final ServiceRequest request); @Required void setConfigurationService(final ConfigurationService configurationService); }
CreateTokenRequestTransformer implements ServiceRequestTransformer { @Override public PaymentService transform(final ServiceRequest request) throws WorldpayModelTransformationException { if (request == null) { throw new WorldpayModelTransformationException("Request provided to create token is invalid."); } final CreateTokenServiceRequest tokenRequest = (CreateTokenServiceRequest) request; final PaymentService paymentService = new PaymentService(); paymentService.setMerchantCode(tokenRequest.getMerchantInfo().getMerchantCode()); paymentService.setVersion(configurationService.getConfiguration().getString(WORLDPAY_CONFIG_VERSION)); final PaymentTokenCreate paymentTokenCreate = (PaymentTokenCreate) tokenRequest.getCardTokenRequest().transformToInternalModel(); final Submit submit = new Submit(); submit.getOrderOrOrderBatchOrShopperOrFuturePayAgreementOrMakeFuturePayPaymentOrIdentifyMeRequestOrPaymentTokenCreateOrChallenge().add(paymentTokenCreate); paymentService.getSubmitOrModifyOrInquiryOrReplyOrNotifyOrVerify().add(submit); return paymentService; }  @Override PaymentService transform(final ServiceRequest request); @Required void setConfigurationService(final ConfigurationService configurationService);  }