Class DefaultPaymentPriorityStrategy
java.lang.Object
com.broadleafcommerce.cartoperation.service.payment.DefaultPaymentPriorityStrategy
- All Implemented Interfaces:
PaymentPriorityStrategy
- Author:
- Samarth Dhruva (samarthd), Sunny Yu
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
getApplicationIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) protected CartOperationCheckoutProperties
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
.protected String
getTenantIdFromContext
(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) void
setCartOperationCheckoutProperties
(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:PaymentPriorityStrategy
Given a list ofPaymentSummaries
, sorts them in order of which should be executed first based onPaymentSummary.getGatewayType()
.- Specified by:
sortByPaymentGatewayPriority
in interfacePaymentPriorityStrategy
- 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 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
- thePaymentSummary
to 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)
-