Interface PaymentGatewaySavedPaymentMethodWebhookHandler
- All Superinterfaces:
PaymentGatewayTypeAware
A gateway-specific interface to assist with the interpretation & processing of payment gateway
webhook requests. Typically, we expect this interface to be used to assist with the recording
results of creating the saved payment method.
- Author:
- Dima Myroniuk (dmyroniuk)
-
Method Summary
Modifier and TypeMethodDescriptiondefault org.springframework.http.ResponseEntity<?>Builds & returns aResponseEntitymeant to communicate to the gateway that the webhook request was unsuccessfully processed.default org.springframework.http.ResponseEntity<?>Builds & returns aResponseEntitymeant to communicate to the gateway that the webhook request was successfully processed.convertWebhookRequest(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Builds & returns aSavedPaymentMethodSetupResultbased on the content of the webhook request.booleanshouldHandleRequest(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Determines if the webhook request should be handled.voidvalidate(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Validates that the webhook request came from the gateway & that it wasn't tampered with.Methods inherited from interface com.broadleafcommerce.paymentgateway.service.PaymentGatewayTypeAware
getGatewayType
-
Method Details
-
validate
void validate(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Validates that the webhook request came from the gateway & that it wasn't tampered with.- Parameters:
headers- The webhook request headersrequestBody- The webhook raw request body in the form of a Stringparameters- The request parameters passed into the webhook- Throws:
WebhookValidationException- if the webhook request is invalid.
-
shouldHandleRequest
boolean shouldHandleRequest(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Determines if the webhook request should be handled.- Parameters:
headers- The webhook request headersrequestBody- The webhook raw request body in the form of a Stringparameters- The request parameters passed into the webhook- Returns:
- true if the webhook request should be handled, otherwise false
-
convertWebhookRequest
SavedPaymentMethodSetupResult convertWebhookRequest(org.springframework.http.HttpHeaders headers, String requestBody, Map<String, String> parameters) Builds & returns aSavedPaymentMethodSetupResultbased on the content of the webhook request.- Parameters:
headers- The webhook request headersrequestBody- The webhook raw request body in the form of a Stringparameters- The request parameters passed into the webhook- Returns:
- a
SavedPaymentMethodSetupResultbased on the contents of the webhook request.
-
buildSuccessfulWebhookResponse
default org.springframework.http.ResponseEntity<?> buildSuccessfulWebhookResponse()Builds & returns aResponseEntitymeant to communicate to the gateway that the webhook request was successfully processed.- Returns:
- a
ResponseEntitymeant to communicate to the gateway that the webhook request was successfully processed.
-
buildFailedWebhookResponse
Builds & returns aResponseEntitymeant to communicate to the gateway that the webhook request was unsuccessfully processed.- Returns:
- a
ResponseEntitymeant to communicate to the gateway that the webhook request was unsuccessfully processed.
-