Class DefaultPaymentPriorityStrategy
java.lang.Object
com.broadleafcommerce.cartoperation.service.payment.DefaultPaymentPriorityStrategy
- All Implemented Interfaces:
PaymentPriorityStrategy
- Author:
- Samarth Dhruva (samarthd), Sunny Yu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringgetApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CartOperationCheckoutPropertiesprotected intgetGatewayPriority(List<String> prioritizedPaymentGatewayTypes, PaymentSummary payment) Gets the priority of the givenPaymentSummary, which is represented by the index of thePaymentSummary.getGatewayType()in the givenprioritizedPaymentGatewayTypes.protected StringgetTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) voidsetCartOperationCheckoutProperties(CartOperationCheckoutProperties cartOperationCheckoutProperties) sortByPaymentGatewayPriority(List<PaymentSummary> payments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Given a list ofPaymentSummaries, sorts them in order of which should be executed first based onPaymentSummary.getGatewayType().
-
Field Details
-
LAST
protected static final int LAST- See Also:
-
-
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:PaymentPriorityStrategyGiven a list ofPaymentSummaries, sorts them in order of which should be executed first based onPaymentSummary.getGatewayType().- Specified by:
sortByPaymentGatewayPriorityin interfacePaymentPriorityStrategy- Parameters:
payments- the payments to sort- Returns:
- a new list representing the sorted result. Will be empty if
paymentsis null or empty.
-
getGatewayPriority
protected int getGatewayPriority(List<String> prioritizedPaymentGatewayTypes, PaymentSummary payment) Gets the priority of the givenPaymentSummary, which is represented by the index of thePaymentSummary.getGatewayType()in the givenprioritizedPaymentGatewayTypes.- Parameters:
prioritizedPaymentGatewayTypes- an ordered list of payment gateway types representing the priorities of the payment gateways based on its indexpayment- thePaymentSummaryto get the priority for- Returns:
- the priority of the given
PaymentSummary, which is represented by the index of thePaymentSummary.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
-
setCartOperationCheckoutProperties
@Autowired public void setCartOperationCheckoutProperties(CartOperationCheckoutProperties cartOperationCheckoutProperties)
-