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
refactor(router): add domain type for merchant_connector_account id (#5685)
Sai Harsha Vardhan771f48cfe0ec
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.jsonindex 48739ac77f..5c57891d10 100644--- a/api-reference-v2/openapi_spec.json+++ b/api-reference-v2/openapi_spec.json@@ -8537,12 +8537,6 @@"example": "\n[{\"gateway\":\"stripe\",\"payment_methods\":[{\"payment_method\":\"card\",\"payment_method_types\":[{\"payment_method_type\":\"credit\",\"card_networks\":[\"Visa\"],\"flow\":\"pre\",\"action\":\"cancel_txn\"},{\"payment_method_type\":\"debit\",\"card_networks\":[\"Visa\"],\"flow\":\"pre\"}]}]}]\n","nullable": true},- "merchant_connector_id": {- "type": "string",- "description": "Unique ID of the connector",- "example": "mca_5apGeP94tMts6rg3U3kR",- "nullable": true- },"pm_auth_config": {"type": "object","description": "pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt",diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rsindex 55a2444973..5b2432cda9 100644--- a/crates/api_models/src/admin.rs+++ b/crates/api_models/src/admin.rs@@ -670,16 +670,18 @@ pub struct MerchantId {any(feature = "v1", feature = "v2"),not(feature = "merchant_connector_account_v2")))]-#[derive(Default, Debug, Deserialize, ToSchema, Serialize)]+#[derive(Debug, Deserialize, ToSchema, Serialize)]pub struct MerchantConnectorId {#[schema(value_type = String)]pub merchant_id: id_type::MerchantId,- pub merchant_connector_id: String,+ #[schema(value_type = String)]+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,}#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]-#[derive(Default, Debug, Deserialize, ToSchema, Serialize)]+#[derive(Debug, Deserialize, ToSchema, Serialize)]pub struct MerchantConnectorId {- pub id: String,+ #[schema(value_type = String)]+ pub id: id_type::MerchantConnectorAccountId,}#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]@@ -757,10 +759,6 @@ pub struct MerchantConnectorCreate {#[schema(example = json!(consts::FRM_CONFIGS_EG))]pub frm_configs: Option<Vec<FrmConfigs>>,- /// Unique ID of the connector- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub merchant_connector_id: Option<String>,-/// pm_auth_config will relate MCA records to their respective chosen auth services, based on payment_method and pmt#[schema(value_type = Option<Object>)]pub pm_auth_config: Option<pii::SecretSerdeValue>,@@ -904,8 +902,8 @@ pub struct MerchantConnectorCreate {pub business_sub_label: Option<String>,/// Unique ID of the connector- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub merchant_connector_id: Option<String>,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = Option<String>)]+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,#[schema(value_type = Option<Object>)]pub pm_auth_config: Option<pii::SecretSerdeValue>,@@ -1031,11 +1029,15 @@ pub struct MerchantConnectorWebhookDetails {#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ToSchema)]pub struct MerchantConnectorInfo {pub connector_label: String,- pub merchant_connector_id: String,+ #[schema(value_type = String)]+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,}impl MerchantConnectorInfo {- pub fn new(connector_label: String, merchant_connector_id: String) -> Self {+ pub fn new(+ connector_label: String,+ merchant_connector_id: id_type::MerchantConnectorAccountId,+ ) -> Self {Self {connector_label,merchant_connector_id,@@ -1060,8 +1062,8 @@ pub struct MerchantConnectorResponse {pub connector_label: Option<String>,/// Unique ID of the merchant connector account- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub id: id_type::MerchantConnectorAccountId,/// Identifier for the business profile, if not provided default will be chosen from merchant account#[schema(max_length = 64, value_type = String)]@@ -1167,8 +1169,8 @@ pub struct MerchantConnectorResponse {pub connector_label: Option<String>,/// Unique ID of the merchant connector account- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub merchant_connector_id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,/// Identifier for the business profile, if not provided default will be chosen from merchant account#[schema(max_length = 64, value_type = String)]@@ -1291,8 +1293,8 @@ pub struct MerchantConnectorListResponse {pub connector_label: Option<String>,/// Unique ID of the merchant connector account- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub merchant_connector_id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,/// Identifier for the business profile, if not provided default will be chosen from merchant account#[schema(max_length = 64, value_type = String)]@@ -1400,8 +1402,8 @@ pub struct MerchantConnectorListResponse {pub connector_label: Option<String>,/// Unique ID of the merchant connector account- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub id: id_type::MerchantConnectorAccountId,/// Identifier for the business profile, if not provided default will be chosen from merchant account#[schema(max_length = 64, value_type = String)]@@ -1760,8 +1762,8 @@ pub struct MerchantConnectorDeleteResponse {#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]pub merchant_id: id_type::MerchantId,/// Unique ID of the connector- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub merchant_connector_id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,/// If the connector is deleted or not#[schema(example = false)]pub deleted: bool,@@ -1774,8 +1776,8 @@ pub struct MerchantConnectorDeleteResponse {#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]pub merchant_id: id_type::MerchantId,/// Unique ID of the connector- #[schema(example = "mca_5apGeP94tMts6rg3U3kR")]- pub id: String,+ #[schema(example = "mca_5apGeP94tMts6rg3U3kR", value_type = String)]+ pub id: id_type::MerchantConnectorAccountId,/// If the connector is deleted or not#[schema(example = false)]pub deleted: bool,diff --git a/crates/api_models/src/connector_onboarding.rs b/crates/api_models/src/connector_onboarding.rsindex de4b8843df..2dca57d595 100644--- a/crates/api_models/src/connector_onboarding.rs+++ b/crates/api_models/src/connector_onboarding.rs@@ -1,9 +1,11 @@+use common_utils::id_type;+use super::{admin, enums};#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]pub struct ActionUrlRequest {pub connector: enums::Connector,- pub connector_id: String,+ pub connector_id: id_type::MerchantConnectorAccountId,pub return_url: String,}@@ -15,8 +17,8 @@ pub enum ActionUrlResponse {#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]pub struct OnboardingSyncRequest {- pub profile_id: common_utils::id_type::ProfileId,- pub connector_id: String,+ pub profile_id: id_type::ProfileId,+ pub connector_id: id_type::MerchantConnectorAccountId,pub connector: enums::Connector,}@@ -45,7 +47,7 @@ pub enum PayPalOnboardingStatus {#[derive(serde::Serialize, Debug, Clone)]pub struct PayPalOnboardingDone {- pub payer_id: common_utils::id_type::MerchantId,+ pub payer_id: id_type::MerchantId,}#[derive(serde::Serialize, Debug, Clone)]@@ -55,6 +57,6 @@ pub struct PayPalIntegrationDone {#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]pub struct ResetTrackingIdRequest {- pub connector_id: String,+ pub connector_id: id_type::MerchantConnectorAccountId,pub connector: enums::Connector,}diff --git a/crates/api_models/src/disputes.rs b/crates/api_models/src/disputes.rsindex 5e9db4cdfd..42803c519c 100644--- a/crates/api_models/src/disputes.rs+++ b/crates/api_models/src/disputes.rs@@ -47,7 +47,8 @@ pub struct DisputeResponse {#[schema(value_type = Option<String>)]pub profile_id: Option<common_utils::id_type::ProfileId>,/// The `merchant_connector_id` of the connector / processor through which the dispute was processed- pub merchant_connector_id: Option<String>,+ #[schema(value_type = Option<String>)]+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Clone, Debug, Serialize, ToSchema, Eq, PartialEq)]diff --git a/crates/api_models/src/mandates.rs b/crates/api_models/src/mandates.rsindex b62a2c38b9..44a8331942 100644--- a/crates/api_models/src/mandates.rs+++ b/crates/api_models/src/mandates.rs@@ -129,5 +129,6 @@ pub struct ProcessorPaymentToken {pub processor_payment_token: String,#[schema(value_type = Connector, example = "stripe")]pub connector: api_enums::Connector,- pub merchant_connector_id: String,+ #[schema(value_type = String)]+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,}diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rsindex de94d4f587..2204a7fc58 100644--- a/crates/api_models/src/payment_methods.rs+++ b/crates/api_models/src/payment_methods.rs@@ -215,7 +215,9 @@ pub struct PaymentMethodMigrate {}#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]-pub struct PaymentsMandateReference(pub HashMap<String, PaymentsMandateReferenceRecord>);+pub struct PaymentsMandateReference(+ pub HashMap<id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>,+);#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]pub struct PaymentsMandateReferenceRecord {@@ -733,7 +735,7 @@ pub struct BankAccountTokenData {pub struct BankAccountConnectorDetails {pub connector: String,pub account_id: masking::Secret<String>,- pub mca_id: String,+ pub mca_id: id_type::MerchantConnectorAccountId,pub access_token: BankAccountAccessCreds,}@@ -1983,7 +1985,7 @@ pub struct PaymentMethodRecord {pub billing_address_line2: Option<masking::Secret<String>>,pub billing_address_line3: Option<masking::Secret<String>>,pub raw_card_number: Option<masking::Secret<String>>,- pub merchant_connector_id: String,+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,pub original_transaction_amount: Option<i64>,pub original_transaction_currency: Option<common_enums::Currency>,pub line_number: Option<i64>,diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex be657cb948..04bcae4c56 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -3829,7 +3829,8 @@ pub struct PaymentsResponse {pub merchant_decision: Option<String>,/// Identifier of the connector ( merchant connector account ) which was chosen to make the payment- pub merchant_connector_id: Option<String>,+ #[schema(value_type = Option<String>)]+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,/// If true, incremental authorization can be performed on this payment, in case the funds authorized initially fall short.pub incremental_authorization_allowed: Option<bool>,@@ -4059,7 +4060,7 @@ pub struct PaymentListFilterConstraints {/// The list of authentication types to filter payments listpub authentication_type: Option<Vec<enums::AuthenticationType>>,/// The list of merchant connector ids to filter payments list for selected label- pub merchant_connector_id: Option<Vec<String>>,+ pub merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,/// The order in which payments list should be sorted#[serde(default)]pub order: Order,diff --git a/crates/api_models/src/payouts.rs b/crates/api_models/src/payouts.rsindex b6b040a36f..aad0cfcf30 100644--- a/crates/api_models/src/payouts.rs+++ b/crates/api_models/src/payouts.rs@@ -473,7 +473,7 @@ pub struct PayoutCreateResponse {/// Unique identifier of the merchant connector account#[schema(value_type = Option<String>, example = "mca_sAD3OZLATetvjLOYhUSy")]- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,/// Current status of the Payout#[schema(value_type = PayoutStatus, example = RequiresConfirmation)]diff --git a/crates/api_models/src/pm_auth.rs b/crates/api_models/src/pm_auth.rsindex 4a1c8eaa31..a949f618bd 100644--- a/crates/api_models/src/pm_auth.rs+++ b/crates/api_models/src/pm_auth.rs@@ -1,7 +1,7 @@use common_enums::{PaymentMethod, PaymentMethodType};use common_utils::{events::{ApiEventMetric, ApiEventsType},- impl_api_event_type,+ id_type, impl_api_event_type,};#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]@@ -46,7 +46,7 @@ pub struct PaymentMethodAuthConnectorChoice {pub payment_method: PaymentMethod,pub payment_method_type: PaymentMethodType,pub connector_name: String,- pub mca_id: String,+ pub mca_id: id_type::MerchantConnectorAccountId,}impl_api_event_type!(diff --git a/crates/api_models/src/refunds.rs b/crates/api_models/src/refunds.rsindex 656416dce9..1f3361d004 100644--- a/crates/api_models/src/refunds.rs+++ b/crates/api_models/src/refunds.rs@@ -159,7 +159,8 @@ pub struct RefundResponse {#[schema(value_type = Option<String>)]pub profile_id: Option<common_utils::id_type::ProfileId>,/// The merchant_connector_id of the processor through which this payment went through- pub merchant_connector_id: Option<String>,+ #[schema(value_type = Option<String>)]+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,/// Charge specific fields for controlling the revert of funds from either platform or connected account#[schema(value_type = Option<ChargeRefunds>)]pub charges: Option<ChargeRefunds>,@@ -186,7 +187,8 @@ pub struct RefundListRequest {/// The list of connectors to filter refunds listpub connector: Option<Vec<String>>,/// The list of merchant connector ids to filter the refunds list for selected label- pub merchant_connector_id: Option<Vec<String>>,+ #[schema(value_type = Option<Vec<String>>)]+ pub merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,/// The list of currencies to filter refunds list#[schema(value_type = Option<Vec<Currency>>)]pub currency: Option<Vec<enums::Currency>>,diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rsindex 04a58aed0d..f9bcf3901b 100644--- a/crates/api_models/src/routing.rs+++ b/crates/api_models/src/routing.rs@@ -173,7 +173,8 @@ pub struct RoutableConnectorChoice {#[serde(skip)]pub choice_kind: RoutableChoiceKind,pub connector: RoutableConnectors,- pub merchant_connector_id: Option<String>,+ #[schema(value_type = Option<String>)]+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)]@@ -188,7 +189,7 @@ pub enum RoutableChoiceSerde {OnlyConnector(Box<RoutableConnectors>),FullStruct {connector: RoutableConnectors,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,},}diff --git a/crates/api_models/src/user/dashboard_metadata.rs b/crates/api_models/src/user/dashboard_metadata.rsindex d8a437e31a..91d1471d9e 100644--- a/crates/api_models/src/user/dashboard_metadata.rs+++ b/crates/api_models/src/user/dashboard_metadata.rs@@ -1,5 +1,5 @@use common_enums::CountryAlpha2;-use common_utils::pii;+use common_utils::{id_type, pii};use masking::Secret;use strum::EnumString;@@ -43,7 +43,7 @@ pub struct SetupProcessor {#[derive(Debug, serde::Deserialize, serde::Serialize)]pub struct ProcessorConnected {- pub processor_id: String,+ pub processor_id: id_type::MerchantConnectorAccountId,pub processor_name: String,}diff --git a/crates/api_models/src/verifications.rs b/crates/api_models/src/verifications.rsindex 5fa1b8cd4c..e84f175839 100644--- a/crates/api_models/src/verifications.rs+++ b/crates/api_models/src/verifications.rs@@ -1,3 +1,5 @@+use common_utils::id_type;+/// The request body for verification of merchant (everything except domain_names are prefilled)#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]#[serde(rename_all = "camelCase")]@@ -13,7 +15,7 @@ pub struct ApplepayMerchantVerificationConfigs {#[serde(rename_all = "snake_case")]pub struct ApplepayMerchantVerificationRequest {pub domain_names: Vec<String>,- pub merchant_connector_account_id: String,+ pub merchant_connector_account_id: id_type::MerchantConnectorAccountId,}/// Response to be sent for the verify/applepay api@@ -27,8 +29,8 @@ pub struct ApplepayMerchantResponse {#[derive(Debug, serde::Deserialize)]#[serde(rename_all = "snake_case")]pub struct ApplepayGetVerifiedDomainsParam {- pub merchant_id: common_utils::id_type::MerchantId,- pub merchant_connector_account_id: String,+ pub merchant_id: id_type::MerchantId,+ pub merchant_connector_account_id: id_type::MerchantConnectorAccountId,}/// Response to be sent for derivation of the already verified domains#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]diff --git a/crates/common_utils/src/id_type.rs b/crates/common_utils/src/id_type.rsindex cc4c56d6ab..b6de37fab4 100644--- a/crates/common_utils/src/id_type.rs+++ b/crates/common_utils/src/id_type.rs@@ -5,6 +5,7 @@ use std::{borrow::Cow, fmt::Debug};mod customer;mod merchant;+mod merchant_connector_account;mod organization;mod profile;@@ -19,6 +20,7 @@ use diesel::{sql_types,};pub use merchant::MerchantId;+pub use merchant_connector_account::MerchantConnectorAccountId;pub use organization::OrganizationId;pub use profile::ProfileId;use serde::{Deserialize, Serialize};diff --git a/crates/common_utils/src/id_type/merchant_connector_account.rs b/crates/common_utils/src/id_type/merchant_connector_account.rsnew file mode 100644index 0000000000..f1bdb171b2--- /dev/null+++ b/crates/common_utils/src/id_type/merchant_connector_account.rs@@ -0,0 +1,23 @@+use crate::errors::{CustomResult, ValidationError};++crate::id_type!(+ MerchantConnectorAccountId,+ "A type for merchant_connector_id that can be used for merchant_connector_account ids"+);+crate::impl_id_type_methods!(MerchantConnectorAccountId, "merchant_connector_id");++// This is to display the `MerchantConnectorAccountId` as MerchantConnectorAccountId(abcd)+crate::impl_debug_id_type!(MerchantConnectorAccountId);+crate::impl_generate_id_id_type!(MerchantConnectorAccountId, "mca");+crate::impl_try_from_cow_str_id_type!(MerchantConnectorAccountId, "merchant_connector_id");++crate::impl_serializable_secret_id_type!(MerchantConnectorAccountId);+crate::impl_queryable_id_type!(MerchantConnectorAccountId);+crate::impl_to_sql_from_sql_id_type!(MerchantConnectorAccountId);++impl MerchantConnectorAccountId {+ /// Get a merchant connector account id from String+ pub fn wrap(merchant_connector_account_id: String) -> CustomResult<Self, ValidationError> {+ Self::try_from(std::borrow::Cow::from(merchant_connector_account_id))+ }+}diff --git a/crates/common_utils/src/lib.rs b/crates/common_utils/src/lib.rsindex 67a67bee5c..f51ed6eab0 100644--- a/crates/common_utils/src/lib.rs+++ b/crates/common_utils/src/lib.rs@@ -233,6 +233,14 @@ pub fn generate_profile_id_of_default_length() -> id_type::ProfileId {id_type::ProfileId::generate()}+/// Generate a merchant_connector_account id with default length, with prefix as `mca`+pub fn generate_merchant_connector_account_id_of_default_length(+) -> id_type::MerchantConnectorAccountId {+ use id_type::GenerateId;++ id_type::MerchantConnectorAccountId::generate()+}+/// Generate a nanoid with the given prefix and a default length#[inline]pub fn generate_id_with_default_len(prefix: &str) -> String {diff --git a/crates/diesel_models/src/authentication.rs b/crates/diesel_models/src/authentication.rsindex 606644255b..488066ff25 100644--- a/crates/diesel_models/src/authentication.rs+++ b/crates/diesel_models/src/authentication.rs@@ -43,7 +43,7 @@ pub struct Authentication {pub acs_signed_content: Option<String>,pub profile_id: common_utils::id_type::ProfileId,pub payment_id: Option<String>,- pub merchant_connector_id: String,+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,pub ds_trans_id: Option<String>,pub directory_server_id: Option<String>,pub acquirer_country_code: Option<String>,@@ -90,7 +90,7 @@ pub struct AuthenticationNew {pub acs_signed_content: Option<String>,pub profile_id: common_utils::id_type::ProfileId,pub payment_id: Option<String>,- pub merchant_connector_id: String,+ pub merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,pub ds_trans_id: Option<String>,pub directory_server_id: Option<String>,pub acquirer_country_code: Option<String>,diff --git a/crates/diesel_models/src/dispute.rs b/crates/diesel_models/src/dispute.rsindex 14fe16c982..45004e10ba 100644--- a/crates/diesel_models/src/dispute.rs+++ b/crates/diesel_models/src/dispute.rs@@ -28,7 +28,7 @@ pub struct DisputeNew {pub connector: String,pub evidence: Option<Secret<serde_json::Value>>,pub profile_id: Option<common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub dispute_amount: i64,}@@ -57,7 +57,7 @@ pub struct Dispute {pub connector: String,pub evidence: Secret<serde_json::Value>,pub profile_id: Option<common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub dispute_amount: i64,}diff --git a/crates/diesel_models/src/file.rs b/crates/diesel_models/src/file.rsindex 523bb1f26e..99265bfa80 100644--- a/crates/diesel_models/src/file.rs+++ b/crates/diesel_models/src/file.rs@@ -18,7 +18,7 @@ pub struct FileMetadataNew {pub available: bool,pub connector_label: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Clone, Debug, Deserialize, Serialize, Identifiable, Queryable, Selectable)]@@ -37,7 +37,7 @@ pub struct FileMetadata {pub created_at: time::PrimitiveDateTime,pub connector_label: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Debug)]@@ -47,7 +47,7 @@ pub enum FileMetadataUpdate {file_upload_provider: Option<common_enums::FileUploadProvider>,available: bool,profile_id: Option<common_utils::id_type::ProfileId>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,},}@@ -58,7 +58,7 @@ pub struct FileMetadataUpdateInternal {file_upload_provider: Option<common_enums::FileUploadProvider>,available: bool,profile_id: Option<common_utils::id_type::ProfileId>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}impl From<FileMetadataUpdate> for FileMetadataUpdateInternal {diff --git a/crates/diesel_models/src/mandate.rs b/crates/diesel_models/src/mandate.rsindex bfac1849a5..dc6916f3c4 100644--- a/crates/diesel_models/src/mandate.rs+++ b/crates/diesel_models/src/mandate.rs@@ -33,7 +33,7 @@ pub struct Mandate {pub metadata: Option<pii::SecretSerdeValue>,pub connector_mandate_ids: Option<pii::SecretSerdeValue>,pub original_payment_id: Option<String>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub updated_by: Option<String>,}@@ -71,7 +71,7 @@ pub struct MandateNew {pub metadata: Option<pii::SecretSerdeValue>,pub connector_mandate_ids: Option<pii::SecretSerdeValue>,pub original_payment_id: Option<String>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub updated_by: Option<String>,}diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rsindex e674b9b758..cd92f5492a 100644--- a/crates/diesel_models/src/merchant_connector_account.rs+++ b/crates/diesel_models/src/merchant_connector_account.rs@@ -33,7 +33,7 @@ pub struct MerchantConnectorAccount {pub connector_account_details: Encryption,pub test_mode: Option<bool>,pub disabled: Option<bool>,- pub merchant_connector_id: String,+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,pub connector_type: storage_enums::ConnectorType,@@ -63,7 +63,7 @@ pub struct MerchantConnectorAccount {not(feature = "merchant_connector_account_v2")))]impl MerchantConnectorAccount {- pub fn get_id(&self) -> String {+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {self.merchant_connector_id.clone()}}@@ -102,13 +102,13 @@ pub struct MerchantConnectorAccount {pub status: storage_enums::ConnectorStatus,pub additional_merchant_data: Option<Encryption>,pub connector_wallets_details: Option<Encryption>,- pub id: String,+ pub id: id_type::MerchantConnectorAccountId,pub version: common_enums::ApiVersion,}#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]impl MerchantConnectorAccount {- pub fn get_id(&self) -> String {+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {self.id.clone()}}@@ -126,7 +126,7 @@ pub struct MerchantConnectorAccountNew {pub connector_account_details: Option<Encryption>,pub test_mode: Option<bool>,pub disabled: Option<bool>,- pub merchant_connector_id: String,+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,pub metadata: Option<pii::SecretSerdeValue>,pub connector_label: Option<String>,@@ -173,7 +173,7 @@ pub struct MerchantConnectorAccountNew {pub status: storage_enums::ConnectorStatus,pub additional_merchant_data: Option<Encryption>,pub connector_wallets_details: Option<Encryption>,- pub id: String,+ pub id: id_type::MerchantConnectorAccountId,pub version: common_enums::ApiVersion,}@@ -190,7 +190,7 @@ pub struct MerchantConnectorAccountUpdateInternal {pub connector_label: Option<String>,pub test_mode: Option<bool>,pub disabled: Option<bool>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,pub frm_configs: Option<pii::SecretSerdeValue>,pub metadata: Option<pii::SecretSerdeValue>,diff --git a/crates/diesel_models/src/payment_attempt.rs b/crates/diesel_models/src/payment_attempt.rsindex 84811f2262..ec87b2da2e 100644--- a/crates/diesel_models/src/payment_attempt.rs+++ b/crates/diesel_models/src/payment_attempt.rs@@ -62,7 +62,7 @@ pub struct PaymentAttempt {pub connector_response_reference_id: Option<String>,pub amount_capturable: i64,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,pub unified_code: Option<String>,@@ -133,7 +133,7 @@ pub struct PaymentAttempt {pub connector_response_reference_id: Option<String>,pub amount_capturable: i64,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,pub unified_code: Option<String>,@@ -215,7 +215,7 @@ pub struct PaymentAttemptNew {pub multiple_capture_count: Option<i16>,pub amount_capturable: i64,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,pub unified_code: Option<String>,@@ -280,7 +280,7 @@ pub enum PaymentAttemptUpdate {surcharge_amount: Option<i64>,tax_amount: Option<i64>,updated_by: String,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,},AuthenticationTypeUpdate {authentication_type: storage_enums::AuthenticationType,@@ -308,7 +308,7 @@ pub enum PaymentAttemptUpdate {tax_amount: Option<i64>,fingerprint_id: Option<String>,updated_by: String,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,payment_method_id: Option<String>,external_three_ds_authentication_attempted: Option<bool>,authentication_connector: Option<String>,@@ -475,7 +475,7 @@ pub struct PaymentAttemptUpdateInternal {tax_amount: Option<i64>,amount_capturable: Option<i64>,updated_by: String,- merchant_connector_id: Option<Option<String>>,+ merchant_connector_id: Option<Option<common_utils::id_type::MerchantConnectorAccountId>>,authentication_data: Option<serde_json::Value>,encoded_data: Option<String>,unified_code: Option<Option<String>>,diff --git a/crates/diesel_models/src/payout_attempt.rs b/crates/diesel_models/src/payout_attempt.rsindex 7e9b2ec4e1..619e694f41 100644--- a/crates/diesel_models/src/payout_attempt.rs+++ b/crates/diesel_models/src/payout_attempt.rs@@ -28,7 +28,7 @@ pub struct PayoutAttempt {#[serde(with = "common_utils::custom_serde::iso8601")]pub last_modified_at: PrimitiveDateTime,pub profile_id: common_utils::id_type::ProfileId,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub routing_info: Option<serde_json::Value>,}@@ -64,7 +64,7 @@ pub struct PayoutAttemptNew {#[serde(with = "common_utils::custom_serde::iso8601")]pub last_modified_at: PrimitiveDateTime,pub profile_id: common_utils::id_type::ProfileId,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub routing_info: Option<serde_json::Value>,}@@ -89,7 +89,7 @@ pub enum PayoutAttemptUpdate {UpdateRouting {connector: String,routing_info: Option<serde_json::Value>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,},}@@ -109,7 +109,7 @@ pub struct PayoutAttemptUpdateInternal {pub last_modified_at: PrimitiveDateTime,pub address_id: Option<String>,pub customer_id: Option<common_utils::id_type::CustomerId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}impl Default for PayoutAttemptUpdateInternal {diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rsindex 7eeddd5d59..ed3f1562f7 100644--- a/crates/diesel_models/src/query/merchant_connector_account.rs+++ b/crates/diesel_models/src/query/merchant_connector_account.rs@@ -51,7 +51,7 @@ impl MerchantConnectorAccount {pub async fn delete_by_merchant_id_merchant_connector_id(conn: &PgPooledConn,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,) -> StorageResult<bool> {generics::generic_delete::<<Self as HasTable>::Table, _>(conn,@@ -115,7 +115,7 @@ impl MerchantConnectorAccount {pub async fn find_by_merchant_id_merchant_connector_id(conn: &PgPooledConn,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,) -> StorageResult<Self> {generics::generic_find_one::<<Self as HasTable>::Table, _, _>(conn,@@ -182,12 +182,18 @@ impl MerchantConnectorAccount {}}- pub async fn delete_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<bool> {+ pub async fn delete_by_id(+ conn: &PgPooledConn,+ id: &common_utils::id_type::MerchantConnectorAccountId,+ ) -> StorageResult<bool> {generics::generic_delete::<<Self as HasTable>::Table, _>(conn, dsl::id.eq(id.to_owned())).await}- pub async fn find_by_id(conn: &PgPooledConn, id: &str) -> StorageResult<Self> {+ pub async fn find_by_id(+ conn: &PgPooledConn,+ id: &common_utils::id_type::MerchantConnectorAccountId,+ ) -> StorageResult<Self> {generics::generic_find_one::<<Self as HasTable>::Table, _, _>(conn,dsl::id.eq(id.to_owned()),diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rsindex 68f16b3445..2af603f695 100644--- a/crates/diesel_models/src/query/payment_attempt.rs+++ b/crates/diesel_models/src/query/payment_attempt.rs@@ -322,7 +322,7 @@ impl PaymentAttempt {payment_method: Option<Vec<enums::PaymentMethod>>,payment_method_type: Option<Vec<enums::PaymentMethodType>>,authentication_type: Option<Vec<enums::AuthenticationType>>,- merchant_connector_id: Option<Vec<String>>,+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,) -> StorageResult<i64> {let mut filter = <Self as HasTable>::table().count()diff --git a/crates/diesel_models/src/refund.rs b/crates/diesel_models/src/refund.rsindex 3b73a60367..10c1fbb9b2 100644--- a/crates/diesel_models/src/refund.rs+++ b/crates/diesel_models/src/refund.rs@@ -48,7 +48,7 @@ pub struct Refund {pub refund_error_code: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub charges: Option<ChargeRefunds>,}@@ -90,7 +90,7 @@ pub struct RefundNew {pub refund_reason: Option<String>,pub profile_id: Option<common_utils::id_type::ProfileId>,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub charges: Option<ChargeRefunds>,}diff --git a/crates/diesel_models/src/user/sample_data.rs b/crates/diesel_models/src/user/sample_data.rsindex 035d99e554..dbdae51c45 100644--- a/crates/diesel_models/src/user/sample_data.rs+++ b/crates/diesel_models/src/user/sample_data.rs@@ -64,7 +64,7 @@ pub struct PaymentAttemptBatchNew {pub multiple_capture_count: Option<i16>,pub amount_capturable: i64,pub updated_by: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,pub unified_code: Option<String>,diff --git a/crates/euclid/src/frontend/ast.rs b/crates/euclid/src/frontend/ast.rsindex c77736effa..5a7b88acfb 100644--- a/crates/euclid/src/frontend/ast.rs+++ b/crates/euclid/src/frontend/ast.rs@@ -164,7 +164,7 @@ pub struct RoutableConnectorChoice {#[serde(skip)]pub choice_kind: RoutableChoiceKind,pub connector: RoutableConnectors,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)]diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rsindex a841e2d150..c97fcbdfe8 100644--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs@@ -3,7 +3,7 @@ use common_utils::{date_time,encryption::Encryption,errors::{CustomResult, ValidationError},- pii, type_name,+ id_type, pii, type_name,types::keymanager::{Identifier, KeyManagerState},};use diesel_models::{enums, merchant_connector_account::MerchantConnectorAccountUpdateInternal};@@ -19,12 +19,12 @@ use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};))]#[derive(Clone, Debug)]pub struct MerchantConnectorAccount {- pub merchant_id: common_utils::id_type::MerchantId,+ pub merchant_id: id_type::MerchantId,pub connector_name: String,pub connector_account_details: Encryptable<pii::SecretSerdeValue>,pub test_mode: Option<bool>,pub disabled: Option<bool>,- pub merchant_connector_id: String,+ pub merchant_connector_id: id_type::MerchantConnectorAccountId,pub payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,pub connector_type: enums::ConnectorType,pub metadata: Option<pii::SecretSerdeValue>,@@ -36,7 +36,7 @@ pub struct MerchantConnectorAccount {pub created_at: time::PrimitiveDateTime,pub modified_at: time::PrimitiveDateTime,pub connector_webhook_details: Option<pii::SecretSerdeValue>,- pub profile_id: common_utils::id_type::ProfileId,+ pub profile_id: id_type::ProfileId,pub applepay_verified_domains: Option<Vec<String>>,pub pm_auth_config: Option<pii::SecretSerdeValue>,pub status: enums::ConnectorStatus,@@ -50,7 +50,7 @@ pub struct MerchantConnectorAccount {not(feature = "merchant_connector_account_v2")))]impl MerchantConnectorAccount {- pub fn get_id(&self) -> String {+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {self.merchant_connector_id.clone()}}@@ -58,8 +58,8 @@ impl MerchantConnectorAccount {#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]#[derive(Clone, Debug)]pub struct MerchantConnectorAccount {- pub id: String,- pub merchant_id: common_utils::id_type::MerchantId,+ pub id: id_type::MerchantConnectorAccountId,+ pub merchant_id: id_type::MerchantId,pub connector_name: String,pub connector_account_details: Encryptable<pii::SecretSerdeValue>,pub disabled: Option<bool>,@@ -71,7 +71,7 @@ pub struct MerchantConnectorAccount {pub created_at: time::PrimitiveDateTime,pub modified_at: time::PrimitiveDateTime,pub connector_webhook_details: Option<pii::SecretSerdeValue>,- pub profile_id: common_utils::id_type::ProfileId,+ pub profile_id: id_type::ProfileId,pub applepay_verified_domains: Option<Vec<String>>,pub pm_auth_config: Option<pii::SecretSerdeValue>,pub status: enums::ConnectorStatus,@@ -82,7 +82,7 @@ pub struct MerchantConnectorAccount {#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]impl MerchantConnectorAccount {- pub fn get_id(&self) -> String {+ pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {self.id.clone()}}@@ -99,7 +99,7 @@ pub enum MerchantConnectorAccountUpdate {connector_account_details: Option<Encryptable<pii::SecretSerdeValue>>,test_mode: Option<bool>,disabled: Option<bool>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,payment_methods_enabled: Option<Vec<pii::SecretSerdeValue>>,metadata: Option<pii::SecretSerdeValue>,frm_configs: Option<Vec<pii::SecretSerdeValue>>,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rsindex 5f2bc035f5..12880172d3 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs@@ -111,7 +111,7 @@ pub trait PaymentAttemptInterface {payment_method: Option<Vec<storage_enums::PaymentMethod>>,payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,authentication_type: Option<Vec<storage_enums::AuthenticationType>>,- merchant_connector_id: Option<Vec<String>>,+ merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,storage_scheme: storage_enums::MerchantStorageScheme,) -> error_stack::Result<i64, errors::StorageError>;}@@ -168,7 +168,7 @@ pub struct PaymentAttempt {pub updated_by: String,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub unified_code: Option<String>,pub unified_message: Option<String>,pub external_three_ds_authentication_attempted: Option<bool>,@@ -258,7 +258,7 @@ pub struct PaymentAttemptNew {pub updated_by: String,pub authentication_data: Option<serde_json::Value>,pub encoded_data: Option<String>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub unified_code: Option<String>,pub unified_message: Option<String>,pub external_three_ds_authentication_attempted: Option<bool>,@@ -317,7 +317,7 @@ pub enum PaymentAttemptUpdate {surcharge_amount: Option<MinorUnit>,tax_amount: Option<MinorUnit>,updated_by: String,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,},AuthenticationTypeUpdate {authentication_type: storage_enums::AuthenticationType,@@ -344,7 +344,7 @@ pub enum PaymentAttemptUpdate {updated_by: String,surcharge_amount: Option<MinorUnit>,tax_amount: Option<MinorUnit>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,external_three_ds_authentication_attempted: Option<bool>,authentication_connector: Option<String>,authentication_id: Option<String>,diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex 4c59a90ba1..dcb06733cc 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -745,7 +745,7 @@ pub struct PaymentIntentListParams {pub payment_method: Option<Vec<storage_enums::PaymentMethod>>,pub payment_method_type: Option<Vec<storage_enums::PaymentMethodType>>,pub authentication_type: Option<Vec<storage_enums::AuthenticationType>>,- pub merchant_connector_id: Option<Vec<String>>,+ pub merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,pub profile_id: Option<id_type::ProfileId>,pub customer_id: Option<id_type::CustomerId>,pub starting_after_id: Option<String>,diff --git a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rsindex 8182ed35ba..f747eb96c4 100644--- a/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs+++ b/crates/hyperswitch_domain_models/src/payouts/payout_attempt.rs@@ -76,7 +76,7 @@ pub struct PayoutAttempt {#[serde(with = "common_utils::custom_serde::iso8601")]pub last_modified_at: PrimitiveDateTime,pub profile_id: id_type::ProfileId,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub routing_info: Option<serde_json::Value>,}@@ -99,7 +99,7 @@ pub struct PayoutAttemptNew {pub created_at: PrimitiveDateTime,pub last_modified_at: PrimitiveDateTime,pub profile_id: id_type::ProfileId,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,pub routing_info: Option<serde_json::Value>,}@@ -124,7 +124,7 @@ pub enum PayoutAttemptUpdate {UpdateRouting {connector: String,routing_info: Option<serde_json::Value>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,},}@@ -142,7 +142,7 @@ pub struct PayoutAttemptUpdateInternal {pub routing_info: Option<serde_json::Value>,pub address_id: Option<String>,pub customer_id: Option<id_type::CustomerId>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,}impl From<PayoutAttemptUpdate> for PayoutAttemptUpdateInternal {diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rsindex 5a078de1d7..8e3bec16b2 100644--- a/crates/kgraph_utils/benches/evaluation.rs+++ b/crates/kgraph_utils/benches/evaluation.rs@@ -58,7 +58,7 @@ fn build_test_data(let stripe_account = MerchantConnectorResponse {connector_type: api_enums::ConnectorType::FizOperations,connector_name: "stripe".to_string(),- id: "something".to_string(),+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),connector_account_details: masking::Secret::new(serde_json::json!({})),disabled: None,metadata: None,@@ -80,7 +80,8 @@ fn build_test_data(let stripe_account = MerchantConnectorResponse {connector_type: api_enums::ConnectorType::FizOperations,connector_name: "stripe".to_string(),- merchant_connector_id: "something".to_string(),+ merchant_connector_id:+ common_utils::generate_merchant_connector_account_id_of_default_length(),connector_account_details: masking::Secret::new(serde_json::json!({})),test_mode: None,disabled: None,diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rsindex 1e099589b0..fa98ae915e 100644--- a/crates/kgraph_utils/src/mca.rs+++ b/crates/kgraph_utils/src/mca.rs@@ -710,7 +710,7 @@ mod tests {let stripe_account = MerchantConnectorResponse {connector_type: api_enums::ConnectorType::FizOperations,connector_name: "stripe".to_string(),- id: "something".to_string(),+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),connector_label: Some("something".to_string()),connector_account_details: masking::Secret::new(serde_json::json!({})),disabled: None,@@ -767,7 +767,8 @@ mod tests {let stripe_account = MerchantConnectorResponse {connector_type: api_enums::ConnectorType::FizOperations,connector_name: "stripe".to_string(),- merchant_connector_id: "something".to_string(),+ merchant_connector_id:+ common_utils::generate_merchant_connector_account_id_of_default_length(),business_country: Some(api_enums::CountryAlpha2::US),connector_label: Some("something".to_string()),business_label: Some("food".to_string()),diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rsindex 084ac8eacc..cb95feee9e 100644--- a/crates/router/src/core/admin.rs+++ b/crates/router/src/core/admin.rs@@ -1842,7 +1842,7 @@ impl<'a> ConnectorTypeAndConnectorName<'a> {))]struct MerchantDefaultConfigUpdate<'a> {routable_connector: &'a Option<api_enums::RoutableConnectors>,- merchant_connector_id: &'a String,+ merchant_connector_id: &'a id_type::MerchantConnectorAccountId,store: &'a dyn StorageInterface,merchant_id: &'a id_type::MerchantId,profile_id: &'a id_type::ProfileId,@@ -1907,7 +1907,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {))]struct DefaultFallbackRoutingConfigUpdate<'a> {routable_connector: &'a Option<api_enums::RoutableConnectors>,- merchant_connector_id: &'a String,+ merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,store: &'a dyn StorageInterface,business_profile: domain::BusinessProfile,key_store: hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,@@ -1954,7 +1954,7 @@ trait MerchantConnectorAccountUpdateBridge {self,db: &dyn StorageInterface,merchant_id: &id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,key_manager_state: &KeyManagerState,) -> RouterResult<domain::MerchantConnectorAccount>;@@ -1980,7 +1980,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnectself,db: &dyn StorageInterface,_merchant_id: &id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,key_manager_state: &KeyManagerState,) -> RouterResult<domain::MerchantConnectorAccount> {@@ -2148,7 +2148,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnectself,db: &dyn StorageInterface,merchant_id: &id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,key_manager_state: &KeyManagerState,) -> RouterResult<domain::MerchantConnectorAccount> {@@ -2161,7 +2161,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect.await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id.to_string(),+ id: merchant_connector_id.get_string_repr().to_string(),},)}@@ -2433,7 +2433,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {connector_label: Some(connector_label.clone()),created_at: date_time::now(),modified_at: date_time::now(),- id: common_utils::generate_time_ordered_id("mca"),+ id: common_utils::generate_merchant_connector_account_id_of_default_length(),connector_webhook_details: match self.connector_webhook_details {Some(connector_webhook_details) => {connector_webhook_details.encode_to_value(@@ -2580,7 +2580,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {merchant_id: business_profile.merchant_id.clone(),connector_type: self.connector_type,connector_name: self.connector_name.to_string(),- merchant_connector_id: utils::generate_id(consts::ID_LENGTH, "mca"),+ merchant_connector_id: common_utils::generate_merchant_connector_account_id_of_default_length(),connector_account_details: domain_types::crypto_operation(key_manager_state,type_name!(domain::MerchantConnectorAccount),@@ -2913,7 +2913,7 @@ pub async fn retrieve_connector(state: SessionState,merchant_id: id_type::MerchantId,profile_id: Option<id_type::ProfileId>,- merchant_connector_id: String,+ merchant_connector_id: id_type::MerchantConnectorAccountId,) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {let store = state.store.as_ref();let key_manager_state = &(&state).into();@@ -2940,7 +2940,7 @@ pub async fn retrieve_connector().await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id.clone(),+ id: merchant_connector_id.get_string_repr().to_string(),})?;core_utils::validate_profile_id_from_auth_layer(profile_id, &mca)?;@@ -2953,7 +2953,7 @@ pub async fn retrieve_connector(pub async fn retrieve_connector(state: SessionState,merchant_id: id_type::MerchantId,- id: String,+ id: id_type::MerchantConnectorAccountId,) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {let store = state.store.as_ref();let key_manager_state = &(&state).into();@@ -2970,14 +2970,14 @@ pub async fn retrieve_connector(.find_merchant_connector_account_by_id(key_manager_state, &id, &key_store).await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: id.clone(),+ id: id.clone().get_string_repr().to_string(),})?;// Validate if the merchant_id sent in the request is validif mca.merchant_id != merchant_id {return Err(errors::ApiErrorResponse::InvalidRequestData {message: format!(- "Invalid merchant_id {} provided for merchant_connector_account {}",+ "Invalid merchant_id {} provided for merchant_connector_account {:?}",merchant_id.get_string_repr(),id),@@ -3039,7 +3039,7 @@ pub async fn update_connector(state: SessionState,merchant_id: &id_type::MerchantId,profile_id: Option<id_type::ProfileId>,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,req: api_models::admin::MerchantConnectorUpdate,) -> RouterResponse<api_models::admin::MerchantConnectorResponse> {let db = state.store.as_ref();@@ -3101,7 +3101,10 @@ pub async fn update_connector(},).attach_printable_lazy(|| {- format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")+ format!(+ "Failed while updating MerchantConnectorAccount: id: {:?}",+ merchant_connector_id+ )})?;let response = updated_mca.foreign_try_into()?;@@ -3116,7 +3119,7 @@ pub async fn update_connector(pub async fn delete_connector(state: SessionState,merchant_id: id_type::MerchantId,- merchant_connector_id: String,+ merchant_connector_id: id_type::MerchantConnectorAccountId,) -> RouterResponse<api::MerchantConnectorDeleteResponse> {let db = state.store.as_ref();let key_manager_state = &(&state).into();@@ -3143,7 +3146,7 @@ pub async fn delete_connector().await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id.clone(),+ id: merchant_connector_id.get_string_repr().to_string(),})?;let is_deleted = db@@ -3153,7 +3156,7 @@ pub async fn delete_connector().await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id.clone(),+ id: merchant_connector_id.get_string_repr().to_string(),})?;let response = api::MerchantConnectorDeleteResponse {@@ -3168,7 +3171,7 @@ pub async fn delete_connector(pub async fn delete_connector(state: SessionState,merchant_id: id_type::MerchantId,- id: String,+ id: id_type::MerchantConnectorAccountId,) -> RouterResponse<api::MerchantConnectorDeleteResponse> {let db = state.store.as_ref();let key_manager_state = &(&state).into();@@ -3185,14 +3188,14 @@ pub async fn delete_connector(.find_merchant_connector_account_by_id(key_manager_state, &id, &key_store).await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: id.clone(),+ id: id.clone().get_string_repr().to_string(),})?;// Validate if the merchant_id sent in the request is validif mca.merchant_id != merchant_id {return Err(errors::ApiErrorResponse::InvalidRequestData {message: format!(- "Invalid merchant_id {} provided for merchant_connector_account {}",+ "Invalid merchant_id {} provided for merchant_connector_account {:?}",merchant_id.get_string_repr(),id),@@ -3204,7 +3207,7 @@ pub async fn delete_connector(.delete_merchant_connector_account_by_id(&id).await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: id.clone(),+ id: id.clone().get_string_repr().to_string(),})?;let response = api::MerchantConnectorDeleteResponse {diff --git a/crates/router/src/core/authentication/utils.rs b/crates/router/src/core/authentication/utils.rsindex 58862d1890..cd93a1cf62 100644--- a/crates/router/src/core/authentication/utils.rs+++ b/crates/router/src/core/authentication/utils.rs@@ -180,7 +180,7 @@ pub async fn create_new_authentication(token: String,profile_id: common_utils::id_type::ProfileId,payment_id: Option<String>,- merchant_connector_id: String,+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,) -> RouterResult<storage::Authentication> {let authentication_id =common_utils::generate_id_with_default_len(consts::AUTHENTICATION_ID_PREFIX);diff --git a/crates/router/src/core/connector_onboarding/paypal.rs b/crates/router/src/core/connector_onboarding/paypal.rsindex f967f2aece..a61fab395f 100644--- a/crates/router/src/core/connector_onboarding/paypal.rs+++ b/crates/router/src/core/connector_onboarding/paypal.rs@@ -141,7 +141,7 @@ async fn find_paypal_merchant_by_tracking_id(pub async fn update_mca(state: &SessionState,merchant_id: common_utils::id_type::MerchantId,- connector_id: String,+ connector_id: common_utils::id_type::MerchantConnectorAccountId,auth_details: oss_types::ConnectorAuthType,) -> RouterResult<oss_api_types::MerchantConnectorResponse> {let connector_auth_json = auth_detailsdiff --git a/crates/router/src/core/files/helpers.rs b/crates/router/src/core/files/helpers.rsindex 14e404e88a..bd4fc74975 100644--- a/crates/router/src/core/files/helpers.rs+++ b/crates/router/src/core/files/helpers.rs@@ -246,7 +246,7 @@ pub async fn upload_and_get_provider_provider_file_id_profile_id(String,api_models::enums::FileUploadProvider,Option<common_utils::id_type::ProfileId>,- Option<String>,+ Option<common_utils::id_type::MerchantConnectorAccountId>,),errors::ApiErrorResponse,> {diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rsindex e74f7f11a7..8118d8a322 100644--- a/crates/router/src/core/mandate.rs+++ b/crates/router/src/core/mandate.rs@@ -353,7 +353,7 @@ pub async fn mandate_procedure<F, FData>(resp: &types::RouterData<F, FData, types::PaymentsResponseData>,customer_id: &Option<id_type::CustomerId>,pm_id: Option<String>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,storage_scheme: MerchantStorageScheme,) -> errors::RouterResult<Option<String>>wherediff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rsindex 586e93a0fe..9896ff3008 100644--- a/crates/router/src/core/payment_methods/cards.rs+++ b/crates/router/src/core/payment_methods/cards.rs@@ -2763,7 +2763,10 @@ pub async fn list_payment_methods(// No PM_FILTER_CGRAPH Cache present in MokaCachelet mut builder = cgraph::ConstraintGraphBuilder::new();for mca in &filtered_mcas {- let domain_id = builder.make_domain(mca.get_id(), mca.connector_name.as_str());+ let domain_id = builder.make_domain(+ mca.get_id().get_string_repr().to_string(),+ mca.connector_name.as_str(),+ );let Ok(domain_id) = domain_id else {logger::error!("Failed to construct domain for list payment methods");@@ -3778,7 +3781,7 @@ pub async fn call_surcharge_decision_management_for_saved_card(#[allow(clippy::too_many_arguments)]pub async fn filter_payment_methods(graph: &cgraph::ConstraintGraph<dir::DirValue>,- mca_id: String,+ mca_id: id_type::MerchantConnectorAccountId,payment_methods: &[Secret<serde_json::Value>],req: &mut api::PaymentMethodListRequest,resp: &mut Vec<ResponsePaymentMethodIntermediate>,@@ -3928,7 +3931,7 @@ pub async fn filter_payment_methods(let context = AnalysisContext::from_dir_values(context_values.clone());logger::info!("Context created for List Payment method is {:?}", context);- let domain_ident: &[String] = &[mca_id.clone()];+ let domain_ident: &[String] = &[mca_id.clone().get_string_repr().to_string()];let result = graph.key_value_analysis(pm_dir_value.clone(),&context,diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex 72a188a47e..586d1989de 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -2008,8 +2008,10 @@ where&connector_name,);- let connector_label = if let Some(connector_label) =- merchant_connector_account.get_mca_id().or(connector_label)+ let connector_label = if let Some(connector_label) = merchant_connector_account+ .get_mca_id()+ .map(|mca_id| mca_id.get_string_repr().to_string())+ .or(connector_label){connector_label} else {@@ -2284,7 +2286,7 @@ pub async fn construct_profile_id_and_get_mca<'a, F>(merchant_account: &domain::MerchantAccount,payment_data: &mut PaymentData<F>,connector_name: &str,- merchant_connector_id: Option<&String>,+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,key_store: &domain::MerchantKeyStore,_should_validate: bool,) -> RouterResult<helpers::MerchantConnectorAccountType>@@ -2710,7 +2712,7 @@ where#[derive(Clone)]pub struct MandateConnectorDetails {pub connector: String,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,}#[derive(Clone)]diff --git a/crates/router/src/core/payments/access_token.rs b/crates/router/src/core/payments/access_token.rsindex 78ef29e473..8ac89f76ad 100644--- a/crates/router/src/core/payments/access_token.rs+++ b/crates/router/src/core/payments/access_token.rs@@ -76,6 +76,7 @@ pub async fn add_access_token<let merchant_connector_id_or_connector_name = connector.merchant_connector_id.clone()+ .map(|mca_id| mca_id.get_string_repr().to_string()).or(creds_identifier.cloned()).unwrap_or(connector.connector_name.to_string());diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rsindex 176e7d96ac..181e2232d9 100644--- a/crates/router/src/core/payments/helpers.rs+++ b/crates/router/src/core/payments/helpers.rs@@ -2693,7 +2693,7 @@ pub fn generate_mandate(network_txn_id: Option<String>,payment_method_data_option: Option<domain::payments::PaymentMethodData>,mandate_reference: Option<MandateReference>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,) -> CustomResult<Option<storage::MandateNew>, errors::ApiErrorResponse> {match (setup_mandate_details, customer_id) {(Some(data), Some(cus_id)) => {@@ -3205,7 +3205,7 @@ impl MerchantConnectorAccountType {None}- pub fn get_mca_id(&self) -> Option<String> {+ pub fn get_mca_id(&self) -> Option<id_type::MerchantConnectorAccountId> {match self {Self::DbVal(db_val) => Some(db_val.get_id()),Self::CacheVal(_) => None,@@ -3239,7 +3239,7 @@ pub async fn get_merchant_connector_account(key_store: &domain::MerchantKeyStore,profile_id: &id_type::ProfileId,connector_name: &str,- merchant_connector_id: Option<&String>,+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,) -> RouterResult<MerchantConnectorAccountType> {let db = &*state.store;let key_manager_state: &KeyManagerState = &state.into();@@ -3332,7 +3332,7 @@ pub async fn get_merchant_connector_account(.await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id.to_string(),+ id: merchant_connector_id.get_string_repr().to_string(),},)}@@ -4232,7 +4232,7 @@ pub async fn get_apple_pay_retryable_connectors<F>(payment_data: &mut PaymentData<F>,key_store: &domain::MerchantKeyStore,pre_routing_connector_data_list: &[api::ConnectorData],- merchant_connector_id: Option<&String>,+ merchant_connector_id: Option<&id_type::MerchantConnectorAccountId>,business_profile: domain::BusinessProfile,) -> CustomResult<Option<Vec<api::ConnectorData>>, errors::ApiErrorResponse>where@@ -5199,7 +5199,7 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details(.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;let merchant_connector_account_details_hash_map: std::collections::HashMap<- String,+ id_type::MerchantConnectorAccountId,domain::MerchantConnectorAccount,> = merchant_connector_account_list.iter()@@ -5214,33 +5214,43 @@ pub async fn validate_merchant_connector_ids_in_connector_mandate_details(for (migrating_merchant_connector_id, migrating_connector_mandate_details) inconnector_mandate_details.0.clone(){- match (card_network.clone() ,merchant_connector_account_details_hash_map.get(&migrating_merchant_connector_id)) {- (Some(enums::CardNetwork::Discover),Some(merchant_connector_account_details)) => if let ("cybersource", None) = (- merchant_connector_account_details.connector_name.as_str(),- migrating_connector_mandate_details- .original_payment_authorized_amount- .zip(- migrating_connector_mandate_details- .original_payment_authorized_currency,- ),- ) {- Err(errors::ApiErrorResponse::MissingRequiredFields {- field_names: vec![- "original_payment_authorized_currency",- "original_payment_authorized_amount",- ],- }).attach_printable(format!("Invalid connector_mandate_details provided for connector {migrating_merchant_connector_id}"))?- },- (_, Some(_)) => (),- (_, None) => {- Err(errors::ApiErrorResponse::InvalidDataValue {- field_name: "merchant_connector_id",- })- .attach_printable_lazy(|| {- format!("{migrating_merchant_connector_id} invalid merchant connector id in connector_mandate_details")- })?- },- }+ match (+ card_network.clone(),+ merchant_connector_account_details_hash_map.get(&migrating_merchant_connector_id),+ ) {+ (Some(enums::CardNetwork::Discover), Some(merchant_connector_account_details)) => {+ if let ("cybersource", None) = (+ merchant_connector_account_details.connector_name.as_str(),+ migrating_connector_mandate_details+ .original_payment_authorized_amount+ .zip(+ migrating_connector_mandate_details+ .original_payment_authorized_currency,+ ),+ ) {+ Err(errors::ApiErrorResponse::MissingRequiredFields {+ field_names: vec![+ "original_payment_authorized_currency",+ "original_payment_authorized_amount",+ ],+ })+ .attach_printable(format!(+ "Invalid connector_mandate_details provided for connector {:?}",+ migrating_merchant_connector_id+ ))?+ }+ }+ (_, Some(_)) => (),+ (_, None) => Err(errors::ApiErrorResponse::InvalidDataValue {+ field_name: "merchant_connector_id",+ })+ .attach_printable_lazy(|| {+ format!(+ "{:?} invalid merchant connector id in connector_mandate_details",+ migrating_merchant_connector_id+ )+ })?,+ }}Ok(())}diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rsindex f26ed588a0..6a2689da40 100644--- a/crates/router/src/core/payments/tokenization.rs+++ b/crates/router/src/core/payments/tokenization.rs@@ -67,7 +67,7 @@ impl<F, Req: Clone> From<&types::RouterData<F, Req, types::PaymentsResponseData>pub async fn save_payment_method<FData>(state: &SessionState,connector_name: String,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,save_payment_method_data: SavePaymentMethodData<FData>,customer_id: Option<id_type::CustomerId>,merchant_account: &domain::MerchantAccount,@@ -657,7 +657,7 @@ wherepub async fn save_payment_method<FData>(_state: &SessionState,_connector_name: String,- _merchant_connector_id: Option<String>,+ _merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,_save_payment_method_data: SavePaymentMethodData<FData>,_customer_id: Option<id_type::CustomerId>,_merchant_account: &domain::MerchantAccount,@@ -983,7 +983,7 @@ pub fn add_connector_mandate_details_in_payment_method(payment_method_type: Option<storage_enums::PaymentMethodType>,authorized_amount: Option<i64>,authorized_currency: Option<storage_enums::Currency>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,connector_mandate_id: Option<String>,) -> Option<storage::PaymentsMandateReference> {let mut mandate_details = HashMap::new();@@ -1011,7 +1011,7 @@ pub fn update_connector_mandate_details_in_payment_method(payment_method_type: Option<storage_enums::PaymentMethodType>,authorized_amount: Option<i64>,authorized_currency: Option<storage_enums::Currency>,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<id_type::MerchantConnectorAccountId>,connector_mandate_id: Option<String>,) -> RouterResult<Option<serde_json::Value>> {let mandate_reference = match payment_method.connector_mandate_details {diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rsindex 1f24298d99..57c4152ee2 100644--- a/crates/router/src/core/payouts.rs+++ b/crates/router/src/core/payouts.rs@@ -2763,7 +2763,7 @@ pub async fn get_mca_from_profile_id(merchant_account: &domain::MerchantAccount,profile_id: &common_utils::id_type::ProfileId,connector_name: &str,- merchant_connector_id: Option<&String>,+ merchant_connector_id: Option<&common_utils::id_type::MerchantConnectorAccountId>,key_store: &domain::MerchantKeyStore,) -> RouterResult<payment_helpers::MerchantConnectorAccountType> {let merchant_connector_account = payment_helpers::get_merchant_connector_account(diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rsindex 47f843030e..4a462b4bc6 100644--- a/crates/router/src/core/pm_auth.rs+++ b/crates/router/src/core/pm_auth.rs@@ -307,7 +307,7 @@ async fn store_bank_details_in_payment_methods(state: SessionState,bank_account_details_resp: pm_auth_types::BankAccountCredentialsResponse,connector_details: (&str, Secret<String>),- mca_id: String,+ mca_id: common_utils::id_type::MerchantConnectorAccountId,) -> RouterResult<()> {let key = key_store.key.get_inner().peek();let db = &*state.clone().store;@@ -753,7 +753,12 @@ pub async fn retrieve_payment_method_from_auth_service().await.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {- id: auth_token.connector_details.mca_id.clone(),+ id: auth_token+ .connector_details+ .mca_id+ .get_string_repr()+ .to_string()+ .clone(),}).attach_printable("error while fetching merchant_connector_account from merchant_id and connector name",diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rsindex 5cbb1e9fdf..448cebbf06 100644--- a/crates/router/src/core/routing/helpers.rs+++ b/crates/router/src/core/routing/helpers.rs@@ -251,7 +251,12 @@ pub struct RoutingAlgorithmHelpers<'h> {}#[derive(Clone, Debug)]-pub struct ConnectNameAndMCAIdForProfile<'a>(pub FxHashSet<(&'a String, String)>);+pub struct ConnectNameAndMCAIdForProfile<'a>(+ pub FxHashSet<(+ &'a String,+ common_utils::id_type::MerchantConnectorAccountId,+ )>,+);#[derive(Clone, Debug)]pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a String>);@@ -322,7 +327,7 @@ impl<'h> RoutingAlgorithmHelpers<'h> {self.name_mca_id_set.0.contains(&(&choice.connector.to_string(), mca_id.clone())),errors::ApiErrorResponse::InvalidRequestData {message: format!(- "connector with name '{}' and merchant connector account id '{}' not found for the given profile",+ "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",choice.connector,mca_id,)@@ -430,7 +435,7 @@ pub async fn validate_connectors_in_routing_config(name_mca_id_set.contains(&(&choice.connector.to_string(), mca_id.clone())),errors::ApiErrorResponse::InvalidRequestData {message: format!(- "connector with name '{}' and merchant connector account id '{}' not found for the given profile",+ "connector with name '{}' and merchant connector account id '{:?}' not found for the given profile",choice.connector,mca_id,)diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rsindex 44bb67d0ba..8dc312b7f5 100644--- a/crates/router/src/core/verification.rs+++ b/crates/router/src/core/verification.rs@@ -87,7 +87,7 @@ pub async fn verify_merchant_creds_for_applepay(pub async fn get_verified_apple_domains_with_mid_mca_id(state: SessionState,merchant_id: common_utils::id_type::MerchantId,- merchant_connector_id: String,+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<services::ApplicationResponse<verifications::ApplepayVerifiedDomainsResponse>,errors::ApiErrorResponse,@@ -111,7 +111,7 @@ pub async fn get_verified_apple_domains_with_mid_mca_id(.find_by_merchant_connector_account_merchant_id_merchant_connector_id(key_manager_state,&merchant_id,- merchant_connector_id.as_str(),+ &merchant_connector_id,&key_store,).awaitdiff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rsindex c4fbf7ab08..e868fe930b 100644--- a/crates/router/src/core/verification/utils.rs+++ b/crates/router/src/core/verification/utils.rs@@ -16,7 +16,7 @@ pub async fn check_existence_and_add_domain_to_db(state: &SessionState,merchant_id: common_utils::id_type::MerchantId,profile_id_from_auth_layer: Option<common_utils::id_type::ProfileId>,- merchant_connector_id: String,+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId,domain_from_req: Vec<String>,) -> CustomResult<Vec<String>, errors::ApiErrorResponse> {let key_manager_state = &state.into();@@ -116,7 +116,10 @@ pub async fn check_existence_and_add_domain_to_db(.await.change_context(errors::ApiErrorResponse::InternalServerError).attach_printable_lazy(|| {- format!("Failed while updating MerchantConnectorAccount: id: {merchant_connector_id}")+ format!(+ "Failed while updating MerchantConnectorAccount: id: {:?}",+ merchant_connector_id+ )})?;Ok(already_verified_domains.clone())diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rsindex 01a1046be3..0a0a35c23c 100644--- a/crates/router/src/core/webhooks/incoming.rs+++ b/crates/router/src/core/webhooks/incoming.rs@@ -1598,7 +1598,7 @@ async fn verify_webhook_source_verification_call(fn get_connector_by_connector_name(state: &SessionState,connector_name: &str,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> CustomResult<(ConnectorEnum, String), errors::ApiErrorResponse> {let authentication_connector =api_models::enums::convert_authentication_connector(connector_name);@@ -1666,7 +1666,14 @@ async fn fetch_optional_mca_and_connector(.find_by_merchant_connector_account_merchant_id_merchant_connector_id(&state.into(),merchant_account.get_id(),- connector_name_or_mca_id,+ &common_utils::id_type::MerchantConnectorAccountId::wrap(+ connector_name_or_mca_id.to_owned(),+ )+ .change_context(errors::ApiErrorResponse::InternalServerError)+ .attach_printable(+ "Error while converting MerchanConnectorAccountId from string+ ",+ )?,key_store,).awaitdiff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rsindex 37613d5961..403b79a037 100644--- a/crates/router/src/db/kafka_store.rs+++ b/crates/router/src/db/kafka_store.rs@@ -1162,7 +1162,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {&self,state: &KeyManagerState,merchant_id: &id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {self.diesel_store@@ -1179,7 +1179,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {async fn find_merchant_connector_account_by_id(&self,state: &KeyManagerState,- id: &str,+ id: &id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {self.diesel_store@@ -1223,7 +1223,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(&self,merchant_id: &id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {self.diesel_store.delete_merchant_connector_account_by_merchant_id_merchant_connector_id(@@ -1236,7 +1236,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]async fn delete_merchant_connector_account_by_id(&self,- id: &str,+ id: &id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {self.diesel_store.delete_merchant_connector_account_by_id(id)@@ -1472,7 +1472,7 @@ impl PaymentAttemptInterface for KafkaStore {payment_method: Option<Vec<common_enums::PaymentMethod>>,payment_method_type: Option<Vec<common_enums::PaymentMethodType>>,authentication_type: Option<Vec<common_enums::AuthenticationType>>,- merchant_connector_id: Option<Vec<String>>,+ merchant_connector_id: Option<Vec<id_type::MerchantConnectorAccountId>>,storage_scheme: MerchantStorageScheme,) -> CustomResult<i64, errors::DataStorageError> {self.diesel_storediff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rsindex 1908e01e94..831804b0c6 100644--- a/crates/router/src/db/merchant_connector_account.rs+++ b/crates/router/src/db/merchant_connector_account.rs@@ -173,7 +173,7 @@ where&self,state: &KeyManagerState,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;@@ -181,7 +181,7 @@ whereasync fn find_merchant_connector_account_by_id(&self,state: &KeyManagerState,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;@@ -216,13 +216,13 @@ whereasync fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(&self,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError>;#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]async fn delete_merchant_connector_account_by_id(&self,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError>;}@@ -387,7 +387,7 @@ impl MerchantConnectorAccountInterface for Store {&self,state: &KeyManagerState,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {let find_call = || async {@@ -421,7 +421,7 @@ impl MerchantConnectorAccountInterface for Store {&format!("{}_{}",merchant_id.get_string_repr(),- merchant_connector_id+ merchant_connector_id.get_string_repr()),find_call,&cache::ACCOUNTS_CACHE,@@ -442,7 +442,7 @@ impl MerchantConnectorAccountInterface for Store {async fn find_merchant_connector_account_by_id(&self,state: &KeyManagerState,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {let find_call = || async {@@ -467,17 +467,22 @@ impl MerchantConnectorAccountInterface for Store {#[cfg(feature = "accounts_cache")]{- cache::get_or_populate_in_memory(self, id, find_call, &cache::ACCOUNTS_CACHE)- .await?- .convert(- state,- key_store.key.get_inner(),- common_utils::types::keymanager::Identifier::Merchant(- key_store.merchant_id.clone(),- ),- )- .await- .change_context(errors::StorageError::DecryptionError)+ cache::get_or_populate_in_memory(+ self,+ id.get_string_repr(),+ find_call,+ &cache::ACCOUNTS_CACHE,+ )+ .await?+ .convert(+ state,+ key_store.key.get_inner(),+ common_utils::types::keymanager::Identifier::Merchant(+ key_store.merchant_id.clone(),+ ),+ )+ .await+ .change_context(errors::StorageError::DecryptionError)}}@@ -593,7 +598,7 @@ impl MerchantConnectorAccountInterface for Store {format!("{}_{}",_merchant_id.get_string_repr(),- _merchant_connector_id+ _merchant_connector_id.get_string_repr()).into(),),@@ -693,7 +698,7 @@ impl MerchantConnectorAccountInterface for Store {format!("{}_{}",_merchant_id.get_string_repr(),- _merchant_connector_id+ _merchant_connector_id.get_string_repr()).into(),),@@ -775,7 +780,7 @@ impl MerchantConnectorAccountInterface for Store {format!("{}_{}",_merchant_id.get_string_repr(),- _merchant_connector_id+ _merchant_connector_id.get_string_repr()).into(),),@@ -815,7 +820,7 @@ impl MerchantConnectorAccountInterface for Store {async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(&self,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {let conn = connection::pg_connection_write(self).await?;let delete_call = || async {@@ -890,7 +895,7 @@ impl MerchantConnectorAccountInterface for Store {#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]async fn delete_merchant_connector_account_by_id(&self,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {let conn = connection::pg_connection_write(self).await?;let delete_call = || async {@@ -1092,7 +1097,7 @@ impl MerchantConnectorAccountInterface for MockDb {&self,state: &KeyManagerState,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {match self@@ -1102,7 +1107,7 @@ impl MerchantConnectorAccountInterface for MockDb {.iter().find(|account| {account.merchant_id == *merchant_id- && account.merchant_connector_id == merchant_connector_id+ && account.merchant_connector_id == *merchant_connector_id}).cloned().async_map(|account| async {@@ -1131,7 +1136,7 @@ impl MerchantConnectorAccountInterface for MockDb {async fn find_merchant_connector_account_by_id(&self,state: &KeyManagerState,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,key_store: &domain::MerchantKeyStore,) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError> {match self@@ -1139,7 +1144,7 @@ impl MerchantConnectorAccountInterface for MockDb {.lock().await.iter()- .find(|account| account.get_id() == id)+ .find(|account| account.get_id() == *id).cloned().async_map(|account| async {account@@ -1393,12 +1398,12 @@ impl MerchantConnectorAccountInterface for MockDb {async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(&self,merchant_id: &common_utils::id_type::MerchantId,- merchant_connector_id: &str,+ merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {let mut accounts = self.merchant_connector_accounts.lock().await;match accounts.iter().position(|account| {account.merchant_id == *merchant_id- && account.merchant_connector_id == merchant_connector_id+ && account.merchant_connector_id == *merchant_connector_id}) {Some(index) => {accounts.remove(index);@@ -1416,10 +1421,10 @@ impl MerchantConnectorAccountInterface for MockDb {#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]async fn delete_merchant_connector_account_by_id(&self,- id: &str,+ id: &common_utils::id_type::MerchantConnectorAccountId,) -> CustomResult<bool, errors::StorageError> {let mut accounts = self.merchant_connector_accounts.lock().await;- match accounts.iter().position(|account| account.get_id() == id) {+ match accounts.iter().position(|account| account.get_id() == *id) {Some(index) => {accounts.remove(index);return Ok(true);@@ -1562,7 +1567,10 @@ mod merchant_connector_account_cache_tests {.unwrap(),test_mode: None,disabled: None,- merchant_connector_id: merchant_connector_id.to_string(),+ merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId::wrap(+ merchant_connector_id.to_string(),+ )+ .unwrap(),payment_methods_enabled: None,connector_type: ConnectorType::FinOperations,metadata: None,@@ -1628,7 +1636,10 @@ mod merchant_connector_account_cache_tests {let delete_call = || async {db.delete_merchant_connector_account_by_merchant_id_merchant_connector_id(&merchant_id,- merchant_connector_id,+ &common_utils::id_type::MerchantConnectorAccountId::wrap(+ merchant_connector_id.to_string(),+ )+ .unwrap(),).await};@@ -1685,7 +1696,7 @@ mod merchant_connector_account_cache_tests {common_utils::id_type::MerchantId::try_from(std::borrow::Cow::from("test_merchant")).unwrap();let connector_label = "stripe_USA";- let id = "simple_id";+ let id = common_utils::generate_merchant_connector_account_id_of_default_length();let profile_id =common_utils::id_type::ProfileId::try_from(std::borrow::Cow::from("pro_max_ultra")).unwrap();@@ -1723,7 +1734,7 @@ mod merchant_connector_account_cache_tests {.unwrap();let mca = domain::MerchantConnectorAccount {- id: id.to_string(),+ id: id.clone(),merchant_id: merchant_id.clone(),connector_name: "stripe".to_string(),connector_account_details: domain::types::crypto_operation(@@ -1803,7 +1814,7 @@ mod merchant_connector_account_cache_tests {.await.unwrap();- let delete_call = || async { db.delete_merchant_connector_account_by_id(id).await };+ let delete_call = || async { db.delete_merchant_connector_account_by_id(&id).await };cache::publish_and_redact(&db,diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rsindex 343246e31a..7616e83bee 100644--- a/crates/router/src/routes/admin.rs+++ b/crates/router/src/routes/admin.rs@@ -410,7 +410,10 @@ pub async fn connector_create(pub async fn connector_retrieve(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<(common_utils::id_type::MerchantId, String)>,+ path: web::Path<(+ common_utils::id_type::MerchantId,+ common_utils::id_type::MerchantConnectorAccountId,+ )>,) -> HttpResponse {let flow = Flow::MerchantConnectorsRetrieve;let (merchant_id, merchant_connector_id) = path.into_inner();@@ -468,7 +471,7 @@ pub async fn connector_retrieve(pub async fn connector_retrieve(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<String>,+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,) -> HttpResponse {let flow = Flow::MerchantConnectorsRetrieve;let id = path.into_inner();@@ -623,7 +626,10 @@ pub async fn payment_connector_list_profile(pub async fn connector_update(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<(common_utils::id_type::MerchantId, String)>,+ path: web::Path<(+ common_utils::id_type::MerchantId,+ common_utils::id_type::MerchantConnectorAccountId,+ )>,json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>,) -> HttpResponse {let flow = Flow::MerchantConnectorsUpdate;@@ -680,7 +686,7 @@ pub async fn connector_update(pub async fn connector_update(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<String>,+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,json_payload: web::Json<api_models::admin::MerchantConnectorUpdate>,) -> HttpResponse {let flow = Flow::MerchantConnectorsUpdate;@@ -733,7 +739,10 @@ pub async fn connector_update(pub async fn connector_delete(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<(common_utils::id_type::MerchantId, String)>,+ path: web::Path<(+ common_utils::id_type::MerchantId,+ common_utils::id_type::MerchantConnectorAccountId,+ )>,) -> HttpResponse {let flow = Flow::MerchantConnectorsDelete;let (merchant_id, merchant_connector_id) = path.into_inner();@@ -784,7 +793,7 @@ pub async fn connector_delete(pub async fn connector_delete(state: web::Data<AppState>,req: HttpRequest,- path: web::Path<String>,+ path: web::Path<common_utils::id_type::MerchantConnectorAccountId>,) -> HttpResponse {let flow = Flow::MerchantConnectorsDelete;let id = path.into_inner();diff --git a/crates/router/src/routes/verification.rs b/crates/router/src/routes/verification.rsindex d064da0517..b818fcfc1d 100644--- a/crates/router/src/routes/verification.rs+++ b/crates/router/src/routes/verification.rs@@ -59,7 +59,7 @@ pub async fn retrieve_apple_pay_verified_domains(verification::get_verified_apple_domains_with_mid_mca_id(state,merchant_id.to_owned(),- mca_id.to_string(),+ mca_id.clone(),)},auth::auth_type(diff --git a/crates/router/src/services/kafka/authentication.rs b/crates/router/src/services/kafka/authentication.rsindex 42079525d8..0dfda622d3 100644--- a/crates/router/src/services/kafka/authentication.rs+++ b/crates/router/src/services/kafka/authentication.rs@@ -37,7 +37,7 @@ pub struct KafkaAuthentication<'a> {pub acs_signed_content: Option<&'a String>,pub profile_id: &'a common_utils::id_type::ProfileId,pub payment_id: Option<&'a String>,- pub merchant_connector_id: &'a String,+ pub merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,pub ds_trans_id: Option<&'a String>,pub directory_server_id: Option<&'a String>,pub acquirer_country_code: Option<&'a String>,diff --git a/crates/router/src/services/kafka/authentication_event.rs b/crates/router/src/services/kafka/authentication_event.rsindex 6213488a6d..8d48e56a61 100644--- a/crates/router/src/services/kafka/authentication_event.rs+++ b/crates/router/src/services/kafka/authentication_event.rs@@ -38,7 +38,7 @@ pub struct KafkaAuthenticationEvent<'a> {pub acs_signed_content: Option<&'a String>,pub profile_id: &'a common_utils::id_type::ProfileId,pub payment_id: Option<&'a String>,- pub merchant_connector_id: &'a String,+ pub merchant_connector_id: &'a common_utils::id_type::MerchantConnectorAccountId,pub ds_trans_id: Option<&'a String>,pub directory_server_id: Option<&'a String>,pub acquirer_country_code: Option<&'a String>,diff --git a/crates/router/src/services/kafka/dispute.rs b/crates/router/src/services/kafka/dispute.rsindex 6f789cbe94..62a4310a64 100644--- a/crates/router/src/services/kafka/dispute.rs+++ b/crates/router/src/services/kafka/dispute.rs@@ -31,7 +31,7 @@ pub struct KafkaDispute<'a> {pub connector: &'a String,pub evidence: &'a Secret<serde_json::Value>,pub profile_id: Option<&'a common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<&'a String>,+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,}impl<'a> KafkaDispute<'a> {diff --git a/crates/router/src/services/kafka/dispute_event.rs b/crates/router/src/services/kafka/dispute_event.rsindex e425491259..9b73cc2e51 100644--- a/crates/router/src/services/kafka/dispute_event.rs+++ b/crates/router/src/services/kafka/dispute_event.rs@@ -32,7 +32,7 @@ pub struct KafkaDisputeEvent<'a> {pub connector: &'a String,pub evidence: &'a Secret<serde_json::Value>,pub profile_id: Option<&'a common_utils::id_type::ProfileId>,- pub merchant_connector_id: Option<&'a String>,+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,}impl<'a> KafkaDisputeEvent<'a> {diff --git a/crates/router/src/services/kafka/payment_attempt.rs b/crates/router/src/services/kafka/payment_attempt.rsindex df566ad8a8..08ec50f06b 100644--- a/crates/router/src/services/kafka/payment_attempt.rs+++ b/crates/router/src/services/kafka/payment_attempt.rs@@ -47,7 +47,7 @@ pub struct KafkaPaymentAttempt<'a> {pub error_reason: Option<&'a String>,pub multiple_capture_count: Option<i16>,pub amount_capturable: MinorUnit,- pub merchant_connector_id: Option<&'a String>,+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,pub net_amount: MinorUnit,pub unified_code: Option<&'a String>,pub unified_message: Option<&'a String>,diff --git a/crates/router/src/services/kafka/payment_attempt_event.rs b/crates/router/src/services/kafka/payment_attempt_event.rsindex 95c5d9edd5..c6337a3b5f 100644--- a/crates/router/src/services/kafka/payment_attempt_event.rs+++ b/crates/router/src/services/kafka/payment_attempt_event.rs@@ -48,7 +48,7 @@ pub struct KafkaPaymentAttemptEvent<'a> {pub error_reason: Option<&'a String>,pub multiple_capture_count: Option<i16>,pub amount_capturable: MinorUnit,- pub merchant_connector_id: Option<&'a String>,+ pub merchant_connector_id: Option<&'a common_utils::id_type::MerchantConnectorAccountId>,pub net_amount: MinorUnit,pub unified_code: Option<&'a String>,pub unified_message: Option<&'a String>,diff --git a/crates/router/src/services/kafka/payout.rs b/crates/router/src/services/kafka/payout.rsindex 08733c4600..7a6254bd52 100644--- a/crates/router/src/services/kafka/payout.rs+++ b/crates/router/src/services/kafka/payout.rs@@ -37,7 +37,7 @@ pub struct KafkaPayout<'a> {pub error_code: Option<&'a String>,pub business_country: Option<storage_enums::CountryAlpha2>,pub business_label: Option<&'a String>,- pub merchant_connector_id: Option<&'a String>,+ pub merchant_connector_id: Option<&'a id_type::MerchantConnectorAccountId>,}impl<'a> KafkaPayout<'a> {diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rsindex 775cc91ebe..681cd6fd11 100644--- a/crates/router/src/types/api.rs+++ b/crates/router/src/types/api.rs@@ -201,7 +201,7 @@ pub struct ConnectorData {pub connector: ConnectorEnum,pub connector_name: types::Connector,pub get_token: GetToken,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,}#[derive(Clone)]@@ -264,7 +264,7 @@ impl ConnectorData {connectors: &Connectors,name: &str,connector_type: GetToken,- connector_id: Option<String>,+ connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> CustomResult<Self, errors::ApiErrorResponse> {let connector = Self::convert_connector(connectors, name)?;let connector_name = api_enums::Connector::from_str(name)@@ -284,7 +284,7 @@ impl ConnectorData {connectors: &Connectors,name: &str,connector_type: GetToken,- connector_id: Option<String>,+ connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> CustomResult<Self, errors::ApiErrorResponse> {let connector = Self::convert_connector(connectors, name)?;let payout_connector_name = api_enums::PayoutConnectors::from_str(name)diff --git a/crates/router/src/types/storage.rs b/crates/router/src/types/storage.rsindex c372a9c09b..9665642389 100644--- a/crates/router/src/types/storage.rs+++ b/crates/router/src/types/storage.rs@@ -74,7 +74,7 @@ use crate::types::api::routing;pub struct RoutingData {pub routed_through: Option<String>,- pub merchant_connector_id: Option<String>,+ pub merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,pub routing_info: PaymentRoutingInfo,pub algorithm: Option<api_models::routing::StraightThroughAlgorithm>,diff --git a/crates/router/src/types/storage/payment_method.rs b/crates/router/src/types/storage/payment_method.rsindex 31b039ab45..0e7bdb14d4 100644--- a/crates/router/src/types/storage/payment_method.rs+++ b/crates/router/src/types/storage/payment_method.rs@@ -95,10 +95,13 @@ pub struct PaymentsMandateReferenceRecord {}#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]-pub struct PaymentsMandateReference(pub HashMap<String, PaymentsMandateReferenceRecord>);+pub struct PaymentsMandateReference(+ pub HashMap<common_utils::id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>,+);impl Deref for PaymentsMandateReference {- type Target = HashMap<String, PaymentsMandateReferenceRecord>;+ type Target =+ HashMap<common_utils::id_type::MerchantConnectorAccountId, PaymentsMandateReferenceRecord>;fn deref(&self) -> &Self::Target {&self.0diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rsindex 7e5f857134..ce8419ad3c 100644--- a/crates/router/src/utils.rs+++ b/crates/router/src/utils.rs@@ -384,7 +384,10 @@ pub async fn find_mca_from_authentication_id_type(.await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: authentication.merchant_connector_id.to_string(),+ id: authentication+ .merchant_connector_id+ .get_string_repr()+ .to_string(),},)}@@ -430,7 +433,7 @@ pub async fn get_mca_from_payment_intent(.await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id,+ id: merchant_connector_id.get_string_repr().to_string(),},)}@@ -528,7 +531,7 @@ pub async fn get_mca_from_payout_attempt(.await.to_not_found_response(errors::ApiErrorResponse::MerchantConnectorAccountNotFound {- id: merchant_connector_id,+ id: merchant_connector_id.get_string_repr().to_string(),},)}diff --git a/crates/router/src/utils/connector_onboarding.rs b/crates/router/src/utils/connector_onboarding.rsindex 7813a7cb31..3c1aea6f7a 100644--- a/crates/router/src/utils/connector_onboarding.rs+++ b/crates/router/src/utils/connector_onboarding.rs@@ -42,7 +42,7 @@ pub fn is_enabled(pub async fn check_if_connector_exists(state: &SessionState,- connector_id: &str,+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,merchant_id: &common_utils::id_type::MerchantId,) -> RouterResult<()> {let key_manager_state = &state.into();@@ -70,7 +70,7 @@ pub async fn check_if_connector_exists().await.to_not_found_response(ApiErrorResponse::MerchantConnectorAccountNotFound {- id: connector_id.to_string(),+ id: connector_id.get_string_repr().to_string(),})?;#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]@@ -85,7 +85,7 @@ pub async fn check_if_connector_exists(pub async fn set_tracking_id_in_configs(state: &SessionState,- connector_id: &str,+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,connector: enums::Connector,) -> RouterResult<()> {let timestamp = common_utils::date_time::now_unix_timestamp().to_string();@@ -130,7 +130,7 @@ pub async fn set_tracking_id_in_configs(pub async fn get_tracking_id_from_configs(state: &SessionState,- connector_id: &str,+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,connector: enums::Connector,) -> RouterResult<String> {let timestamp = state@@ -144,14 +144,17 @@ pub async fn get_tracking_id_from_configs(.attach_printable("Error getting data from configs table")?.config;- Ok(format!("{}_{}", connector_id, timestamp))+ Ok(format!("{}_{}", connector_id.get_string_repr(), timestamp))}-fn build_key(connector_id: &str, connector: enums::Connector) -> String {+fn build_key(+ connector_id: &common_utils::id_type::MerchantConnectorAccountId,+ connector: enums::Connector,+) -> String {format!("{}_{}_{}",consts::CONNECTOR_ONBOARDING_CONFIG_PREFIX,connector,- connector_id,+ connector_id.get_string_repr(),)}diff --git a/crates/router/tests/connectors/utils.rs b/crates/router/tests/connectors/utils.rsindex 16e1d6a7c2..b9be08c435 100644--- a/crates/router/tests/connectors/utils.rs+++ b/crates/router/tests/connectors/utils.rs@@ -47,7 +47,7 @@ pub fn construct_connector_data_old(connector: types::api::BoxedConnector,connector_name: types::Connector,get_token: types::api::GetToken,- merchant_connector_id: Option<String>,+ merchant_connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,) -> types::api::ConnectorData {types::api::ConnectorData {connector: ConnectorEnum::Old(connector),diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rsindex ed3c47b9c9..37e01cbbb5 100644--- a/crates/storage_impl/src/mock_db/payment_attempt.rs+++ b/crates/storage_impl/src/mock_db/payment_attempt.rs@@ -44,7 +44,7 @@ impl PaymentAttemptInterface for MockDb {_payment_method: Option<Vec<PaymentMethod>>,_payment_method_type: Option<Vec<PaymentMethodType>>,_authentication_type: Option<Vec<AuthenticationType>>,- _merchanat_connector_id: Option<Vec<String>>,+ _merchanat_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,_storage_scheme: storage_enums::MerchantStorageScheme,) -> CustomResult<i64, StorageError> {Err(StorageError::MockDbError)?diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rsindex a599618615..382abacfa7 100644--- a/crates/storage_impl/src/payments/payment_attempt.rs+++ b/crates/storage_impl/src/payments/payment_attempt.rs@@ -295,7 +295,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {payment_method: Option<Vec<PaymentMethod>>,payment_method_type: Option<Vec<PaymentMethodType>>,authentication_type: Option<Vec<AuthenticationType>>,- merchant_connector_id: Option<Vec<String>>,+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,_storage_scheme: MerchantStorageScheme,) -> CustomResult<i64, errors::StorageError> {let conn = self@@ -1064,7 +1064,7 @@ impl<T: DatabaseStore> PaymentAttemptInterface for KVRouterStore<T> {payment_method: Option<Vec<PaymentMethod>>,payment_method_type: Option<Vec<PaymentMethodType>>,authentication_type: Option<Vec<AuthenticationType>>,- merchant_connector_id: Option<Vec<String>>,+ merchant_connector_id: Option<Vec<common_utils::id_type::MerchantConnectorAccountId>>,storage_scheme: MerchantStorageScheme,) -> CustomResult<i64, errors::StorageError> {self.router_store