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 Summary
Fields Modifier and Type Field Description protected static intLAST
-
Constructor Summary
Constructors Constructor Description DefaultPaymentPriorityStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringgetApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)protected CartOperationCheckoutPropertiesgetCartOperationCheckoutProperties()protected 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)List<PaymentSummary>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 Detail
-
LAST
protected static final int LAST
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
protected CartOperationCheckoutProperties getCartOperationCheckoutProperties()
-
setCartOperationCheckoutProperties
@Autowired public void setCartOperationCheckoutProperties(CartOperationCheckoutProperties cartOperationCheckoutProperties)
-
-