Class DefaultTransactionResultService
java.lang.Object
com.broadleafcommerce.paymenttransaction.service.DefaultTransactionResultService
- All Implemented Interfaces:
TransactionResultService
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultTransactionResultService(PaymentTransactionService<PaymentTransaction> paymentTransactionService, TransactionExecutionUtil transactionExecutionUtil, PaymentService<Payment> paymentService, PaymentLockService<Payment> paymentLockService, TransactionExecutionService transactionExecutionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.data.tracking.core.context.ContextInfobuildContextInfoFromTransaction(@NonNull PaymentTransaction transaction) protected TransactionExecutionResponsebuildPendingTransactionNotFoundResponse(@NonNull PaymentTransaction pendingTransaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequestbuildTransactionLookupRequest(@NonNull Payment payment, @NonNull PaymentTransaction paymentTransaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Builds the transaction details to pass to the payment gateway.getPayment(@NonNull PaymentTransaction pendingTransaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Fetches the payment that the pending transaction belongs to.protected PaymentLockService<Payment>protected PaymentService<Payment>protected PaymentTransactionService<PaymentTransaction>protected TransactionExecutionServiceprotected TransactionExecutionUtilprotected com.broadleafcommerce.common.extension.TypeFactoryhandleRecordTransactionException(@NonNull Exception e, @NonNull String gatewayType, Payment payment, PaymentTransaction pendingTransaction, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Handles the exceptions thrown when recording transaction results.identifyChildTransaction(@NonNull Payment payment, @NonNull PaymentTransaction transactionRequiringExternal) Identifies the child transaction of the pending transaction.identifyPendingTransactionByTransactionIdentifier(@NonNull com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier transactionIdentifier, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Identifies the transaction that is pending results from the gateway.protected voidlogIfPaymentArchived(@NonNull Payment payment, @NonNull PaymentTransaction transaction) recordChildTransactionResults(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull Payment payment, @NonNull PaymentTransaction pendingTransaction, @NonNull String managementStateReason, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Records the transaction results from the payment gateway.
-
Constructor Details
-
DefaultTransactionResultService
public DefaultTransactionResultService(PaymentTransactionService<PaymentTransaction> paymentTransactionService, TransactionExecutionUtil transactionExecutionUtil, PaymentService<Payment> paymentService, PaymentLockService<Payment> paymentLockService, TransactionExecutionService transactionExecutionService, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
-
-
Method Details
-
handleRecordTransactionException
public TransactionExecutionResponse handleRecordTransactionException(@NonNull @NonNull Exception e, @NonNull @NonNull String gatewayType, @Nullable Payment payment, @Nullable PaymentTransaction pendingTransaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:TransactionResultServiceHandles the exceptions thrown when recording transaction results.- Specified by:
handleRecordTransactionExceptionin interfaceTransactionResultService- Parameters:
e- the exception throwngatewayType- the gateway used to process this payment.payment- the payment being processed, if available.pendingTransaction- the transaction pending results, if available.context- the contextInfo for the request- Returns:
- the
TransactionExecutionResponsedescribing the resulting transaction andPaymentSummary
-
buildPendingTransactionNotFoundResponse
protected TransactionExecutionResponse buildPendingTransactionNotFoundResponse(@NonNull @NonNull PaymentTransaction pendingTransaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) -
getPayment
public Payment getPayment(@NonNull @NonNull PaymentTransaction pendingTransaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:TransactionResultServiceFetches the payment that the pending transaction belongs to. By default, this method returns the archived payment as well.- Specified by:
getPaymentin interfaceTransactionResultService- Parameters:
pendingTransaction- the transaction that is pending results from the gatewaycontext- the contextInfo for the request- Returns:
- the
Paymentthat this transaction belongs to
-
buildTransactionLookupRequest
public com.broadleafcommerce.paymentgateway.domain.TransactionLookupRequest buildTransactionLookupRequest(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction paymentTransaction, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:TransactionResultServiceBuilds the transaction details to pass to the payment gateway.- Specified by:
buildTransactionLookupRequestin interfaceTransactionResultService- Parameters:
payment- thePaymentthat this transaction belongs topaymentTransaction- the transaction that is pending results from the gatewaycontextInfo- the contextInfo for the request- Returns:
- the request object including transaction-identifying data
-
identifyPendingTransactionByTransactionIdentifier
public PaymentTransaction identifyPendingTransactionByTransactionIdentifier(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier transactionIdentifier, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Description copied from interface:TransactionResultServiceIdentifies the transaction that is pending results from the gateway.- Specified by:
identifyPendingTransactionByTransactionIdentifierin interfaceTransactionResultService- Parameters:
transactionIdentifier- the identifier for the transactioncontextInfo- the contextInfo for the request- Returns:
- the
PaymentTransactionthat is pending results from the gateway
-
recordChildTransactionResults
public TransactionExecutionResponse recordChildTransactionResults(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction pendingTransaction, @NonNull @NonNull String managementStateReason, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:TransactionResultServiceRecords the transaction results from the payment gateway.- Specified by:
recordChildTransactionResultsin interfaceTransactionResultService- Parameters:
paymentResponse- the payment gateway's response to the executed transactionpayment- thePaymentthat this transaction belongs topendingTransaction- the transaction that is pending results from the gatewaymanagementStateReason- the reason for the transaction managementState, i.e. "EXTERNAL_TRANSACTION"lockToken- the token that owns the payment lockcontext- the contextInfo for the request- Returns:
- the
TransactionExecutionResponsedescribing the resulting transaction andPaymentSummary
-
identifyChildTransaction
public Optional<PaymentTransaction> identifyChildTransaction(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transactionRequiringExternal) Description copied from interface:TransactionResultServiceIdentifies the child transaction of the pending transaction.- Specified by:
identifyChildTransactionin interfaceTransactionResultService- Parameters:
payment- thePaymentthat this transaction belongs totransactionRequiringExternal- the transaction that is pending results from the gateway- Returns:
- the child transaction, if found
-
buildContextInfoFromTransaction
protected com.broadleafcommerce.data.tracking.core.context.ContextInfo buildContextInfoFromTransaction(@NonNull @NonNull PaymentTransaction transaction) -
logIfPaymentArchived
protected void logIfPaymentArchived(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transaction) -
getPaymentTransactionService
-
getTransactionExecutionUtil
-
getPaymentService
-
getPaymentLockService
-
getTransactionExecutionService
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
-