ApplePayController extends AbstractWorldpayController { @Secured({"ROLE_CUSTOMERGROUP", "ROLE_GUEST", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) @PostMapping(value = "/request-session", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody public Object requestPaymentSession(@RequestBody final ValidateMerchantRequestWsDTO validateMerchantRequestWsDTO) { final ValidateMerchantRequestData validateMerchantRequestData = dataMapper.map(validateMerchantRequestWsDTO, ValidateMerchantRequestData.class); final ValidateMerchantRequestDTO requestDTO = worldpayApplePayPaymentCheckoutFacade.getValidateMerchantRequestDTO(); return restTemplate.postForObject(validateMerchantRequestData.getValidationURL(), requestDTO, Object.class); }  @Secured({"ROLE_CUSTOMERGROUP", "ROLE_GUEST", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) @PostMapping(value = "/request-session", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody Object requestPaymentSession(@RequestBody final ValidateMerchantRequestWsDTO validateMerchantRequestWsDTO); @Secured( {"ROLE_CUSTOMERGROUP", "ROLE_GUEST", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) @PostMapping(value = "/authorise-order", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody DirectResponseData authoriseOrder(@RequestBody final ApplePayAuthorisationRequest authorisationRequest); @Secured( {"ROLE_CUSTOMERGROUP", "ROLE_GUEST", "ROLE_CUSTOMERMANAGERGROUP", "ROLE_TRUSTED_CLIENT"}) @PostMapping(value = "/update-payment-method", consumes = {MediaType.APPLICATION_JSON_VALUE}) @ResponseBody ApplePayOrderUpdate updatePaymentMethod(@RequestBody final ApplePayPaymentMethodUpdateRequest paymentMethodUpdateRequest);  }
@Test public void testRequestPaymentSession() { when(dataMapperMock.map(validateMerchantRequestWsDTOMock, ValidateMerchantRequestData.class)).thenReturn(validateMerchantRequestDataMock); when(validateMerchantRequestDataMock.getValidationURL()).thenReturn("http: when(worldpayApplePayPaymentCheckoutFacadeMock.getValidateMerchantRequestDTO()).thenReturn(validateMerchantRequestDTOMock); testObj.requestPaymentSession(validateMerchantRequestWsDTOMock); verify(worldpayApplePayPaymentCheckoutFacadeMock).getValidateMerchantRequestDTO(); verify(restTemplateMock).postForObject(validateMerchantRequestDataMock.getValidationURL(), validateMerchantRequestDTOMock, Object.class); }