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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(platform): `make_pm_data` to work with platform setup (#11017)
Sandeep Kumarc942eccf0957
diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rsindex 44f4388314..3b9741b735 100644--- a/crates/router/src/core/payment_methods.rs+++ b/crates/router/src/core/payment_methods.rs@@ -105,7 +105,7 @@ pub async fn retrieve_payment_method_core(state: &SessionState,payment_intent: &PaymentIntent,payment_attempt: &PaymentAttempt,- merchant_key_store: &domain::MerchantKeyStore,+ provider: &domain::Provider,business_profile: Option<&domain::Profile>,) -> RouterResult<(Option<domain::PaymentMethodData>, Option<String>)> {match pm_data {@@ -116,7 +116,7 @@ pub async fn retrieve_payment_method_core(payment_intent,enums::PaymentMethod::Card,pm,- merchant_key_store,+ provider.get_key_store(),business_profile,).await?;@@ -129,7 +129,7 @@ pub async fn retrieve_payment_method_core(payment_intent,enums::PaymentMethod::BankDebit,pm,- merchant_key_store,+ provider.get_key_store(),business_profile,).await?;@@ -154,7 +154,7 @@ pub async fn retrieve_payment_method_core(payment_intent,enums::PaymentMethod::BankTransfer,pm,- merchant_key_store,+ provider.get_key_store(),business_profile,).await?;@@ -168,7 +168,7 @@ pub async fn retrieve_payment_method_core(payment_intent,enums::PaymentMethod::Wallet,pm,- merchant_key_store,+ provider.get_key_store(),business_profile,).await?;@@ -182,7 +182,7 @@ pub async fn retrieve_payment_method_core(payment_intent,enums::PaymentMethod::BankRedirect,pm,- merchant_key_store,+ provider.get_key_store(),business_profile,).await?;@@ -532,7 +532,7 @@ pub async fn retrieve_payment_method_with_token(#[allow(clippy::too_many_arguments)]pub async fn retrieve_payment_method_with_token(state: &SessionState,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,token_data: &storage::PaymentTokenData,payment_intent: &PaymentIntent,payment_attempt: &PaymentAttempt,@@ -552,7 +552,7 @@ pub async fn retrieve_payment_method_with_token(&generic_token.token,payment_intent,payment_attempt,- merchant_key_store,+ platform.get_provider().get_key_store(),card_token_data,).await?@@ -572,7 +572,7 @@ pub async fn retrieve_payment_method_with_token(&generic_token.token,payment_intent,payment_attempt,- merchant_key_store,+ platform.get_provider().get_key_store(),card_token_data,).await?@@ -596,7 +596,7 @@ pub async fn retrieve_payment_method_with_token(.unwrap_or(&card_token.token),payment_intent,card_token_data,- merchant_key_store,+ platform,storage_scheme,mandate_id,payment_method_info@@ -636,7 +636,7 @@ pub async fn retrieve_payment_method_with_token(.unwrap_or(&card_token.token),payment_intent,card_token_data,- merchant_key_store,+ platform,storage_scheme,mandate_id,payment_method_info@@ -669,7 +669,7 @@ pub async fn retrieve_payment_method_with_token(storage::PaymentTokenData::AuthBankDebit(auth_token) => {pm_auth::retrieve_payment_method_from_auth_service(state,- merchant_key_store,+ platform.get_processor(),auth_token,payment_intent,customer,@@ -706,9 +706,8 @@ pub async fn retrieve_payment_method_with_token(let bank_debit_detail = cards::get_bank_debit_from_hs_locker(state,- merchant_key_store,+ platform.get_provider(),&customer.customer_id,- &merchant_key_store.merchant_id,locker_id,).await?;diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex f46086884a..1bd71f49b7 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -5001,16 +5001,20 @@ pub async fn get_bank_from_vault(#[cfg(feature = "v1")]pub async fn get_bank_debit_from_hs_locker(state: &routes::SessionState,- key_store: &domain::MerchantKeyStore,+ provider: &domain::Provider,customer_id: &id_type::CustomerId,- merchant_id: &id_type::MerchantId,token_ref: &str,) -> errors::RouterResult<api_models::payment_methods::BankDebitDetail> {- let payment_method =- get_encrypted_data_from_vault(state, key_store, customer_id, merchant_id, token_ref)- .await- .change_context(errors::ApiErrorResponse::InternalServerError)- .attach_printable("Error getting payment method from locker")?;+ let payment_method = get_encrypted_data_from_vault(+ state,+ provider.get_key_store(),+ customer_id,+ provider.get_account().get_id(),+ token_ref,+ )+ .await+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable("Error getting payment method from locker")?;let bank_debit_create_data: api_models::payment_methods::BankDebitDetail = payment_method.peek()diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex c248db3662..f9061a7259 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -736,7 +736,7 @@ where&operation,&mut payment_data,&validate_result,- platform.get_processor().get_key_store(),+ platform,&customer,&business_profile,)@@ -4580,7 +4580,7 @@ whereoperation,payment_data,validate_result,- platform.get_processor().get_key_store(),+ platform,customer,business_profile,should_retry_with_pan,@@ -7715,7 +7715,7 @@ pub async fn get_connector_tokenization_action_when_confirm_true<F, Req, D>(operation: &BoxedOperation<'_, F, Req, D>,payment_data: &mut D,validate_result: &operations::ValidateResult,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -7783,7 +7783,7 @@ wherestate,payment_data,validate_result.storage_scheme,- merchant_key_store,+ platform,customer,business_profile,should_retry_with_pan,@@ -7802,7 +7802,7 @@ wherestate,payment_data,validate_result.storage_scheme,- merchant_key_store,+ platform,customer,business_profile,should_retry_with_pan,@@ -7855,7 +7855,7 @@ pub async fn tokenize_in_router_when_confirm_false_or_external_authentication<F,operation: &BoxedOperation<'_, F, Req, D>,payment_data: &mut D,validate_result: &operations::ValidateResult,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,) -> RouterResult<D>@@ -7875,7 +7875,7 @@ wherestate,payment_data,validate_result.storage_scheme,- merchant_key_store,+ platform,customer,business_profile,false,@@ -10811,7 +10811,7 @@ pub async fn payment_external_authentication<F: Clone + Sync>(&state,&payment_attempt,&payment_intent,- platform.get_processor().get_key_store(),+ &platform,storage_scheme,).await?diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 3bd8979140..d9019fdf29 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -2434,7 +2434,7 @@ pub async fn retrieve_payment_method_data_with_permanent_token(_payment_method_id: &str,payment_intent: &PaymentIntent,card_token_data: Option<&domain::CardToken>,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,_storage_scheme: enums::MerchantStorageScheme,mandate_id: Option<api_models::payments::MandateIds>,payment_method_info: domain::PaymentMethod,@@ -2491,12 +2491,11 @@ pub async fn retrieve_payment_method_data_with_permanent_token(Box::pin(fetch_card_details_from_locker(state,customer_id,- &payment_intent.merchant_id,+ platform,locker_id,card_token_data,co_badged_card_data,payment_method_info,- merchant_key_store,)).await})@@ -2544,12 +2543,11 @@ pub async fn retrieve_payment_method_data_with_permanent_token(Box::pin(fetch_card_details_from_locker(state,customer_id,- &payment_intent.merchant_id,+ platform,locker_id,card_token_data,co_badged_card_data,payment_method_info,- merchant_key_store,)).await})@@ -2624,12 +2622,11 @@ pub async fn retrieve_card_with_permanent_token_for_external_authentication(pub async fn fetch_card_details_from_locker(state: &SessionState,customer_id: &id_type::CustomerId,- merchant_id: &id_type::MerchantId,+ platform: &domain::Platform,locker_id: &str,card_token_data: Option<&domain::CardToken>,co_badged_card_data: Option<api_models::payment_methods::CoBadgedCardData>,payment_method_info: domain::PaymentMethod,- merchant_key_store: &domain::MerchantKeyStore,) -> RouterResult<domain::Card> {match &payment_method_info.vault_source_details.clone() {domain::PaymentMethodVaultSourceDetails::ExternalVault {@@ -2637,11 +2634,11 @@ pub async fn fetch_card_details_from_locker(} => {fetch_card_details_from_external_vault(state,- merchant_id,+ platform.get_processor().get_account().get_id(),card_token_data,co_badged_card_data,payment_method_info,- merchant_key_store,+ platform.get_processor().get_key_store(),external_vault_source,).await@@ -2650,7 +2647,7 @@ pub async fn fetch_card_details_from_locker(fetch_card_details_from_internal_locker(state,customer_id,- merchant_id,+ platform.get_provider().get_account().get_id(),locker_id,card_token_data,co_badged_card_data,@@ -2985,7 +2982,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(_operation: BoxedOperation<'a, F, R, D>,_state: &'a SessionState,_payment_data: &mut PaymentData<F>,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_storage_scheme: common_enums::enums::MerchantStorageScheme,_business_profile: Option<&domain::Profile>,@@ -3003,7 +3000,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(operation: BoxedOperation<'a, F, R, D>,state: &'a SessionState,payment_data: &mut PaymentData<F>,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,storage_scheme: common_enums::enums::MerchantStorageScheme,business_profile: &domain::Profile,@@ -3073,7 +3070,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(let pm_data = Box::pin(payment_methods::retrieve_payment_method_with_token(state,- merchant_key_store,+ platform,hyperswitch_token,&payment_data.payment_intent,&payment_data.payment_attempt,@@ -3108,7 +3105,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(state,&payment_data.payment_intent,&payment_data.payment_attempt,- merchant_key_store,+ platform.get_provider(),Some(business_profile),).await?;@@ -3138,7 +3135,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>(state,&payment_data.payment_intent,&payment_data.payment_attempt,- merchant_key_store,+ platform.get_provider(),Some(business_profile),).await?;@@ -7488,7 +7485,7 @@ pub async fn get_payment_method_details_from_payment_token(state: &SessionState,payment_attempt: &PaymentAttempt,payment_intent: &PaymentIntent,- key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,storage_scheme: enums::MerchantStorageScheme,) -> RouterResult<Option<(domain::PaymentMethodData, enums::PaymentMethod)>> {let hyperswitch_token = if let Some(token) = payment_attempt.payment_token.clone() {@@ -7546,7 +7543,7 @@ pub async fn get_payment_method_details_from_payment_token(&generic_token.token,payment_intent,payment_attempt,- key_store,+ platform.get_provider().get_key_store(),None,).await@@ -7558,7 +7555,7 @@ pub async fn get_payment_method_details_from_payment_token(&generic_token.token,payment_intent,payment_attempt,- key_store,+ platform.get_provider().get_key_store(),None,).await@@ -7570,7 +7567,7 @@ pub async fn get_payment_method_details_from_payment_token(&card_token.token,payment_intent,None,- key_store,+ platform.get_provider().get_key_store(),storage_scheme,).await@@ -7583,7 +7580,7 @@ pub async fn get_payment_method_details_from_payment_token(&card_token.token,payment_intent,None,- key_store,+ platform.get_provider().get_key_store(),storage_scheme,).await@@ -7593,7 +7590,7 @@ pub async fn get_payment_method_details_from_payment_token(storage::PaymentTokenData::AuthBankDebit(auth_token) => {retrieve_payment_method_from_auth_service(state,- key_store,+ platform.get_processor(),&auth_token,payment_intent,&None,diff --git a/crates/router/src/core/payments/operations.rs b/crates/router/src/core/payments/operations.rsindex 75f81db109..474b70c422 100644--- a/crates/router/src/core/payments/operations.rs+++ b/crates/router/src/core/payments/operations.rs@@ -317,7 +317,7 @@ pub trait Domain<F: Clone, R, D>: Send + Sync {state: &'a SessionState,payment_data: &mut D,storage_scheme: enums::MerchantStorageScheme,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -667,7 +667,7 @@ where_state: &'a SessionState,_payment_data: &mut D,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,@@ -772,7 +772,7 @@ where_state: &'a SessionState,_payment_data: &mut D,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,@@ -887,7 +887,7 @@ where_state: &'a SessionState,_payment_data: &mut D,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,@@ -980,7 +980,7 @@ where_state: &'a SessionState,_payment_data: &mut D,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rsindex ad53e724da..ff23901874 100644--- a/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs+++ b/crates/router/src/core/payments/operations/external_vault_proxy_payment_intent.rs@@ -337,7 +337,7 @@ impl<F: Clone + Send + Sync> Domain<F, ExternalVaultProxyPaymentsRequest, Paymen_state: &'a SessionState,_payment_data: &mut PaymentConfirmData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_attempt_list.rs b/crates/router/src/core/payments/operations/payment_attempt_list.rsindex 151327f544..665a81f343 100644--- a/crates/router/src/core/payments/operations/payment_attempt_list.rs+++ b/crates/router/src/core/payments/operations/payment_attempt_list.rs@@ -185,7 +185,7 @@ impl<F: Clone + Send + Sync>_state: &'a SessionState,_payment_data: &mut payments::PaymentAttemptListData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_attempt_record.rs b/crates/router/src/core/payments/operations/payment_attempt_record.rsindex 902f91468b..ed5fff1199 100644--- a/crates/router/src/core/payments/operations/payment_attempt_record.rs+++ b/crates/router/src/core/payments/operations/payment_attempt_record.rs@@ -341,7 +341,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsAttemptRecordRequest, PaymentAtte_state: &'a SessionState,_payment_data: &mut PaymentAttemptRecordData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rsindex cf5801ce35..5c3f2d1d04 100644--- a/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs+++ b/crates/router/src/core/payments/operations/payment_cancel_post_capture.rs@@ -249,7 +249,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsCancelPostCaptureRequest, Pa_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_cancel_v2.rs b/crates/router/src/core/payments/operations/payment_cancel_v2.rsindex a619c3bfa7..0254429b1c 100644--- a/crates/router/src/core/payments/operations/payment_cancel_v2.rs+++ b/crates/router/src/core/payments/operations/payment_cancel_v2.rs@@ -260,7 +260,7 @@ impl<F: Send + Clone + Sync>_state: &'a SessionState,_payment_data: &mut hyperswitch_domain_models::payments::PaymentCancelData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_capture_v2.rs b/crates/router/src/core/payments/operations/payment_capture_v2.rsindex f80359421a..b23fa4c291 100644--- a/crates/router/src/core/payments/operations/payment_capture_v2.rs+++ b/crates/router/src/core/payments/operations/payment_capture_v2.rs@@ -239,7 +239,7 @@ impl<F: Clone + Send> Domain<F, PaymentsCaptureRequest, PaymentCaptureData<F>> f_state: &'a SessionState,_payment_data: &mut PaymentCaptureData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_complete_authorize.rs b/crates/router/src/core/payments/operations/payment_complete_authorize.rsindex 2c0655ca5c..030940fc12 100644--- a/crates/router/src/core/payments/operations/payment_complete_authorize.rs+++ b/crates/router/src/core/payments/operations/payment_complete_authorize.rs@@ -453,7 +453,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forstate: &'a SessionState,payment_data: &mut PaymentData<F>,storage_scheme: storage_enums::MerchantStorageScheme,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -466,7 +466,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forBox::new(self),state,payment_data,- merchant_key_store,+ platform,customer,storage_scheme,business_profile,diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rsindex 092eb6e3b6..7f9eb37ced 100644--- a/crates/router/src/core/payments/operations/payment_confirm.rs+++ b/crates/router/src/core/payments/operations/payment_confirm.rs@@ -984,7 +984,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forstate: &'a SessionState,payment_data: &mut PaymentData<F>,storage_scheme: storage_enums::MerchantStorageScheme,- key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -997,7 +997,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forBox::new(self),state,payment_data,- key_store,+ platform,customer,storage_scheme,business_profile,diff --git a/crates/router/src/core/payments/operations/payment_confirm_intent.rs b/crates/router/src/core/payments/operations/payment_confirm_intent.rsindex 19fa7575e0..00cb47e776 100644--- a/crates/router/src/core/payments/operations/payment_confirm_intent.rs+++ b/crates/router/src/core/payments/operations/payment_confirm_intent.rs@@ -498,7 +498,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsConfirmIntentRequest, PaymentConfstate: &'a SessionState,payment_data: &mut PaymentConfirmData<F>,storage_scheme: storage_enums::MerchantStorageScheme,- key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rsindex 762695384b..24582ccd00 100644--- a/crates/router/src/core/payments/operations/payment_create.rs+++ b/crates/router/src/core/payments/operations/payment_create.rs@@ -789,7 +789,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forstate: &'a SessionState,payment_data: &mut PaymentData<F>,storage_scheme: enums::MerchantStorageScheme,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -802,7 +802,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forBox::new(self),state,payment_data,- merchant_key_store,+ platform,customer,storage_scheme,business_profile,diff --git a/crates/router/src/core/payments/operations/payment_create_intent.rs b/crates/router/src/core/payments/operations/payment_create_intent.rsindex 74f83d29ad..eb0db904c9 100644--- a/crates/router/src/core/payments/operations/payment_create_intent.rs+++ b/crates/router/src/core/payments/operations/payment_create_intent.rs@@ -265,7 +265,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsCreateIntentRequest, payments::Pa_state: &'a SessionState,_payment_data: &mut payments::PaymentIntentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_get.rs b/crates/router/src/core/payments/operations/payment_get.rsindex fd996a24d4..bc756ab4b4 100644--- a/crates/router/src/core/payments/operations/payment_get.rs+++ b/crates/router/src/core/payments/operations/payment_get.rs@@ -284,7 +284,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsRetrieveRequest, PaymentStatusDat_state: &'a SessionState,_payment_data: &mut PaymentStatusData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_get_intent.rs b/crates/router/src/core/payments/operations/payment_get_intent.rsindex a2683acce9..bf8e7a70ac 100644--- a/crates/router/src/core/payments/operations/payment_get_intent.rs+++ b/crates/router/src/core/payments/operations/payment_get_intent.rs@@ -186,7 +186,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsGetIntentRequest, payments::Payme_state: &'a SessionState,_payment_data: &mut payments::PaymentIntentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs b/crates/router/src/core/payments/operations/payment_post_session_tokens.rsindex 5713f18a81..31a27efc32 100644--- a/crates/router/src/core/payments/operations/payment_post_session_tokens.rs+++ b/crates/router/src/core/payments/operations/payment_post_session_tokens.rs@@ -226,7 +226,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsPostSessionTokensRequest, Pa_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rsindex f92ad1ab72..f844c9441d 100644--- a/crates/router/src/core/payments/operations/payment_session.rs+++ b/crates/router/src/core/payments/operations/payment_session.rs@@ -379,7 +379,7 @@ where_state: &'b SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_session_intent.rs b/crates/router/src/core/payments/operations/payment_session_intent.rsindex 1e0ca8911d..a298931eb0 100644--- a/crates/router/src/core/payments/operations/payment_session_intent.rs+++ b/crates/router/src/core/payments/operations/payment_session_intent.rs@@ -255,7 +255,7 @@ impl<F: Clone + Send + Sync> Domain<F, PaymentsSessionRequest, payments::Payment_state: &'a SessionState,_payment_data: &mut payments::PaymentIntentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_start.rs b/crates/router/src/core/payments/operations/payment_start.rsindex fd86d6276a..b7283837ab 100644--- a/crates/router/src/core/payments/operations/payment_start.rs+++ b/crates/router/src/core/payments/operations/payment_start.rs@@ -349,7 +349,7 @@ wherestate: &'a SessionState,payment_data: &mut PaymentData<F>,storage_scheme: storage_enums::MerchantStorageScheme,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -369,7 +369,7 @@ whereBox::new(self),state,payment_data,- merchant_key_store,+ platform,customer,storage_scheme,business_profile,diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rsindex 404d56525a..4d1f11a657 100644--- a/crates/router/src/core/payments/operations/payment_status.rs+++ b/crates/router/src/core/payments/operations/payment_status.rs@@ -127,7 +127,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> for_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rsindex 8e676a85a6..b69b435251 100644--- a/crates/router/src/core/payments/operations/payment_update.rs+++ b/crates/router/src/core/payments/operations/payment_update.rs@@ -733,7 +733,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forstate: &'a SessionState,payment_data: &mut PaymentData<F>,storage_scheme: storage_enums::MerchantStorageScheme,- merchant_key_store: &domain::MerchantKeyStore,+ platform: &domain::Platform,customer: &Option<domain::Customer>,business_profile: &domain::Profile,should_retry_with_pan: bool,@@ -746,7 +746,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsRequest, PaymentData<F>> forBox::new(self),state,payment_data,- merchant_key_store,+ platform,customer,storage_scheme,business_profile,diff --git a/crates/router/src/core/payments/operations/payment_update_intent.rs b/crates/router/src/core/payments/operations/payment_update_intent.rsindex 010b67bb5a..a55ea0c3f8 100644--- a/crates/router/src/core/payments/operations/payment_update_intent.rs+++ b/crates/router/src/core/payments/operations/payment_update_intent.rs@@ -459,7 +459,7 @@ impl<F: Clone + Send> Domain<F, PaymentsUpdateIntentRequest, payments::PaymentIn_state: &'a SessionState,_payment_data: &mut payments::PaymentIntentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payment_update_metadata.rs b/crates/router/src/core/payments/operations/payment_update_metadata.rsindex 6287ce2227..cf2d2b78f3 100644--- a/crates/router/src/core/payments/operations/payment_update_metadata.rs+++ b/crates/router/src/core/payments/operations/payment_update_metadata.rs@@ -212,7 +212,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsUpdateMetadataRequest, Payme_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payments_extend_authorization.rs b/crates/router/src/core/payments/operations/payments_extend_authorization.rsindex 2d968017cc..86d8ab7579 100644--- a/crates/router/src/core/payments/operations/payments_extend_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_extend_authorization.rs@@ -254,7 +254,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsExtendAuthorizationRequest,_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs b/crates/router/src/core/payments/operations/payments_incremental_authorization.rsindex 1f729fa2e7..02f8bb5478 100644--- a/crates/router/src/core/payments/operations/payments_incremental_authorization.rs+++ b/crates/router/src/core/payments/operations/payments_incremental_authorization.rs@@ -357,7 +357,7 @@ impl<F: Clone + Send + Sync>_state: &'a SessionState,_payment_data: &mut payments::PaymentData<F>,_storage_scheme: enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/proxy_payments_intent.rs b/crates/router/src/core/payments/operations/proxy_payments_intent.rsindex e1fbc067b7..caa865c7ed 100644--- a/crates/router/src/core/payments/operations/proxy_payments_intent.rs+++ b/crates/router/src/core/payments/operations/proxy_payments_intent.rs@@ -300,7 +300,7 @@ impl<F: Clone + Send + Sync> Domain<F, ProxyPaymentsRequest, PaymentConfirmData<_state: &'a SessionState,_payment_data: &mut PaymentConfirmData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/payments/operations/tax_calculation.rs b/crates/router/src/core/payments/operations/tax_calculation.rsindex 36035fbd48..34b891b66d 100644--- a/crates/router/src/core/payments/operations/tax_calculation.rs+++ b/crates/router/src/core/payments/operations/tax_calculation.rs@@ -345,7 +345,7 @@ impl<F: Clone + Send + Sync> Domain<F, api::PaymentsDynamicTaxCalculationRequest_state: &'a SessionState,_payment_data: &mut PaymentData<F>,_storage_scheme: storage_enums::MerchantStorageScheme,- _merchant_key_store: &domain::MerchantKeyStore,+ _platform: &domain::Platform,_customer: &Option<domain::Customer>,_business_profile: &domain::Profile,_should_retry_with_pan: bool,diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rsindex 28455a0d88..cac2c62b49 100644--- a/crates/router/src/core/pm_auth.rs+++ b/crates/router/src/core/pm_auth.rs@@ -289,7 +289,7 @@ pub async fn exchange_token_core(let bank_account_details_resp = get_bank_account_creds(connector,- &platform,+ platform.get_processor(),connector_name,&access_token,auth_type,@@ -595,7 +595,7 @@ async fn store_in_db(pub async fn get_bank_account_creds(connector: PaymentAuthConnectorData,- platform: &domain::Platform,+ processor: &domain::Processor,connector_name: &str,access_token: &Secret<String>,auth_type: pm_auth_types::ConnectorAuthType,@@ -611,7 +611,7 @@ pub async fn get_bank_account_creds(let router_data_bank_details = pm_auth_types::BankDetailsRouterData {flow: std::marker::PhantomData,- merchant_id: Some(platform.get_processor().get_account().get_id().clone()),+ merchant_id: Some(processor.get_account().get_id().clone()),connector: Some(connector_name.to_string()),request: pm_auth_types::BankAccountCredentialsRequest {access_token: access_token.clone(),@@ -764,7 +764,7 @@ pub async fn retrieve_payment_method_from_auth_service(#[cfg(feature = "v1")]pub async fn retrieve_payment_method_from_auth_service(state: &SessionState,- key_store: &domain::MerchantKeyStore,+ processor: &domain::Processor,auth_token: &payment_methods::BankAccountTokenData,payment_intent: &PaymentIntent,_customer: &Option<domain::Customer>,@@ -774,17 +774,13 @@ pub async fn retrieve_payment_method_from_auth_service(let connector = PaymentAuthConnectorData::get_connector_by_name(auth_token.connector_details.connector.as_str(),)?;- let merchant_account = db- .find_merchant_account_by_merchant_id(&payment_intent.merchant_id, key_store)- .await- .to_not_found_response(ApiErrorResponse::MerchantAccountNotFound)?;#[cfg(feature = "v1")]let mca = db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(- &payment_intent.merchant_id,+ &payment_intent.processor_merchant_id,&auth_token.connector_details.mca_id,- key_store,+ processor.get_key_store(),).await.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {@@ -804,16 +800,9 @@ pub async fn retrieve_payment_method_from_auth_service(let BankAccountAccessCreds::AccessToken(access_token) =&auth_token.connector_details.access_token;- let platform = domain::Platform::new(- merchant_account.clone(),- key_store.clone(),- merchant_account.clone(),- key_store.clone(),- None,- );let bank_account_creds = get_bank_account_creds(connector,- &platform,+ processor,&auth_token.connector_details.connector,access_token,auth_type,