@Test public void shouldNotCreateGooglePayPaymentInfoWhenTransactionIsNotAuthorised() throws WorldpayException, InvalidCartException { when(worldpayDirectOrderServiceMock.authoriseGooglePay(cartModelMock, googlePayAdditionalAuthInfoMock)).thenReturn(directAuthoriseServiceResponseMock); when(directAuthoriseServiceResponseMock.getPaymentReply().getAuthStatus()).thenReturn(REFUSED); testObj.authoriseGooglePayDirect(googlePayAdditionalAuthInfoMock); verify(worldpayPaymentInfoServiceMock, never()).createPaymentInfoGooglePay(any(CartModel.class), any(GooglePayAdditionalAuthInfo.class)); }
@Override public DirectResponseData authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo) throws WorldpayException, InvalidCartException { try { final CartModel cart = cartService.getSessionCart(); final DirectAuthoriseServiceResponse directAuthoriseServiceResponse = worldpayDirectOrderService.authoriseGooglePay(cart, googlePayAdditionalAuthInfo); if (directAuthoriseServiceResponse.getPaymentReply().getAuthStatus().equals(AUTHORISED)) { worldpayPaymentInfoService.createPaymentInfoGooglePay(cart, googlePayAdditionalAuthInfo); } return handleDirectServiceResponse(directAuthoriseServiceResponse, cart); } catch (final WorldpayConfigurationException e) { LOG.error(THERE_IS_NO_CONFIGURATION, e); throw e; } }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo) throws WorldpayException, InvalidCartException { try { final CartModel cart = cartService.getSessionCart(); final DirectAuthoriseServiceResponse directAuthoriseServiceResponse = worldpayDirectOrderService.authoriseGooglePay(cart, googlePayAdditionalAuthInfo); if (directAuthoriseServiceResponse.getPaymentReply().getAuthStatus().equals(AUTHORISED)) { worldpayPaymentInfoService.createPaymentInfoGooglePay(cart, googlePayAdditionalAuthInfo); } return handleDirectServiceResponse(directAuthoriseServiceResponse, cart); } catch (final WorldpayConfigurationException e) { LOG.error(THERE_IS_NO_CONFIGURATION, e); throw e; } } }
DefaultWorldpayDirectOrderFacade implements WorldpayDirectOrderFacade { @Override public DirectResponseData authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo) throws WorldpayException, InvalidCartException { try { final CartModel cart = cartService.getSessionCart(); final DirectAuthoriseServiceResponse directAuthoriseServiceResponse = worldpayDirectOrderService.authoriseGooglePay(cart, googlePayAdditionalAuthInfo); if (directAuthoriseServiceResponse.getPaymentReply().getAuthStatus().equals(AUTHORISED)) { worldpayPaymentInfoService.createPaymentInfoGooglePay(cart, googlePayAdditionalAuthInfo); } return handleDirectServiceResponse(directAuthoriseServiceResponse, cart); } catch (final WorldpayConfigurationException e) { LOG.error(THERE_IS_NO_CONFIGURATION, e); throw e; } } 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 authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo) throws WorldpayException, InvalidCartException { try { final CartModel cart = cartService.getSessionCart(); final DirectAuthoriseServiceResponse directAuthoriseServiceResponse = worldpayDirectOrderService.authoriseGooglePay(cart, googlePayAdditionalAuthInfo); if (directAuthoriseServiceResponse.getPaymentReply().getAuthStatus().equals(AUTHORISED)) { worldpayPaymentInfoService.createPaymentInfoGooglePay(cart, googlePayAdditionalAuthInfo); } return handleDirectServiceResponse(directAuthoriseServiceResponse, cart); } catch (final WorldpayConfigurationException e) { LOG.error(THERE_IS_NO_CONFIGURATION, e); throw e; } } 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 authoriseGooglePayDirect(final GooglePayAdditionalAuthInfo googlePayAdditionalAuthInfo) throws WorldpayException, InvalidCartException { try { final CartModel cart = cartService.getSessionCart(); final DirectAuthoriseServiceResponse directAuthoriseServiceResponse = worldpayDirectOrderService.authoriseGooglePay(cart, googlePayAdditionalAuthInfo); if (directAuthoriseServiceResponse.getPaymentReply().getAuthStatus().equals(AUTHORISED)) { worldpayPaymentInfoService.createPaymentInfoGooglePay(cart, googlePayAdditionalAuthInfo); } return handleDirectServiceResponse(directAuthoriseServiceResponse, cart); } catch (final WorldpayConfigurationException e) { LOG.error(THERE_IS_NO_CONFIGURATION, e); throw e; } } 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();  }