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

fix(dummyconnector): add tenant id in dummyconnector requests (#7008)

Kartikeya Hegde9c983b68bd83
diff --git a/crates/hyperswitch_domain_models/src/router_data.rs b/crates/hyperswitch_domain_models/src/router_data.rs
index 2970ac127e..8e4c79a965 100644
--- a/crates/hyperswitch_domain_models/src/router_data.rs
+++ b/crates/hyperswitch_domain_models/src/router_data.rs
@@ -22,6 +22,7 @@ pub struct RouterData<Flow, Request, Response> {
// Make this change after all the connector dependency has been removed from connectors
pub payment_id: String,
pub attempt_id: String,
+ pub tenant_id: id_type::TenantId,
pub status: common_enums::enums::AttemptStatus,
pub payment_method: common_enums::enums::PaymentMethod,
pub connector_auth_type: ConnectorAuthType,
diff --git a/crates/hyperswitch_domain_models/src/router_data_v2.rs b/crates/hyperswitch_domain_models/src/router_data_v2.rs
index acc7343cb1..7ca106331e 100644
--- a/crates/hyperswitch_domain_models/src/router_data_v2.rs
+++ b/crates/hyperswitch_domain_models/src/router_data_v2.rs
@@ -2,6 +2,7 @@ pub mod flow_common_types;
use std::{marker::PhantomData, ops::Deref};
+use common_utils::id_type;
#[cfg(feature = "frm")]
pub use flow_common_types::FrmFlowData;
#[cfg(feature = "payouts")]
@@ -16,6 +17,7 @@ use crate::router_data::{ConnectorAuthType, ErrorResponse};
#[derive(Debug, Clone)]
pub struct RouterDataV2<Flow, ResourceCommonData, FlowSpecificRequest, FlowSpecificResponse> {
pub flow: PhantomData<Flow>,
+ pub tenant_id: id_type::TenantId,
pub resource_common_data: ResourceCommonData,
pub connector_auth_type: ConnectorAuthType,
/// Contains flow-specific data required to construct a request and send it to the connector.
diff --git a/crates/router/src/connector/dummyconnector.rs b/crates/router/src/connector/dummyconnector.rs
index 15a2ff6903..226067cef9 100644
--- a/crates/router/src/connector/dummyconnector.rs
+++ b/crates/router/src/connector/dummyconnector.rs
@@ -2,7 +2,7 @@ pub mod transformers;
use std::fmt::Debug;
-use common_utils::request::RequestContent;
+use common_utils::{consts as common_consts, request::RequestContent};
use diesel_models::enums;
use error_stack::{report, ResultExt};
@@ -62,12 +62,18 @@ where
req: &types::RouterData<Flow, Request, Response>,
_connectors: &settings::Connectors,
) -> CustomResult<Vec<(String, request::Maskable<String>)>, errors::ConnectorError> {
- let mut header = vec![(
- headers::CONTENT_TYPE.to_string(),
- types::PaymentsAuthorizeType::get_content_type(self)
- .to_string()
- .into(),
- )];
+ let mut header = vec![
+ (
+ headers::CONTENT_TYPE.to_string(),
+ types::PaymentsAuthorizeType::get_content_type(self)
+ .to_string()
+ .into(),
+ ),
+ (
+ common_consts::TENANT_HEADER.to_string(),
+ req.tenant_id.get_string_repr().to_string().into(),
+ ),
+ ];
let mut api_key = self.get_auth_header(&req.connector_auth_type)?;
header.append(&mut api_key);
Ok(header)
diff --git a/crates/router/src/core/authentication.rs b/crates/router/src/core/authentication.rs
index 09cebda490..bedd7787a7 100644
--- a/crates/router/src/core/authentication.rs
+++ b/crates/router/src/core/authentication.rs
@@ -42,6 +42,7 @@ pub async fn perform_authentication(
psd2_sca_exemption_type: Option<common_enums::ScaExemptionType>,
) -> CustomResult<api::authentication::AuthenticationResponse, ApiErrorResponse> {
let router_data = transformers::construct_authentication_router_data(
+ state,
merchant_id,
authentication_connector.clone(),
payment_method_data,
@@ -108,6 +109,7 @@ pub async fn perform_post_authentication(
.attach_printable_lazy(|| format!("Error while fetching authentication record with authentication_id {authentication_id}"))?;
if !authentication.authentication_status.is_terminal_status() && is_pull_mechanism_enabled {
let router_data = transformers::construct_post_authentication_router_data(
+ state,
authentication_connector.to_string(),
business_profile,
three_ds_connector_account,
@@ -151,6 +153,7 @@ pub async fn perform_pre_authentication(
let authentication = if authentication_connector.is_separate_version_call_required() {
let router_data: core_types::authentication::PreAuthNVersionCallRouterData =
transformers::construct_pre_authentication_router_data(
+ state,
authentication_connector_name.clone(),
card_number.clone(),
&three_ds_connector_account,
@@ -178,6 +181,7 @@ pub async fn perform_pre_authentication(
let router_data: core_types::authentication::PreAuthNRouterData =
transformers::construct_pre_authentication_router_data(
+ state,
authentication_connector_name.clone(),
card_number,
&three_ds_connector_account,
diff --git a/crates/router/src/core/authentication/transformers.rs b/crates/router/src/core/authentication/transformers.rs
index 30373d1408..4e7e005c94 100644
--- a/crates/router/src/core/authentication/transformers.rs
+++ b/crates/router/src/core/authentication/transformers.rs
@@ -15,6 +15,7 @@ use crate::{
transformers::{ForeignFrom, ForeignTryFrom},
},
utils::ext_traits::OptionExt,
+ SessionState,
};
const IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW: &str =
@@ -24,6 +25,7 @@ const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_AUTHENTICATION_FLOW: &str =
#[allow(clippy::too_many_arguments)]
pub fn construct_authentication_router_data(
+ state: &SessionState,
merchant_id: common_utils::id_type::MerchantId,
authentication_connector: String,
payment_method_data: domain::PaymentMethodData,
@@ -65,6 +67,7 @@ pub fn construct_authentication_router_data(
webhook_url,
};
construct_router_data(
+ state,
authentication_connector,
payment_method,
merchant_id.clone(),
@@ -76,6 +79,7 @@ pub fn construct_authentication_router_data(
}
pub fn construct_post_authentication_router_data(
+ state: &SessionState,
authentication_connector: String,
business_profile: domain::Profile,
merchant_connector_account: payments_helpers::MerchantConnectorAccountType,
@@ -90,6 +94,7 @@ pub fn construct_post_authentication_router_data(
threeds_server_transaction_id,
};
construct_router_data(
+ state,
authentication_connector,
PaymentMethod::default(),
business_profile.merchant_id.clone(),
@@ -101,6 +106,7 @@ pub fn construct_post_authentication_router_data(
}
pub fn construct_pre_authentication_router_data<F: Clone>(
+ state: &SessionState,
authentication_connector: String,
card_holder_account_number: cards::CardNumber,
merchant_connector_account: &payments_helpers::MerchantConnectorAccountType,
@@ -116,6 +122,7 @@ pub fn construct_pre_authentication_router_data<F: Clone>(
card_holder_account_number,
};
construct_router_data(
+ state,
authentication_connector,
PaymentMethod::default(),
merchant_id,
@@ -126,7 +133,9 @@ pub fn construct_pre_authentication_router_data<F: Clone>(
)
}
+#[allow(clippy::too_many_arguments)]
pub fn construct_router_data<F: Clone, Req, Res>(
+ state: &SessionState,
authentication_connector_name: String,
payment_method: PaymentMethod,
merchant_id: common_utils::id_type::MerchantId,
@@ -144,6 +153,7 @@ pub fn construct_router_data<F: Clone, Req, Res>(
flow: PhantomData,
merchant_id,
customer_id: None,
+ tenant_id: state.tenant.tenant_id.clone(),
connector_customer: None,
connector: authentication_connector_name,
payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("authentication")
diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
index c413208b20..e6ff3fdbfc 100644
--- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs
@@ -47,7 +47,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
async fn construct_router_data<'a>(
&self,
- _state: &SessionState,
+ state: &SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
@@ -75,6 +75,7 @@ impl ConstructFlowSpecificData<frm_api::Checkout, FraudCheckCheckoutData, FraudC
flow: std::marker::PhantomData,
merchant_id: merchant_account.get_id().clone(),
customer_id,
+ tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_string(),
payment_id: self.payment_intent.payment_id.get_string_repr().to_owned(),
attempt_id: self.payment_attempt.attempt_id.clone(),
diff --git a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
index 640e808d54..4dbe17d17b 100644
--- a/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/fulfillment_flow.rs
@@ -71,6 +71,7 @@ pub async fn construct_fulfillment_router_data<'a>(
let router_data = RouterData {
flow: std::marker::PhantomData,
merchant_id: merchant_account.get_id().clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
connector,
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
attempt_id: payment_attempt.attempt_id.clone(),
diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs
index 5e35403118..21c5de5ed3 100644
--- a/crates/router/src/core/fraud_check/flows/record_return.rs
+++ b/crates/router/src/core/fraud_check/flows/record_return.rs
@@ -45,7 +45,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
async fn construct_router_data<'a>(
&self,
- _state: &SessionState,
+ state: &SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
@@ -69,6 +69,7 @@ impl ConstructFlowSpecificData<RecordReturn, FraudCheckRecordReturnData, FraudCh
let router_data = RouterData {
flow: std::marker::PhantomData,
merchant_id: merchant_account.get_id().clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
customer_id,
connector: connector_id.to_string(),
payment_id: self.payment_intent.payment_id.get_string_repr().to_owned(),
diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs
index dde9ba52a2..189edb5bc0 100644
--- a/crates/router/src/core/fraud_check/flows/sale_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs
@@ -42,7 +42,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
async fn construct_router_data<'a>(
&self,
- _state: &SessionState,
+ state: &SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
@@ -69,6 +69,7 @@ impl ConstructFlowSpecificData<frm_api::Sale, FraudCheckSaleData, FraudCheckResp
connector: connector_id.to_string(),
payment_id: self.payment_intent.payment_id.get_string_repr().to_owned(),
attempt_id: self.payment_attempt.attempt_id.clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
status,
payment_method: self
.payment_attempt
diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
index 673753ce4e..7ddf41c509 100644
--- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs
+++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs
@@ -49,7 +49,7 @@ impl
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
async fn construct_router_data<'a>(
&self,
- _state: &SessionState,
+ state: &SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
_key_store: &domain::MerchantKeyStore,
@@ -77,6 +77,7 @@ impl
let router_data = RouterData {
flow: std::marker::PhantomData,
merchant_id: merchant_account.get_id().clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
customer_id,
connector: connector_id.to_string(),
payment_id: self.payment_intent.payment_id.get_string_repr().to_owned(),
diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs
index 15ceb9b1da..414bb00e76 100644
--- a/crates/router/src/core/mandate.rs
+++ b/crates/router/src/core/mandate.rs
@@ -110,6 +110,7 @@ pub async fn revoke_mandate(
> = connector_data.connector.get_connector_integration();
let router_data = utils::construct_mandate_revoke_router_data(
+ &state,
merchant_connector_account,
&merchant_account,
mandate.clone(),
diff --git a/crates/router/src/core/mandate/utils.rs b/crates/router/src/core/mandate/utils.rs
index 5418d7b7a7..95736604fc 100644
--- a/crates/router/src/core/mandate/utils.rs
+++ b/crates/router/src/core/mandate/utils.rs
@@ -7,6 +7,7 @@ use error_stack::ResultExt;
use crate::{
core::{errors, payments::helpers},
types::{self, domain, PaymentAddress},
+ SessionState,
};
const IRRELEVANT_ATTEMPT_ID_IN_MANDATE_REVOKE_FLOW: &str =
@@ -16,6 +17,7 @@ const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_MANDATE_REVOKE_FLOW: &str =
"irrelevant_connector_request_reference_id_in_mandate_revoke_flow";
pub async fn construct_mandate_revoke_router_data(
+ state: &SessionState,
merchant_connector_account: helpers::MerchantConnectorAccountType,
merchant_account: &domain::MerchantAccount,
mandate: Mandate,
@@ -28,6 +30,7 @@ pub async fn construct_mandate_revoke_router_data(
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
customer_id: Some(mandate.customer_id),
+ tenant_id: state.tenant.tenant_id.clone(),
connector_customer: None,
connector: mandate.connector,
payment_id: mandate
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index b2c90e03b5..7f6e8c7fc8 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -4035,6 +4035,7 @@ pub fn router_data_type_conversion<F1, F2, Req1, Req2, Res1, Res2>(
request,
response,
merchant_id: router_data.merchant_id,
+ tenant_id: router_data.tenant_id,
address: router_data.address,
amount_captured: router_data.amount_captured,
minor_amount_captured: router_data.minor_amount_captured,
diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs
index 79bcfb6a49..c668691219 100644
--- a/crates/router/src/core/payments/transformers.rs
+++ b/crates/router/src/core/payments/transformers.rs
@@ -122,6 +122,7 @@ where
.payment_id
.get_string_repr()
.to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
attempt_id: payment_data.payment_attempt.get_id().to_owned(),
status: payment_data.payment_attempt.status,
payment_method: diesel_models::enums::PaymentMethod::default(),
@@ -301,6 +302,7 @@ pub async fn construct_payment_router_data_for_authorize<'a>(
let router_data = types::RouterData {
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
connector: connector_id.to_owned(),
@@ -464,6 +466,7 @@ pub async fn construct_payment_router_data_for_capture<'a>(
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
connector: connector_id.to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
// TODO: evaluate why we need payment id at the connector level. We already have connector reference id
payment_id: payment_data
.payment_attempt
@@ -599,6 +602,7 @@ pub async fn construct_router_data_for_psync<'a>(
merchant_id: merchant_account.get_id().clone(),
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
+ tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_owned(),
// TODO: evaluate why we need payment id at the connector level. We already have connector reference id
payment_id: payment_intent.id.get_string_repr().to_owned(),
@@ -662,7 +666,7 @@ pub async fn construct_router_data_for_psync<'a>(
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_payment_router_data_for_sdk_session<'a>(
- _state: &'a SessionState,
+ state: &'a SessionState,
payment_data: hyperswitch_domain_models::payments::PaymentIntentData<api::Session>,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
@@ -756,6 +760,7 @@ pub async fn construct_payment_router_data_for_sdk_session<'a>(
// TODO: evaluate why we need customer id at the connector level. We already have connector customer id.
customer_id,
connector: connector_id.to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
// TODO: evaluate why we need payment id at the connector level. We already have connector reference id
payment_id: payment_data.payment_intent.id.get_string_repr().to_owned(),
// TODO: evaluate why we need attempt id at the connector level. We already have connector reference id
@@ -944,6 +949,7 @@ where
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
customer_id,
+ tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_owned(),
payment_id: payment_data
.payment_attempt
diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs
index 3c8432795a..11be2ebfb5 100644
--- a/crates/router/src/core/payouts.rs
+++ b/crates/router/src/core/payouts.rs
@@ -1216,9 +1216,13 @@ pub async fn create_recipient(
);
if should_call_connector {
// 1. Form router data
- let router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Fetch connector integration details
let connector_integration: services::BoxedPayoutConnectorIntegrationInterface<
@@ -1396,9 +1400,13 @@ pub async fn check_payout_eligibility(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Fetch connector integration details
let connector_integration: services::BoxedPayoutConnectorIntegrationInterface<
@@ -1594,9 +1602,13 @@ pub async fn create_payout(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let mut router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let mut router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Get/Create access token
access_token::create_access_token(
@@ -1808,9 +1820,13 @@ pub async fn create_payout_retrieve(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let mut router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let mut router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Get/Create access token
access_token::create_access_token(
@@ -1964,9 +1980,13 @@ pub async fn create_recipient_disburse_account(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Fetch connector integration details
let connector_integration: services::BoxedPayoutConnectorIntegrationInterface<
@@ -2067,9 +2087,13 @@ pub async fn cancel_payout(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Fetch connector integration details
let connector_integration: services::BoxedPayoutConnectorIntegrationInterface<
@@ -2191,9 +2215,13 @@ pub async fn fulfill_payout(
payout_data: &mut PayoutData,
) -> RouterResult<()> {
// 1. Form Router data
- let mut router_data =
- core_utils::construct_payout_router_data(connector_data, merchant_account, payout_data)
- .await?;
+ let mut router_data = core_utils::construct_payout_router_data(
+ state,
+ connector_data,
+ merchant_account,
+ payout_data,
+ )
+ .await?;
// 2. Get/Create access token
access_token::create_access_token(
diff --git a/crates/router/src/core/relay/utils.rs b/crates/router/src/core/relay/utils.rs
index 946f8df7d6..0829934fdc 100644
--- a/crates/router/src/core/relay/utils.rs
+++ b/crates/router/src/core/relay/utils.rs
@@ -71,6 +71,7 @@ pub async fn construct_relay_refund_router_data<'a, F>(
flow: std::marker::PhantomData,
merchant_id: merchant_id.clone(),
customer_id: None,
+ tenant_id: state.tenant.tenant_id.clone(),
connector: connector_name.to_string(),
payment_id: IRRELEVANT_PAYMENT_INTENT_ID.to_string(),
attempt_id: IRRELEVANT_PAYMENT_ATTEMPT_ID.to_string(),
diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs
index 5ed1b63d72..2afd8477f1 100644
--- a/crates/router/src/core/unified_authentication_service.rs
+++ b/crates/router/src/core/unified_authentication_service.rs
@@ -43,6 +43,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
let pre_auth_router_data: hyperswitch_domain_models::types::UasPreAuthenticationRouterData =
utils::construct_uas_router_data(
+ state,
connector_name.to_string(),
payment_method,
payment_data.payment_attempt.merchant_id.clone(),
@@ -81,6 +82,7 @@ impl<F: Clone + Sync> UnifiedAuthenticationService<F> for ClickToPay {
let post_authentication_data = UasPostAuthenticationRequestData {};
let post_auth_router_data: hyperswitch_domain_models::types::UasPostAuthenticationRouterData = utils::construct_uas_router_data(
+ state,
connector_name.to_string(),
payment_method,
payment_data.payment_attempt.merchant_id.clone(),
diff --git a/crates/router/src/core/unified_authentication_service/utils.rs b/crates/router/src/core/unified_authentication_service/utils.rs
index fe4f864604..dfa56628c8 100644
--- a/crates/router/src/core/unified_authentication_service/utils.rs
+++ b/crates/router/src/core/unified_authentication_service/utils.rs
@@ -102,7 +102,9 @@ where
Ok(router_data)
}
+#[allow(clippy::too_many_arguments)]
pub fn construct_uas_router_data<F: Clone, Req, Res>(
+ state: &SessionState,
authentication_connector_name: String,
payment_method: PaymentMethod,
merchant_id: common_utils::id_type::MerchantId,
@@ -125,6 +127,7 @@ pub fn construct_uas_router_data<F: Clone, Req, Res>(
payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("authentication")
.get_string_repr()
.to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
attempt_id: IRRELEVANT_ATTEMPT_ID_IN_AUTHENTICATION_FLOW.to_owned(),
status: common_enums::AttemptStatus::default(),
payment_method,
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index c441e32581..fac89112df 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -54,6 +54,7 @@ const IRRELEVANT_ATTEMPT_ID_IN_DISPUTE_FLOW: &str = "irrelevant_attempt_id_in_di
#[cfg(all(feature = "payouts", feature = "v2", feature = "customer_v2"))]
#[instrument(skip_all)]
pub async fn construct_payout_router_data<'a, F>(
+ _state: &SessionState,
_connector_data: &api::ConnectorData,
_merchant_account: &domain::MerchantAccount,
_payout_data: &mut PayoutData,
@@ -68,6 +69,7 @@ pub async fn construct_payout_router_data<'a, F>(
))]
#[instrument(skip_all)]
pub async fn construct_payout_router_data<'a, F>(
+ state: &SessionState,
connector_data: &api::ConnectorData,
merchant_account: &domain::MerchantAccount,
payout_data: &mut PayoutData,
@@ -152,6 +154,7 @@ pub async fn construct_payout_router_data<'a, F>(
flow: PhantomData,
merchant_id: merchant_account.get_id().to_owned(),
customer_id: customer_details.to_owned().map(|c| c.customer_id),
+ tenant_id: state.tenant.tenant_id.clone(),
connector_customer: connector_customer_id,
connector: connector_name.to_string(),
payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("payout")
@@ -330,6 +333,7 @@ pub async fn construct_refund_router_data<'a, F>(
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
customer_id: payment_intent.customer_id.to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
connector: connector_id.to_string(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
attempt_id: payment_attempt.attempt_id.clone(),
@@ -652,6 +656,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
connector: dispute.connector.to_string(),
+ tenant_id: state.tenant.tenant_id.clone(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
attempt_id: payment_attempt.attempt_id.clone(),
status: payment_attempt.status,
@@ -753,6 +758,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
merchant_id: merchant_account.get_id().clone(),
connector: connector_id.to_string(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
attempt_id: payment_attempt.attempt_id.clone(),
status: payment_attempt.status,
payment_method,
@@ -851,6 +857,7 @@ pub async fn construct_upload_file_router_data<'a>(
merchant_id: merchant_account.get_id().clone(),
connector: connector_id.to_string(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
attempt_id: payment_attempt.attempt_id.clone(),
status: payment_attempt.status,
payment_method,
@@ -978,6 +985,7 @@ pub async fn construct_payments_dynamic_tax_calculation_router_data<'a, F: Clone
connector: merchant_connector_account.connector_name.clone(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
attempt_id: payment_attempt.attempt_id.clone(),
+ tenant_id: state.tenant.tenant_id.clone(),
status: payment_attempt.status,
payment_method: diesel_models::enums::PaymentMethod::default(),
connector_auth_type,
@@ -1076,6 +1084,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
merchant_id: merchant_account.get_id().clone(),
connector: connector_id.to_string(),
payment_id: payment_attempt.payment_id.get_string_repr().to_owned(),
+ tenant_id: state.tenant.tenant_id.clone(),
attempt_id: payment_attempt.attempt_id.clone(),
status: payment_attempt.status,
payment_method,
@@ -1169,6 +1178,7 @@ pub async fn construct_retrieve_file_router_data<'a>(
flow: PhantomData,
merchant_id: merchant_account.get_id().clone(),
connector: connector_id.to_string(),
+ tenant_id: state.tenant.tenant_id.clone(),
customer_id: None,
connector_customer: None,
payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("dispute")
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index ff9849958b..474a0c628e 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1658,6 +1658,7 @@ async fn verify_webhook_source_verification_call(
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let router_data = construct_webhook_router_data(
+ state,
connector_name,
merchant_connector_account,
merchant_account,
diff --git a/crates/router/src/core/webhooks/incoming_v2.rs b/crates/router/src/core/webhooks/incoming_v2.rs
index 569cd330a0..39b7091e73 100644
--- a/crates/router/src/core/webhooks/incoming_v2.rs
+++ b/crates/router/src/core/webhooks/incoming_v2.rs
@@ -665,6 +665,7 @@ async fn verify_webhook_source_verification_call(
.change_context(errors::ConnectorError::WebhookSourceVerificationFailed)?;
let router_data = construct_webhook_router_data(
+ state,
connector_name,
merchant_connector_account,
merchant_account,
diff --git a/crates/router/src/core/webhooks/utils.rs b/crates/router/src/core/webhooks/utils.rs
index b21ec0056c..256fae78d4 100644
--- a/crates/router/src/core/webhooks/utils.rs
+++ b/crates/router/src/core/webhooks/utils.rs
@@ -11,6 +11,7 @@ use crate::{
db::{get_and_deserialize_key, StorageInterface},
services::logger,
types::{self, api, domain, PaymentAddress},
+ SessionState,
};
const IRRELEVANT_ATTEMPT_ID_IN_SOURCE_VERIFICATION_FLOW: &str =
@@ -57,6 +58,7 @@ pub async fn is_webhook_event_disabled(
}
pub async fn construct_webhook_router_data<'a>(
+ state: &SessionState,
connector_name: &str,
merchant_connector_account: domain::MerchantConnectorAccount,
merchant_account: &domain::MerchantAccount,
@@ -74,6 +76,7 @@ pub async fn construct_webhook_router_data<'a>(
merchant_id: merchant_account.get_id().clone(),
connector: connector_name.to_string(),
customer_id: None,
+ tenant_id: state.tenant.tenant_id.clone(),
payment_id: common_utils::id_type::PaymentId::get_irrelevant_id("source_verification_flow")
.get_string_repr()
.to_owned(),
diff --git a/crates/router/src/services/conversion_impls.rs b/crates/router/src/services/conversion_impls.rs
index 9bb88cf4ec..8572add041 100644
--- a/crates/router/src/services/conversion_impls.rs
+++ b/crates/router/src/services/conversion_impls.rs
@@ -1,3 +1,4 @@
+use common_utils::id_type;
use error_stack::ResultExt;
#[cfg(feature = "frm")]
use hyperswitch_domain_models::router_data_v2::flow_common_types::FrmFlowData;
@@ -23,17 +24,19 @@ fn get_irrelevant_id_string(id_name: &str, flow_name: &str) -> String {
format!("irrelevant {id_name} in {flow_name} flow")
}
fn get_default_router_data<F, Req, Resp>(
+ tenant_id: id_type::TenantId,
flow_name: &str,
request: Req,
response: Result<Resp, router_data::ErrorResponse>,
) -> RouterData<F, Req, Resp> {
RouterData {
+ tenant_id,
flow: std::marker::PhantomData,
- merchant_id: common_utils::id_type::MerchantId::get_irrelevant_merchant_id(),
+ merchant_id: id_type::MerchantId::get_irrelevant_merchant_id(),
customer_id: None,
connector_customer: None,
connector: get_irrelevant_id_string("connector", flow_name),
- payment_id: common_utils::id_type::PaymentId::get_irrelevant_id(flow_name)
+ payment_id: id_type::PaymentId::get_irrelevant_id(flow_name)
.get_string_repr()
.to_owned(),
attempt_id: get_irrelevant_id_string("attempt_id", flow_name),
@@ -93,6 +96,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for AccessTo
let resource_common_data = Self {};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -109,7 +113,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for AccessTo
let Self {} = new_router_data.resource_common_data;
let request = new_router_data.request.clone();
let response = new_router_data.response.clone();
- let router_data = get_default_router_data("access token", request, response);
+ let router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "access token",
+ request,
+ response,
+ );
Ok(router_data)
}
}
@@ -153,6 +162,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -196,8 +206,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PaymentF
connector_response,
payment_method_status,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("payment", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "payment",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.merchant_id = merchant_id;
router_data.customer_id = customer_id;
router_data.connector_customer = connector_customer;
@@ -256,6 +270,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for RefundFl
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -282,8 +297,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for RefundFl
connector_request_reference_id,
refund_id,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("refund", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "refund",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.merchant_id = merchant_id;
router_data.customer_id = customer_id;
router_data.payment_id = payment_id;
@@ -323,6 +342,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for Disputes
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -348,6 +368,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for Disputes
dispute_id,
} = new_router_data.resource_common_data;
let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
"Disputes",
new_router_data.request,
new_router_data.response,
@@ -386,6 +407,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FrmFlowD
minor_amount_captured: old_router_data.minor_amount_captured,
};
Ok(RouterDataV2 {
+ tenant_id: old_router_data.tenant_id.clone(),
flow: std::marker::PhantomData,
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
@@ -412,8 +434,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FrmFlowD
amount_captured,
minor_amount_captured,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("frm", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "frm",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.merchant_id = merchant_id;
router_data.payment_id = payment_id;
@@ -446,6 +472,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FilesFlo
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -466,8 +493,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for FilesFlo
connector_meta_data,
connector_request_reference_id,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("files", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "files",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.merchant_id = merchant_id;
router_data.payment_id = payment_id;
router_data.attempt_id = attempt_id;
@@ -489,6 +520,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for WebhookS
merchant_id: old_router_data.merchant_id.clone(),
};
Ok(RouterDataV2 {
+ tenant_id: old_router_data.tenant_id.clone(),
flow: std::marker::PhantomData,
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
@@ -505,6 +537,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for WebhookS
{
let Self { merchant_id } = new_router_data.resource_common_data;
let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
"webhook source verify",
new_router_data.request,
new_router_data.response,
@@ -532,6 +565,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for MandateR
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -551,6 +585,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for MandateR
payment_id,
} = new_router_data.resource_common_data;
let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
"mandate revoke",
new_router_data.request,
new_router_data.response,
@@ -559,7 +594,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for MandateR
router_data.customer_id = Some(customer_id);
router_data.payment_id = payment_id
.unwrap_or_else(|| {
- common_utils::id_type::PaymentId::get_irrelevant_id("mandate revoke")
+ id_type::PaymentId::get_irrelevant_id("mandate revoke")
.get_string_repr()
.to_owned()
})
@@ -588,6 +623,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PayoutFl
quote_id: old_router_data.quote_id.clone(),
};
Ok(RouterDataV2 {
+ tenant_id: old_router_data.tenant_id.clone(),
flow: std::marker::PhantomData,
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
@@ -613,8 +649,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for PayoutFl
payout_method_data,
quote_id,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("payout", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "payout",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.merchant_id = merchant_id;
router_data.customer_id = customer_id;
router_data.connector_customer = connector_customer;
@@ -642,6 +682,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
address: old_router_data.address.clone(),
};
Ok(RouterDataV2 {
+ tenant_id: old_router_data.tenant_id.clone(),
flow: std::marker::PhantomData,
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
@@ -662,6 +703,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp>
address,
} = new_router_data.resource_common_data;
let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
"external authentication",
new_router_data.request,
new_router_data.response,
@@ -692,6 +734,7 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowD
};
Ok(RouterDataV2 {
flow: std::marker::PhantomData,
+ tenant_id: old_router_data.tenant_id.clone(),
resource_common_data,
connector_auth_type: old_router_data.connector_auth_type.clone(),
request: old_router_data.request.clone(),
@@ -709,8 +752,12 @@ impl<T, Req: Clone, Resp: Clone> RouterDataConversion<T, Req, Resp> for UasFlowD
authenticate_by,
source_authentication_id,
} = new_router_data.resource_common_data;
- let mut router_data =
- get_default_router_data("uas", new_router_data.request, new_router_data.response);
+ let mut router_data = get_default_router_data(
+ new_router_data.tenant_id.clone(),
+ "uas",
+ new_router_data.request,
+ new_router_data.response,
+ );
router_data.connector = authenticate_by;
router_data.authentication_id = Some(source_authentication_id);
Ok(router_data)
diff --git a/crates/router/src/types.rs b/crates/router/src/types.rs
index f9c9e6edb2..2ae2af9247 100644
--- a/crates/router/src/types.rs
+++ b/crates/router/src/types.rs
@@ -914,6 +914,7 @@ impl<F1, F2, T1, T2> ForeignFrom<(&RouterData<F1, T1, PaymentsResponseData>, T2)
merchant_id: data.merchant_id.clone(),
connector: data.connector.clone(),
attempt_id: data.attempt_id.clone(),
+ tenant_id: data.tenant_id.clone(),
status: data.status,
payment_method: data.payment_method,
connector_auth_type: data.connector_auth_type.clone(),
@@ -983,6 +984,7 @@ impl<F1, F2>
merchant_id: data.merchant_id.clone(),
connector: data.connector.clone(),
attempt_id: data.attempt_id.clone(),
+ tenant_id: data.tenant_id.clone(),
status: data.status,
payment_method: data.payment_method,
connector_auth_type: data.connector_auth_type.clone(),
diff --git a/crates/router/src/types/api/verify_connector.rs b/crates/router/src/types/api/verify_connector.rs
index 47d8add58c..4d248bbf0b 100644
--- a/crates/router/src/types/api/verify_connector.rs
+++ b/crates/router/src/types/api/verify_connector.rs
@@ -65,6 +65,7 @@ impl VerifyConnectorData {
fn get_router_data<F, R1, R2>(
&self,
+ state: &SessionState,
request_data: R1,
access_token: Option<types::AccessToken>,
) -> types::RouterData<F, R1, R2> {
@@ -81,6 +82,7 @@ impl VerifyConnectorData {
attempt_id: attempt_id.clone(),
description: None,
customer_id: None,
+ tenant_id: state.tenant.tenant_id.clone(),
merchant_id: common_utils::id_type::MerchantId::default(),
reference_id: None,
access_token,
@@ -132,7 +134,7 @@ pub trait VerifyConnector {
) -> errors::RouterResponse<()> {
let authorize_data = connector_data.get_payment_authorize_data();
let access_token = Self::get_access_token(state, connector_data.clone()).await?;
- let router_data = connector_data.get_router_data(authorize_data, access_token);
+ let router_data = connector_data.get_router_data(state, authorize_data, access_token);
let request = connector_data
.connector
diff --git a/crates/router/src/types/api/verify_connector/paypal.rs b/crates/router/src/types/api/verify_connector/paypal.rs
index f7de86ceeb..d7c4fca748 100644
--- a/crates/router/src/types/api/verify_connector/paypal.rs
+++ b/crates/router/src/types/api/verify_connector/paypal.rs
@@ -17,7 +17,7 @@ impl VerifyConnector for connector::Paypal {
) -> errors::CustomResult<Option<types::AccessToken>, errors::ApiErrorResponse> {
let token_data: types::AccessTokenRequestData =
connector_data.connector_auth.clone().try_into()?;
- let router_data = connector_data.get_router_data(token_data, None);
+ let router_data = connector_data.get_router_data(state, token_data, None);
let request = connector_data
.connector
diff --git a/crates/router/tests/connectors/aci.rs b/crates/router/tests/connectors/aci.rs
index 645b81e706..8b3372d7de 100644
--- a/crates/router/tests/connectors/aci.rs
+++ b/crates/router/tests/connectors/aci.rs
@@ -27,6 +27,7 @@ fn construct_payment_router_data() -> types::PaymentsAuthorizeRouterData {
flow: PhantomData,
merchant_id,
customer_id: Some(id_type::CustomerId::try_from(Cow::from("aci")).unwrap()),
+ tenant_id: id_type::TenantId::try_from_string("public".to_string()).unwrap(),
connector: "aci".to_string(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
@@ -145,6 +146,7 @@ fn construct_refund_router_data<F>() -> types::RefundsRouterData<F> {
flow: PhantomData,
merchant_id,
customer_id: Some(id_type::CustomerId::try_from(Cow::from("aci")).unwrap()),
+ tenant_id: id_type::TenantId::try_from_string("public".to_string()).unwrap(),
connector: "aci".to_string(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rs
index 03ea1f42e8..2cf3dc965f 100644
--- a/crates/router/tests/connectors/utils.rs
+++ b/crates/router/tests/connectors/utils.rs
@@ -490,6 +490,8 @@ pub trait ConnectorActions: Connector {
merchant_id,
customer_id: Some(common_utils::generate_customer_id_of_default_length()),
connector: self.get_name(),
+ tenant_id: common_utils::id_type::TenantId::try_from_string("public".to_string())
+ .unwrap(),
payment_id: uuid::Uuid::new_v4().to_string(),
attempt_id: uuid::Uuid::new_v4().to_string(),
status: enums::AttemptStatus::default(),