DefaultWorldpayB2BDirectOrderFacade extends DefaultWorldpayDirectOrderFacade implements WorldpayB2BDirectOrderFacade { @Override public DirectResponseData authoriseRecurringPayment(final String orderCode, final WorldpayAdditionalInfoData worldpayAdditionalInfoData) throws WorldpayException, InvalidCartException { final AbstractOrderModel abstractOrderModel = b2BOrderService.getOrderForCode(orderCode); return internalAuthoriseRecurringPayment(abstractOrderModel, worldpayAdditionalInfoData); } DefaultWorldpayB2BDirectOrderFacade(final WorldpayAuthenticatedShopperIdStrategy worldpayAuthenticatedShopperIdStrategy, final WorldpayDirectOrderService worldpayDirectOrderService, final CartService cartService, final AcceleratorCheckoutFacade acceleratorCheckoutFacade, final WorldpayPaymentInfoService worldpayPaymentInfoService, final WorldpayMerchantConfigDataFacade worldpayMerchantConfigDataFacade, final CartFacade cartFacade, final B2BOrderService b2BOrderService); @Override DirectResponseData authoriseRecurringPayment(final String orderCode,
                                                        final WorldpayAdditionalInfoData worldpayAdditionalInfoData); @Override DirectResponseData authorise3DSecureOnOrder(final String orderCode,
                                                       final String paResponse,
                                                       final WorldpayAdditionalInfoData worldpayAdditionalInfoData);  }
@Test public void authoriseRecurringPaymentShouldNotPlaceOrder() throws WorldpayException, InvalidCartException { final DirectResponseData result = testObj.authoriseRecurringPayment(worldpayAdditionalInfoDataMock); verify(acceleratorCheckoutFacadeMock, never()).placeOrder(); assertEquals(TransactionStatus.AUTHORISED, result.getTransactionStatus()); }
@Test public void authoriseRecurringPaymentShouldAuthoriseOrderForCode() throws WorldpayException, InvalidCartException { final DirectResponseData result = testObj.authoriseRecurringPayment(ORDER_CODE, worldpayAdditionalInfoDataMock); verify(worldpayDirectOrderServiceMock).authoriseRecurringPayment(orderModelMock, worldpayAdditionalInfoDataMock); assertEquals(TransactionStatus.AUTHORISED, result.getTransactionStatus()); }