Class OrderPaymentConfirmationStrategyImpl

java.lang.Object
org.broadleafcommerce.core.checkout.service.strategy.OrderPaymentConfirmationStrategyImpl
All Implemented Interfaces:
OrderPaymentConfirmationStrategy

@Service("blOrderPaymentConfirmationStrategy") public class OrderPaymentConfirmationStrategyImpl extends Object implements OrderPaymentConfirmationStrategy
Strategy to handle confirming "UNCONFIRMED" transactions on an Order Payment during the checkout workflow.

The default implementation is to (based on the passed in payment type): - If PaymentType == CREDIT_CARD -> AUTHORIZE or AUTHORIZE_AND_CAPTURE based on configuration of the gateway - Otherwise -> call the configured gateways PaymentGatewayTransactionConfirmationService

However, if PENDING payments are enabled, then this logic will be by-passed and a new transaction will be created as the payment is marked to be charged offline or asynchronously.

Author:
Elbert Bautista (elbertbautista)
  • Field Details

    • LOG

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

      @Autowired(required=false) @Qualifier("blPaymentGatewayConfigurationServiceProvider") protected org.broadleafcommerce.common.payment.service.PaymentGatewayConfigurationServiceProvider paymentConfigurationServiceProvider
    • orderToPaymentRequestService

      protected OrderToPaymentRequestDTOService orderToPaymentRequestService
    • secureOrderPaymentService

      protected SecureOrderPaymentService secureOrderPaymentService
    • systemPropertiesService

      protected org.broadleafcommerce.common.config.service.SystemPropertiesService systemPropertiesService
  • Constructor Details

    • OrderPaymentConfirmationStrategyImpl

      public OrderPaymentConfirmationStrategyImpl()
  • Method Details

    • confirmTransaction

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO confirmTransaction(PaymentTransaction tx, ProcessContext<CheckoutSeed> context) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException, WorkflowException, CheckoutException
      Description copied from interface: OrderPaymentConfirmationStrategy
      Strategy to determine how to "confirm" an OrderPayment at checkout
      Specified by:
      confirmTransaction in interface OrderPaymentConfirmationStrategy
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
      WorkflowException
      CheckoutException
    • confirmPendingTransaction

      public org.broadleafcommerce.common.payment.dto.PaymentResponseDTO confirmPendingTransaction(PaymentTransaction tx, ProcessContext<CheckoutSeed> context) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException, WorkflowException, CheckoutException
      Description copied from interface: OrderPaymentConfirmationStrategy
      Strategy to determine how to "confirm" a PENDING OrderPayment post-checkout
      Specified by:
      confirmPendingTransaction in interface OrderPaymentConfirmationStrategy
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
      WorkflowException
      CheckoutException
    • confirmTransactionInternal

      protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO confirmTransactionInternal(PaymentTransaction tx, ProcessContext<CheckoutSeed> context, boolean isCheckout) throws org.broadleafcommerce.common.vendor.service.exception.PaymentException, WorkflowException, CheckoutException
      Throws:
      org.broadleafcommerce.common.vendor.service.exception.PaymentException
      WorkflowException
      CheckoutException
    • orderContainsMultipleFinalPayments

      protected boolean orderContainsMultipleFinalPayments(Order order)
      determine whether or not this order contains multiple final payments. (e.g. paying with multiple credit cards)
      Parameters:
      order -
      Returns:
    • transactionIsDetachedCreditRequest

      protected boolean transactionIsDetachedCreditRequest(PaymentTransaction transaction)
      determine whether or not this transaction is a detached credit request. By default, will look at the additional fields map to determine intent (as the actual type of the transaction is UNCONFIRMED).
      Parameters:
      transaction -
      Returns:
    • constructPendingTransaction

      protected org.broadleafcommerce.common.payment.dto.PaymentResponseDTO constructPendingTransaction(org.broadleafcommerce.common.payment.PaymentType paymentType, org.broadleafcommerce.common.payment.PaymentGatewayType gatewayType, org.broadleafcommerce.common.payment.dto.PaymentRequestDTO confirmationRequest)
    • populateCreditCardOnRequest

      protected void populateCreditCardOnRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, OrderPayment payment) throws WorkflowException
      Throws:
      WorkflowException
    • populateBillingAddressOnRequest

      protected void populateBillingAddressOnRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, OrderPayment payment)
    • populateCustomerOnRequest

      protected void populateCustomerOnRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, OrderPayment payment)
    • populateShippingAddressOnRequest

      protected void populateShippingAddressOnRequest(org.broadleafcommerce.common.payment.dto.PaymentRequestDTO requestDTO, OrderPayment payment)
    • constructExpirationDate

      protected String constructExpirationDate(Integer expMonth, Integer expYear)
      Default expiration date construction. Some Payment Gateways may require a different format. Override if necessary or set the property "gateway.config.global.expDateFormat" with a format string to provide the correct format for the configured gateway.
      Parameters:
      expMonth -
      expYear -
      Returns:
    • getGatewayExpirationDateFormat

      protected String getGatewayExpirationDateFormat()
    • enablePendingPaymentsOnCheckoutConfirmation

      protected boolean enablePendingPaymentsOnCheckoutConfirmation()
      Set "gateway.config.global.enablePendingPayments" property to allow confirmation of an "UNCONFIRMED" transaction into a "PENDING" state instead of confirming into an AUTHORIZE or AUTHORIZE_AND_CAPTURE status.