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 int
LAST
-
Constructor Summary
Constructors Constructor Description DefaultPaymentPriorityStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
getApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
protected CartOperationCheckoutProperties
getCartOperationCheckoutProperties()
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)
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: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
protected CartOperationCheckoutProperties getCartOperationCheckoutProperties()
-
setCartOperationCheckoutProperties
@Autowired public void setCartOperationCheckoutProperties(CartOperationCheckoutProperties cartOperationCheckoutProperties)
-
-