GooglePayController extends AbstractCheckoutController { @RequireHardLogIn @PostMapping(value = "/authorise-order", consumes = {MediaType.APPLICATION_JSON_VALUE}) public DirectResponseData authoriseOrder(@RequestBody final GooglePayAuthorisationRequest authorisationRequest) throws WorldpayException, InvalidCartException { saveBillingAddresses(authorisationRequest.getBillingAddress()); return worldpayDirectOrderFacade.authoriseGooglePayDirect(authorisationRequest.getToken()); }  @RequireHardLogIn @PostMapping(value = "/authorise-order", consumes = {MediaType.APPLICATION_JSON_VALUE}) DirectResponseData authoriseOrder(@RequestBody final GooglePayAuthorisationRequest authorisationRequest);  }
@Test public void testAuthoriseOrder() throws WorldpayException, InvalidCartException { final GooglePayAuthorisationRequest authorisationRequest = new GooglePayAuthorisationRequest(); final GooglePayAdditionalAuthInfo token = new GooglePayAdditionalAuthInfo(); token.setProtocolVersion("2"); token.setSignature("lorem ipsum dolor"); token.setSignedMessage("wop wop wop"); authorisationRequest.setToken(token); final GooglePayAddressData billingAddress = new GooglePayAddressData(); billingAddress.setAddress1("Av Aragon 30"); billingAddress.setAddress2("Planta 8 oficina 999"); billingAddress.setAdministrativeArea("Valencia"); billingAddress.setCountryCode("ES"); billingAddress.setName("James Bond"); billingAddress.setPostalCode("46015"); authorisationRequest.setBillingAddress(billingAddress); testObj.authoriseOrder(authorisationRequest); verify(i18NFacadeMock).getCountryForIsocode("ES"); verify(checkoutCustomerStrategyMock).getCurrentUserForCheckout(); verify(userFacadeMock).addAddress(any(AddressData.class)); verify(worldpayDirectOrderFacadeMock).authoriseGooglePayDirect(authorisationRequest.getToken()); verify(worldpayPaymentCheckoutFacadeMock).setBillingDetails(any(AddressData.class)); }