feat(multitenancy): add support for multitenancy and handle the same in router, producer, consumer, drainer and analytics (#4630)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Arun Raj M <jarnura47@gmail.com>
This commit is contained in:
Jagan
2024-06-03 17:57:30 +05:30
committed by GitHub
parent a1788b8da9
commit 15d6c3e846
188 changed files with 2260 additions and 1414 deletions

View File

@ -25,7 +25,7 @@ use crate::{
consts,
core::errors::{self, RouterResult, StorageErrorExt},
db::StorageInterface,
routes::AppState,
routes::SessionState,
types::{
self, domain,
storage::{self, enums},
@ -45,7 +45,7 @@ const IRRELEVANT_ATTEMPT_ID_IN_DISPUTE_FLOW: &str = "irrelevant_attempt_id_in_di
#[cfg(feature = "payouts")]
#[instrument(skip_all)]
pub async fn get_mca_for_payout<'a>(
state: &'a AppState,
state: &'a SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
@ -72,7 +72,7 @@ pub async fn get_mca_for_payout<'a>(
#[cfg(feature = "payouts")]
#[instrument(skip_all)]
pub async fn construct_payout_router_data<'a, F>(
state: &'a AppState,
state: &'a SessionState,
connector_name: &api_models::enums::Connector,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
@ -214,7 +214,7 @@ pub async fn construct_payout_router_data<'a, F>(
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_refund_router_data<'a, F>(
state: &'a AppState,
state: &'a SessionState,
connector_id: &str,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
@ -263,7 +263,7 @@ pub async fn construct_refund_router_data<'a, F>(
.change_context(errors::ApiErrorResponse::InternalServerError)?;
let webhook_url = Some(helpers::create_webhook_url(
&state.conf.server.base_url.clone(),
&state.base_url.clone(),
&merchant_account.merchant_id,
&connector_id.to_string(),
));
@ -513,7 +513,7 @@ pub fn validate_dispute_stage_and_dispute_status(
#[instrument(skip_all)]
pub async fn construct_accept_dispute_router_data<'a>(
state: &'a AppState,
state: &'a SessionState,
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
@ -607,7 +607,7 @@ pub async fn construct_accept_dispute_router_data<'a>(
#[instrument(skip_all)]
pub async fn construct_submit_evidence_router_data<'a>(
state: &'a AppState,
state: &'a SessionState,
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
@ -701,7 +701,7 @@ pub async fn construct_submit_evidence_router_data<'a>(
#[instrument(skip_all)]
#[allow(clippy::too_many_arguments)]
pub async fn construct_upload_file_router_data<'a>(
state: &'a AppState,
state: &'a SessionState,
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
@ -799,7 +799,7 @@ pub async fn construct_upload_file_router_data<'a>(
#[instrument(skip_all)]
pub async fn construct_defend_dispute_router_data<'a>(
state: &'a AppState,
state: &'a SessionState,
payment_intent: &'a storage::PaymentIntent,
payment_attempt: &storage::PaymentAttempt,
merchant_account: &domain::MerchantAccount,
@ -895,7 +895,7 @@ pub async fn construct_defend_dispute_router_data<'a>(
#[instrument(skip_all)]
pub async fn construct_retrieve_file_router_data<'a>(
state: &'a AppState,
state: &'a SessionState,
merchant_account: &domain::MerchantAccount,
key_store: &domain::MerchantKeyStore,
file_metadata: &diesel_models::file::FileMetadata,