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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultStripeGatewayWebhookHandler
(StripeRestConfigurationProperties configurationProperties, com.broadleafcommerce.common.extension.TypeFactory typeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addRawResponse
(@NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull Object response) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeCapturedResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Charge charge, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeFailedResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Charge charge, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeRefundedResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Charge charge, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildChargeSucceededResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Charge charge, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildPaymentIntentFailedResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.PaymentIntent paymentIntent, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected com.stripe.net.RequestOptions
buildRequestOptions
(@NonNull String idempotencyKey, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> buildReviewClosedResponse
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Review review, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) protected com.stripe.model.Event
constructEvent
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) Deprecated, for removal: This API element is subject to removal in a future version.org.apache.commons.lang3.tuple.Pair<com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier,
com.broadleafcommerce.paymentgateway.domain.PaymentResponse> convertToPaymentResponse
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected javax.money.MonetaryAmount
getAmountInMajorUnits
(@NonNull Long amount, @NonNull String currencyCode) protected String
getApplicationId
(@NonNull Map<String, String> parameters) protected String
protected StripeConfigurationProperties
protected StripeRestConfigurationProperties
getEventId
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected String
getFailureMessage
(@NonNull com.stripe.model.Charge charge) protected String
getGatewayResponseCode
(@NonNull com.stripe.model.PaymentIntent paymentIntent) protected String
getGatewayTransactionId
(@NonNull com.stripe.model.StripeObject stripeObject) protected com.stripe.model.PaymentIntent
getPaymentIntent
(@NonNull com.stripe.model.Review review, @NonNull org.springframework.http.HttpHeaders headers, @NonNull Map<String, String> parameters) getPaymentMethodPropertiesForFutureUse
(@NonNull com.stripe.model.Charge charge) protected com.stripe.model.StripeObject
getStripeObject
(@NonNull com.stripe.model.Event event) protected StripeWebhookEventService
protected String
getTenantId
(@NonNull Map<String, String> parameters) protected String
protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
getTransactionIdentifier
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.Charge charge, @NonNull Map<String, String> parameters) protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
getTransactionIdentifier
(@NonNull com.stripe.model.Event event, @NonNull com.stripe.model.PaymentIntent paymentIntent, @NonNull Map<String, String> parameters) protected com.broadleafcommerce.paymentgateway.domain.TransactionIdentifier
getTransactionIdentifier
(@NonNull com.stripe.model.Event event, @NonNull Map<String, String> metadata, @NonNull Map<String, String> parameters) protected com.broadleafcommerce.paymentgateway.domain.enums.DefaultTransactionTypes
getTransactionType
(@NonNull com.stripe.model.PaymentIntent paymentIntent) protected com.broadleafcommerce.paymentgateway.domain.enums.TransactionType
getTransactionType
(com.stripe.model.Charge charge) protected com.broadleafcommerce.common.extension.TypeFactory
protected String
identifyFailureType
(String responseCode, String transactionReferenceId) protected boolean
isAchPayment
(@NonNull com.stripe.model.PaymentIntent paymentIntent) void
setConfigProperties
(StripeConfigurationProperties configProperties) void
setStripeWebhookEventService
(StripeWebhookEventService stripeWebhookEventService) boolean
shouldHandleRequest
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) void
validate
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) protected com.stripe.model.Event
validateAndConstructEvent
(@NonNull org.springframework.http.HttpHeaders headers, @NonNull String requestBody, @NonNull Map<String, String> parameters) Deprecated, for removal: This API element is subject to removal in a future version.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
buildFailedWebhookResponse, buildSuccessfulWebhookResponse, convertToPaymentResponse, shouldHandleRequest, validate
-
Field Details
-
STRIPE_SIGNATURE_HEADER
- See Also:
-
STRIPE_ACCOUNT_HEADER
- See Also:
-
-
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 interfacecom.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 interfacecom.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 interfacecom.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 interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
getSupportedWebhookNotificationTypes
- Specified by:
getSupportedWebhookNotificationTypes
in interfacecom.broadleafcommerce.paymentgateway.service.PaymentGatewayWebhookHandler
-
getGatewayType
- Specified by:
getGatewayType
in interfacecom.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 ExceptionDeprecated, 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
-
getTenantId
-
getTenantId
-
getApplicationId
-
getTransactionIdentifier
-
getTransactionIdentifier
-
getTransactionIdentifier
-
identifyFailureType
-
buildRequestOptions
-
getAmountInMajorUnits
-
getSupportedEventTypes
-
getGatewayResponseCode
@Nullable protected String getGatewayResponseCode(@NonNull @NonNull com.stripe.model.PaymentIntent paymentIntent) -
getFailureMessage
-
getPaymentMethodPropertiesForFutureUse
-
addRawResponse
protected void addRawResponse(@NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse, @NonNull @NonNull Object response) -
getConfigurationProperties
-
getTypeFactory
protected com.broadleafcommerce.common.extension.TypeFactory getTypeFactory() -
getConfigProperties
-
setConfigProperties
-
getStripeWebhookEventService
-
setStripeWebhookEventService
@Autowired public void setStripeWebhookEventService(StripeWebhookEventService stripeWebhookEventService)
-
StripeWebhookEventService.constructEvent(HttpHeaders, String, Map)
.