Class DefaultStripeTransactionService

java.lang.Object
com.broadleafcommerce.payment.service.gateway.DefaultStripeTransactionService
All Implemented Interfaces:
StripeTransactionService, com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService, com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware

public class DefaultStripeTransactionService extends Object implements StripeTransactionService
  • Field Details

    • REDIRECT_URL_PAYMENT_INTENT_ID_PARAM

      protected static final String REDIRECT_URL_PAYMENT_INTENT_ID_PARAM
      See Also:
    • REDIRECT_URL_PAYMENT_INTENT_ACCESS_TOKEN_PARAM

      protected static final String REDIRECT_URL_PAYMENT_INTENT_ACCESS_TOKEN_PARAM
      See Also:
  • Constructor Details

  • Method Details

    • authorize

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse authorize(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      authorize in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
    • capture

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse capture(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      capture in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
    • authorizeAndCapture

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse authorizeAndCapture(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      authorizeAndCapture in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
    • isACHPaymentRequest

      protected boolean isACHPaymentRequest(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
    • doAuthAndOrCaptureForAch

      protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse doAuthAndOrCaptureForAch(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
    • doAuthAndOrCapture

      protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse doAuthAndOrCapture(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, boolean capture)
    • reverseAuthorize

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse reverseAuthorize(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      reverseAuthorize in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
    • refund

      public com.broadleafcommerce.paymentgateway.domain.PaymentResponse refund(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest)
      Specified by:
      refund in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTransactionService
    • fillResponse

      @Deprecated protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.Charge charge)
    • fillResponse

      protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.Charge charge, @Nullable String stripeMethodType)
      Populates the PaymentResponse based on the provided Charge
      Parameters:
      paymentResponse - the response object that should be populated & which will be returned from this service's public methods
      charge - the Stripe API's returned object that hold the results of the transaction
    • fillResponse

      @Deprecated protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.Refund refund)
    • fillResponse

      protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.Refund refund, @Nullable String stripeMethodType)
    • fillResponse

      @Deprecated protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.PaymentIntent paymentIntent) throws StripePaymentIntentRequiresActionException
      Throws:
      StripePaymentIntentRequiresActionException
    • fillResponse

      protected void fillResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, com.stripe.model.PaymentIntent paymentIntent, @Nullable String stripeMethodType) throws StripePaymentIntentRequiresActionException
      Populates the PaymentResponse based on the provided PaymentIntent See the following for all possible values of Stripe's Payment Intent statuses: https://stripe.com/docs/payments/payment-intents/status
      Parameters:
      paymentRequest - the request object whose data was sent to Stripe for this transaction
      paymentResponse - the response object that should be populated & which will be returned from this service's public methods
      paymentIntent - the Stripe API's returned object that hold the results of the transaction
      Throws:
      StripePaymentIntentRequiresActionException
    • handlePaymentIntentProcessingStatus

      protected void handlePaymentIntentProcessingStatus(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent, @Nullable String stripeMethodType)
    • isFlaggedForManualReview

      @Nullable protected Boolean isFlaggedForManualReview(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
      Determines whether the payment transaction has been flagged for manual review.
      See Also:
      • Review.getOpen()
    • getPaymentMethodPropertiesForFutureUse

      protected Map<String,String> getPaymentMethodPropertiesForFutureUse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • addRawResponse

      protected void addRawResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull Object response)
    • handlePaymentIntentRequiresAction

      protected void handlePaymentIntentRequiresAction(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent) throws StripePaymentIntentRequiresActionException
      Throws:
      StripePaymentIntentRequiresActionException
    • handlePaymentIntentRequiresPaymentMethod

      protected void handlePaymentIntentRequiresPaymentMethod(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent) throws StripePaymentIntentRequiresPaymentMethodException
      Throws:
      StripePaymentIntentRequiresPaymentMethodException
    • handlePaymentIntentErrors

      protected void handlePaymentIntentErrors(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • identifyFailureType

      protected String identifyFailureType(com.stripe.model.StripeError stripePaymentError, String transactionReferenceId)
    • getGatewayTransactionId

      @Nullable protected String getGatewayTransactionId(@NonNull @NonNull com.stripe.model.StripeObject stripeObject)
    • getRequestId

      @Deprecated(forRemoval=true) @Nullable protected String getRequestId(@NonNull @NonNull com.stripe.model.Charge charge)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • getResponseCode

      @Nullable protected String getResponseCode(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • requiresMicroDepositVerification

      protected boolean requiresMicroDepositVerification(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • populateMicroDepositVerificationDetails

      protected com.broadleafcommerce.paymentgateway.domain.PaymentResponse populateMicroDepositVerificationDetails(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent, @Nullable String stripeMethodType)
    • buildNextAction

      protected com.broadleafcommerce.paymentgateway.domain.NextAction buildNextAction(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • getCustomMicroDepositVerificationURL

      @Nullable protected String getCustomMicroDepositVerificationURL(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • buildRedirectUrl

      protected String buildRedirectUrl(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent, @NonNull @NonNull String customMicroDepositVerificationURL)
    • getHostedVerificationUrl

      @Nullable protected String getHostedVerificationUrl(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • getMicroDepositType

      @Nullable protected String getMicroDepositType(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • determineRecommendedSavedPaymentMethodStatus

      @Nullable protected String determineRecommendedSavedPaymentMethodStatus(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentRequest paymentRequest, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse)
      Returns the recommended saved payment method status if it should be created.
      Returns:
      DefaultSavedPaymentMethodStatuses.INVALID_PAYMENT_METHOD if the transaction's failure type is DefaultSavedPaymentMethodStatuses.INVALID_PAYMENT_METHOD. DefaultSavedPaymentMethodStatuses.AWAITING_ASYNC_RESULTS if the transaction succeeds but awaiting an asynchronous result
    • getGatewayType

      public String getGatewayType()
      Specified by:
      getGatewayType in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
    • getStripeService

      protected StripeExternalCallService getStripeService()
    • getPaymentResponseUtil

      protected com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil getPaymentResponseUtil()
    • setPaymentResponseUtil

      @Autowired public void setPaymentResponseUtil(com.broadleafcommerce.paymentgateway.util.PaymentResponseUtil paymentResponseUtil)
    • getConfigProperties

      protected StripeConfigurationProperties getConfigProperties()
    • setConfigProperties

      @Autowired public void setConfigProperties(StripeConfigurationProperties configProperties)
    • getTypeFactory

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

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

      protected PaymentIntentAccessTokenService getPaymentIntentAccessTokenService()
    • setPaymentIntentAccessTokenService

      @Autowired public void setPaymentIntentAccessTokenService(PaymentIntentAccessTokenService paymentIntentAccessTokenService)
    • getCustomerNotificationService

      protected StripeCustomerNotificationService getCustomerNotificationService()
    • setCustomerNotificationService

      @Autowired public void setCustomerNotificationService(StripeCustomerNotificationService customerNotificationService)