@Component(value="blValidateAndConfirmPaymentActivity") public class ValidateAndConfirmPaymentActivity extends BaseActivity<ProcessContext<CheckoutSeed>>
This activity is responsible for validating and processing several aspects of an order's payment so that it may successfully complete the checkout workflow. This activity will:
PaymentTransactionType.AUTHORIZE and
PaymentTransactionType.AUTHORIZE_AND_CAPTURE and PaymentTransactionType.PENDING transactions.PaymentTransactionType.UNCONFIRMED transactions that exist on an OrderPayment. This can
mean different things depending on the type of Order Payment and is handled by the OrderPaymentConfirmationStrategyConfirmPaymentsRollbackHandler. It will also by default
attempt to mark the payment as "ARCHIVED" so that the user may attempt to re-enter their payment details.| Modifier and Type | Class and Description |
|---|---|
protected class |
ValidateAndConfirmPaymentActivity.ResponseTransactionPair |
| Modifier and Type | Field and Description |
|---|---|
static String |
FAILED_RESPONSES |
protected static org.apache.commons.logging.Log |
LOG |
static int |
ORDER |
protected OrderPaymentConfirmationStrategy |
orderPaymentConfirmationStrategy |
protected OrderPaymentService |
orderPaymentService |
protected OrderPaymentStatusService |
orderPaymentStatusService |
protected OrderToPaymentRequestDTOService |
orderToPaymentRequestService |
protected PaymentGatewayConfigurationServiceProvider |
paymentConfigurationServiceProvider |
protected PaymentGatewayCheckoutService |
paymentGatewayCheckoutService |
static String |
ROLLBACK_TRANSACTIONS
Used by the
ConfirmPaymentsRollbackHandler
to roll back transactions that this activity confirms. |
automaticallyRegisterRollbackHandler, beanName, errorHandler, order, rollbackHandler, rollbackRegion, stateConfiguration| Constructor and Description |
|---|
ValidateAndConfirmPaymentActivity(ConfirmPaymentsRollbackHandler rollbackHandler) |
| Modifier and Type | Method and Description |
|---|---|
protected CustomerPayment |
createCustomerPaymentToken(PaymentTransaction transaction) |
ProcessContext<CheckoutSeed> |
execute(ProcessContext<CheckoutSeed> context)
Called by the encompassing processor to activate
the execution of the Activity
|
protected void |
handleUnsuccessfulTransactions(List<ValidateAndConfirmPaymentActivity.ResponseTransactionPair> failedTransactions,
ProcessContext<CheckoutSeed> context)
Default implementation is to throw a generic CheckoutException which will be caught and displayed
on the Checkout Page where the Customer can try again.
|
protected boolean |
shouldRollbackFailedTransaction(ValidateAndConfirmPaymentActivity.ResponseTransactionPair failedTransactionPair) |
getAutomaticallyRegisterRollbackHandler, getBeanName, getErrorHandler, getOrder, getRollbackHandler, getRollbackRegion, getStateConfiguration, setAutomaticallyRegisterRollbackHandler, setBeanName, setErrorHandler, setOrder, setRollbackHandler, setRollbackRegion, setStateConfiguration, shouldExecutepublic static final int ORDER
protected static final org.apache.commons.logging.Log LOG
public static final String ROLLBACK_TRANSACTIONS
Used by the ConfirmPaymentsRollbackHandler
to roll back transactions that this activity confirms.
This could also contain failed transactions that still need to be rolled back
public static final String FAILED_RESPONSES
@Autowired(required=false) @Qualifier(value="blPaymentGatewayConfigurationServiceProvider") protected PaymentGatewayConfigurationServiceProvider paymentConfigurationServiceProvider
protected OrderToPaymentRequestDTOService orderToPaymentRequestService
protected OrderPaymentService orderPaymentService
protected PaymentGatewayCheckoutService paymentGatewayCheckoutService
protected OrderPaymentConfirmationStrategy orderPaymentConfirmationStrategy
protected OrderPaymentStatusService orderPaymentStatusService
@Autowired
public ValidateAndConfirmPaymentActivity(@Qualifier(value="blConfirmPaymentsRollbackHandler")
ConfirmPaymentsRollbackHandler rollbackHandler)
public ProcessContext<CheckoutSeed> execute(ProcessContext<CheckoutSeed> context) throws Exception
Activitycontext - - process context for this workflowExceptionprotected void handleUnsuccessfulTransactions(List<ValidateAndConfirmPaymentActivity.ResponseTransactionPair> failedTransactions, ProcessContext<CheckoutSeed> context) throws Exception
Default implementation is to throw a generic CheckoutException which will be caught and displayed on the Checkout Page where the Customer can try again. In many cases, this is sufficient as it is usually recommended to display a generic Error Message to prevent Credit Card fraud.
The configured payment gateway may return a more specific error. Each gateway is different and will often times return different error codes based on the acquiring bank as well. In that case, you may override this method to decipher these errors and handle it appropriately based on your business requirements.
Exceptionprotected boolean shouldRollbackFailedTransaction(ValidateAndConfirmPaymentActivity.ResponseTransactionPair failedTransactionPair)
protected CustomerPayment createCustomerPaymentToken(PaymentTransaction transaction)
Copyright © 2018. All rights reserved.