Class ExternalBraintreeProvider

java.lang.Object
com.broadleafcommerce.braintree.provider.external.AbstractExternalProvider
com.broadleafcommerce.braintree.provider.external.ExternalBraintreeProvider
All Implemented Interfaces:
BraintreeProvider

public class ExternalBraintreeProvider extends AbstractExternalProvider implements BraintreeProvider
  • Constructor Details

    • ExternalBraintreeProvider

      public ExternalBraintreeProvider(org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper, ExternalBraintreeProviderProperties providerProperties, BraintreeConfigurationProperties configProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • generateClientToken

      public BraintreeGenerateTokenResponse generateClientToken(@Nullable String customerId, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      This method generate Client Token which will be used on the Client Side integration for Drop-in calls
      Specified by:
      generateClientToken in interface BraintreeProvider
      Parameters:
      customerId - Only applies to the Drop-in UI; not needed when generating client tokens for custom integrations. A string value representing an existing customer in your Vault. Passing this option allows customers to manage their vaulted payment methods via the Drop-in UI
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      BraintreeGenerateTokenResponse which contains all authorization and configuration information your client needs to initialize the client SDK to communicate with Braintree
    • authorizeTransaction

      public BraintreeResponse authorizeTransaction(@NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, @NonNull @NonNull String nonce, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Executes the DefaultTransactionTypes.AUTHORIZE transactions.
      Specified by:
      authorizeTransaction in interface BraintreeProvider
      Parameters:
      braintreePaymentRequest - the request body
      nonce - - payment_method_nonce representing customer payment authorization. This value comes from the Client Side and can be generated by Drop-in, PayPal or any other payment methods supported by Braintree
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • authorizeAndCaptureTransaction

      public BraintreeResponse authorizeAndCaptureTransaction(@NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, @NonNull @NonNull String nonce, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Executes the DefaultTransactionTypes.AUTHORIZE_AND_CAPTURE transactions.
      Specified by:
      authorizeAndCaptureTransaction in interface BraintreeProvider
      Parameters:
      braintreePaymentRequest - the request body
      nonce - the nonce from Client SDK
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • captureTransaction

      public BraintreeResponse captureTransaction(@NonNull @NonNull String transactionId, @NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Executes the DefaultTransactionTypes.CAPTURE transactions.
      Specified by:
      captureTransaction in interface BraintreeProvider
      Parameters:
      transactionId - the transaction id to capture
      braintreePaymentRequest - the request body
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • reverseAuthorizeTransaction

      public BraintreeResponse reverseAuthorizeTransaction(@NonNull @NonNull String transactionId, @NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Executes the DefaultTransactionTypes.REVERSE_AUTH transactions.
      Specified by:
      reverseAuthorizeTransaction in interface BraintreeProvider
      Parameters:
      transactionId - the transaction id to reverse
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • refundTransaction

      public BraintreeResponse refundTransaction(@NonNull @NonNull String transactionId, @NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Executes the DefaultTransactionTypes.REFUND transactions.
      Specified by:
      refundTransaction in interface BraintreeProvider
      Parameters:
      transactionId - the transaction id to reverse
      braintreePaymentRequest - the request body
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • getTransactionStatus

      public BraintreeResponse getTransactionStatus(@NonNull @NonNull String transactionId, @Nullable String applicationId, @Nullable String tenantId)
      Description copied from interface: BraintreeProvider
      Get current status of the transaction.
      Specified by:
      getTransactionStatus in interface BraintreeProvider
      Parameters:
      transactionId - the transaction id to reverse
      applicationId - the application id
      tenantId - the tenant id
      Returns:
      the response from Braintree API
    • getApiUrlBuilder

      protected org.springframework.web.util.UriComponentsBuilder getApiUrlBuilder()
    • checkError

      protected BraintreeResponse checkError(BraintreeResponse braintreeResponse)
    • getApiToken

      protected String getApiToken(@Nullable String applicationId, @Nullable String tenantId)
    • buildGenerateTokenRequest

      protected BraintreeGenerateTokenRequest buildGenerateTokenRequest(@Nullable String customerId, @Nullable String applicationId, @Nullable String tenantId)
    • buildBraintreeReverseAuthorizeTransactionRequest

      protected BraintreeReverseAuthorizeTransactionRequest buildBraintreeReverseAuthorizeTransactionRequest(@NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, String transactionId)
    • buildBraintreeAuthorizeTransactionRequest

      protected BraintreeAuthorizeTransactionRequest buildBraintreeAuthorizeTransactionRequest(BraintreePaymentRequest braintreePaymentRequest, String nonce, @Nullable String applicationId, @Nullable String tenantId)
    • buildBraintreeAuthorizeAndCaptureTransactionRequest

      protected BraintreeAuthorizeAndCaptureTransactionRequest buildBraintreeAuthorizeAndCaptureTransactionRequest(BraintreePaymentRequest braintreePaymentRequest, String nonce, @Nullable String applicationId, @Nullable String tenantId)
    • buildBraintreeCaptureTransactionRequest

      protected BraintreeCaptureTransactionRequest buildBraintreeCaptureTransactionRequest(@NonNull @NonNull BraintreePaymentRequest braintreePaymentRequest, String transactionId)
    • buildBraintreeRefundTransactionRequest

      protected BraintreeRefundTransactionRequest buildBraintreeRefundTransactionRequest(String transactionId, BraintreePaymentRequest braintreePaymentRequest)
    • buildBraintreeSearchTransactionRequest

      protected BraintreeSearchTransactionRequest buildBraintreeSearchTransactionRequest(String transactionId)
    • populateCustomFields

      protected void populateCustomFields(List<CustomField> customFields, BraintreePaymentRequest braintreePaymentRequest)
    • getProviderProperties

      protected ExternalBraintreeProviderProperties getProviderProperties()
    • getTypeFactory

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

      protected BraintreeConfigurationProperties getConfigProperties()