WorldpaySummaryCheckoutStepController extends AbstractWorldpayDirectCheckoutStepController { @RequestMapping(value = "/view", method = RequestMethod.GET) @RequireHardLogIn @PreValidateCheckoutStep(checkoutStep = SUMMARY) public String enterStep(final Model model, final RedirectAttributes redirectAttributes, final HttpServletResponse response) throws CMSItemNotFoundException { final CartData cartData = getCheckoutFacade().getCheckoutCart(); if (CollectionUtils.isNotEmpty(cartData.getEntries())) { for (final OrderEntryData entry : cartData.getEntries()) { final String productCode = entry.getProduct().getCode(); final ProductData product = getProductFacade().getProductForCodeAndOptions(productCode, Arrays.asList(BASIC, PRICE)); entry.setProduct(product); } } model.addAttribute(CART_DATA, cartData); model.addAttribute(ALL_ITEMS, cartData.getEntries()); model.addAttribute(DELIVERY_ADDRESS, cartData.getDeliveryAddress()); model.addAttribute(DELIVERY_MODE, cartData.getDeliveryMode()); model.addAttribute(PAYMENT_INFO, cartData.getPaymentInfo()); model.addAttribute(CSE_PAYMENT_FORM, new CSEPaymentForm()); final ContentPageModel contentPageForLabelOrId = getContentPageForLabelOrId(MULTI_CHECKOUT_SUMMARY_CMS_PAGE_LABEL); storeCmsPageInModel(model, contentPageForLabelOrId); setUpMetaDataForContentPage(model, contentPageForLabelOrId); model.addAttribute(BREADCRUMBS_KEY, getResourceBreadcrumbBuilder().getBreadcrumbs(CHECKOUT_MULTI_SUMMARY_BREADCRUMB)); model.addAttribute(META_ROBOTS, "noindex,nofollow"); setCheckoutStepLinksForModel(model, getCheckoutStep()); final String subscriptionId = cartData.getPaymentInfo().getSubscriptionId(); model.addAttribute(REQUEST_SECURITY_CODE, StringUtils.isNotBlank(subscriptionId)); model.addAttribute(SUBSCRIPTION_ID, subscriptionId); model.addAttribute(BIN, cartData.getPaymentInfo().getBin()); return worldpayAddonEndpointService.getCheckoutSummaryPage(); }  @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();  }
@Test @SuppressWarnings("unchecked") public void enterStepShouldReturnCheckoutSummaryPage() throws CMSItemNotFoundException { when(cartDataMock.getDeliveryAddress()).thenReturn(deliveryAddressMock); when(cartDataMock.getDeliveryMode()).thenReturn(deliveryModeDataMock); when(paymentInfoMock.getSubscriptionId()).thenReturn(SUBSCRIPTION_ID); final String result = testObj.enterStep(modelMock, redirectAttributesMock, responseMock); assertEquals(cartDataMock, modelMock.asMap().get(CART_DATA)); final List<OrderEntryData> orderEntryDatas = (List<OrderEntryData>) modelMock.asMap().get(ALL_ITEMS); assertEquals(1, orderEntryDatas.size()); assertEquals(orderEntryDataMock, orderEntryDatas.get(0)); assertEquals(deliveryAddressMock, modelMock.asMap().get(DELIVERY_ADDRESS)); assertEquals(deliveryModeDataMock, modelMock.asMap().get(DELIVERY_MODE)); assertEquals(BIN_VALUE, modelMock.asMap().get(BIN)); assertEquals(paymentInfoMock, modelMock.asMap().get(PAYMENT_INFO)); assertEquals(true, modelMock.asMap().get(REQUEST_SECURITY_CODE)); assertNull(((CSEPaymentForm) modelMock.asMap().get(CSE_PAYMENT_FORM)).getSecurityCode()); assertFalse(((CSEPaymentForm) modelMock.asMap().get(CSE_PAYMENT_FORM)).isTermsCheck()); assertEquals(contentPageModelMock, modelMock.asMap().get(CMS_PAGE_MODEL)); assertEquals(EMPTY_LIST, modelMock.asMap().get(BREADCRUMBS_KEY)); assertEquals(NOINDEX_NOFOLLOW, modelMock.asMap().get(META_ROBOTS)); assertEquals(StringUtils.remove(checkoutStepMock.previousStep(), REDIRECT_PREFIX), modelMock.asMap().get("previousStepUrl")); assertEquals(StringUtils.remove(checkoutStepMock.nextStep(), REDIRECT_PREFIX), modelMock.asMap().get("nextStepUrl")); assertEquals(StringUtils.remove(checkoutStepMock.currentStep(), REDIRECT_PREFIX), modelMock.asMap().get("currentStepUrl")); assertEquals(checkoutStepMock.getProgressBarId(), modelMock.asMap().get("progressBarId")); assertEquals(CHECKOUT_SUMMARY_PAGE, result); }