Class DefaultExternalTransactionResultService

java.lang.Object
com.broadleafcommerce.paymenttransaction.service.DefaultExternalTransactionResultService
All Implemented Interfaces:
ExternalTransactionResultService

public class DefaultExternalTransactionResultService extends Object implements ExternalTransactionResultService
The default implementation for ExternalTransactionResultService.
Author:
LSPL385
  • Constructor Details

    • DefaultExternalTransactionResultService

      public DefaultExternalTransactionResultService(com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider paymentGatewayResourceProvider, TransactionExecutionUtil transactionExecutionUtil, TransactionResultService transactionResultService)
  • Method Details

    • identifyTransactionRequiringExternalInteraction

      public PaymentTransaction identifyTransactionRequiringExternalInteraction(@NonNull @NonNull Payment payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ExternalTransactionResultService
      Finds the transaction that required external results.
      Specified by:
      identifyTransactionRequiringExternalInteraction in interface ExternalTransactionResultService
      Parameters:
      payment - the payment object that contains a reference to the required transaction
      context - context information related to multitenancy
      Returns:
      the transaction that required external results
    • lookupAndRecordExternalTransactionResult

      public TransactionExecutionResponse lookupAndRecordExternalTransactionResult(@NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transactionRequiringExternal, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ExternalTransactionResultService
      Reads the transaction result using PaymentGatewayTransactionLookupService, records the result to the appropriate transaction and payment.

      This can be used, for example, to verify that a customer has approved a payment for transactions that requires to add bank details.

      Specified by:
      lookupAndRecordExternalTransactionResult in interface ExternalTransactionResultService
      Parameters:
      payment - the payment gateway type that is used to identify the appropriate PaymentGatewayTransactionLookupService
      transactionRequiringExternal - the transaction that requires external results
      lockToken - Token granted to resource that owns the payment lock.
      context - context information related to multitenancy
      Returns:
      the TransactionExecutionResponse describing the resulting transaction and PaymentSummary
    • validatePaymentCallbackToken

      public PaymentCallbackValidationResponse validatePaymentCallbackToken(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentCallbackValidationRequest validationRequest, @Nullable PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Description copied from interface: ExternalTransactionResultService
      Validates the callback request and returns the result of that validation.
      Specified by:
      validatePaymentCallbackToken in interface ExternalTransactionResultService
      Parameters:
      payments - the page of payments for the request
      validationRequest - the callback validation request
      paymentLockTokens - the PaymentLockTokens, if any
      contextInfo - context information related to multitenancy.
      Returns:
      the payment callback validation response
    • handleTransactionResult

      public TransactionExecutionResponse handleTransactionResult(@NonNull @NonNull String gatewayType, @NonNull @NonNull Map<String,String> requestParams, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: ExternalTransactionResultService
      Reads the transaction result using PaymentGatewayTransactionLookupService, records the result to the appropriate transaction and payment.

      This can be used, for example, to verify that a customer has approved a payment for transactions that require to add bank details.

      Specified by:
      handleTransactionResult in interface ExternalTransactionResultService
      Parameters:
      gatewayType - the payment gateway type that is used to identify the appropriate PaymentGatewayTransactionLookupService
      requestParams - the parameters for request
      context - context information related to multitenancy
      Returns:
      the TransactionExecutionDetail describing the resulting transaction and PaymentSummary
    • identifyExternalTransaction

      protected PaymentTransaction identifyExternalTransaction(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier transactionIdentifier, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • recordExternalTransactionResults

      protected TransactionExecutionResponse recordExternalTransactionResults(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull Payment payment, @NonNull @NonNull PaymentTransaction transactionRequiringExternalInteraction, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • validateTransactionResults

      protected void validateTransactionResults(@NonNull @NonNull TransactionExecutionResponse transactionResponse, @NonNull @NonNull PaymentTransaction transactionRequiringExternal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getSecureTokenKeyFromRequest

      protected String getSecureTokenKeyFromRequest(@NonNull @NonNull PaymentCallbackValidationRequest validationRequest)
    • parseTokenIdFromSecureTokenKey

      protected String parseTokenIdFromSecureTokenKey(String secureTokenKey)
    • determinePaymentFromCallbackRequest

      protected Payment determinePaymentFromCallbackRequest(@NonNull @NonNull org.springframework.data.domain.Page<Payment> payments, @NonNull @NonNull PaymentCallbackValidationRequest validationRequest, @NonNull @NonNull String requestTokenId)
    • getPaymentGatewayResourceProvider

      protected com.broadleafcommerce.paymentgateway.service.provider.PaymentGatewayResourceProvider getPaymentGatewayResourceProvider()
    • getTransactionExecutionUtil

      protected TransactionExecutionUtil getTransactionExecutionUtil()
    • getTransactionResultService

      protected TransactionResultService getTransactionResultService()
    • getPaymentService

      protected PaymentService<Payment> getPaymentService()
    • setPaymentService

      @Autowired public void setPaymentService(PaymentService<Payment> paymentService)
    • getPaymentCallbackSecurityTokenUtil

      @Nullable protected com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil getPaymentCallbackSecurityTokenUtil()
    • setPaymentCallbackSecurityTokenUtil

      @Autowired(required=false) public void setPaymentCallbackSecurityTokenUtil(@Nullable com.broadleafcommerce.paymentgateway.util.PaymentCallbackSecurityTokenUtil paymentCallbackSecurityTokenUtil)
    • getTypeFactory

      protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory()
    • setTypeFactory

      @Autowired public void setTypeFactory(com.broadleafcommerce.common.extension.TypeFactory typeFactory)