ApplePayController extends AbstractCheckoutController { @RequireHardLogIn @PostMapping(value = "/authorise-order", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody public DirectResponseData authoriseOrder(@RequestBody final ApplePayAuthorisationRequest authorisationRequest) throws WorldpayException, InvalidCartException { worldpayApplePayPaymentCheckoutFacade.saveBillingAddresses(authorisationRequest.getBillingContact()); return worldpayDirectOrderFacade.authoriseApplePayDirect(authorisationRequest.getToken().getPaymentData()); }  @RequireHardLogIn @PostMapping(value = "/request-session", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody Object requestPaymentSession(@RequestBody final ValidateMerchantRequestData validateMerchantRequestData); @RequireHardLogIn @PostMapping(value = "/authorise-order", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody DirectResponseData authoriseOrder(@RequestBody final ApplePayAuthorisationRequest authorisationRequest); @RequireHardLogIn @PostMapping(value = "/update-payment-method", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody ApplePayOrderUpdate updatePaymentMethod(@RequestBody final ApplePayPaymentMethodUpdateRequest paymentMethodUpdateRequest);  }
@Test public void testAuthoriseOrder() throws WorldpayException, InvalidCartException { when(authorisationRequestMock.getBillingContact()).thenReturn(billingContactMock); when(authorisationRequestMock.getToken().getPaymentData()).thenReturn(paymentDataMock); doNothing().when(worldpayApplePayPaymentCheckoutFacadeMock).saveBillingAddresses(billingContactMock); testObj.authoriseOrder(authorisationRequestMock); verify(worldpayApplePayPaymentCheckoutFacadeMock).saveBillingAddresses(billingContactMock); verify(worldpayDirectOrderFacadeMock).authoriseApplePayDirect(paymentDataMock); }