WorldpayThreeDSecureFlexEndpointController extends AbstractWorldpayDirectCheckoutStepController { @PostMapping(value = "/response") @RequireHardLogIn public String doHandleThreeDSecureResponse(final HttpServletRequest request, final ThreeDSecureFlexForm threeDSecureFlexForm, final RedirectAttributes redirectAttributes) { return REDIRECT_PREFIX + configurationService.getConfiguration().getString(WorldpayapiConstants.WORLDPAY_3DSECURE_FLEX_SECOND_AUTH_SUBMIT_URL); }  @PostMapping(value = "/response") @RequireHardLogIn String doHandleThreeDSecureResponse(final HttpServletRequest request, final ThreeDSecureFlexForm threeDSecureFlexForm, final RedirectAttributes redirectAttributes); @GetMapping(value = "/response/autosubmit") @RequireHardLogIn String getThreeDSecureResponseAutosubmit(final HttpServletRequest request, final ThreeDSecureFlexForm threeDSecureFlexForm, final RedirectAttributes redirectAttributes); @PostMapping(value = "/response/autosubmit") @RequireHardLogIn String doHandleThreeDSecureResponse(final HttpServletRequest request, @ModelAttribute(B2B_CSE_PAYMENT_FORM) final B2BCSEPaymentForm b2bCSEPaymentForm, final Model model, final HttpServletResponse response);  }
@Test public void testDoHandleThreeDSecureResponse() { final String response = testObj.doHandleThreeDSecureResponse(requestMock, threeDSecureFlexFormMock, redirectAttributesMock); Assert.assertEquals(REDIRECT_PREFIX + CHECKOUT_MULTI_WORLDPAY_3_DSECUREFLEX_SOP_RESPONSE_AUTOSUBMIT, response); }
@Test public void testDoHandleThreeDSecureResponseWithException() throws CMSItemNotFoundException, InvalidCartException, WorldpayException { when(worldpayDirectOrderFacadeMock.executeSecondPaymentAuthorisation3DSecure()).thenThrow(new WorldpayException("errorMessage")); doNothing().when(testObj).setupAddPaymentPage(modelMock); final String result = testObj.doHandleThreeDSecureResponse(requestMock, b2bCSEPaymentFormMock, modelMock, responseMock); assertEquals(CSE_PAYMENT_DETAILS_PAGE, result); }