From bea4b9e7f430c3d7fbb25be0b472d2afb01135ec Mon Sep 17 00:00:00 2001 From: Kashif Date: Mon, 2 Dec 2024 23:34:00 +0530 Subject: [PATCH] fix(connector): adyen - propagate connector mandate details in incoming webhooks (#6720) --- crates/router/src/connector/adyen.rs | 21 +++++++++++++++++++ .../src/connector/adyen/transformers.rs | 3 +++ 2 files changed, 24 insertions(+) diff --git a/crates/router/src/connector/adyen.rs b/crates/router/src/connector/adyen.rs index f3b7414a923..57b80f58153 100644 --- a/crates/router/src/connector/adyen.rs +++ b/crates/router/src/connector/adyen.rs @@ -1908,6 +1908,27 @@ impl api::IncomingWebhook for Adyen { updated_at: notif.event_date, }) } + + fn get_mandate_details( + &self, + request: &api::IncomingWebhookRequestDetails<'_>, + ) -> CustomResult< + Option, + errors::ConnectorError, + > { + let notif = get_webhook_object_from_body(request.body) + .change_context(errors::ConnectorError::WebhookBodyDecodingFailed)?; + let mandate_reference = + notif + .additional_data + .recurring_detail_reference + .map(|mandate_id| { + hyperswitch_domain_models::router_flow_types::ConnectorMandateDetails { + connector_mandate_id: mandate_id.clone(), + } + }); + Ok(mandate_reference) + } } impl api::Dispute for Adyen {} diff --git a/crates/router/src/connector/adyen/transformers.rs b/crates/router/src/connector/adyen/transformers.rs index 7daee6e73d7..cae5f508a2e 100644 --- a/crates/router/src/connector/adyen/transformers.rs +++ b/crates/router/src/connector/adyen/transformers.rs @@ -4261,6 +4261,9 @@ pub struct AdyenAdditionalDataWH { pub chargeback_reason_code: Option, #[serde(default, with = "common_utils::custom_serde::iso8601::option")] pub defense_period_ends_at: Option, + /// Enable recurring details in dashboard to receive this ID, https://docs.adyen.com/online-payments/tokenization/create-and-use-tokens#test-and-go-live + #[serde(rename = "recurring.recurringDetailReference")] + pub recurring_detail_reference: Option>, } #[derive(Debug, Deserialize)]