refactor(merchant_id): create domain type for merchant_id (#5408)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
Co-authored-by: Sanchith Hegde <22217505+SanchithHegde@users.noreply.github.com>
This commit is contained in:
Narayan Bhat
2024-07-24 19:18:25 +05:30
committed by GitHub
parent e18ea7a7ba
commit 7068fbfbe2
406 changed files with 3168 additions and 2633 deletions

View File

@ -72,8 +72,8 @@ pub struct MerchantAccountCreate {
pub sub_merchants_enabled: Option<bool>,
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf")]
pub parent_merchant_id: Option<String>,
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf", value_type = Option<String>)]
pub parent_merchant_id: Option<id_type::MerchantId>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = false, example = true)]
@ -264,8 +264,8 @@ pub struct MerchantAccountMetadata {
#[serde(deny_unknown_fields)]
pub struct MerchantAccountUpdate {
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Name of the Merchant Account
#[schema(example = "NewAge Retailer")]
@ -296,8 +296,8 @@ pub struct MerchantAccountUpdate {
pub sub_merchants_enabled: Option<bool>,
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf")]
pub parent_merchant_id: Option<String>,
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf", value_type = Option<String>)]
pub parent_merchant_id: Option<id_type::MerchantId>,
/// A boolean value to indicate if payment response hash needs to be enabled
#[schema(default = false, example = true)]
@ -346,8 +346,8 @@ pub struct MerchantAccountUpdate {
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct MerchantAccountResponse {
/// The identifier for the Merchant Account
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Name of the Merchant Account
#[schema(value_type = Option<String>,example = "NewAge Retailer")]
@ -392,8 +392,8 @@ pub struct MerchantAccountResponse {
pub sub_merchants_enabled: Option<bool>,
/// Refers to the Parent Merchant ID if the merchant being created is a sub-merchant
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf")]
pub parent_merchant_id: Option<String>,
#[schema(max_length = 255, example = "xkkdf909012sdjki2dkh5sdf", value_type = Option<String>)]
pub parent_merchant_id: Option<id_type::MerchantId>,
/// API key that will be used for server side API access
#[schema(example = "AH3423bkjbkjdsfbkj")]
@ -555,8 +555,8 @@ pub struct WebhookDetails {
#[derive(Debug, Serialize, ToSchema)]
pub struct MerchantAccountDeleteResponse {
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// If the connector is deleted or not
#[schema(example = false)]
pub deleted: bool,
@ -564,12 +564,13 @@ pub struct MerchantAccountDeleteResponse {
#[derive(Default, Debug, Deserialize, Serialize)]
pub struct MerchantId {
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
}
#[derive(Default, Debug, Deserialize, ToSchema, Serialize)]
pub struct MerchantConnectorId {
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
pub merchant_connector_id: String,
}
@ -1037,8 +1038,8 @@ pub enum AcceptedCountries {
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct MerchantConnectorDeleteResponse {
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[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,
@ -1050,8 +1051,8 @@ pub struct MerchantConnectorDeleteResponse {
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ToggleKVResponse {
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Status of KV for the specific merchant
#[schema(example = true)]
pub kv_enabled: bool,
@ -1076,7 +1077,8 @@ pub struct TransferKeyResponse {
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct ToggleKVRequest {
#[serde(skip_deserializing)]
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Status of KV for the specific merchant
#[schema(example = true)]
pub kv_enabled: bool,
@ -1208,7 +1210,7 @@ pub struct BusinessProfileCreate {
#[schema(value_type = Option<BusinessPayoutLinkConfig>)]
pub payout_link_config: Option<BusinessPayoutLinkConfig>,
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.
/// These key-value pairs are sent as additional custom headers in the outgoing webhook request. It is recommended not to use more than four key-value pairs.
#[schema(value_type = Option<Object>, example = r#"{ "key1": "value-1", "key2": "value-2" }"#)]
pub outgoing_webhook_custom_http_headers: Option<HashMap<String, String>>,
}
@ -1216,8 +1218,8 @@ pub struct BusinessProfileCreate {
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct BusinessProfileResponse {
/// The identifier for Merchant Account
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The default business profile that must be used for creating merchant accounts and payments
#[schema(max_length = 64, example = "pro_abcdefghijklmnopqrstuvwxyz")]

View File

@ -114,7 +114,7 @@ pub struct ReportRequest {
#[serde(rename_all = "camelCase")]
pub struct GenerateReportRequest {
pub request: ReportRequest,
pub merchant_id: String,
pub merchant_id: common_utils::id_type::MerchantId,
pub email: Secret<String, EmailStrategy>,
}

View File

@ -33,8 +33,8 @@ pub struct CreateApiKeyResponse {
pub key_id: String,
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The unique name for the API Key to help you identify it.
#[schema(max_length = 64, example = "Sandbox integration key")]
@ -76,8 +76,8 @@ pub struct RetrieveApiKeyResponse {
pub key_id: String,
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The unique name for the API Key to help you identify it.
#[schema(max_length = 64, example = "Sandbox integration key")]
@ -134,15 +134,16 @@ pub struct UpdateApiKeyRequest {
pub key_id: String,
#[serde(skip_deserializing)]
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
}
/// The response body for revoking an API Key.
#[derive(Debug, Serialize, ToSchema)]
pub struct RevokeApiKeyResponse {
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The identifier for the API Key.
#[schema(max_length = 64, example = "5hEEqkgJUyuxgSKGArHA4mWSnX")]

View File

@ -1,12 +1,12 @@
#[derive(Debug, Clone, serde::Serialize)]
pub struct ApplePayCertificatesMigrationResponse {
pub migration_successful: Vec<String>,
pub migration_failed: Vec<String>,
pub migration_successful: Vec<common_utils::id_type::MerchantId>,
pub migration_failed: Vec<common_utils::id_type::MerchantId>,
}
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, PartialEq, Eq)]
pub struct ApplePayCertificatesMigrationRequest {
pub merchant_ids: Vec<String>,
pub merchant_ids: Vec<common_utils::id_type::MerchantId>,
}
impl common_utils::events::ApiEventMetric for ApplePayCertificatesMigrationRequest {}

View File

@ -45,7 +45,7 @@ pub enum PayPalOnboardingStatus {
#[derive(serde::Serialize, Debug, Clone)]
pub struct PayPalOnboardingDone {
pub payer_id: String,
pub payer_id: common_utils::id_type::MerchantId,
}
#[derive(serde::Serialize, Debug, Clone)]

View File

@ -21,8 +21,8 @@ pub struct CustomerRequest {
pub customer_id: Option<id_type::CustomerId>,
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
#[serde(default = "unknown_merchant", skip)]
pub merchant_id: String,
#[serde(skip)]
pub merchant_id: id_type::MerchantId,
/// The customer's name
#[schema(max_length = 255, value_type = Option<String>, example = "Jon Test")]
pub name: Option<Secret<String>>,
@ -342,8 +342,3 @@ pub struct CustomerDeleteResponse {
#[schema(example = false)]
pub payment_methods_deleted: bool,
}
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
fn unknown_merchant() -> String {
String::from("merchant_unknown")
}

View File

@ -100,7 +100,7 @@ pub struct PaymentMethodCreate {
/// This struct is only used by and internal api to migrate payment method
pub struct PaymentMethodMigrate {
/// Merchant id
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
/// The type of payment method use for the payment.
pub payment_method: Option<api_enums::PaymentMethod>,
@ -352,8 +352,8 @@ impl CardDetailUpdate {
#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)]
pub struct PaymentMethodResponse {
/// Unique identifier for a merchant
#[schema(example = "merchant_1671528864")]
pub merchant_id: String,
#[schema(example = "merchant_1671528864", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The unique identifier of the customer.
#[schema(value_type = Option<String>, max_length = 64, min_length = 1, example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
@ -1176,8 +1176,8 @@ pub struct PaymentMethodCollectLinkResponse {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct PaymentMethodCollectLinkRenderRequest {
/// Unique identifier for a merchant.
#[schema(example = "merchant_1671528864")]
pub merchant_id: String,
#[schema(example = "merchant_1671528864", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The unique identifier for the collect link.
#[schema(value_type = String, example = "pm_collect_link_2bdacf398vwzq5n422S1")]
@ -1346,7 +1346,7 @@ pub struct PaymentMethodRecord {
pub email: Option<pii::Email>,
pub phone: Option<masking::Secret<String>>,
pub phone_country_code: Option<String>,
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub payment_method: Option<api_enums::PaymentMethod>,
pub payment_method_type: Option<api_enums::PaymentMethodType>,
pub nick_name: masking::Secret<String>,

View File

@ -272,9 +272,9 @@ pub struct PaymentsRequest {
/// This is an identifier for the merchant account. This is inferred from the API key
/// provided during the request
#[schema(max_length = 255, example = "merchant_1668273825")]
#[schema(max_length = 255, example = "merchant_1668273825", value_type = Option<String>)]
#[remove_in(PaymentsUpdateRequest, PaymentsCreateRequest, PaymentsConfirmRequest)]
pub merchant_id: Option<String>,
pub merchant_id: Option<id_type::MerchantId>,
/// Details of the routing configuration for that payment
#[schema(value_type = Option<StraightThroughAlgorithm>, example = json!({
@ -934,7 +934,7 @@ impl From<MinorUnit> for Amount {
#[serde(deny_unknown_fields)]
pub struct PaymentsRedirectRequest {
pub payment_id: String,
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub connector: String,
pub param: String,
}
@ -2877,7 +2877,8 @@ pub struct CardResponse {
#[serde(rename_all = "snake_case")]
pub struct RewardData {
/// The merchant ID with which we have to call the connector
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
}
#[derive(Debug, Clone, Eq, PartialEq, serde::Serialize, serde::Deserialize, ToSchema)]
@ -3282,7 +3283,8 @@ pub struct PaymentsCaptureRequest {
#[serde(skip_deserializing)]
pub payment_id: String,
/// The unique identifier for the merchant
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
/// The Amount to be captured/ debited from the user's payment method.
#[schema(value_type = i64, example = 6540)]
pub amount_to_capture: Option<MinorUnit>,
@ -3570,8 +3572,8 @@ pub struct PaymentsResponse {
/// This is an identifier for the merchant account. This is inferred from the API key
/// provided during the request
#[schema(max_length = 255, example = "merchant_1668273825")]
pub merchant_id: Option<String>,
#[schema(max_length = 255, example = "merchant_1668273825", value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
#[schema(value_type = IntentStatus, example = "failed", default = "requires_confirmation")]
pub status: api_enums::IntentStatus,
@ -4110,7 +4112,7 @@ pub struct TimeRange {
#[derive(Setter, Clone, Default, Debug, PartialEq, serde::Serialize)]
pub struct VerifyResponse {
pub verify_id: Option<String>,
pub merchant_id: Option<String>,
pub merchant_id: Option<id_type::MerchantId>,
// pub status: enums::VerifyStatus,
pub client_secret: Option<Secret<String>>,
pub customer_id: Option<id_type::CustomerId>,
@ -4276,7 +4278,7 @@ pub struct RedirectionResponse {
pub struct PaymentsResponseForm {
pub transaction_id: String,
// pub transaction_reference_id: String,
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub order_id: String,
}
@ -4285,7 +4287,8 @@ pub struct PaymentsRetrieveRequest {
/// The type of ID (ex: payment intent id, payment attempt id or connector txn id)
pub resource_id: PaymentIdType,
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
/// Decider to enable or disable the connector call for retrieve request
pub force_sync: bool,
/// The parameters passed to a retrieve request
@ -4883,7 +4886,8 @@ pub struct PaymentsSessionResponse {
#[derive(Default, Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)]
pub struct PaymentRetrieveBody {
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
/// Decider to enable or disable the connector call for retrieve request
pub force_sync: Option<bool>,
/// This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
@ -4899,7 +4903,8 @@ pub struct PaymentRetrieveBodyWithCredentials {
/// The identifier for payment.
pub payment_id: String,
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
/// Decider to enable or disable the connector call for retrieve request
pub force_sync: Option<bool>,
/// Merchant connector details used to make payments.
@ -4967,7 +4972,8 @@ pub struct PaymentsManualUpdateRequest {
/// The identifier for the payment attempt
pub attempt_id: String,
/// Merchant ID
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The status of the attempt
pub attempt_status: Option<enums::AttemptStatus>,
/// Error code of the connector
@ -5059,7 +5065,8 @@ pub struct PaymentsStartRequest {
/// that have been done by a single merchant. This field is auto generated and is returned in the API response.
pub payment_id: String,
/// The identifier for the Merchant Account.
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The identifier for the payment transaction
pub attempt_id: String,
}
@ -5275,7 +5282,8 @@ pub struct RetrievePaymentLinkResponse {
/// Identifier for Payment Link
pub payment_link_id: String,
/// Identifier for Merchant
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
/// Payment Link
pub link_to_pay: String,
/// The payment amount. Amount for the payment in the lowest denomination of the currency
@ -5297,7 +5305,8 @@ pub struct RetrievePaymentLinkResponse {
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
pub struct PaymentLinkInitiateRequest {
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
pub payment_id: String,
}

View File

@ -33,8 +33,8 @@ pub struct PayoutCreateRequest {
/// This is an identifier for the merchant account. This is inferred from the API key
/// provided during the request
#[schema(max_length = 255, value_type = String, example = "merchant_1668273825")]
pub merchant_id: Option<String>,
#[schema(max_length = 255, value_type = Option<String>, example = "merchant_1668273825")]
pub merchant_id: Option<id_type::MerchantId>,
/// The payout amount. Amount for the payout in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
#[schema(value_type = i64, example = 1000)]
@ -362,7 +362,7 @@ pub struct PayoutCreateResponse {
/// This is an identifier for the merchant account. This is inferred from the API key
/// provided during the request
#[schema(max_length = 255, value_type = String, example = "merchant_1668273825")]
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
/// The payout amount. Amount for the payout in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc.,
#[schema(value_type = i64, example = 1000)]
@ -531,7 +531,8 @@ pub struct PayoutAttemptResponse {
#[derive(Default, Debug, Clone, Deserialize, ToSchema)]
pub struct PayoutRetrieveBody {
pub force_sync: Option<bool>,
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
}
#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
@ -552,7 +553,8 @@ pub struct PayoutRetrieveRequest {
pub force_sync: Option<bool>,
/// The identifier for the Merchant Account.
pub merchant_id: Option<String>,
#[schema(value_type = Option<String>)]
pub merchant_id: Option<id_type::MerchantId>,
}
#[derive(Default, Debug, Serialize, ToSchema, Clone, Deserialize)]
@ -707,7 +709,8 @@ pub struct PayoutLinkResponse {
#[derive(Clone, Debug, serde::Deserialize, ToSchema, serde::Serialize)]
pub struct PayoutLinkInitiateRequest {
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: id_type::MerchantId,
pub payout_id: String,
}

View File

@ -5,7 +5,7 @@ use crate::enums;
#[derive(serde::Deserialize, Debug, serde::Serialize)]
pub struct ReconUpdateMerchantRequest {
pub merchant_id: String,
pub merchant_id: common_utils::id_type::MerchantId,
pub recon_status: enums::ReconStatus,
pub user_email: pii::Email,
}

View File

@ -32,8 +32,8 @@ pub struct RefundRequest {
pub refund_id: Option<String>,
/// The identifier for the Merchant Account
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: Option<String>,
#[schema(max_length = 255, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = Option<String>)]
pub merchant_id: Option<common_utils::id_type::MerchantId>,
/// Total amount for which the refund is to be initiated. Amount for the payment in lowest denomination of the currency. (i.e) in cents for USD denomination, in paisa for INR denomination etc., If not provided, this will default to the full payment amount
#[schema(value_type = Option<i64> , minimum = 100, example = 6540)]
@ -103,7 +103,8 @@ pub struct RefundManualUpdateRequest {
#[serde(skip)]
pub refund_id: String,
/// Merchant ID
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The status for refund
pub status: Option<RefundStatus>,
/// The code for the error

View File

@ -445,7 +445,8 @@ pub struct RoutingDictionaryRecord {
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct RoutingDictionary {
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
pub active_id: Option<String>,
pub records: Vec<RoutingDictionaryRecord>,
}

View File

@ -28,7 +28,7 @@ pub type SignUpResponse = DashboardEntryResponse;
#[derive(serde::Serialize, Debug, Clone)]
pub struct DashboardEntryResponse {
pub token: Secret<String>,
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub name: Secret<String>,
pub email: pii::Email,
pub verification_days_left: Option<i64>,
@ -71,7 +71,7 @@ pub struct AuthorizeResponse {
pub user_id: String,
//this field is added for audit/debug reasons
#[serde(skip_serializing)]
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
}
#[derive(serde::Deserialize, Debug, serde::Serialize)]
@ -125,7 +125,7 @@ pub struct AcceptInviteFromEmailRequest {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct SwitchMerchantIdRequest {
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
}
#[derive(serde::Deserialize, Debug, serde::Serialize)]
@ -156,7 +156,7 @@ pub struct UserDetails {
#[derive(serde::Serialize, Debug, Clone)]
pub struct GetUserDetailsResponse {
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub name: Secret<String>,
pub email: pii::Email,
pub verification_days_left: Option<i64>,
@ -201,7 +201,7 @@ pub struct SendVerifyEmailRequest {
#[derive(Debug, serde::Serialize)]
pub struct UserMerchantAccount {
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub merchant_name: OptionalEncryptableName,
pub is_active: bool,
pub role_id: String,
@ -212,14 +212,14 @@ pub struct UserMerchantAccount {
#[cfg(feature = "recon")]
#[derive(serde::Serialize, Debug)]
pub struct VerifyTokenResponse {
pub merchant_id: String,
pub merchant_id: id_type::MerchantId,
pub user_email: pii::Email,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct UpdateUserAccountDetailsRequest {
pub name: Option<Secret<String>>,
pub preferred_merchant_id: Option<String>,
pub preferred_merchant_id: Option<id_type::MerchantId>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]

View File

@ -99,13 +99,13 @@ pub enum UserStatus {
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct MerchantSelectRequest {
pub merchant_ids: Vec<String>,
pub merchant_ids: Vec<common_utils::id_type::MerchantId>,
// TODO: Remove this once the token only api is being used
pub need_dashboard_entry_response: Option<bool>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct AcceptInvitationRequest {
pub merchant_ids: Vec<String>,
pub merchant_ids: Vec<common_utils::id_type::MerchantId>,
}
#[derive(Debug, serde::Deserialize, serde::Serialize)]

View File

@ -27,7 +27,7 @@ pub struct ApplepayMerchantResponse {
#[derive(Debug, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub struct ApplepayGetVerifiedDomainsParam {
pub merchant_id: String,
pub merchant_id: common_utils::id_type::MerchantId,
pub merchant_connector_account_id: String,
}
/// Response to be sent for derivation of the already verified domains

View File

@ -47,8 +47,8 @@ pub struct EventListItemResponse {
pub event_id: String,
/// The identifier for the Merchant Account.
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44")]
pub merchant_id: String,
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The identifier for the Business Profile.
#[schema(max_length = 64, example = "SqB0zwDGR5wHppWf0bx7GKr1f2")]
@ -97,7 +97,11 @@ pub struct EventRetrieveResponse {
impl common_utils::events::ApiEventMetric for EventRetrieveResponse {
fn get_api_event_type(&self) -> Option<common_utils::events::ApiEventsType> {
Some(common_utils::events::ApiEventsType::Events {
merchant_id_or_profile_id: self.event_information.merchant_id.clone(),
merchant_id_or_profile_id: self
.event_information
.merchant_id
.get_string_repr()
.to_owned(),
})
}
}

View File

@ -207,7 +207,8 @@ pub struct IncomingWebhookDetails {
#[derive(Debug, Clone, Serialize, ToSchema)]
pub struct OutgoingWebhook {
/// The merchant id of the merchant
pub merchant_id: String,
#[schema(value_type = String)]
pub merchant_id: common_utils::id_type::MerchantId,
/// The unique event id for each webhook
pub event_id: String,