Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

feat(core): Add webhook context support for event type determination (#11118)

awasthi21956bb327658c
diff --git a/connector-template/mod.rs b/connector-template/mod.rs
index c632e677d9..048ceaf89e 100644
--- a/connector-template/mod.rs
+++ b/connector-template/mod.rs
@@ -582,6 +582,7 @@ impl webhooks::IncomingWebhook for {{project-name | downcase | pascal_case}} {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookResourceData>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/aci.rs b/crates/hyperswitch_connectors/src/connectors/aci.rs
index 853a74549e..7fc4cecc86 100644
--- a/crates/hyperswitch_connectors/src/connectors/aci.rs
+++ b/crates/hyperswitch_connectors/src/connectors/aci.rs
@@ -46,7 +46,7 @@ use hyperswitch_interfaces::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType,
RefundExecuteType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use ring::aead::{self, UnboundKey};
@@ -933,6 +933,7 @@ impl IncomingWebhook for Aci {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let aci_notification: aci::AciWebhookNotification =
serde_json::from_slice(request.body)
diff --git a/crates/hyperswitch_connectors/src/connectors/adyen.rs b/crates/hyperswitch_connectors/src/connectors/adyen.rs
index e2b84dcb4f..be6bb0a080 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyen.rs
@@ -76,7 +76,9 @@ use hyperswitch_interfaces::{
PaymentsSyncType, PaymentsVoidType, RefundExecuteType, Response, SetupMandateType,
SubmitEvidenceType,
},
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
use masking::{ExposeInterface, Mask, Maskable, Secret};
use ring::hmac;
@@ -2102,6 +2104,7 @@ impl IncomingWebhook for Adyen {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
@@ -2136,6 +2139,7 @@ impl IncomingWebhook for Adyen {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<disputes::DisputePayload, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
index d464c58099..8e161afe6a 100644
--- a/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
+++ b/crates/hyperswitch_connectors/src/connectors/adyenplatform.rs
@@ -50,7 +50,9 @@ use hyperswitch_interfaces::{
api::{self, ConnectorCommon, ConnectorIntegration, ConnectorSpecifications},
configs::Connectors,
errors::ConnectorError,
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
use masking::{Mask as _, Maskable, Secret};
#[cfg(feature = "payouts")]
@@ -427,6 +429,7 @@ impl IncomingWebhook for Adyenplatform {
&self,
#[cfg(feature = "payouts")] request: &IncomingWebhookRequestDetails<'_>,
#[cfg(not(feature = "payouts"))] _request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
#[cfg(feature = "payouts")]
{
diff --git a/crates/hyperswitch_connectors/src/connectors/affirm.rs b/crates/hyperswitch_connectors/src/connectors/affirm.rs
index 41308ff5d7..69a957eb02 100644
--- a/crates/hyperswitch_connectors/src/connectors/affirm.rs
+++ b/crates/hyperswitch_connectors/src/connectors/affirm.rs
@@ -787,6 +787,7 @@ impl webhooks::IncomingWebhook for Affirm {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/airwallex.rs b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
index a51b5b1a2e..961cd7fb5d 100644
--- a/crates/hyperswitch_connectors/src/connectors/airwallex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/airwallex.rs
@@ -52,7 +52,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, ConnectorCustomerType, CreateOrderType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use router_env::logger;
@@ -1167,6 +1167,7 @@ impl IncomingWebhook for Airwallex {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: airwallex::AirwallexWebhookData = request
.body
@@ -1190,6 +1191,7 @@ impl IncomingWebhook for Airwallex {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let details: airwallex::AirwallexWebhookData = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
index 473247774d..cdba4d24fc 100644
--- a/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/amazonpay.rs
@@ -732,6 +732,7 @@ impl webhooks::IncomingWebhook for Amazonpay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/archipel.rs b/crates/hyperswitch_connectors/src/connectors/archipel.rs
index ea89b5aa45..4a68fddcd6 100644
--- a/crates/hyperswitch_connectors/src/connectors/archipel.rs
+++ b/crates/hyperswitch_connectors/src/connectors/archipel.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Maskable;
use router_env::{error, info};
@@ -1052,6 +1052,7 @@ impl IncomingWebhook for Archipel {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authipay.rs b/crates/hyperswitch_connectors/src/connectors/authipay.rs
index b5332dbaab..b77ac11d3e 100644
--- a/crates/hyperswitch_connectors/src/connectors/authipay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authipay.rs
@@ -758,6 +758,7 @@ impl webhooks::IncomingWebhook for Authipay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
index 98177aaae5..9e97702d95 100644
--- a/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/authorizedotnet.rs
@@ -1075,6 +1075,7 @@ impl webhooks::IncomingWebhook for Authorizedotnet {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: authorizedotnet::AuthorizedotnetWebhookEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/bambora.rs b/crates/hyperswitch_connectors/src/connectors/bambora.rs
index 47eb29d3c8..ce07d929c7 100644
--- a/crates/hyperswitch_connectors/src/connectors/bambora.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bambora.rs
@@ -821,6 +821,7 @@ impl webhooks::IncomingWebhook for Bambora {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
index 913366e2e6..909c190c00 100644
--- a/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bamboraapac.rs
@@ -42,7 +42,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use transformers as bamboraapac;
@@ -723,6 +723,7 @@ impl IncomingWebhook for Bamboraapac {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
index d4f0b25dc0..e773ec78bf 100644
--- a/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bankofamerica.rs
@@ -1077,6 +1077,7 @@ impl webhooks::IncomingWebhook for Bankofamerica {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
index 08d159bc4c..4856c0eb88 100644
--- a/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
+++ b/crates/hyperswitch_connectors/src/connectors/barclaycard.rs
@@ -1527,6 +1527,7 @@ impl webhooks::IncomingWebhook for Barclaycard {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/billwerk.rs b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
index 74d47af73d..e8a86e62c1 100644
--- a/crates/hyperswitch_connectors/src/connectors/billwerk.rs
+++ b/crates/hyperswitch_connectors/src/connectors/billwerk.rs
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers::{
@@ -799,6 +799,7 @@ impl IncomingWebhook for Billwerk {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bitpay.rs b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
index 4361cbfe81..9625a00f20 100644
--- a/crates/hyperswitch_connectors/src/connectors/bitpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bitpay.rs
@@ -395,6 +395,7 @@ impl webhooks::IncomingWebhook for Bitpay {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let notif: BitpayWebhookDetails = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
index 1a82914234..87b1c6cc50 100644
--- a/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
+++ b/crates/hyperswitch_connectors/src/connectors/blackhawknetwork.rs
@@ -623,6 +623,7 @@ impl webhooks::IncomingWebhook for Blackhawknetwork {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
index 2c102ffb4a..28d5db8033 100644
--- a/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
+++ b/crates/hyperswitch_connectors/src/connectors/bluesnap.rs
@@ -51,7 +51,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use router_env::logger;
@@ -1162,6 +1162,7 @@ impl IncomingWebhook for Bluesnap {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: bluesnap::BluesnapWebhookObjectEventType =
serde_urlencoded::from_bytes(request.body)
@@ -1172,6 +1173,7 @@ impl IncomingWebhook for Bluesnap {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let dispute_details: bluesnap::BluesnapDisputeWebhookBody =
serde_urlencoded::from_bytes(request.body)
diff --git a/crates/hyperswitch_connectors/src/connectors/boku.rs b/crates/hyperswitch_connectors/src/connectors/boku.rs
index 2ebd2f3597..1a26c92966 100644
--- a/crates/hyperswitch_connectors/src/connectors/boku.rs
+++ b/crates/hyperswitch_connectors/src/connectors/boku.rs
@@ -41,7 +41,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask, PeekInterface, Secret, WithType};
use ring::hmac;
@@ -646,6 +646,7 @@ impl IncomingWebhook for Boku {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/braintree.rs b/crates/hyperswitch_connectors/src/connectors/braintree.rs
index 205beb6c7a..170ae5b025 100644
--- a/crates/hyperswitch_connectors/src/connectors/braintree.rs
+++ b/crates/hyperswitch_connectors/src/connectors/braintree.rs
@@ -58,7 +58,9 @@ use hyperswitch_interfaces::{
PaymentsCompleteAuthorizeType, PaymentsSessionType, PaymentsSyncType, PaymentsVoidType,
RefundExecuteType, RefundSyncType, Response, TokenizationType,
},
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
use ring::hmac;
@@ -1092,6 +1094,7 @@ impl IncomingWebhook for Braintree {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
@@ -1124,6 +1127,7 @@ impl IncomingWebhook for Braintree {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/breadpay.rs b/crates/hyperswitch_connectors/src/connectors/breadpay.rs
index cdf02deb24..3a5e05a7ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/breadpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/breadpay.rs
@@ -789,6 +789,7 @@ impl webhooks::IncomingWebhook for Breadpay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/calida.rs b/crates/hyperswitch_connectors/src/connectors/calida.rs
index 1876fae093..b1479f6af4 100644
--- a/crates/hyperswitch_connectors/src/connectors/calida.rs
+++ b/crates/hyperswitch_connectors/src/connectors/calida.rs
@@ -704,6 +704,7 @@ impl webhooks::IncomingWebhook for Calida {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body = transformers::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
index 6b7b7a8bf3..bd8b3132db 100644
--- a/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cashtocode.rs
@@ -401,6 +401,7 @@ impl webhooks::IncomingWebhook for Cashtocode {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::PaymentIntentSuccess)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/celero.rs b/crates/hyperswitch_connectors/src/connectors/celero.rs
index 9c978b8d62..d656d3d1cc 100644
--- a/crates/hyperswitch_connectors/src/connectors/celero.rs
+++ b/crates/hyperswitch_connectors/src/connectors/celero.rs
@@ -708,6 +708,7 @@ impl webhooks::IncomingWebhook for Celero {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/chargebee.rs b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
index 837d38e557..38fcc25287 100644
--- a/crates/hyperswitch_connectors/src/connectors/chargebee.rs
+++ b/crates/hyperswitch_connectors/src/connectors/chargebee.rs
@@ -808,6 +808,7 @@ impl webhooks::IncomingWebhook for Chargebee {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook =
chargebee::ChargebeeInvoiceBody::get_invoice_webhook_data_from_body(request.body)
diff --git a/crates/hyperswitch_connectors/src/connectors/checkbook.rs b/crates/hyperswitch_connectors/src/connectors/checkbook.rs
index 438b224539..18f3edfe2e 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkbook.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkbook.rs
@@ -547,6 +547,7 @@ impl webhooks::IncomingWebhook for Checkbook {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: checkbook::CheckbookPaymentsResponse = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/checkout.rs b/crates/hyperswitch_connectors/src/connectors/checkout.rs
index 836edb823e..cd9f046853 100644
--- a/crates/hyperswitch_connectors/src/connectors/checkout.rs
+++ b/crates/hyperswitch_connectors/src/connectors/checkout.rs
@@ -1345,6 +1345,7 @@ impl webhooks::IncomingWebhook for Checkout {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: checkout::CheckoutWebhookEventTypeBody = request
.body
@@ -1381,6 +1382,7 @@ impl webhooks::IncomingWebhook for Checkout {
fn get_dispute_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let dispute_details: checkout::CheckoutDisputeWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/coinbase.rs b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
index 6978672eb7..e528f835f1 100644
--- a/crates/hyperswitch_connectors/src/connectors/coinbase.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coinbase.rs
@@ -423,6 +423,7 @@ impl webhooks::IncomingWebhook for Coinbase {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif: CoinbaseWebhookDetails = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/coingate.rs b/crates/hyperswitch_connectors/src/connectors/coingate.rs
index b0412be80c..feb5252a63 100644
--- a/crates/hyperswitch_connectors/src/connectors/coingate.rs
+++ b/crates/hyperswitch_connectors/src/connectors/coingate.rs
@@ -561,6 +561,7 @@ impl webhooks::IncomingWebhook for Coingate {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif: CoingateWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
index 82bf945b26..99ae2f93d1 100644
--- a/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cryptopay.rs
@@ -473,6 +473,7 @@ impl webhooks::IncomingWebhook for Cryptopay {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif: CryptopayWebhookDetails =
request
diff --git a/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs b/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
index 6a1c7e0881..cba1e12005 100644
--- a/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
+++ b/crates/hyperswitch_connectors/src/connectors/ctp_mastercard.rs
@@ -114,6 +114,7 @@ impl webhooks::IncomingWebhook for CtpMastercard {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/custombilling.rs b/crates/hyperswitch_connectors/src/connectors/custombilling.rs
index fbc16b4ec6..df2d0dea56 100644
--- a/crates/hyperswitch_connectors/src/connectors/custombilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/custombilling.rs
@@ -560,6 +560,7 @@ impl webhooks::IncomingWebhook for Custombilling {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersource.rs b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
index d5107f25a5..b20db6436f 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersource.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersource.rs
@@ -2138,6 +2138,7 @@ impl webhooks::IncomingWebhook for Cybersource {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/cybersourcedecisionmanager.rs b/crates/hyperswitch_connectors/src/connectors/cybersourcedecisionmanager.rs
index 1edf846741..f0c511b9e2 100644
--- a/crates/hyperswitch_connectors/src/connectors/cybersourcedecisionmanager.rs
+++ b/crates/hyperswitch_connectors/src/connectors/cybersourcedecisionmanager.rs
@@ -641,6 +641,7 @@ impl webhooks::IncomingWebhook for Cybersourcedecisionmanager {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/datatrans.rs b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
index 682c0c832a..8d308ba554 100644
--- a/crates/hyperswitch_connectors/src/connectors/datatrans.rs
+++ b/crates/hyperswitch_connectors/src/connectors/datatrans.rs
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers as datatrans;
@@ -784,6 +784,7 @@ impl IncomingWebhook for Datatrans {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
index 0e85227371..a88ec39fd5 100644
--- a/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/deutschebank.rs
@@ -996,6 +996,7 @@ impl webhooks::IncomingWebhook for Deutschebank {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
index c56b9841d9..7e0afd287a 100644
--- a/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/digitalvirgo.rs
@@ -519,6 +519,7 @@ impl webhooks::IncomingWebhook for Digitalvirgo {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dlocal.rs b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
index 2ab380fe56..3aca0f4548 100644
--- a/crates/hyperswitch_connectors/src/connectors/dlocal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dlocal.rs
@@ -701,6 +701,7 @@ impl webhooks::IncomingWebhook for Dlocal {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs b/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs
index 7aa90e865f..fce89678e1 100644
--- a/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dummyconnector.rs
@@ -41,7 +41,7 @@ use hyperswitch_interfaces::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, RefundExecuteType,
RefundSyncType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask as _, Maskable};
use transformers as dummyconnector;
@@ -640,6 +640,7 @@ impl<const T: u8> IncomingWebhook for DummyConnector<T> {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/dwolla.rs b/crates/hyperswitch_connectors/src/connectors/dwolla.rs
index 6dbd059de7..2c5eaaddd3 100644
--- a/crates/hyperswitch_connectors/src/connectors/dwolla.rs
+++ b/crates/hyperswitch_connectors/src/connectors/dwolla.rs
@@ -937,6 +937,7 @@ impl webhooks::IncomingWebhook for Dwolla {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: dwolla::DwollaWebhookDetails = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/ebanx.rs b/crates/hyperswitch_connectors/src/connectors/ebanx.rs
index dc32c45c0f..c556d4f16f 100644
--- a/crates/hyperswitch_connectors/src/connectors/ebanx.rs
+++ b/crates/hyperswitch_connectors/src/connectors/ebanx.rs
@@ -41,7 +41,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "payouts")]
use masking::Maskable;
@@ -440,6 +440,7 @@ impl IncomingWebhook for Ebanx {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/elavon.rs b/crates/hyperswitch_connectors/src/connectors/elavon.rs
index e66354c631..e543d5d95c 100644
--- a/crates/hyperswitch_connectors/src/connectors/elavon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/elavon.rs
@@ -573,6 +573,7 @@ impl webhooks::IncomingWebhook for Elavon {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/envoy.rs b/crates/hyperswitch_connectors/src/connectors/envoy.rs
index 03666ea412..489c104e15 100644
--- a/crates/hyperswitch_connectors/src/connectors/envoy.rs
+++ b/crates/hyperswitch_connectors/src/connectors/envoy.rs
@@ -583,6 +583,7 @@ impl webhooks::IncomingWebhook for Envoy {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
index d9df449dc7..a7cf0fa050 100644
--- a/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/facilitapay.rs
@@ -868,6 +868,7 @@ impl webhooks::IncomingWebhook for Facilitapay {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body: responses::FacilitapayWebhookNotification = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/finix.rs b/crates/hyperswitch_connectors/src/connectors/finix.rs
index 6ce6b1e225..c909e38d36 100644
--- a/crates/hyperswitch_connectors/src/connectors/finix.rs
+++ b/crates/hyperswitch_connectors/src/connectors/finix.rs
@@ -1182,6 +1182,7 @@ impl webhooks::IncomingWebhook for Finix {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
if is_test_webhook(request) {
return Ok(IncomingWebhookEvent::SetupWebhook);
@@ -1197,6 +1198,7 @@ impl webhooks::IncomingWebhook for Finix {
fn get_dispute_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let webhook_body: finix::FinixWebhookBody =
request
diff --git a/crates/hyperswitch_connectors/src/connectors/fiserv.rs b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
index e1fe509d57..19a074106d 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiserv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiserv.rs
@@ -911,6 +911,7 @@ impl webhooks::IncomingWebhook for Fiserv {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
index 97d871b3ab..76d4cddabf 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiservemea.rs
@@ -777,6 +777,7 @@ impl webhooks::IncomingWebhook for Fiservemea {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/fiuu.rs b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
index 00c6a4b0aa..db5873f5b3 100644
--- a/crates/hyperswitch_connectors/src/connectors/fiuu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/fiuu.rs
@@ -914,6 +914,7 @@ impl webhooks::IncomingWebhook for Fiuu {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let header = utils::get_header_key_value("content-type", request.headers)?;
let resource: FiuuWebhooksResponse = if header == "application/x-www-form-urlencoded" {
diff --git a/crates/hyperswitch_connectors/src/connectors/flexiti.rs b/crates/hyperswitch_connectors/src/connectors/flexiti.rs
index 35b180e826..de210b44c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/flexiti.rs
+++ b/crates/hyperswitch_connectors/src/connectors/flexiti.rs
@@ -717,6 +717,7 @@ impl webhooks::IncomingWebhook for Flexiti {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/forte.rs b/crates/hyperswitch_connectors/src/connectors/forte.rs
index 55e11316f3..79f832c88e 100644
--- a/crates/hyperswitch_connectors/src/connectors/forte.rs
+++ b/crates/hyperswitch_connectors/src/connectors/forte.rs
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers as forte;
@@ -710,6 +710,7 @@ impl IncomingWebhook for Forte {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/getnet.rs b/crates/hyperswitch_connectors/src/connectors/getnet.rs
index 59366befbb..632d790840 100644
--- a/crates/hyperswitch_connectors/src/connectors/getnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/getnet.rs
@@ -759,6 +759,7 @@ impl webhooks::IncomingWebhook for Getnet {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let notif = getnet::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/gigadat.rs b/crates/hyperswitch_connectors/src/connectors/gigadat.rs
index cd2091e4fe..94b77b0003 100644
--- a/crates/hyperswitch_connectors/src/connectors/gigadat.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gigadat.rs
@@ -982,6 +982,7 @@ impl webhooks::IncomingWebhook for Gigadat {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let query_params = get_webhook_query_params(request)?;
let body_str = std::str::from_utf8(request.body)
diff --git a/crates/hyperswitch_connectors/src/connectors/globalpay.rs b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
index 981a9d29b4..94146a115d 100644
--- a/crates/hyperswitch_connectors/src/connectors/globalpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globalpay.rs
@@ -51,7 +51,7 @@ use hyperswitch_interfaces::{
PaymentsSyncType, PaymentsVoidType, RefreshTokenType, RefundExecuteType, RefundSyncType,
Response, TokenizationType,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use requests::{GlobalpayPaymentsRequest, GlobalpayRefreshTokenRequest};
@@ -1053,6 +1053,7 @@ impl IncomingWebhook for Globalpay {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: response::GlobalpayWebhookObjectEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/globepay.rs b/crates/hyperswitch_connectors/src/connectors/globepay.rs
index adaa18f5cc..97130a87ab 100644
--- a/crates/hyperswitch_connectors/src/connectors/globepay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/globepay.rs
@@ -554,6 +554,7 @@ impl webhooks::IncomingWebhook for Globepay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/gocardless.rs b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
index c540f765e5..af20514b33 100644
--- a/crates/hyperswitch_connectors/src/connectors/gocardless.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gocardless.rs
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, PaymentsSyncType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers as gocardless;
@@ -797,6 +797,7 @@ impl IncomingWebhook for Gocardless {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: gocardless::GocardlessWebhookEvent = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/gpayments.rs b/crates/hyperswitch_connectors/src/connectors/gpayments.rs
index fa4463e465..ca5e424cec 100644
--- a/crates/hyperswitch_connectors/src/connectors/gpayments.rs
+++ b/crates/hyperswitch_connectors/src/connectors/gpayments.rs
@@ -47,7 +47,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Maskable;
use transformers as gpayments;
@@ -205,6 +205,7 @@ impl IncomingWebhook for Gpayments {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/helcim.rs b/crates/hyperswitch_connectors/src/connectors/helcim.rs
index e9004d5429..5dd9b1b541 100644
--- a/crates/hyperswitch_connectors/src/connectors/helcim.rs
+++ b/crates/hyperswitch_connectors/src/connectors/helcim.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "v2")]
use masking::PeekInterface;
@@ -825,6 +825,7 @@ impl IncomingWebhook for Helcim {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hipay.rs b/crates/hyperswitch_connectors/src/connectors/hipay.rs
index f22d50d95a..d39611901b 100644
--- a/crates/hyperswitch_connectors/src/connectors/hipay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hipay.rs
@@ -734,6 +734,7 @@ impl webhooks::IncomingWebhook for Hipay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hyperpg.rs b/crates/hyperswitch_connectors/src/connectors/hyperpg.rs
index 7ae3cc9e4e..2405b02e5b 100644
--- a/crates/hyperswitch_connectors/src/connectors/hyperpg.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hyperpg.rs
@@ -578,6 +578,7 @@ impl webhooks::IncomingWebhook for Hyperpg {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs b/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
index 7912ea4996..1098c3fc0d 100644
--- a/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hyperswitch_vault.rs
@@ -478,6 +478,7 @@ impl webhooks::IncomingWebhook for HyperswitchVault {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs
index dcc5920d75..5307780d70 100644
--- a/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/hyperwallet.rs
@@ -588,6 +588,7 @@ impl webhooks::IncomingWebhook for Hyperwallet {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/iatapay.rs b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
index 6751e4c2e9..f0c00f7cd8 100644
--- a/crates/hyperswitch_connectors/src/connectors/iatapay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/iatapay.rs
@@ -42,7 +42,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use lazy_static::lazy_static;
use masking::{Mask, PeekInterface};
@@ -735,6 +735,7 @@ impl IncomingWebhook for Iatapay {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let notif: iatapay::IatapayWebhookResponse = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/inespay.rs b/crates/hyperswitch_connectors/src/connectors/inespay.rs
index 0fdaa3586f..1f44240fe5 100644
--- a/crates/hyperswitch_connectors/src/connectors/inespay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/inespay.rs
@@ -694,6 +694,7 @@ impl webhooks::IncomingWebhook for Inespay {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let data_return = get_webhook_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/itaubank.rs b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
index 226567c2fd..6f8dd242d9 100644
--- a/crates/hyperswitch_connectors/src/connectors/itaubank.rs
+++ b/crates/hyperswitch_connectors/src/connectors/itaubank.rs
@@ -41,7 +41,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::PeekInterface;
use transformers as itaubank;
@@ -787,6 +787,7 @@ impl IncomingWebhook for Itaubank {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
index 4d9fe29aaa..f3cb77bf78 100644
--- a/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
+++ b/crates/hyperswitch_connectors/src/connectors/jpmorgan.rs
@@ -814,6 +814,7 @@ impl webhooks::IncomingWebhook for Jpmorgan {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
index df2e57f433..4d0bd10cf4 100644
--- a/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
+++ b/crates/hyperswitch_connectors/src/connectors/juspaythreedsserver.rs
@@ -632,6 +632,7 @@ impl webhooks::IncomingWebhook for Juspaythreedsserver {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/katapult.rs b/crates/hyperswitch_connectors/src/connectors/katapult.rs
index 5236d980c1..0a3a967d31 100644
--- a/crates/hyperswitch_connectors/src/connectors/katapult.rs
+++ b/crates/hyperswitch_connectors/src/connectors/katapult.rs
@@ -589,6 +589,7 @@ impl webhooks::IncomingWebhook for Katapult {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/klarna.rs b/crates/hyperswitch_connectors/src/connectors/klarna.rs
index 83acb1201b..2e08b8a355 100644
--- a/crates/hyperswitch_connectors/src/connectors/klarna.rs
+++ b/crates/hyperswitch_connectors/src/connectors/klarna.rs
@@ -45,7 +45,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use router_env::logger;
@@ -1415,6 +1415,7 @@ impl IncomingWebhook for Klarna {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/loonio.rs b/crates/hyperswitch_connectors/src/connectors/loonio.rs
index 9e06a4f533..ff273c3429 100644
--- a/crates/hyperswitch_connectors/src/connectors/loonio.rs
+++ b/crates/hyperswitch_connectors/src/connectors/loonio.rs
@@ -799,6 +799,7 @@ impl webhooks::IncomingWebhook for Loonio {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body: loonio::LoonioWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/mifinity.rs b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
index 5e6f3d67cf..35c9afdc27 100644
--- a/crates/hyperswitch_connectors/src/connectors/mifinity.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mifinity.rs
@@ -40,7 +40,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use lazy_static::lazy_static;
use masking::{ExposeInterface, Mask};
@@ -503,6 +503,7 @@ impl IncomingWebhook for Mifinity {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mollie.rs b/crates/hyperswitch_connectors/src/connectors/mollie.rs
index 03630fa8cb..177b2e05cf 100644
--- a/crates/hyperswitch_connectors/src/connectors/mollie.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mollie.rs
@@ -850,6 +850,7 @@ impl webhooks::IncomingWebhook for Mollie {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/moneris.rs b/crates/hyperswitch_connectors/src/connectors/moneris.rs
index efe34a96be..a8ad7e709a 100644
--- a/crates/hyperswitch_connectors/src/connectors/moneris.rs
+++ b/crates/hyperswitch_connectors/src/connectors/moneris.rs
@@ -799,6 +799,7 @@ impl webhooks::IncomingWebhook for Moneris {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/mpgs.rs b/crates/hyperswitch_connectors/src/connectors/mpgs.rs
index d67c61047e..647233ed0a 100644
--- a/crates/hyperswitch_connectors/src/connectors/mpgs.rs
+++ b/crates/hyperswitch_connectors/src/connectors/mpgs.rs
@@ -586,6 +586,7 @@ impl webhooks::IncomingWebhook for Mpgs {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
index a241003699..024e5d65f7 100644
--- a/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/multisafepay.rs
@@ -42,7 +42,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask};
use transformers as multisafepay;
@@ -545,6 +545,7 @@ impl IncomingWebhook for Multisafepay {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/netcetera.rs b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
index 08393c0911..029c01e8d2 100644
--- a/crates/hyperswitch_connectors/src/connectors/netcetera.rs
+++ b/crates/hyperswitch_connectors/src/connectors/netcetera.rs
@@ -46,7 +46,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Maskable;
use transformers as netcetera;
@@ -194,6 +194,7 @@ impl IncomingWebhook for Netcetera {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Ok(IncomingWebhookEvent::ExternalAuthenticationARes)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nexinets.rs b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
index 879d901fd7..106c05f71d 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexinets.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexinets.rs
@@ -47,7 +47,7 @@ use hyperswitch_interfaces::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType,
RefundExecuteType, RefundSyncType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Mask;
#[cfg(feature = "v2")]
@@ -720,6 +720,7 @@ impl IncomingWebhook for Nexinets {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
index 3535aa0f01..dc55e6cc47 100644
--- a/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nexixpay.rs
@@ -1154,6 +1154,7 @@ impl webhooks::IncomingWebhook for Nexixpay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/nmi.rs b/crates/hyperswitch_connectors/src/connectors/nmi.rs
index 79a026143b..26ef4452ba 100644
--- a/crates/hyperswitch_connectors/src/connectors/nmi.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nmi.rs
@@ -48,7 +48,7 @@ use hyperswitch_interfaces::{
PaymentsPreAuthenticateType, PaymentsPreProcessingType, PaymentsSyncType, PaymentsVoidType,
RefundExecuteType, RefundSyncType, Response, SetupMandateType,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Maskable;
use regex::Regex;
@@ -1026,6 +1026,7 @@ impl IncomingWebhook for Nmi {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
let event_type_body: nmi::NmiWebhookEventBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/nomupay.rs b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
index 97f9e42e38..af449895fa 100644
--- a/crates/hyperswitch_connectors/src/connectors/nomupay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nomupay.rs
@@ -761,6 +761,7 @@ impl webhooks::IncomingWebhook for Nomupay {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/noon.rs b/crates/hyperswitch_connectors/src/connectors/noon.rs
index b8f3179d08..784db8faad 100644
--- a/crates/hyperswitch_connectors/src/connectors/noon.rs
+++ b/crates/hyperswitch_connectors/src/connectors/noon.rs
@@ -881,6 +881,7 @@ impl webhooks::IncomingWebhook for Noon {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: noon::NoonWebhookEvent = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/nordea.rs b/crates/hyperswitch_connectors/src/connectors/nordea.rs
index a5efceb8e1..fa7bb746b2 100644
--- a/crates/hyperswitch_connectors/src/connectors/nordea.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nordea.rs
@@ -1214,6 +1214,7 @@ impl webhooks::IncomingWebhook for Nordea {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/novalnet.rs b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
index 7a6741bc86..0d16026132 100644
--- a/crates/hyperswitch_connectors/src/connectors/novalnet.rs
+++ b/crates/hyperswitch_connectors/src/connectors/novalnet.rs
@@ -910,6 +910,7 @@ impl webhooks::IncomingWebhook for Novalnet {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)?;
@@ -962,6 +963,7 @@ impl webhooks::IncomingWebhook for Novalnet {
fn get_dispute_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<disputes::DisputePayload, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/nuvei.rs b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
index 2577ce9c9a..dbe74ceb89 100644
--- a/crates/hyperswitch_connectors/src/connectors/nuvei.rs
+++ b/crates/hyperswitch_connectors/src/connectors/nuvei.rs
@@ -62,7 +62,7 @@ use hyperswitch_interfaces::{
disputes, errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::ExposeInterface;
use transformers as nuvei;
@@ -1358,6 +1358,7 @@ impl IncomingWebhook for Nuvei {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
// Parse the webhook payload
let webhook = get_webhook_object_from_body(request.body)?;
@@ -1405,6 +1406,7 @@ impl IncomingWebhook for Nuvei {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<disputes::DisputePayload, errors::ConnectorError> {
let webhook = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/opayo.rs b/crates/hyperswitch_connectors/src/connectors/opayo.rs
index 4f68a8d6e3..118ca09732 100644
--- a/crates/hyperswitch_connectors/src/connectors/opayo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opayo.rs
@@ -575,6 +575,7 @@ impl webhooks::IncomingWebhook for Opayo {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/opennode.rs b/crates/hyperswitch_connectors/src/connectors/opennode.rs
index 80d11c59d5..e69b5671c3 100644
--- a/crates/hyperswitch_connectors/src/connectors/opennode.rs
+++ b/crates/hyperswitch_connectors/src/connectors/opennode.rs
@@ -430,6 +430,7 @@ impl IncomingWebhook for Opennode {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let notif = serde_urlencoded::from_bytes::<OpennodeWebhookDetails>(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/paybox.rs b/crates/hyperswitch_connectors/src/connectors/paybox.rs
index af4bae008f..2f15cb18c6 100644
--- a/crates/hyperswitch_connectors/src/connectors/paybox.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paybox.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask};
use transformers as paybox;
@@ -587,6 +587,7 @@ impl IncomingWebhook for Paybox {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payeezy.rs b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
index 2a36ffcade..64c3e25ef2 100644
--- a/crates/hyperswitch_connectors/src/connectors/payeezy.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payeezy.rs
@@ -42,7 +42,7 @@ use hyperswitch_interfaces::{
types::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsVoidType, RefundExecuteType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask};
use rand::distributions::DistString;
@@ -570,6 +570,7 @@ impl IncomingWebhook for Payeezy {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnow.rs b/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
index 613f7f14f8..2c11f43a5c 100644
--- a/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payjustnow.rs
@@ -719,6 +719,7 @@ impl webhooks::IncomingWebhook for Payjustnow {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: payjustnow::PayjustnowWebhookDetails = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs
index 768a67d4f4..a303916194 100644
--- a/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payjustnowinstore.rs
@@ -502,6 +502,7 @@ impl webhooks::IncomingWebhook for Payjustnowinstore {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let details: payjustnowinstore::PayjustnowinstoreWebhookDetails = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/payload.rs b/crates/hyperswitch_connectors/src/connectors/payload.rs
index a07e7275ef..7de5162822 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload.rs
@@ -12,7 +12,9 @@ use common_utils::{
errors::{CustomResult, ReportSwitchExt},
ext_traits::{ByteSliceExt, BytesExt},
request::{Method, Request, RequestBuilder, RequestContent},
- types::{AmountConvertor, StringMajorUnit, StringMajorUnitForConnector},
+ types::{
+ AmountConvertor, StringMajorUnit, StringMajorUnitForConnector, StringMinorUnitForConnector,
+ },
};
use error_stack::ResultExt;
use hyperswitch_domain_models::{
@@ -47,6 +49,7 @@ use hyperswitch_interfaces::{
ConnectorValidation,
},
configs::Connectors,
+ disputes::DisputePayload,
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, ConnectorCustomerType, PaymentsVoidType, Response, SetupMandateType},
@@ -298,10 +301,18 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
fn get_url(
&self,
- _req: &SetupMandateRouterData,
+ req: &SetupMandateRouterData,
connectors: &Connectors,
) -> CustomResult<String, errors::ConnectorError> {
- Ok(format!("{}/transactions", self.base_url(connectors)))
+ // Use /payment_methods for ACH, /transactions for cards
+ match &req.request.payment_method_data {
+ PaymentMethodData::BankDebit(
+ hyperswitch_domain_models::payment_method_data::BankDebitData::AchBankDebit {
+ ..
+ },
+ ) => Ok(format!("{}/payment_methods", self.base_url(connectors))),
+ _ => Ok(format!("{}/transactions", self.base_url(connectors))),
+ }
}
fn get_request_body(
@@ -309,8 +320,21 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
req: &SetupMandateRouterData,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
- let connector_req = requests::PayloadPaymentRequestData::try_from(req)?;
- Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+ // Use different request struct for ACH vs cards
+ match &req.request.payment_method_data {
+ PaymentMethodData::BankDebit(
+ hyperswitch_domain_models::payment_method_data::BankDebitData::AchBankDebit {
+ ..
+ },
+ ) => {
+ let connector_req = requests::PayloadPaymentMethodRequest::try_from(req)?;
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+ }
+ _ => {
+ let connector_req = requests::PayloadPaymentRequestData::try_from(req)?;
+ Ok(RequestContent::FormUrlEncoded(Box::new(connector_req)))
+ }
+ }
}
fn build_request(
@@ -334,19 +358,42 @@ impl ConnectorIntegration<SetupMandate, SetupMandateRequestData, PaymentsRespons
event_builder: Option<&mut ConnectorEvent>,
res: Response,
) -> CustomResult<SetupMandateRouterData, errors::ConnectorError> {
- let response: responses::PayloadPaymentsResponse = res
- .response
- .parse_struct("PayloadPaymentsResponse")
- .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
-
- event_builder.map(|i| i.set_response_body(&response));
- router_env::logger::info!(connector_response=?response);
-
- RouterData::try_from(ResponseRouterData {
- response,
- data: data.clone(),
- http_code: res.status_code,
- })
+ match &data.request.payment_method_data {
+ PaymentMethodData::BankDebit(
+ hyperswitch_domain_models::payment_method_data::BankDebitData::AchBankDebit {
+ ..
+ },
+ ) => {
+ let response: responses::PayloadPaymentMethodResponse = res
+ .response
+ .parse_struct("PayloadPaymentMethodResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ _ => {
+ let response: responses::PayloadPaymentsResponse = res
+ .response
+ .parse_struct("PayloadPaymentsResponse")
+ .change_context(errors::ConnectorError::ResponseDeserializationFailed)?;
+
+ event_builder.map(|i| i.set_response_body(&response));
+ router_env::logger::info!(connector_response=?response);
+
+ RouterData::try_from(ResponseRouterData {
+ response,
+ data: data.clone(),
+ http_code: res.status_code,
+ })
+ }
+ }
}
fn get_error_response(
@@ -865,6 +912,49 @@ impl webhooks::IncomingWebhook for Payload {
Ok(request.body.to_vec())
}
+ fn get_dispute_details(
+ &self,
+ request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ snapshot: Option<&webhooks::WebhookContext>,
+ ) -> CustomResult<DisputePayload, errors::ConnectorError> {
+ let webhook_body: responses::PayloadWebhookEvent = request
+ .body
+ .parse_struct("PayloadWebhookEvent")
+ .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
+ let payment_context = snapshot.map(|s| s.get_payment_context()).ok_or(
+ errors::ConnectorError::GenericError {
+ error_message: "Payment context not found".to_string(),
+ error_object: serde_json::Value::Null,
+ },
+ )?;
+ let currency = payment_context.currency.ok_or_else(|| {
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "currency",
+ }
+ })?;
+
+ let amount = StringMinorUnitForConnector
+ .convert(payment_context.amount, currency)
+ .change_context(errors::ConnectorError::AmountConversionFailed)?;
+
+ Ok(DisputePayload {
+ amount,
+ currency,
+ dispute_stage: api_models::enums::DisputeStage::Dispute,
+ connector_dispute_id: webhook_body.triggered_on.transaction_id.ok_or_else(|| {
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "connector_dispute_id",
+ }
+ })?,
+ connector_reason: None,
+ connector_reason_code: None,
+ challenge_required_by: None,
+ connector_status: webhook_body.trigger.as_str().to_string(),
+ created_at: None,
+ updated_at: None,
+ })
+ }
+
fn get_webhook_source_verification_signature(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
@@ -900,12 +990,9 @@ impl webhooks::IncomingWebhook for Payload {
| responses::PayloadWebhooksTrigger::Decline
| responses::PayloadWebhooksTrigger::Deposit
| responses::PayloadWebhooksTrigger::Reject
- | responses::PayloadWebhooksTrigger::PaymentActivationStatus
- | responses::PayloadWebhooksTrigger::PaymentLinkStatus
| responses::PayloadWebhooksTrigger::ProcessingStatus
| responses::PayloadWebhooksTrigger::BankAccountReject
- | responses::PayloadWebhooksTrigger::TransactionOperation
- | responses::PayloadWebhooksTrigger::TransactionOperationClear => {
+ | responses::PayloadWebhooksTrigger::Chargeback => {
let reference_id = webhook_body
.triggered_on
.transaction_id
@@ -917,9 +1004,12 @@ impl webhooks::IncomingWebhook for Payload {
}
// Refund handling not implemented since refund webhook payloads cannot be uniquely identified.
// The only differentiator is the distinct IDs received for payment and refund.
- responses::PayloadWebhooksTrigger::Refund
- | responses::PayloadWebhooksTrigger::Chargeback
- | responses::PayloadWebhooksTrigger::ChargebackReversal => {
+ responses::PayloadWebhooksTrigger::TransactionOperation
+ | responses::PayloadWebhooksTrigger::TransactionOperationClear
+ | responses::PayloadWebhooksTrigger::ChargebackReversal
+ | responses::PayloadWebhooksTrigger::PaymentActivationStatus
+ | responses::PayloadWebhooksTrigger::PaymentLinkStatus
+ | responses::PayloadWebhooksTrigger::Refund => {
Err(errors::ConnectorError::WebhooksNotImplemented.into())
}
}
@@ -928,13 +1018,34 @@ impl webhooks::IncomingWebhook for Payload {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ snapshot: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body: responses::PayloadWebhookEvent =
request.body.parse_struct("PayloadWebhookEvent").switch()?;
- Ok(api_models::webhooks::IncomingWebhookEvent::from(
- webhook_body.trigger,
- ))
+ // Check if this is an ACH late failure (network rejection after payment was already Charged)
+ // These should be treated as disputes, unlike regular Chargeback which uses normal flow
+ let is_ach_late_failure = snapshot
+ .map(|s| {
+ let payment_context = s.get_payment_context();
+ let is_ach =
+ payment_context.payment_method_type == Some(enums::PaymentMethodType::Ach);
+ let is_charged = payment_context.previous_status == enums::AttemptStatus::Charged;
+ let is_late_failure_trigger = matches!(
+ webhook_body.trigger,
+ responses::PayloadWebhooksTrigger::Decline
+ | responses::PayloadWebhooksTrigger::Reject
+ | responses::PayloadWebhooksTrigger::BankAccountReject
+ );
+ is_ach && is_charged && is_late_failure_trigger
+ })
+ .unwrap_or(false);
+
+ Ok(if is_ach_late_failure {
+ api_models::webhooks::IncomingWebhookEvent::DisputeLost
+ } else {
+ api_models::webhooks::IncomingWebhookEvent::from(webhook_body.trigger)
+ })
}
fn get_webhook_resource_object(
diff --git a/crates/hyperswitch_connectors/src/connectors/payload/requests.rs b/crates/hyperswitch_connectors/src/connectors/payload/requests.rs
index 0926a1a190..75d3372ea9 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload/requests.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload/requests.rs
@@ -146,3 +146,30 @@ pub struct PayloadRefundRequest {
#[serde(rename = "ledger[0][assoc_transaction_id]")]
pub ledger_assoc_transaction_id: String,
}
+
+// Request struct for ACH SetupMandate using /payment_methods API
+#[derive(Debug, Clone, Serialize)]
+pub struct PayloadPaymentMethodRequest {
+ pub account_id: Secret<String>, // Customer ID from createCustomer
+ #[serde(flatten)]
+ pub bank_account: PayloadBankAccountData,
+ pub account_holder: Secret<String>,
+ #[serde(rename = "type")]
+ pub payment_method_type: PayloadPaymentMethodType,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub struct PayloadBankAccountData {
+ #[serde(rename = "bank_account[account_number]")]
+ pub account_number: Secret<String>,
+ #[serde(rename = "bank_account[routing_number]")]
+ pub routing_number: Secret<String>,
+ #[serde(rename = "bank_account[account_type]")]
+ pub account_type: PayloadAccAccountType,
+}
+
+#[derive(Debug, Clone, Serialize)]
+#[serde(rename_all = "snake_case")]
+pub enum PayloadPaymentMethodType {
+ BankAccount,
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/payload/responses.rs b/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
index 81074d60f9..319f9717e9 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload/responses.rs
@@ -1,6 +1,5 @@
use masking::Secret;
use serde::{Deserialize, Serialize};
-
// PaymentsResponse
#[derive(Default, Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "lowercase")]
@@ -124,6 +123,31 @@ pub enum PayloadWebhooksTrigger {
#[serde(rename = "transaction:operation:clear")]
TransactionOperationClear,
}
+impl PayloadWebhooksTrigger {
+ pub fn as_str(&self) -> &'static str {
+ match self {
+ Self::Payment => "payment",
+ Self::Processed => "processed",
+ Self::Authorized => "authorized",
+ Self::Credit => "credit",
+ Self::Refund => "refund",
+ Self::Reversal => "reversal",
+ Self::Void => "void",
+ Self::AutomaticPayment => "automatic_payment",
+ Self::Decline => "decline",
+ Self::Deposit => "deposit",
+ Self::Reject => "reject",
+ Self::PaymentActivationStatus => "payment_activation:status",
+ Self::PaymentLinkStatus => "payment_link:status",
+ Self::ProcessingStatus => "processing_status",
+ Self::BankAccountReject => "bank_account_reject",
+ Self::Chargeback => "chargeback",
+ Self::ChargebackReversal => "chargeback_reversal",
+ Self::TransactionOperation => "transaction:operation",
+ Self::TransactionOperationClear => "transaction:operation:clear",
+ }
+ }
+}
// Webhook response structures
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -144,3 +168,29 @@ pub struct PayloadEventDetails {
pub object: String,
pub value: Option<serde_json::Value>, // Changed to handle any value type including null
}
+
+// Response struct for ACH SetupMandate using /payment_methods API
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct PayloadPaymentMethodResponse {
+ pub id: String, // Payment method ID (pm_xxx)
+ pub account_holder: Option<Secret<String>>,
+ pub customer_id: String, // Same as account_id sent
+ pub verification_status: PayloadVerificationStatus,
+ pub status: String, // "active"
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
+#[serde(rename_all = "kebab-case")]
+pub enum PayloadVerificationStatus {
+ Verified,
+ OwnerVerified,
+ NotVerified,
+ #[serde(other)]
+ Other,
+}
+
+impl PayloadVerificationStatus {
+ pub fn is_verified(&self) -> bool {
+ matches!(self, Self::Verified | Self::OwnerVerified)
+ }
+}
diff --git a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
index 0248f23fe7..f964cac904 100644
--- a/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payload/transformers.rs
@@ -294,6 +294,62 @@ impl TryFrom<&SetupMandateRouterData> for requests::PayloadPaymentRequestData {
}
}
+// ACH-specific transformer for SetupMandate using /payment_methods API
+impl TryFrom<&SetupMandateRouterData> for requests::PayloadPaymentMethodRequest {
+ type Error = Error;
+ fn try_from(item: &SetupMandateRouterData) -> Result<Self, Self::Error> {
+ if item.request.amount > 0 {
+ return Err(errors::ConnectorError::FlowNotSupported {
+ flow: "Setup mandate with non zero amount".to_string(),
+ connector: "Payload".to_string(),
+ }
+ .into());
+ }
+
+ match &item.request.payment_method_data {
+ PaymentMethodData::BankDebit(BankDebitData::AchBankDebit {
+ account_number,
+ routing_number,
+ bank_type,
+ bank_account_holder_name,
+ ..
+ }) => {
+ let account_type = bank_type
+ .map(|b_type| match b_type {
+ enums::BankType::Checking => requests::PayloadAccAccountType::Checking,
+ enums::BankType::Savings => requests::PayloadAccAccountType::Savings,
+ })
+ .ok_or_else(|| errors::ConnectorError::MissingRequiredField {
+ field_name: "bank_type",
+ })?;
+
+ let account_holder = bank_account_holder_name.clone().ok_or_else(|| {
+ errors::ConnectorError::MissingRequiredField {
+ field_name: "bank_account_holder_name",
+ }
+ })?;
+
+ let customer_id = item.get_connector_customer_id()?;
+
+ Ok(Self {
+ account_id: Secret::new(customer_id),
+ bank_account: requests::PayloadBankAccountData {
+ account_number: account_number.clone(),
+ routing_number: routing_number.clone(),
+ account_type,
+ },
+ account_holder,
+ payment_method_type: requests::PayloadPaymentMethodType::BankAccount,
+ })
+ }
+ _ => Err(errors::ConnectorError::NotImplemented(
+ get_unimplemented_payment_method_error_message("Payload"),
+ )
+ .into()),
+ }
+ }
+}
+
impl TryFrom<&PayloadRouterData<&PaymentsAuthorizeRouterData>>
for requests::PayloadPaymentsRequest
{
@@ -459,6 +515,75 @@ where
}
}
+// Response transformer for ACH SetupMandate using /payment_methods API
+impl<F, T>
+ TryFrom<ResponseRouterData<F, responses::PayloadPaymentMethodResponse, T, PaymentsResponseData>>
+ for RouterData<F, T, PaymentsResponseData>
+{
+ type Error = Error;
+ fn try_from(
+ item: ResponseRouterData<
+ F,
+ responses::PayloadPaymentMethodResponse,
+ T,
+ PaymentsResponseData,
+ >,
+ ) -> Result<Self, Self::Error> {
+ let response = item.response;
+
+ // Only store payment method ID if verification_status is verified or owner-verified
+ // Fail the SetupMandate if not verified
+ if response.verification_status.is_verified() {
+ let mandate_reference = Some(MandateReference {
+ connector_mandate_id: Some(response.id.clone()),
+ payment_method_id: None,
+ mandate_metadata: None,
+ connector_mandate_request_reference_id: None,
+ });
+
+ Ok(Self {
+ status: enums::AttemptStatus::Charged, // SetupMandate succeeded
+ response: Ok(PaymentsResponseData::TransactionResponse {
+ resource_id: ResponseId::ConnectorTransactionId(response.id),
+ redirection_data: Box::new(None),
+ mandate_reference: Box::new(mandate_reference),
+ connector_metadata: None,
+ network_txn_id: None,
+ connector_response_reference_id: None,
+ incremental_authorization_allowed: None,
+ authentication_data: None,
+ charges: None,
+ }),
+ connector_response: None,
+ ..item.data
+ })
+ } else {
+ // Not verified - fail the SetupMandate
+ Ok(Self {
+ status: enums::AttemptStatus::Failure,
+ response: Err(ErrorResponse {
+ code: NO_ERROR_CODE.to_string(),
+ message: format!(
+ "Bank account verification status is {:?}",
+ response.verification_status
+ ),
+ reason: None,
+ status_code: item.http_code,
+ attempt_status: Some(enums::AttemptStatus::Failure),
+ connector_transaction_id: Some(response.id),
+ connector_response_reference_id: None,
+ network_decline_code: None,
+ network_advice_code: None,
+ network_error_message: None,
+ connector_metadata: None,
+ }),
+ connector_response: None,
+ ..item.data
+ })
+ }
+ }
+}
+
impl<T> TryFrom<&PayloadRouterData<T>> for requests::PayloadCancelRequest {
type Error = Error;
fn try_from(_item: &PayloadRouterData<T>) -> Result<Self, Self::Error> {
diff --git a/crates/hyperswitch_connectors/src/connectors/payme.rs b/crates/hyperswitch_connectors/src/connectors/payme.rs
index 9e9e13ee50..8280677d2d 100644
--- a/crates/hyperswitch_connectors/src/connectors/payme.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payme.rs
@@ -1314,6 +1314,7 @@ impl webhooks::IncomingWebhook for Payme {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let resource =
serde_urlencoded::from_bytes::<payme::WebhookEventDataResourceEvent>(request.body)
@@ -1348,6 +1349,7 @@ impl webhooks::IncomingWebhook for Payme {
fn get_dispute_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let webhook_object =
serde_urlencoded::from_bytes::<payme::WebhookEventDataResource>(request.body)
diff --git a/crates/hyperswitch_connectors/src/connectors/payone.rs b/crates/hyperswitch_connectors/src/connectors/payone.rs
index 10cff2e908..e61a3d2840 100644
--- a/crates/hyperswitch_connectors/src/connectors/payone.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payone.rs
@@ -44,7 +44,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "payouts")]
use hyperswitch_interfaces::{
@@ -380,6 +380,7 @@ impl IncomingWebhook for Payone {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paypal.rs b/crates/hyperswitch_connectors/src/connectors/paypal.rs
index b1b9947fae..e8fb13911d 100644
--- a/crates/hyperswitch_connectors/src/connectors/paypal.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paypal.rs
@@ -73,7 +73,7 @@ use hyperswitch_interfaces::{
PaymentsVoidType, RefreshTokenType, RefundExecuteType, RefundSyncType, Response,
SdkSessionUpdateType, SetupMandateType, VerifyWebhookSourceType,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask, Maskable, PeekInterface, Secret};
#[cfg(feature = "payouts")]
@@ -2179,6 +2179,7 @@ impl IncomingWebhook for Paypal {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let payload: paypal::PaypalWebooksEventType = request
.body
@@ -2260,6 +2261,7 @@ impl IncomingWebhook for Paypal {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<disputes::DisputePayload, errors::ConnectorError> {
let webhook_payload: paypal::PaypalWebhooksBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/paysafe.rs b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
index f7b8f65fd8..db8e03af3d 100644
--- a/crates/hyperswitch_connectors/src/connectors/paysafe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paysafe.rs
@@ -1182,6 +1182,7 @@ impl webhooks::IncomingWebhook for Paysafe {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/paystack.rs b/crates/hyperswitch_connectors/src/connectors/paystack.rs
index c7ca421ad1..10d126157d 100644
--- a/crates/hyperswitch_connectors/src/connectors/paystack.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paystack.rs
@@ -630,6 +630,7 @@ impl webhooks::IncomingWebhook for Paystack {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/paytm.rs b/crates/hyperswitch_connectors/src/connectors/paytm.rs
index 93b2a79f13..4e9bcde2f5 100644
--- a/crates/hyperswitch_connectors/src/connectors/paytm.rs
+++ b/crates/hyperswitch_connectors/src/connectors/paytm.rs
@@ -578,6 +578,7 @@ impl webhooks::IncomingWebhook for Paytm {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/payu.rs b/crates/hyperswitch_connectors/src/connectors/payu.rs
index 14b85d9d2f..0638a58e14 100644
--- a/crates/hyperswitch_connectors/src/connectors/payu.rs
+++ b/crates/hyperswitch_connectors/src/connectors/payu.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, PaymentsVoidType,
RefreshTokenType, RefundExecuteType, RefundSyncType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers as payu;
@@ -785,6 +785,7 @@ impl IncomingWebhook for Payu {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Ok(IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/peachpayments.rs b/crates/hyperswitch_connectors/src/connectors/peachpayments.rs
index 23661e4e11..ee7bdf01c7 100644
--- a/crates/hyperswitch_connectors/src/connectors/peachpayments.rs
+++ b/crates/hyperswitch_connectors/src/connectors/peachpayments.rs
@@ -726,6 +726,7 @@ impl webhooks::IncomingWebhook for Peachpayments {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body: peachpayments::PeachpaymentsIncomingWebhook = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/phonepe.rs b/crates/hyperswitch_connectors/src/connectors/phonepe.rs
index 76055a066c..4dcca143f8 100644
--- a/crates/hyperswitch_connectors/src/connectors/phonepe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/phonepe.rs
@@ -578,6 +578,7 @@ impl webhooks::IncomingWebhook for Phonepe {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/placetopay.rs b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
index c2bcfbc88d..ce5c2d531e 100644
--- a/crates/hyperswitch_connectors/src/connectors/placetopay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/placetopay.rs
@@ -41,7 +41,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use transformers as placetopay;
@@ -658,6 +658,7 @@ impl IncomingWebhook for Placetopay {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/plaid.rs b/crates/hyperswitch_connectors/src/connectors/plaid.rs
index d3c4b2a66b..6424698063 100644
--- a/crates/hyperswitch_connectors/src/connectors/plaid.rs
+++ b/crates/hyperswitch_connectors/src/connectors/plaid.rs
@@ -39,7 +39,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::{PaymentsAuthorizeType, PaymentsPostProcessingType, PaymentsSyncType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask as _, Maskable};
use transformers as plaid;
@@ -437,6 +437,7 @@ impl IncomingWebhook for Plaid {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err((ConnectorError::WebhooksNotImplemented).into())
}
diff --git a/crates/hyperswitch_connectors/src/connectors/powertranz.rs b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
index 5df1bfc1a3..12f1178431 100644
--- a/crates/hyperswitch_connectors/src/connectors/powertranz.rs
+++ b/crates/hyperswitch_connectors/src/connectors/powertranz.rs
@@ -633,6 +633,7 @@ impl webhooks::IncomingWebhook for Powertranz {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
index b25fc1c6df..6666ba62b5 100644
--- a/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/prophetpay.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers as prophetpay;
@@ -710,6 +710,7 @@ impl IncomingWebhook for Prophetpay {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/rapyd.rs b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
index 89ce5951cd..a6775c35ec 100644
--- a/crates/hyperswitch_connectors/src/connectors/rapyd.rs
+++ b/crates/hyperswitch_connectors/src/connectors/rapyd.rs
@@ -46,7 +46,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask, PeekInterface, Secret};
use rand::distributions::{Alphanumeric, DistString};
@@ -863,6 +863,7 @@ impl IncomingWebhook for Rapyd {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
@@ -923,6 +924,7 @@ impl IncomingWebhook for Rapyd {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let webhook: transformers::RapydIncomingWebhook = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/razorpay.rs b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
index e550bf248d..c4df76af04 100644
--- a/crates/hyperswitch_connectors/src/connectors/razorpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/razorpay.rs
@@ -43,7 +43,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, CreateOrderType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use lazy_static::lazy_static;
use masking::{Mask, Maskable, PeekInterface};
@@ -780,6 +780,7 @@ impl IncomingWebhook for Razorpay {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/recurly.rs b/crates/hyperswitch_connectors/src/connectors/recurly.rs
index 983c7f3734..4c9c9b3c66 100644
--- a/crates/hyperswitch_connectors/src/connectors/recurly.rs
+++ b/crates/hyperswitch_connectors/src/connectors/recurly.rs
@@ -686,6 +686,7 @@ impl webhooks::IncomingWebhook for Recurly {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook = RecurlyWebhookBody::get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?;
@@ -704,6 +705,7 @@ impl webhooks::IncomingWebhook for Recurly {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/redsys.rs b/crates/hyperswitch_connectors/src/connectors/redsys.rs
index 044f9a88ee..46458e039f 100644
--- a/crates/hyperswitch_connectors/src/connectors/redsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/redsys.rs
@@ -988,6 +988,7 @@ impl webhooks::IncomingWebhook for Redsys {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/riskified.rs b/crates/hyperswitch_connectors/src/connectors/riskified.rs
index 61bb4ecfa6..8a4ddaf390 100644
--- a/crates/hyperswitch_connectors/src/connectors/riskified.rs
+++ b/crates/hyperswitch_connectors/src/connectors/riskified.rs
@@ -59,7 +59,7 @@ use hyperswitch_interfaces::{
},
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "frm")]
use masking::Maskable;
@@ -632,6 +632,7 @@ impl IncomingWebhook for Riskified {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
let resource: riskified::RiskifiedWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/santander.rs b/crates/hyperswitch_connectors/src/connectors/santander.rs
index b2f59f23cc..fe3d1820da 100644
--- a/crates/hyperswitch_connectors/src/connectors/santander.rs
+++ b/crates/hyperswitch_connectors/src/connectors/santander.rs
@@ -1027,6 +1027,7 @@ impl webhooks::IncomingWebhook for Santander {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let body = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/shift4.rs b/crates/hyperswitch_connectors/src/connectors/shift4.rs
index dd8342f08d..92d4574bb2 100644
--- a/crates/hyperswitch_connectors/src/connectors/shift4.rs
+++ b/crates/hyperswitch_connectors/src/connectors/shift4.rs
@@ -47,7 +47,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, PeekInterface};
use transformers::{self as shift4, Shift4PaymentsRequest, Shift4RefundRequest};
@@ -955,6 +955,7 @@ impl IncomingWebhook for Shift4 {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: shift4::Shift4WebhookObjectEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/sift.rs b/crates/hyperswitch_connectors/src/connectors/sift.rs
index 0fb597e4cd..1769a2a52f 100644
--- a/crates/hyperswitch_connectors/src/connectors/sift.rs
+++ b/crates/hyperswitch_connectors/src/connectors/sift.rs
@@ -586,6 +586,7 @@ impl webhooks::IncomingWebhook for Sift {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/signifyd.rs b/crates/hyperswitch_connectors/src/connectors/signifyd.rs
index 4ea8bc7fbc..6ce6f56e2d 100644
--- a/crates/hyperswitch_connectors/src/connectors/signifyd.rs
+++ b/crates/hyperswitch_connectors/src/connectors/signifyd.rs
@@ -59,7 +59,7 @@ use hyperswitch_interfaces::{
consts::NO_ERROR_CODE,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "frm")]
use masking::Mask;
@@ -705,6 +705,7 @@ impl IncomingWebhook for Signifyd {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
let resource: signifyd::SignifydWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/silverflow.rs b/crates/hyperswitch_connectors/src/connectors/silverflow.rs
index a3d3d37fc5..e85cb3064c 100644
--- a/crates/hyperswitch_connectors/src/connectors/silverflow.rs
+++ b/crates/hyperswitch_connectors/src/connectors/silverflow.rs
@@ -802,6 +802,7 @@ impl webhooks::IncomingWebhook for Silverflow {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook_body = String::from_utf8(request.body.to_vec())
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/square.rs b/crates/hyperswitch_connectors/src/connectors/square.rs
index 142ce0697f..687b0f633e 100644
--- a/crates/hyperswitch_connectors/src/connectors/square.rs
+++ b/crates/hyperswitch_connectors/src/connectors/square.rs
@@ -45,7 +45,7 @@ use hyperswitch_interfaces::{
consts, errors,
events::connector_api_logs::ConnectorEvent,
types::{self, PaymentsAuthorizeType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use lazy_static::lazy_static;
use masking::{Mask, Maskable, PeekInterface};
@@ -891,6 +891,7 @@ impl IncomingWebhook for Square {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: square::SquareWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/stax.rs b/crates/hyperswitch_connectors/src/connectors/stax.rs
index 85990b2bf8..049e04877c 100644
--- a/crates/hyperswitch_connectors/src/connectors/stax.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stax.rs
@@ -898,6 +898,7 @@ impl webhooks::IncomingWebhook for Stax {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: stax::StaxWebhookBody = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/stripe.rs b/crates/hyperswitch_connectors/src/connectors/stripe.rs
index 655447cb2d..71c9429d76 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripe.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripe.rs
@@ -74,7 +74,7 @@ use hyperswitch_interfaces::{
RefundExecuteType, RefundSyncType, Response, RetrieveFileType, SubmitEvidenceType,
TokenizationType, UploadFileType,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask as _, Maskable, PeekInterface};
use router_env::{instrument, tracing};
@@ -2409,6 +2409,7 @@ impl IncomingWebhook for Stripe {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
let details: stripe::WebhookEventTypeBody = request
.body
@@ -2500,6 +2501,7 @@ impl IncomingWebhook for Stripe {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<DisputePayload, ConnectorError> {
let details: stripe::WebhookEvent = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
index 82bbd4039b..34db1d1f6a 100644
--- a/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
+++ b/crates/hyperswitch_connectors/src/connectors/stripebilling.rs
@@ -897,6 +897,7 @@ impl webhooks::IncomingWebhook for Stripebilling {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let webhook =
stripebilling::StripebillingWebhookBody::get_webhook_object_from_body(request.body)
@@ -920,6 +921,7 @@ impl webhooks::IncomingWebhook for Stripebilling {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/taxjar.rs b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
index f89c277e81..8014b0aa17 100644
--- a/crates/hyperswitch_connectors/src/connectors/taxjar.rs
+++ b/crates/hyperswitch_connectors/src/connectors/taxjar.rs
@@ -290,6 +290,7 @@ impl webhooks::IncomingWebhook for Taxjar {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/tesouro.rs b/crates/hyperswitch_connectors/src/connectors/tesouro.rs
index fafda41127..51ff1447fd 100644
--- a/crates/hyperswitch_connectors/src/connectors/tesouro.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tesouro.rs
@@ -898,6 +898,7 @@ impl webhooks::IncomingWebhook for Tesouro {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
index d205609ea8..ed7b25c5d0 100644
--- a/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
+++ b/crates/hyperswitch_connectors/src/connectors/threedsecureio.rs
@@ -48,7 +48,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask as _, Maskable};
use transformers as threedsecureio;
@@ -208,6 +208,7 @@ impl IncomingWebhook for Threedsecureio {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/thunes.rs b/crates/hyperswitch_connectors/src/connectors/thunes.rs
index 81bb6eaa96..e197bed1a8 100644
--- a/crates/hyperswitch_connectors/src/connectors/thunes.rs
+++ b/crates/hyperswitch_connectors/src/connectors/thunes.rs
@@ -560,6 +560,7 @@ impl webhooks::IncomingWebhook for Thunes {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/tokenex.rs b/crates/hyperswitch_connectors/src/connectors/tokenex.rs
index 377fc03ad2..85c6d04e33 100644
--- a/crates/hyperswitch_connectors/src/connectors/tokenex.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tokenex.rs
@@ -362,6 +362,7 @@ impl webhooks::IncomingWebhook for Tokenex {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/tokenio.rs b/crates/hyperswitch_connectors/src/connectors/tokenio.rs
index 0affeaefac..4ac8e50992 100644
--- a/crates/hyperswitch_connectors/src/connectors/tokenio.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tokenio.rs
@@ -615,6 +615,7 @@ impl webhooks::IncomingWebhook for Tokenio {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
// Check token-event header first
let event_type = if let Some(header_value) = request.headers.get("token-event") {
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpay.rs b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
index 7e4d0b71e4..b0ae54e8b5 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpay.rs
@@ -1048,6 +1048,7 @@ impl webhooks::IncomingWebhook for Trustpay {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let response: trustpay::TrustpayWebhookResponse = request
.body
@@ -1142,6 +1143,7 @@ impl webhooks::IncomingWebhook for Trustpay {
fn get_dispute_details(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<DisputePayload, errors::ConnectorError> {
let trustpay_response: trustpay::TrustpayWebhookResponse = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/trustpayments.rs b/crates/hyperswitch_connectors/src/connectors/trustpayments.rs
index a56bfca5f4..8923be5b3a 100644
--- a/crates/hyperswitch_connectors/src/connectors/trustpayments.rs
+++ b/crates/hyperswitch_connectors/src/connectors/trustpayments.rs
@@ -769,6 +769,7 @@ impl webhooks::IncomingWebhook for Trustpayments {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/tsys.rs b/crates/hyperswitch_connectors/src/connectors/tsys.rs
index 689b641ab2..073f5f6f4c 100644
--- a/crates/hyperswitch_connectors/src/connectors/tsys.rs
+++ b/crates/hyperswitch_connectors/src/connectors/tsys.rs
@@ -634,6 +634,7 @@ impl webhooks::IncomingWebhook for Tsys {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
index e00006cfa8..1cd58a75dc 100644
--- a/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
+++ b/crates/hyperswitch_connectors/src/connectors/unified_authentication_service.rs
@@ -731,6 +731,7 @@ impl webhooks::IncomingWebhook for UnifiedAuthenticationService {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::ExternalAuthenticationARes)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/vgs.rs b/crates/hyperswitch_connectors/src/connectors/vgs.rs
index 8e683ff61e..9195742059 100644
--- a/crates/hyperswitch_connectors/src/connectors/vgs.rs
+++ b/crates/hyperswitch_connectors/src/connectors/vgs.rs
@@ -442,6 +442,7 @@ impl webhooks::IncomingWebhook for Vgs {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/volt.rs b/crates/hyperswitch_connectors/src/connectors/volt.rs
index 48a0799a89..9702b47827 100644
--- a/crates/hyperswitch_connectors/src/connectors/volt.rs
+++ b/crates/hyperswitch_connectors/src/connectors/volt.rs
@@ -744,6 +744,7 @@ impl webhooks::IncomingWebhook for Volt {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
if request.body.is_empty() {
Ok(IncomingWebhookEvent::EndpointVerification)
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
index 6bc3167435..74e55a359e 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargo.rs
@@ -1321,6 +1321,7 @@ impl webhooks::IncomingWebhook for Wellsfargo {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Ok(api_models::webhooks::IncomingWebhookEvent::EventNotSupported)
}
diff --git a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
index 0c0ef55598..e250c5e974 100644
--- a/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wellsfargopayout.rs
@@ -39,7 +39,7 @@ use hyperswitch_interfaces::{
PaymentsAuthorizeType, PaymentsCaptureType, PaymentsSyncType, RefundExecuteType,
RefundSyncType, Response,
},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{ExposeInterface, Mask as _, Maskable};
@@ -564,6 +564,7 @@ impl IncomingWebhook for Wellsfargopayout {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
Err(report!(ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/wise.rs b/crates/hyperswitch_connectors/src/connectors/wise.rs
index f526a508a5..eb96c440e8 100644
--- a/crates/hyperswitch_connectors/src/connectors/wise.rs
+++ b/crates/hyperswitch_connectors/src/connectors/wise.rs
@@ -46,7 +46,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::Response,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
#[cfg(feature = "payouts")]
use masking::PeekInterface;
@@ -844,6 +844,7 @@ impl IncomingWebhook for Wise {
&self,
#[cfg(feature = "payouts")] request: &IncomingWebhookRequestDetails<'_>,
#[cfg(not(feature = "payouts"))] _request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
#[cfg(feature = "payouts")]
{
diff --git a/crates/hyperswitch_connectors/src/connectors/worldline.rs b/crates/hyperswitch_connectors/src/connectors/worldline.rs
index 3e86ce3682..e0c60e6a90 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldline.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldline.rs
@@ -762,6 +762,7 @@ impl webhooks::IncomingWebhook for Worldline {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
if is_endpoint_verification(request.headers) {
Ok(api_models::webhooks::IncomingWebhookEvent::EndpointVerification)
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpay.rs b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
index f9af3fbf78..ab8d11f061 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpay.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpay.rs
@@ -58,7 +58,7 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, PaymentsVoidType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::Mask;
#[cfg(feature = "payouts")]
@@ -1341,6 +1341,7 @@ impl IncomingWebhook for Worldpay {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let body: WorldpayWebhookEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpaymodular.rs b/crates/hyperswitch_connectors/src/connectors/worldpaymodular.rs
index 48e6ca4a2a..d87a6074eb 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpaymodular.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpaymodular.rs
@@ -27,7 +27,7 @@ use hyperswitch_interfaces::{
errors::ConnectorError,
events::connector_api_logs::ConnectorEvent,
types::*,
- webhooks::{IncomingWebhook, IncomingWebhookRequestDetails},
+ webhooks::{IncomingWebhook, IncomingWebhookRequestDetails, WebhookContext},
};
use masking::{Mask, Maskable};
use transformers::*;
@@ -742,6 +742,7 @@ impl IncomingWebhook for Worldpaymodular {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, ConnectorError> {
let body: WorldpaymodularWebhookEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
index 6adf78c2a7..9318b55620 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayvantiv.rs
@@ -1467,6 +1467,7 @@ impl webhooks::IncomingWebhook for Worldpayvantiv {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
index 3d57fc3076..d3408a4adc 100644
--- a/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
+++ b/crates/hyperswitch_connectors/src/connectors/worldpayxml.rs
@@ -1307,6 +1307,7 @@ impl webhooks::IncomingWebhook for Worldpayxml {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
let body_str = std::str::from_utf8(request.body)
.map_err(|_| errors::ConnectorError::WebhookBodyDecodingFailed)?;
diff --git a/crates/hyperswitch_connectors/src/connectors/xendit.rs b/crates/hyperswitch_connectors/src/connectors/xendit.rs
index 2b8e86be5c..e7fc1fc441 100644
--- a/crates/hyperswitch_connectors/src/connectors/xendit.rs
+++ b/crates/hyperswitch_connectors/src/connectors/xendit.rs
@@ -1044,6 +1044,7 @@ impl webhooks::IncomingWebhook for Xendit {
fn get_webhook_event_type(
&self,
request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let body: XenditWebhookEvent = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/zen.rs b/crates/hyperswitch_connectors/src/connectors/zen.rs
index e88fea428b..6d6c3c4e69 100644
--- a/crates/hyperswitch_connectors/src/connectors/zen.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zen.rs
@@ -43,7 +43,9 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{PaymentsAuthorizeType, PaymentsSyncType, RefundExecuteType, RefundSyncType, Response},
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
use masking::{Mask, PeekInterface, Secret};
use transformers::{self as zen, ZenPaymentStatus, ZenWebhookTxnType};
@@ -646,6 +648,7 @@ impl IncomingWebhook for Zen {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let details: zen::ZenWebhookEventType = request
.body
diff --git a/crates/hyperswitch_connectors/src/connectors/zift.rs b/crates/hyperswitch_connectors/src/connectors/zift.rs
index b39104f064..18c26536ed 100644
--- a/crates/hyperswitch_connectors/src/connectors/zift.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zift.rs
@@ -729,6 +729,7 @@ impl webhooks::IncomingWebhook for Zift {
fn get_webhook_event_type(
&self,
_request: &webhooks::IncomingWebhookRequestDetails<'_>,
+ _context: Option<&webhooks::WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError> {
Err(report!(errors::ConnectorError::WebhooksNotImplemented))
}
diff --git a/crates/hyperswitch_connectors/src/connectors/zsl.rs b/crates/hyperswitch_connectors/src/connectors/zsl.rs
index f6c7863a44..a6a1b65c53 100644
--- a/crates/hyperswitch_connectors/src/connectors/zsl.rs
+++ b/crates/hyperswitch_connectors/src/connectors/zsl.rs
@@ -42,7 +42,9 @@ use hyperswitch_interfaces::{
errors,
events::connector_api_logs::ConnectorEvent,
types::{self, Response},
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
use lazy_static::lazy_static;
use masking::{ExposeInterface, Secret};
@@ -385,6 +387,7 @@ impl IncomingWebhook for Zsl {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
let notif = get_webhook_object_from_body(request.body)
.change_context(errors::ConnectorError::WebhookEventTypeNotFound)?;
diff --git a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs b/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
index ef11396a92..166e7da9b4 100644
--- a/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
+++ b/crates/hyperswitch_interfaces/src/connector_integration_interface.rs
@@ -23,7 +23,9 @@ use crate::{
disputes, errors,
events::connector_api_logs::ConnectorEvent,
types,
- webhooks::{IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails},
+ webhooks::{
+ IncomingWebhook, IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext,
+ },
};
/// RouterDataConversion trait
@@ -350,10 +352,11 @@ impl IncomingWebhook for ConnectorEnum {
fn get_webhook_event_type(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ snapshot: Option<&WebhookContext>,
) -> CustomResult<IncomingWebhookEvent, errors::ConnectorError> {
match self {
- Self::Old(connector) => connector.get_webhook_event_type(request),
- Self::New(connector) => connector.get_webhook_event_type(request),
+ Self::Old(connector) => connector.get_webhook_event_type(request, snapshot),
+ Self::New(connector) => connector.get_webhook_event_type(request, snapshot),
}
}
@@ -381,10 +384,11 @@ impl IncomingWebhook for ConnectorEnum {
fn get_dispute_details(
&self,
request: &IncomingWebhookRequestDetails<'_>,
+ snapshot: Option<&WebhookContext>,
) -> CustomResult<disputes::DisputePayload, errors::ConnectorError> {
match self {
- Self::Old(connector) => connector.get_dispute_details(request),
- Self::New(connector) => connector.get_dispute_details(request),
+ Self::Old(connector) => connector.get_dispute_details(request, snapshot),
+ Self::New(connector) => connector.get_dispute_details(request, snapshot),
}
}
diff --git a/crates/hyperswitch_interfaces/src/webhooks.rs b/crates/hyperswitch_interfaces/src/webhooks.rs
index aa9a654091..6068901c1b 100644
--- a/crates/hyperswitch_interfaces/src/webhooks.rs
+++ b/crates/hyperswitch_interfaces/src/webhooks.rs
@@ -47,6 +47,95 @@ impl From<&ApiErrorResponse> for IncomingWebhookFlowError {
}
}
}
+/// This provides the router core with the complete state of the resource
+/// to perform business logic and validating state transitions.
+#[derive(Debug, Clone)]
+pub enum WebhookResourceData {
+ /// Context for payment-related webhooks
+ Payment {
+ /// The previous payment attempt details before processing this webhook
+ payment_attempt: hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt,
+ },
+}
+
+impl WebhookResourceData {
+ /// Helper to get the previous payment attempt
+ pub fn get_payment_attempt(
+ &self,
+ ) -> &hyperswitch_domain_models::payments::payment_attempt::PaymentAttempt {
+ match self {
+ Self::Payment { payment_attempt } => payment_attempt,
+ }
+ }
+}
+
+/// Minimal payment snapshot for connector-side webhook processing.
+/// Contains only essential fields needed by connectors, not full domain objects.
+#[derive(Debug, Clone)]
+pub struct PaymentWebhookContext {
+ /// Previous payment attempt status
+ pub previous_status: common_enums::AttemptStatus,
+ /// Payment method (e.g., Card, BankDebit)
+ pub payment_method: Option<common_enums::PaymentMethod>,
+ /// Payment method type (e.g., Ach, Credit)
+ pub payment_method_type: Option<common_enums::PaymentMethodType>,
+ /// Payment amount
+ pub amount: common_utils::types::MinorUnit,
+ /// Payment currency
+ pub currency: Option<common_enums::Currency>,
+}
+
+/// Minimal snapshot for connector-side webhook processing.
+/// This contains only the essential fields needed by connectors to determine the
+/// correct event type or state, avoiding the exposure of full domain objects.
+#[derive(Debug, Clone)]
+pub enum WebhookContext {
+ /// Snapshot of payment state before webhook processing
+ Payment(PaymentWebhookContext),
+}
+
+impl WebhookContext {
+ /// Get payment snapshot if this is a Payment variant
+ pub fn get_payment_context(&self) -> &PaymentWebhookContext {
+ match self {
+ Self::Payment(context) => context,
+ }
+ }
+}
+
+#[cfg(feature = "v1")]
+impl From<&WebhookResourceData> for WebhookContext {
+ fn from(data: &WebhookResourceData) -> Self {
+ match data {
+ WebhookResourceData::Payment { payment_attempt } => {
+ Self::Payment(PaymentWebhookContext {
+ previous_status: payment_attempt.status,
+ payment_method: payment_attempt.payment_method,
+ payment_method_type: payment_attempt.payment_method_type,
+ amount: payment_attempt.net_amount.get_order_amount(),
+ currency: payment_attempt.currency,
+ })
+ }
+ }
+ }
+}
+
+#[cfg(feature = "v2")]
+impl From<&WebhookResourceData> for WebhookContext {
+ fn from(data: &WebhookResourceData) -> Self {
+ match data {
+ WebhookResourceData::Payment { payment_attempt } => {
+ Self::Payment(PaymentWebhookContext {
+ previous_status: payment_attempt.status,
+ payment_method: payment_attempt.get_payment_method(),
+ payment_method_type: payment_attempt.get_payment_method_type(),
+ amount: payment_attempt.amount_details.get_net_amount(),
+ currency: None, // Currency is not stored on PaymentAttempt in v2
+ })
+ }
+ }
+ }
+}
/// Trait defining incoming webhook
#[async_trait::async_trait]
@@ -226,6 +315,7 @@ pub trait IncomingWebhook: ConnectorCommon + Sync {
fn get_webhook_event_type(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<api_models::webhooks::IncomingWebhookEvent, errors::ConnectorError>;
/// fn get_webhook_resource_object
@@ -247,6 +337,7 @@ pub trait IncomingWebhook: ConnectorCommon + Sync {
fn get_dispute_details(
&self,
_request: &IncomingWebhookRequestDetails<'_>,
+ _context: Option<&WebhookContext>,
) -> CustomResult<crate::disputes::DisputePayload, errors::ConnectorError> {
Err(errors::ConnectorError::NotImplemented("get_dispute_details method".to_string()).into())
}
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index c934149735..386890eaf0 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -21,7 +21,6 @@ use hyperswitch_connectors::connectors::unified_authentication_service::transfor
use hyperswitch_domain_models::payouts::payouts::PayoutsUpdate;
use hyperswitch_domain_models::{
mandates::CommonMandateReference,
- merchant_key_store::MerchantKeyStore,
payments::{payment_attempt::PaymentAttempt, HeaderPayload},
router_request_types::{
unified_authentication_service::UasAuthenticationResponseData,
@@ -29,7 +28,9 @@ use hyperswitch_domain_models::{
},
router_response_types::{VerifyWebhookSourceResponseData, VerifyWebhookStatus},
};
-use hyperswitch_interfaces::webhooks::{IncomingWebhookFlowError, IncomingWebhookRequestDetails};
+use hyperswitch_interfaces::webhooks::{
+ IncomingWebhookFlowError, IncomingWebhookRequestDetails, WebhookContext, WebhookResourceData,
+};
use masking::{ExposeInterface, PeekInterface};
use router_env::{instrument, tracing, RequestId};
use unified_connector_service_client::payments as payments_grpc;
@@ -50,7 +51,6 @@ use crate::{
unified_connector_service, utils as core_utils,
webhooks::{network_tokenization_incoming, utils::construct_webhook_router_data},
},
- db::StorageInterface,
events::api_logs::ApiEvent,
logger,
routes::{
@@ -410,7 +410,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
let webhook_effect = match process_webhook_further {
true => {
- let business_logic_result = process_webhook_business_logic(
+ let business_logic_result = Box::pin(process_webhook_business_logic(
&state,
req_state,
&platform,
@@ -422,7 +422,9 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
&mut webhook_processing_result.shadow_ucs_data,
final_request_details,
is_relay_webhook,
- )
+ webhook_processing_result.webhook_resource_data,
+ webhook_processing_result.object_reference_id,
+ ))
.await;
match business_logic_result {
@@ -543,6 +545,8 @@ async fn process_ucs_webhook_transform<'a>(
transform_data: Some(Box::new(transform_data)),
decoded_body: None, // UCS path uses raw body
shadow_ucs_data: None,
+ webhook_resource_data: None,
+ object_reference_id: None,
})
}
@@ -563,6 +567,8 @@ pub struct WebhookProcessingResult<'a> {
pub transform_data: Option<Box<unified_connector_service::WebhookTransformData>>,
pub decoded_body: Option<actix_web::web::Bytes>,
pub shadow_ucs_data: Option<ShadowUcsData<'a>>,
+ pub webhook_resource_data: Option<WebhookResourceData>,
+ pub object_reference_id: Option<api::ObjectReferenceId>,
}
#[derive(Clone, Debug)]
@@ -715,9 +721,32 @@ async fn process_non_ucs_webhook<'a>(
query_params: request_details.query_params.clone(),
body: &decoded_body,
};
+ let object_ref_id = connector
+ .get_webhook_object_reference_id(&updated_request_details)
+ .ok();
+
+ let webhook_resource_data = match &object_ref_id {
+ Some(webhooks::ObjectReferenceId::PaymentId(id)) => {
+ let payment_attempt = get_payment_attempt_from_object_reference_id(
+ state,
+ webhooks::ObjectReferenceId::PaymentId(id.clone()),
+ platform,
+ )
+ .await?;
+ Some(WebhookResourceData::Payment { payment_attempt })
+ }
+ // For non-payment webhooks (Refund, Mandate, etc.), we don't need webhook resource data for now
+ _ => None,
+ };
match connector
- .get_webhook_event_type(&updated_request_details)
+ .get_webhook_event_type(
+ &updated_request_details,
+ webhook_resource_data
+ .as_ref()
+ .map(WebhookContext::from)
+ .as_ref(),
+ )
.allow_webhook_event_type_not_found(
state
.clone()
@@ -736,6 +765,8 @@ async fn process_non_ucs_webhook<'a>(
transform_data: None,
decoded_body: Some(decoded_body),
shadow_ucs_data: None,
+ webhook_resource_data,
+ object_reference_id: object_ref_id,
}),
None => {
metrics::WEBHOOK_EVENT_TYPE_IDENTIFICATION_FAILURE_COUNT.add(
@@ -819,11 +850,16 @@ async fn process_webhook_business_logic(
shadow_ucs_data: &mut Option<ShadowUcsData<'_>>,
request_details: &IncomingWebhookRequestDetails<'_>,
is_relay_webhook: bool,
+ webhook_resource_data: Option<WebhookResourceData>,
+ object_reference_id: Option<api::ObjectReferenceId>,
) -> errors::RouterResult<WebhookResponseTracker> {
- let object_ref_id = connector
- .get_webhook_object_reference_id(request_details)
- .switch()
- .attach_printable("Could not find object reference id in incoming webhook body")?;
+ let object_ref_id = match object_reference_id {
+ Some(id) => id,
+ None => connector
+ .get_webhook_object_reference_id(request_details)
+ .switch()
+ .attach_printable("Could not find object reference id in incoming webhook body")?,
+ };
let connector_enum = Connector::from_str(connector_name)
.change_context(errors::ApiErrorResponse::InvalidDataValue {
field_name: "connector",
@@ -1085,6 +1121,7 @@ async fn process_webhook_business_logic(
event_type,
webhook_transform_data,
shadow_ucs_data,
+ webhook_resource_data,
))
.await
.attach_printable("Incoming webhook flow for payments failed"),
@@ -1110,6 +1147,7 @@ async fn process_webhook_business_logic(
connector,
request_details,
event_type,
+ webhook_resource_data,
))
.await
.attach_printable("Incoming webhook flow for disputes failed"),
@@ -1354,6 +1392,7 @@ async fn payments_incoming_webhook_flow(
event_type: webhooks::IncomingWebhookEvent,
webhook_transform_data: &Option<Box<unified_connector_service::WebhookTransformData>>,
shadow_ucs_data: &Option<ShadowUcsData<'_>>,
+ webhook_resource_data: Option<WebhookResourceData>,
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
let consume_or_trigger_flow = if source_verified {
// Determine the appropriate action based on UCS availability
@@ -1401,17 +1440,21 @@ async fn payments_incoming_webhook_flow(
Some(payments::CallConnectorAction::Trigger)
}
});
+ let payment_attempt =
+ if let Some(WebhookResourceData::Payment { payment_attempt }) = &webhook_resource_data {
+ payment_attempt.clone()
+ } else {
+ get_payment_attempt_from_object_reference_id(
+ &state,
+ webhook_details.object_reference_id.clone(),
+ &platform,
+ )
+ .await?
+ };
let payments_response = match webhook_details.object_reference_id {
webhooks::ObjectReferenceId::PaymentId(ref id) => {
- let payment_id = get_payment_id(
- state.store.as_ref(),
- id,
- platform.get_processor().get_account().get_id(),
- platform.get_processor().get_account().storage_scheme,
- platform.get_processor().get_key_store(),
- )
- .await?;
+ let payment_id = payment_attempt.payment_id.clone();
let lock_action = api_locking::LockAction::Hold {
input: api_locking::LockingInput {
@@ -2721,17 +2764,32 @@ async fn disputes_incoming_webhook_flow(
connector: &ConnectorEnum,
request_details: &IncomingWebhookRequestDetails<'_>,
event_type: webhooks::IncomingWebhookEvent,
+ webhook_resource_data: Option<WebhookResourceData>,
) -> CustomResult<WebhookResponseTracker, errors::ApiErrorResponse> {
metrics::INCOMING_DISPUTE_WEBHOOK_METRIC.add(1, &[]);
if source_verified {
let db = &*state.store;
- let dispute_details = connector.get_dispute_details(request_details).switch()?;
- let payment_attempt = get_payment_attempt_from_object_reference_id(
- &state,
- webhook_details.object_reference_id,
- &platform,
- )
- .await?;
+ let payment_attempt = match webhook_resource_data.as_ref() {
+ Some(context) => context.get_payment_attempt().clone(),
+ None => {
+ get_payment_attempt_from_object_reference_id(
+ &state,
+ webhook_details.object_reference_id,
+ &platform,
+ )
+ .await?
+ }
+ };
+ let dispute_details = connector
+ .get_dispute_details(
+ request_details,
+ webhook_resource_data
+ .as_ref()
+ .map(WebhookContext::from)
+ .as_ref(),
+ )
+ .switch()?;
+
let option_dispute = db
.find_by_merchant_id_payment_id_connector_dispute_id(
platform.get_processor().get_account().get_id(),
@@ -2908,51 +2966,6 @@ async fn bank_transfer_webhook_flow(
}
}
-async fn get_payment_id(
- db: &dyn StorageInterface,
- payment_id: &api::PaymentIdType,
- processor_merchant_id: &common_utils::id_type::MerchantId,
- storage_scheme: enums::MerchantStorageScheme,
- key_store: &MerchantKeyStore,
-) -> errors::RouterResult<common_utils::id_type::PaymentId> {
- let pay_id = || async {
- match payment_id {
- api_models::payments::PaymentIdType::PaymentIntentId(ref id) => Ok(id.to_owned()),
- api_models::payments::PaymentIdType::ConnectorTransactionId(ref id) => db
- .find_payment_attempt_by_processor_merchant_id_connector_txn_id(
- processor_merchant_id,
- id,
- storage_scheme,
- key_store,
- )
- .await
- .map(|p| p.payment_id),
- api_models::payments::PaymentIdType::PaymentAttemptId(ref id) => db
- .find_payment_attempt_by_attempt_id_processor_merchant_id(
- id,
- processor_merchant_id,
- storage_scheme,
- key_store,
- )
- .await
- .map(|p| p.payment_id),
- api_models::payments::PaymentIdType::PreprocessingId(ref id) => db
- .find_payment_attempt_by_preprocessing_id_processor_merchant_id(
- id,
- processor_merchant_id,
- storage_scheme,
- key_store,
- )
- .await
- .map(|p| p.payment_id),
- }
- };
-
- pay_id()
- .await
- .to_not_found_response(errors::ApiErrorResponse::PaymentNotFound)
-}
-
#[inline]
async fn verify_webhook_source_verification_call(
connector: ConnectorEnum,
@@ -3421,7 +3434,7 @@ pub async fn process_uas_incoming_webhook<'a>(
}?;
let event_type = connector_integration
- .get_webhook_event_type(incoming_webhook_request)
+ .get_webhook_event_type(incoming_webhook_request, None)
.switch()
.attach_printable("Could not get webhook event")?;
@@ -3443,6 +3456,8 @@ pub async fn process_uas_incoming_webhook<'a>(
transform_data: None,
decoded_body: Some(decoded_body),
shadow_ucs_data: None,
+ webhook_resource_data: None,
+ object_reference_id: None,
};
Ok(webhook_result)
diff --git a/crates/router/src/core/webhooks/incoming_v2.rs b/crates/router/src/core/webhooks/incoming_v2.rs
index e619f89628..1b9da55064 100644
--- a/crates/router/src/core/webhooks/incoming_v2.rs
+++ b/crates/router/src/core/webhooks/incoming_v2.rs
@@ -176,7 +176,7 @@ async fn incoming_webhooks_core<W: types::OutgoingWebhookType>(
request_details.body = &decoded_body;
let event_type = match connector
- .get_webhook_event_type(&request_details)
+ .get_webhook_event_type(&request_details, None)
.allow_webhook_event_type_not_found(
state
.clone()