Class DefaultStripeGatewayWebhookHandler

java.lang.Object
com.broadleafcommerce.payment.service.gateway.webhooks.DefaultStripeGatewayWebhookHandler
All Implemented Interfaces:
StripeGatewayWebhookHandler, com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware, com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler

public class DefaultStripeGatewayWebhookHandler extends Object implements StripeGatewayWebhookHandler
Author:
Dima Myroniuk (dmyroniuk)
  • Field Details

  • Constructor Details

    • DefaultStripeGatewayWebhookHandler

      public DefaultStripeGatewayWebhookHandler(StripeRestConfigurationProperties configurationProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory)
  • Method Details

    • validate

      public void validate(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters)
      Specified by:
      validate in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • shouldHandleRequest

      public boolean shouldHandleRequest(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters)
      Specified by:
      shouldHandleRequest in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • convertToPaymentResponse

      public org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> convertToPaymentResponse(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters)
      Specified by:
      convertToPaymentResponse in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • getEventId

      public String getEventId(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters)
      Specified by:
      getEventId in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • getSupportedWebhookNotificationTypes

      public List<String> getSupportedWebhookNotificationTypes()
      Specified by:
      getSupportedWebhookNotificationTypes in interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
    • getGatewayType

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

      protected com.stripe.model.StripeObject getStripeObject(@NonNull @NonNull com.stripe.model.Event event)
    • isAchPayment

      protected boolean isAchPayment(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • validateAndConstructEvent

      @Deprecated(forRemoval=true) protected com.stripe.model.Event validateAndConstructEvent(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters) throws Exception
      Deprecated, for removal: This API element is subject to removal in a future version.
      Throws:
      Exception
    • constructEvent

      @Deprecated(forRemoval=true) protected com.stripe.model.Event constructEvent(@NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull String requestBody, @NonNull @NonNull Map<String,String> parameters)
      Deprecated, for removal: This API element is subject to removal in a future version.
    • buildReviewClosedResponse

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildReviewClosedResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Review review, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters) throws com.stripe.exception.StripeException
      Throws:
      com.stripe.exception.StripeException
    • getPaymentIntent

      protected com.stripe.model.PaymentIntent getPaymentIntent(@NonNull @NonNull com.stripe.model.Review review, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters) throws com.stripe.exception.StripeException
      Throws:
      com.stripe.exception.StripeException
    • buildChargeCapturedResponse

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeCapturedResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Charge charge, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • getGatewayTransactionId

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

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeRefundedResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Charge charge, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • buildChargeSucceededResponse

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeSucceededResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Charge charge, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • buildChargeFailedResponse

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeFailedResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Charge charge, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • buildPaymentIntentFailedResponse

      protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildPaymentIntentFailedResponse(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • getTransactionType

      protected com.broadleafcommerce.paymentgateway.domain.enums.DefaultTransactionTypes getTransactionType(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • getTransactionType

      protected com.broadleafcommerce.paymentgateway.domain.enums.TransactionType getTransactionType(com.stripe.model.Charge charge)
    • getApplicationId

      @Nullable protected String getApplicationId(@NonNull @NonNull Map<String,String> parameters, @NonNull @NonNull Map<String,String> metadata)
    • getTenantId

      @Nullable protected String getTenantId(@NonNull @NonNull Map<String,String> parameters, @NonNull @NonNull Map<String,String> metadata)
    • getTenantId

      @Nullable protected String getTenantId(@NonNull @NonNull Map<String,String> parameters)
    • getApplicationId

      @Nullable protected String getApplicationId(@NonNull @NonNull Map<String,String> parameters)
    • getTransactionIdentifier

      protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier getTransactionIdentifier(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent, @NonNull @NonNull Map<String,String> parameters)
    • getTransactionIdentifier

      protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier getTransactionIdentifier(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull com.stripe.model.Charge charge, @NonNull @NonNull Map<String,String> parameters)
    • getTransactionIdentifier

      protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier getTransactionIdentifier(@NonNull @NonNull com.stripe.model.Event event, @NonNull @NonNull Map<String,String> metadata, @NonNull @NonNull Map<String,String> parameters)
    • identifyFailureType

      protected String identifyFailureType(String responseCode, String transactionReferenceId)
    • buildRequestOptions

      protected com.stripe.net.RequestOptions buildRequestOptions(@NonNull @NonNull String idempotencyKey, @NonNull @NonNull org.springframework.http.HttpHeaders headers, @NonNull @NonNull Map<String,String> parameters)
    • getAmountInMajorUnits

      protected javax.money.MonetaryAmount getAmountInMajorUnits(@NonNull @NonNull Long amount, @NonNull @NonNull String currencyCode)
    • getSupportedEventTypes

      protected List<String> getSupportedEventTypes()
    • getGatewayResponseCode

      @Nullable protected String getGatewayResponseCode(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent)
    • getFailureMessage

      @Nullable protected String getFailureMessage(@NonNull @NonNull com.stripe.model.Charge charge)
    • getPaymentMethodPropertiesForFutureUse

      protected Map<String,String> getPaymentMethodPropertiesForFutureUse(@NonNull @NonNull com.stripe.model.Charge charge)
    • addRawResponse

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

      protected StripeRestConfigurationProperties getConfigurationProperties()
    • getTypeFactory

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

      protected StripeConfigurationProperties getConfigProperties()
    • setConfigProperties

      @Autowired public void setConfigProperties(StripeConfigurationProperties configProperties)
    • getStripeWebhookEventService

      protected StripeWebhookEventService getStripeWebhookEventService()
    • setStripeWebhookEventService

      @Autowired public void setStripeWebhookEventService(StripeWebhookEventService stripeWebhookEventService)