Class BroadleafCheckoutController
java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.core.web.controller.checkout.AbstractCheckoutController
org.broadleafcommerce.core.web.controller.checkout.BroadleafCheckoutController
In charge of performing the various checkout operations
- Author:
- Andre Azzolini (apazzolini), Elbert Bautista (elbertbautista), Joshua Skorton (jskorton)
-
Field Summary
FieldsFields inherited from class org.broadleafcommerce.core.web.controller.checkout.AbstractCheckoutController
ACTIVE_STAGE, addressService, baseConfirmationView, billingInfoFormValidator, cartPageRedirect, cartStateService, checkoutControllerExtensionManager, checkoutPageRedirect, checkoutService, checkoutStagesPartial, checkoutView, countryService, countrySubdivisionService, customerAddressService, customerPaymentService, customerService, dtoTranslationService, fulfillmentGroupService, fulfillmentOptionService, giftCardInfoFormValidator, initBinderService, isoService, multishipAddAddressFormValidator, orderInfoFormValidator, orderMultishipOptionService, orderPaymentService, orderService, paymentGatewayCheckoutService, paymentInfoFormValidator, phoneService, shippingInfoFormValidator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncheckout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) Renders the default checkout page and allows modules to add variables to the model.getCheckoutStagePartial(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String stage, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) Renders checkout stages partial at the requested stageprotected StringgetConfirmationViewRedirect(String orderNumber) voidhandleProcessingException(Exception e, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) initiateCheckout(Long orderId) protected voidpreValidateCartOperation(org.springframework.ui.Model model) processCompleteCheckoutOrderFinalized(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) If the order has been finalized.processPassthroughCheckout(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, PaymentType paymentType) Creates a pass-through payment of the PaymentType passed in with an amount equal to the order total after any non-final applied payments.saveGlobalOrderDetails(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, OrderInfoForm orderInfoForm, org.springframework.validation.BindingResult result) Attempts to attach the user's email to the order so that they may proceed anonymouslyMethods inherited from class org.broadleafcommerce.core.web.controller.checkout.AbstractCheckoutController
getBaseConfirmationView, getCartPageRedirect, getCheckoutPageRedirect, getCheckoutStagesPartial, getCheckoutView, getConfirmationView, initBinder, populateModelWithReferenceDataMethods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController
addDeepLink, getContextPath, isAjaxRequest, jsonResponse
-
Field Details
-
baseConfirmationRedirect
-
-
Constructor Details
-
BroadleafCheckoutController
public BroadleafCheckoutController()
-
-
Method Details
-
checkout
public String checkout(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) Renders the default checkout page and allows modules to add variables to the model.- Parameters:
request-response-model-model-- Returns:
- the checkout view path
-
preValidateCartOperation
protected void preValidateCartOperation(org.springframework.ui.Model model) -
getCheckoutStagePartial
public String getCheckoutStagePartial(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.ui.Model model, String stage, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) Renders checkout stages partial at the requested stage- Parameters:
request-response-model-stage-- Returns:
- the checkout stages partial path
-
saveGlobalOrderDetails
public String saveGlobalOrderDetails(jakarta.servlet.http.HttpServletRequest request, org.springframework.ui.Model model, OrderInfoForm orderInfoForm, org.springframework.validation.BindingResult result) throws ServiceException Attempts to attach the user's email to the order so that they may proceed anonymously- Parameters:
request-model-orderInfoForm-result-- Returns:
- Throws:
ServiceException
-
processPassthroughCheckout
public String processPassthroughCheckout(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, PaymentType paymentType) throws PaymentException, PricingException Creates a pass-through payment of the PaymentType passed in with an amount equal to the order total after any non-final applied payments. (for example gift cards, customer credit, or third party accounts)This intended to be used in cases like COD and other Payment Types where implementations wish to just checkout without having to do any payment processing.
This default implementations assumes that the pass-through payment is the only "final" payment, as this will remove any payments that are not PaymentTransactionType.UNCONFIRMED That means that it will look at all transactions on the order payment and see if it has unconfirmed transactions. If it does, it will not remove it.
Make sure not to expose this method in your extended Controller if you do not wish to have this feature enabled.
- Parameters:
redirectAttributes-paymentType-- Returns:
- Throws:
PaymentExceptionPricingException
-
processCompleteCheckoutOrderFinalized
public String processCompleteCheckoutOrderFinalized(org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) throws PaymentException If the order has been finalized. i.e. all the payments have been applied to the order, then you can go ahead and call checkout using the passed in order id. This is usually called from a Review Page or if enough Payments have been applied to the Order to complete checkout. (e.g. Gift Cards cover the entire amount and there is no need to call an external Payment Gateway, or a Payment from a Hosted Gateway has already been applied to the order like Paypal Express Checkout)- Returns:
- Throws:
ExceptionPaymentException
-
initiateCheckout
- Throws:
Exception
-
handleProcessingException
public void handleProcessingException(Exception e, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) throws PaymentException - Throws:
PaymentException
-
getBaseConfirmationRedirect
-
getConfirmationViewRedirect
-