@Test public void testExecuteSecondPaymentAuthorisation3DSecureAuthorised() throws WorldpayException, InvalidCartException { final DirectResponseData result = testObj.executeSecondPaymentAuthorisation3DSecure(); final InOrder inOrder = inOrder(acceleratorCheckoutFacadeMock, worldpayDirectOrderServiceMock); inOrder.verify(worldpayDirectOrderServiceMock).authorise3DSecureAgain(WORLDPAY_ORDER_CODE); inOrder.verify(worldpayDirectOrderServiceMock).completeAuthorise3DSecure(cartModelMock, directAuthoriseServiceResponse3dSecureMock); inOrder.verify(acceleratorCheckoutFacadeMock).placeOrder(); assertEquals(AUTHORISED, result.getTransactionStatus()); assertEquals(acceleratorCheckoutFacadeMock.placeOrder(), result.getOrderData()); }
@Override public DirectResponseData executeSecondPaymentAuthorisation3DSecure() throws WorldpayException, InvalidCartException { final DirectResponseData response = new DirectResponseData(); if (cartService.hasSessionCart()) { final CartModel cartModel = cartService.getSessionCart(); final DirectAuthoriseServiceResponse serviceResponse = worldpayDirectOrderService.authorise3DSecureAgain(cartModel.getWorldpayOrderCode()); if (shouldProcessResponse(serviceResponse)) { return processDirectResponseData(cartModel, serviceResponse, response); } else if (serviceResponse.getErrorDetail() != null) { final String errorMessage = format(THERE_WAS_AN_ERROR_IN_THE_SERVICE_GATEWAY_MESSAGE, serviceResponse.getErrorDetail().getMessage()); LOG.error(errorMessage); throw new WorldpayException(errorMessage); } else { throw new WorldpayException(THERE_WAS_AN_ERROR_COMMUNICATING_WITH_WORLDPAY); } } else { throwWorldpayException("The session has not a valid cart"); } return response; }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData executeSecondPaymentAuthorisation3DSecure() throws WorldpayException, InvalidCartException { final DirectResponseData response = new DirectResponseData(); if (cartService.hasSessionCart()) { final CartModel cartModel = cartService.getSessionCart(); final DirectAuthoriseServiceResponse serviceResponse = worldpayDirectOrderService.authorise3DSecureAgain(cartModel.getWorldpayOrderCode()); if (shouldProcessResponse(serviceResponse)) { return processDirectResponseData(cartModel, serviceResponse, response); } else if (serviceResponse.getErrorDetail() != null) { final String errorMessage = format(THERE_WAS_AN_ERROR_IN_THE_SERVICE_GATEWAY_MESSAGE, serviceResponse.getErrorDetail().getMessage()); LOG.error(errorMessage); throw new WorldpayException(errorMessage); } else { throw new WorldpayException(THERE_WAS_AN_ERROR_COMMUNICATING_WITH_WORLDPAY); } } else { throwWorldpayException("The session has not a valid cart"); } return response; } }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData executeSecondPaymentAuthorisation3DSecure() throws WorldpayException, InvalidCartException { final DirectResponseData response = new DirectResponseData(); if (cartService.hasSessionCart()) { final CartModel cartModel = cartService.getSessionCart(); final DirectAuthoriseServiceResponse serviceResponse = worldpayDirectOrderService.authorise3DSecureAgain(cartModel.getWorldpayOrderCode()); if (shouldProcessResponse(serviceResponse)) { return processDirectResponseData(cartModel, serviceResponse, response); } else if (serviceResponse.getErrorDetail() != null) { final String errorMessage = format(THERE_WAS_AN_ERROR_IN_THE_SERVICE_GATEWAY_MESSAGE, serviceResponse.getErrorDetail().getMessage()); LOG.error(errorMessage); throw new WorldpayException(errorMessage); } else { throw new WorldpayException(THERE_WAS_AN_ERROR_COMMUNICATING_WITH_WORLDPAY); } } else { throwWorldpayException("The session has not a valid cart"); } return response; } DefaultWorldpayDirectOrderFacade(final WorldpayAuthenticatedShopperIdStrategy worldpayAuthenticatedShopperIdStrategy,
                                            final WorldpayDirectOrderService worldpayDirectOrderService,
                                            final CartService cartService,
                                            final AcceleratorCheckoutFacade acceleratorCheckoutFacade,
                                            final WorldpayPaymentInfoService worldpayPaymentInfoService,
                                            final WorldpayMerchantConfigDataFacade worldpayMerchantConfigDataFacade,
                                            final CartFacade cartFacade); }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData executeSecondPaymentAuthorisation3DSecure() throws WorldpayException, InvalidCartException { final DirectResponseData response = new DirectResponseData(); if (cartService.hasSessionCart()) { final CartModel cartModel = cartService.getSessionCart(); final DirectAuthoriseServiceResponse serviceResponse = worldpayDirectOrderService.authorise3DSecureAgain(cartModel.getWorldpayOrderCode()); if (shouldProcessResponse(serviceResponse)) { return processDirectResponseData(cartModel, serviceResponse, response); } else if (serviceResponse.getErrorDetail() != null) { final String errorMessage = format(THERE_WAS_AN_ERROR_IN_THE_SERVICE_GATEWAY_MESSAGE, serviceResponse.getErrorDetail().getMessage()); LOG.error(errorMessage); throw new WorldpayException(errorMessage); } else { throw new WorldpayException(THERE_WAS_AN_ERROR_COMMUNICATING_WITH_WORLDPAY); } } else { throwWorldpayException("The session has not a valid cart"); } return response; } DefaultWorldpayDirectOrderFacade(final WorldpayAuthenticatedShopperIdStrategy worldpayAuthenticatedShopperIdStrategy,
                                            final WorldpayDirectOrderService worldpayDirectOrderService,
                                            final CartService cartService,
                                            final AcceleratorCheckoutFacade acceleratorCheckoutFacade,
                                            final WorldpayPaymentInfoService worldpayPaymentInfoService,
                                            final WorldpayMerchantConfigDataFacade worldpayMerchantConfigDataFacade,
                                            final CartFacade cartFacade); @Override void tokenize(final CartModel cartModel, final CSEAdditionalAuthInfo cseAdditionalAuthInfo, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override void tokenize(final CSEAdditionalAuthInfo cseAdditionalAuthInfo, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authorise(final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authoriseRecurringPayment(final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authoriseRecurringPayment(final AbstractOrderModel abstractOrderModel,
                                                        final WorldpayAdditionalInfoData worldpayAdditionalInfoData,
                                                        final MerchantInfo merchantInfo); @Override String authoriseKlarnaRedirect(final WorldpayAdditionalInfoData worldpayAdditionalInfoData, final AdditionalAuthInfo additionalAuthInfo); @Override DirectResponseData authoriseApplePayDirect(final ApplePayAdditionalAuthInfo applePayAdditionalAuthInfo); @Override DirectResponseData authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo); @Override ApplePayOrderUpdate updatePaymentMethod(final ApplePayPaymentMethodUpdateRequest paymentMethodUpdateRequest); @Override String authoriseBankTransferRedirect(final BankTransferAdditionalAuthInfo bankTransferAdditionalAuthInfo,
                                                final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authorise3DSecure(final String paResponse, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData executeSecondPaymentAuthorisation3DSecure(); @Override DirectResponseData authoriseAndTokenize(final WorldpayAdditionalInfoData worldpayAdditionalInfoData, final CSEAdditionalAuthInfo cseAdditionalAuthInfo); CartService getCartService(); }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData executeSecondPaymentAuthorisation3DSecure() throws WorldpayException, InvalidCartException { final DirectResponseData response = new DirectResponseData(); if (cartService.hasSessionCart()) { final CartModel cartModel = cartService.getSessionCart(); final DirectAuthoriseServiceResponse serviceResponse = worldpayDirectOrderService.authorise3DSecureAgain(cartModel.getWorldpayOrderCode()); if (shouldProcessResponse(serviceResponse)) { return processDirectResponseData(cartModel, serviceResponse, response); } else if (serviceResponse.getErrorDetail() != null) { final String errorMessage = format(THERE_WAS_AN_ERROR_IN_THE_SERVICE_GATEWAY_MESSAGE, serviceResponse.getErrorDetail().getMessage()); LOG.error(errorMessage); throw new WorldpayException(errorMessage); } else { throw new WorldpayException(THERE_WAS_AN_ERROR_COMMUNICATING_WITH_WORLDPAY); } } else { throwWorldpayException("The session has not a valid cart"); } return response; } DefaultWorldpayDirectOrderFacade(final WorldpayAuthenticatedShopperIdStrategy worldpayAuthenticatedShopperIdStrategy,
                                            final WorldpayDirectOrderService worldpayDirectOrderService,
                                            final CartService cartService,
                                            final AcceleratorCheckoutFacade acceleratorCheckoutFacade,
                                            final WorldpayPaymentInfoService worldpayPaymentInfoService,
                                            final WorldpayMerchantConfigDataFacade worldpayMerchantConfigDataFacade,
                                            final CartFacade cartFacade); @Override void tokenize(final CartModel cartModel, final CSEAdditionalAuthInfo cseAdditionalAuthInfo, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override void tokenize(final CSEAdditionalAuthInfo cseAdditionalAuthInfo, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authorise(final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authoriseRecurringPayment(final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authoriseRecurringPayment(final AbstractOrderModel abstractOrderModel,
                                                        final WorldpayAdditionalInfoData worldpayAdditionalInfoData,
                                                        final MerchantInfo merchantInfo); @Override String authoriseKlarnaRedirect(final WorldpayAdditionalInfoData worldpayAdditionalInfoData, final AdditionalAuthInfo additionalAuthInfo); @Override DirectResponseData authoriseApplePayDirect(final ApplePayAdditionalAuthInfo applePayAdditionalAuthInfo); @Override DirectResponseData authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo); @Override ApplePayOrderUpdate updatePaymentMethod(final ApplePayPaymentMethodUpdateRequest paymentMethodUpdateRequest); @Override String authoriseBankTransferRedirect(final BankTransferAdditionalAuthInfo bankTransferAdditionalAuthInfo,
                                                final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authorise3DSecure(final String paResponse, final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData executeSecondPaymentAuthorisation3DSecure(); @Override DirectResponseData authoriseAndTokenize(final WorldpayAdditionalInfoData worldpayAdditionalInfoData, final CSEAdditionalAuthInfo cseAdditionalAuthInfo); CartService getCartService();  }