Class DefaultPaymentPriorityStrategy

java.lang.Object
com.broadleafcommerce.cartoperation.service.payment.DefaultPaymentPriorityStrategy
All Implemented Interfaces:
PaymentPriorityStrategy

public class DefaultPaymentPriorityStrategy extends Object implements PaymentPriorityStrategy
Author:
Samarth Dhruva (samarthd), Sunny Yu
  • Field Details

  • Constructor Details

    • DefaultPaymentPriorityStrategy

      public DefaultPaymentPriorityStrategy()
  • Method Details

    • sortByPaymentGatewayPriority

      public List<PaymentSummary> sortByPaymentGatewayPriority(List<PaymentSummary> payments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: PaymentPriorityStrategy
      Given a list of PaymentSummaries, sorts them in order of which should be executed first based on PaymentSummary.getGatewayType().
      Specified by:
      sortByPaymentGatewayPriority in interface PaymentPriorityStrategy
      Parameters:
      payments - the payments to sort
      Returns:
      a new list representing the sorted result. Will be empty if payments is null or empty.
    • getGatewayPriority

      protected int getGatewayPriority(List<String> prioritizedPaymentGatewayTypes, PaymentSummary payment)
      Gets the priority of the given PaymentSummary, which is represented by the index of the PaymentSummary.getGatewayType() in the given prioritizedPaymentGatewayTypes.
      Parameters:
      prioritizedPaymentGatewayTypes - an ordered list of payment gateway types representing the priorities of the payment gateways based on its index
      payment - the PaymentSummary to get the priority for
      Returns:
      the priority of the given PaymentSummary, which is represented by the index of the PaymentSummary.getGatewayType()
    • getApplicationIdFromContext

      @Nullable protected String getApplicationIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getTenantIdFromContext

      @Nullable protected String getTenantIdFromContext(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getCartOperationCheckoutProperties

      protected CartOperationCheckoutProperties getCartOperationCheckoutProperties()
    • setCartOperationCheckoutProperties

      @Autowired public void setCartOperationCheckoutProperties(CartOperationCheckoutProperties cartOperationCheckoutProperties)