Class OrderPaymentConfirmationStrategyImpl
java.lang.Object
org.broadleafcommerce.core.checkout.service.strategy.OrderPaymentConfirmationStrategyImpl
- All Implemented Interfaces:
OrderPaymentConfirmationStrategy
@Service("blOrderPaymentConfirmationStrategy")
public class OrderPaymentConfirmationStrategyImpl
extends Object
implements OrderPaymentConfirmationStrategy
Strategy to handle confirming "UNCONFIRMED" transactions on an Order Payment during the checkout workflow.
The default implementation is to (based on the passed in payment type):
- If PaymentType == CREDIT_CARD -> AUTHORIZE or AUTHORIZE_AND_CAPTURE based on configuration of the gateway
- Otherwise -> call the configured gateways PaymentGatewayTransactionConfirmationService
However, if PENDING payments are enabled, then this logic will be by-passed and a new transaction will be created as the payment is marked to be charged offline or asynchronously.
- Author:
- Elbert Bautista (elbertbautista)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.commons.logging.Logprotected OrderToPaymentRequestDTOServiceprotected SecureOrderPaymentServiceprotected SystemPropertiesService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionStrategy to determine how to "confirm" a PENDING OrderPayment post-checkoutconfirmTransaction(PaymentTransaction tx, ProcessContext<CheckoutSeed> context) Strategy to determine how to "confirm" an OrderPayment at checkoutprotected PaymentResponseDTOconfirmTransactionInternal(PaymentTransaction tx, ProcessContext<CheckoutSeed> context, boolean isCheckout) protected StringconstructExpirationDate(Integer expMonth, Integer expYear) Default expiration date construction.protected PaymentResponseDTOconstructPendingTransaction(PaymentType paymentType, PaymentGatewayType gatewayType, PaymentRequestDTO confirmationRequest) protected booleanSet "gateway.config.global.enablePendingPayments" property to allow confirmation of an "UNCONFIRMED" transaction into a "PENDING" state instead of confirming into an AUTHORIZE or AUTHORIZE_AND_CAPTURE status.protected Stringprotected booleandetermine whether or not this order contains multiple final payments.protected voidpopulateBillingAddressOnRequest(PaymentRequestDTO requestDTO, OrderPayment payment) protected voidpopulateCreditCardOnRequest(PaymentRequestDTO requestDTO, OrderPayment payment) protected voidpopulateCustomerOnRequest(PaymentRequestDTO requestDTO, OrderPayment payment) protected voidpopulateShippingAddressOnRequest(PaymentRequestDTO requestDTO, OrderPayment payment) protected booleantransactionIsDetachedCreditRequest(PaymentTransaction transaction) determine whether or not this transaction is a detached credit request.
-
Field Details
-
LOG
protected static final org.apache.commons.logging.Log LOG -
paymentConfigurationServiceProvider
@Autowired(required=false) @Qualifier("blPaymentGatewayConfigurationServiceProvider") protected PaymentGatewayConfigurationServiceProvider paymentConfigurationServiceProvider -
orderToPaymentRequestService
-
secureOrderPaymentService
-
systemPropertiesService
-
-
Constructor Details
-
OrderPaymentConfirmationStrategyImpl
public OrderPaymentConfirmationStrategyImpl()
-
-
Method Details
-
confirmTransaction
public PaymentResponseDTO confirmTransaction(PaymentTransaction tx, ProcessContext<CheckoutSeed> context) throws PaymentException, WorkflowException, CheckoutException Description copied from interface:OrderPaymentConfirmationStrategyStrategy to determine how to "confirm" an OrderPayment at checkout- Specified by:
confirmTransactionin interfaceOrderPaymentConfirmationStrategy- Throws:
PaymentExceptionWorkflowExceptionCheckoutException
-
confirmPendingTransaction
public PaymentResponseDTO confirmPendingTransaction(PaymentTransaction tx, ProcessContext<CheckoutSeed> context) throws PaymentException, WorkflowException, CheckoutException Description copied from interface:OrderPaymentConfirmationStrategyStrategy to determine how to "confirm" a PENDING OrderPayment post-checkout- Specified by:
confirmPendingTransactionin interfaceOrderPaymentConfirmationStrategy- Throws:
PaymentExceptionWorkflowExceptionCheckoutException
-
confirmTransactionInternal
protected PaymentResponseDTO confirmTransactionInternal(PaymentTransaction tx, ProcessContext<CheckoutSeed> context, boolean isCheckout) throws PaymentException, WorkflowException, CheckoutException -
orderContainsMultipleFinalPayments
determine whether or not this order contains multiple final payments. (e.g. paying with multiple credit cards)- Parameters:
order-- Returns:
-
transactionIsDetachedCreditRequest
determine whether or not this transaction is a detached credit request. By default, will look at the additional fields map to determine intent (as the actual type of the transaction is UNCONFIRMED).- Parameters:
transaction-- Returns:
-
constructPendingTransaction
protected PaymentResponseDTO constructPendingTransaction(PaymentType paymentType, PaymentGatewayType gatewayType, PaymentRequestDTO confirmationRequest) -
populateCreditCardOnRequest
protected void populateCreditCardOnRequest(PaymentRequestDTO requestDTO, OrderPayment payment) throws WorkflowException - Throws:
WorkflowException
-
populateBillingAddressOnRequest
-
populateCustomerOnRequest
-
populateShippingAddressOnRequest
-
constructExpirationDate
Default expiration date construction. Some Payment Gateways may require a different format. Override if necessary or set the property "gateway.config.global.expDateFormat" with a format string to provide the correct format for the configured gateway.- Parameters:
expMonth-expYear-- Returns:
-
getGatewayExpirationDateFormat
-
enablePendingPaymentsOnCheckoutConfirmation
protected boolean enablePendingPaymentsOnCheckoutConfirmation()Set "gateway.config.global.enablePendingPayments" property to allow confirmation of an "UNCONFIRMED" transaction into a "PENDING" state instead of confirming into an AUTHORIZE or AUTHORIZE_AND_CAPTURE status.
-