Class DefaultPaymentPriorityStrategy
- java.lang.Object
-
- com.broadleafcommerce.orderoperation.service.payment.DefaultPaymentPriorityStrategy
-
- All Implemented Interfaces:
PaymentPriorityStrategy
public class DefaultPaymentPriorityStrategy extends Object implements PaymentPriorityStrategy
- Author:
- Samarth Dhruva (samarthd), Sunny Yu
-
-
Constructor Summary
Constructors Constructor Description DefaultPaymentPriorityStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
getApplicationIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
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 OrderOperationPaymentProperties
getOrderOperationPaymentProperties()
protected int
getRefundPriority(PaymentSummary payment)
Deprecated.since 1.7.2, in favor ofgetGatewayPriority(List, PaymentSummary)
protected String
getTenantIdFromContext(com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
void
setOrderOperationPaymentProperties(OrderOperationPaymentProperties orderOperationPaymentProperties)
protected List<PaymentSummary>
sortByPaymentGatewayPriority(BiFunction<String,String,List<String>> paymentGatewayPrioritiesGetter, List<PaymentSummary> payments, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Sorts the givenPaymentSummaries
based on the payment gateway priorities.List<PaymentSummary>
sortByPaymentGatewayPriorityForCapture(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.List<PaymentSummary>
sortByPaymentGatewayPriorityForRefund(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.List<PaymentSummary>
sortByRefundPriority(List<PaymentSummary> payments)
Deprecated.
-
-
-
Field Detail
-
FIRST
protected static final int FIRST
- See Also:
- Constant Field Values
-
LAST
protected static final int LAST
- See Also:
- Constant Field Values
-
-
Method Detail
-
sortByPaymentGatewayPriorityForCapture
public List<PaymentSummary> sortByPaymentGatewayPriorityForCapture(@Nullable 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.- Specified by:
sortByPaymentGatewayPriorityForCapture
in interfacePaymentPriorityStrategy
- Parameters:
payments
- the payments to sortcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- a new list representing the sorted result. Will be empty if
payments
is null or empty.
-
sortByPaymentGatewayPriorityForRefund
public List<PaymentSummary> sortByPaymentGatewayPriorityForRefund(@Nullable 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.- Specified by:
sortByPaymentGatewayPriorityForRefund
in interfacePaymentPriorityStrategy
- Parameters:
payments
- the payments to sortcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- a new list representing the sorted result. Will be empty if
payments
is null or empty.
-
sortByPaymentGatewayPriority
protected List<PaymentSummary> sortByPaymentGatewayPriority(BiFunction<String,String,List<String>> paymentGatewayPrioritiesGetter, @Nullable List<PaymentSummary> payments, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
Sorts the givenPaymentSummaries
based on the payment gateway priorities.The payment priorities are represented by an ordered list of payment gateways using its index, the lower the index, the higher the priority.
- Parameters:
paymentGatewayPrioritiesGetter
- the getter to retrieve the ordered list of payment gateways representing their prioritiespayments
- thePaymentSummaries
to sortcontextInfo
- context information surrounding sandboxing and multitenant state- Returns:
- the sorted list of
PaymentSummaries
-
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()
-
sortByRefundPriority
@Deprecated public List<PaymentSummary> sortByRefundPriority(List<PaymentSummary> payments)
Deprecated.Description copied from interface:PaymentPriorityStrategy
Given a list ofPaymentSummaries
, sorts them in order of which should be refunded first.- Specified by:
sortByRefundPriority
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.
-
getRefundPriority
@Deprecated protected int getRefundPriority(PaymentSummary payment)
Deprecated.since 1.7.2, in favor ofgetGatewayPriority(List, PaymentSummary)
-
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)
-
getOrderOperationPaymentProperties
protected OrderOperationPaymentProperties getOrderOperationPaymentProperties()
-
setOrderOperationPaymentProperties
@Autowired public void setOrderOperationPaymentProperties(OrderOperationPaymentProperties orderOperationPaymentProperties)
-
-