Class SamplePaymentGatewayController

java.lang.Object
org.broadleafcommerce.common.web.controller.BroadleafAbstractController
org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
org.broadleafcommerce.vendor.sample.web.controller.SamplePaymentGatewayController

@Controller("blSamplePaymentGatewayController") @RequestMapping("/sample-checkout") public class SamplePaymentGatewayController extends org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
This is a sample implementation of PaymentGatewayAbstractController that mimics what a real Payment Gateway Controller might look like. This will handle translating the "fake response" from our SamplePaymentGateway so that it can be processed in the system. In order to use this sample controller, you will need to component scan the package "org.broadleafcommerce". This should NOT be used in production, and is meant solely for demonstration purposes only.
Author:
Elbert Bautista (elbertbautista)
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final org.apache.commons.logging.Log
     
    protected org.broadleafcommerce.common.payment.service.PaymentGatewayConfiguration
     
    protected org.broadleafcommerce.common.payment.service.PaymentGatewayWebResponseService
     

    Fields inherited from class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController

    baseCartRedirect, baseConfirmationRedirect, baseErrorView, baseOrderReviewRedirect, baseRedirect, cartReqAttributeNotProvidedMessage, PAYMENT_PROCESSING_ERROR, paymentGatewayCheckoutService, processingErrorMessage, webResponsePrintService
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    errorEndpoint(org.springframework.ui.Model model, jakarta.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, Map<String,String> pathVars)
     
    org.broadleafcommerce.common.payment.service.PaymentGatewayConfiguration
     
     
    org.broadleafcommerce.common.payment.service.PaymentGatewayWebResponseService
     
    void
    handleProcessingException(Exception e, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes)
     
    void
    handleUnsuccessfulTransaction(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.broadleafcommerce.common.payment.dto.PaymentResponseDTO responseDTO)
     
    returnEndpoint(org.springframework.ui.Model model, jakarta.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, Map<String,String> pathVars)
     

    Methods inherited from class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController

    applyPaymentToOrder, getBaseConfirmationRedirect, getCartReqAttributeNotProvidedMessage, getCartViewRedirect, getConfirmationViewRedirect, getErrorViewRedirect, getOrderReviewRedirect, getProcessingErrorMessage, initiateCheckout, lookupOrderNumberFromOrderId, process

    Methods inherited from class org.broadleafcommerce.common.web.controller.BroadleafAbstractController

    addDeepLink, getContextPath, isAjaxRequest, jsonResponse

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LOG

      protected static final org.apache.commons.logging.Log LOG
    • GATEWAY_CONTEXT_KEY

      protected static final String GATEWAY_CONTEXT_KEY
      See Also:
    • paymentGatewayWebResponseService

      protected org.broadleafcommerce.common.payment.service.PaymentGatewayWebResponseService paymentGatewayWebResponseService
    • paymentGatewayConfiguration

      protected org.broadleafcommerce.common.payment.service.PaymentGatewayConfiguration paymentGatewayConfiguration
  • Constructor Details

    • SamplePaymentGatewayController

      public SamplePaymentGatewayController()
  • Method Details

    • handleProcessingException

      public void handleProcessingException(Exception e, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      handleProcessingException in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • handleUnsuccessfulTransaction

      public void handleUnsuccessfulTransaction(org.springframework.ui.Model model, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, org.broadleafcommerce.common.payment.dto.PaymentResponseDTO responseDTO) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      handleUnsuccessfulTransaction in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • getGatewayContextKey

      public String getGatewayContextKey()
      Specified by:
      getGatewayContextKey in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
    • getWebResponseService

      public org.broadleafcommerce.common.payment.service.PaymentGatewayWebResponseService getWebResponseService()
      Specified by:
      getWebResponseService in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
    • getConfiguration

      public org.broadleafcommerce.common.payment.service.PaymentGatewayConfiguration getConfiguration()
      Specified by:
      getConfiguration in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
    • returnEndpoint

      @RequestMapping(value="/return", method=POST) public String returnEndpoint(org.springframework.ui.Model model, jakarta.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, Map<String,String> pathVars) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      returnEndpoint in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
    • errorEndpoint

      @RequestMapping(value="/error", method=GET) public String errorEndpoint(org.springframework.ui.Model model, jakarta.servlet.http.HttpServletRequest request, org.springframework.web.servlet.mvc.support.RedirectAttributes redirectAttributes, Map<String,String> pathVars) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException
      Specified by:
      errorEndpoint in class org.broadleafcommerce.common.web.payment.controller.PaymentGatewayAbstractController
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException