@Test public void shouldRedirectToOrderConfirmationPage() throws CMSItemNotFoundException, WorldpayException, InvalidCartException { when(worldpayDirectOrderFacadeMock.authoriseRecurringPayment(worldpayAdditionalInfoDataMock)).thenReturn(directResponseDataMock); doReturn(REDIRECT_VIEW).when(testObj).handleDirectResponse(modelMock, directResponseDataMock, responseMock); final String result = testObj.placeOrder(formMock, modelMock, httpServletRequestMock, redirectAttributesMock, responseMock); assertEquals(REDIRECT_VIEW, result); verify(worldpayAdditionalInfoDataMock).setSecurityCode(SECURITY_CODE); }
@RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { if (validateCart(redirectAttributes)) { return REDIRECT_PREFIX + CART_SUFFIX; } if (!isOrderFormValid(csePaymentForm, model)) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return enterStep(model, redirectAttributes, response); } final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSESubscriptionAdditionalAuthInfo(csePaymentForm); final WorldpayAdditionalInfoData worldpayAdditionalInfoData = getWorldpayAdditionalInfo(request, csePaymentForm.getSecurityCode(), cseAdditionalAuthInfo); return authorisePayment(model, worldpayAdditionalInfoData, response); }
WorldpaySummaryCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController { @RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { if (validateCart(redirectAttributes)) { return REDIRECT_PREFIX + CART_SUFFIX; } if (!isOrderFormValid(csePaymentForm, model)) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return enterStep(model, redirectAttributes, response); } final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSESubscriptionAdditionalAuthInfo(csePaymentForm); final WorldpayAdditionalInfoData worldpayAdditionalInfoData = getWorldpayAdditionalInfo(request, csePaymentForm.getSecurityCode(), cseAdditionalAuthInfo); return authorisePayment(model, worldpayAdditionalInfoData, response); } }
WorldpaySummaryCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController { @RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { if (validateCart(redirectAttributes)) { return REDIRECT_PREFIX + CART_SUFFIX; } if (!isOrderFormValid(csePaymentForm, model)) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return enterStep(model, redirectAttributes, response); } final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSESubscriptionAdditionalAuthInfo(csePaymentForm); final WorldpayAdditionalInfoData worldpayAdditionalInfoData = getWorldpayAdditionalInfo(request, csePaymentForm.getSecurityCode(), cseAdditionalAuthInfo); return authorisePayment(model, worldpayAdditionalInfoData, response); }  }
WorldpaySummaryCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController { @RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { if (validateCart(redirectAttributes)) { return REDIRECT_PREFIX + CART_SUFFIX; } if (!isOrderFormValid(csePaymentForm, model)) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return enterStep(model, redirectAttributes, response); } final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSESubscriptionAdditionalAuthInfo(csePaymentForm); final WorldpayAdditionalInfoData worldpayAdditionalInfoData = getWorldpayAdditionalInfo(request, csePaymentForm.getSecurityCode(), cseAdditionalAuthInfo); return authorisePayment(model, worldpayAdditionalInfoData, response); }  @RequestMapping(value = "/view", method = RequestMethod.GET) @RequireHardLogIn @PreValidateCheckoutStep(checkoutStep = SUMMARY) String enterStep(final Model model, final RedirectAttributes redirectAttributes, final HttpServletResponse response); @RequestMapping(value = "/placeOrder") @RequireHardLogIn String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model,
                             final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response); @RequestMapping(value = "/express", method = RequestMethod.GET) @RequireHardLogIn String performExpressCheckout(final Model model, final RedirectAttributes redirectModel, final HttpServletResponse response); @GetMapping(value = "/DDCIframe") @RequireHardLogIn String getDDCIframeContent(final Model model); @GetMapping(value = "/challengeIframe") @RequireHardLogIn String getChallengeIframeContent(final Model model); @RequestMapping(value = "/back", method = RequestMethod.GET) @RequireHardLogIn @Override String back(final RedirectAttributes redirectAttributes); @RequestMapping(value = "/next", method = RequestMethod.GET) @RequireHardLogIn @Override String next(final RedirectAttributes redirectAttributes); @Override CheckoutFlowFacade getCheckoutFlowFacade(); }
WorldpaySummaryCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController { @RequestMapping(value = "/placeOrder") @RequireHardLogIn public String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model, final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { if (validateCart(redirectAttributes)) { return REDIRECT_PREFIX + CART_SUFFIX; } if (!isOrderFormValid(csePaymentForm, model)) { response.setStatus(HttpServletResponse.SC_BAD_REQUEST); return enterStep(model, redirectAttributes, response); } final CSEAdditionalAuthInfo cseAdditionalAuthInfo = createCSESubscriptionAdditionalAuthInfo(csePaymentForm); final WorldpayAdditionalInfoData worldpayAdditionalInfoData = getWorldpayAdditionalInfo(request, csePaymentForm.getSecurityCode(), cseAdditionalAuthInfo); return authorisePayment(model, worldpayAdditionalInfoData, response); }  @RequestMapping(value = "/view", method = RequestMethod.GET) @RequireHardLogIn @PreValidateCheckoutStep(checkoutStep = SUMMARY) String enterStep(final Model model, final RedirectAttributes redirectAttributes, final HttpServletResponse response); @RequestMapping(value = "/placeOrder") @RequireHardLogIn String placeOrder(@ModelAttribute("csePaymentForm") final CSEPaymentForm csePaymentForm, final Model model,
                             final HttpServletRequest request, final RedirectAttributes redirectAttributes, final HttpServletResponse response); @RequestMapping(value = "/express", method = RequestMethod.GET) @RequireHardLogIn String performExpressCheckout(final Model model, final RedirectAttributes redirectModel, final HttpServletResponse response); @GetMapping(value = "/DDCIframe") @RequireHardLogIn String getDDCIframeContent(final Model model); @GetMapping(value = "/challengeIframe") @RequireHardLogIn String getChallengeIframeContent(final Model model); @RequestMapping(value = "/back", method = RequestMethod.GET) @RequireHardLogIn @Override String back(final RedirectAttributes redirectAttributes); @RequestMapping(value = "/next", method = RequestMethod.GET) @RequireHardLogIn @Override String next(final RedirectAttributes redirectAttributes); @Override CheckoutFlowFacade getCheckoutFlowFacade();  }