mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-29 17:19:15 +08:00
refactor: introduce a domain type for profile ID (#5687)
This commit is contained in:
@ -330,9 +330,8 @@ pub struct MerchantAccountUpdate {
|
||||
pub frm_routing_algorithm: Option<serde_json::Value>,
|
||||
|
||||
/// The default business profile that must be used for creating merchant accounts and payments
|
||||
/// To unset this field, pass an empty string
|
||||
#[schema(max_length = 64)]
|
||||
pub default_profile: Option<String>,
|
||||
#[schema(max_length = 64, value_type = Option<String>)]
|
||||
pub default_profile: Option<id_type::ProfileId>,
|
||||
|
||||
/// Default payment method collect link config
|
||||
#[schema(value_type = Option<BusinessCollectLinkConfig>)]
|
||||
@ -526,8 +525,8 @@ pub struct MerchantAccountResponse {
|
||||
pub is_recon_enabled: bool,
|
||||
|
||||
/// The default business profile that must be used for creating merchant accounts and payments
|
||||
#[schema(max_length = 64)]
|
||||
pub default_profile: Option<String>,
|
||||
#[schema(max_length = 64, value_type = Option<String>)]
|
||||
pub default_profile: Option<id_type::ProfileId>,
|
||||
|
||||
/// Used to indicate the status of the recon module for a merchant account
|
||||
#[schema(value_type = ReconStatus, example = "not_requested")]
|
||||
@ -699,7 +698,8 @@ pub struct MerchantConnectorCreate {
|
||||
pub connector_label: Option<String>,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// An object containing the required details/credentials for a Connector account.
|
||||
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
@ -829,7 +829,8 @@ pub struct MerchantConnectorCreate {
|
||||
pub connector_label: Option<String>,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(max_length = 64, value_type = Option<String>)]
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
|
||||
/// An object containing the required details/credentials for a Connector account.
|
||||
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
@ -1063,8 +1064,8 @@ pub struct MerchantConnectorResponse {
|
||||
pub id: String,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
#[schema(max_length = 64)]
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// An object containing the required details/credentials for a Connector account.
|
||||
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
@ -1170,8 +1171,8 @@ pub struct MerchantConnectorResponse {
|
||||
pub merchant_connector_id: String,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
#[schema(max_length = 64)]
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// An object containing the required details/credentials for a Connector account.
|
||||
#[schema(value_type = Option<MerchantConnectorDetails>,example = json!({ "auth_type": "HeaderKey","api_key": "Basic MyVerySecretApiKey" }))]
|
||||
@ -1294,8 +1295,8 @@ pub struct MerchantConnectorListResponse {
|
||||
pub merchant_connector_id: String,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
#[schema(max_length = 64)]
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// An object containing the details about the payment methods that need to be enabled under this merchant connector account
|
||||
#[schema(example = json!([
|
||||
@ -1403,8 +1404,8 @@ pub struct MerchantConnectorListResponse {
|
||||
pub id: String,
|
||||
|
||||
/// Identifier for the business profile, if not provided default will be chosen from merchant account
|
||||
#[schema(max_length = 64)]
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// An object containing the details about the payment methods that need to be enabled under this merchant connector account
|
||||
#[schema(example = json!([
|
||||
@ -2076,9 +2077,9 @@ pub struct BusinessProfileResponse {
|
||||
#[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")]
|
||||
pub profile_id: String,
|
||||
/// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
|
||||
#[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// Name of the business profile
|
||||
#[schema(max_length = 64)]
|
||||
@ -2193,8 +2194,8 @@ pub struct BusinessProfileResponse {
|
||||
pub merchant_id: id_type::MerchantId,
|
||||
|
||||
/// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
|
||||
#[schema(max_length = 64, example = "pro_abcdefghijklmnopqrstuvwxyz")]
|
||||
pub id: String,
|
||||
#[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
|
||||
pub id: id_type::ProfileId,
|
||||
|
||||
/// Name of the business profile
|
||||
#[schema(max_length = 64)]
|
||||
|
||||
@ -15,7 +15,7 @@ pub enum ActionUrlResponse {
|
||||
|
||||
#[derive(serde::Deserialize, serde::Serialize, Debug, Clone)]
|
||||
pub struct OnboardingSyncRequest {
|
||||
pub profile_id: String,
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
pub connector_id: String,
|
||||
pub connector: enums::Connector,
|
||||
}
|
||||
|
||||
@ -44,7 +44,8 @@ pub struct DisputeResponse {
|
||||
#[serde(with = "common_utils::custom_serde::iso8601")]
|
||||
pub created_at: PrimitiveDateTime,
|
||||
/// The `profile_id` associated with the dispute
|
||||
pub profile_id: Option<String>,
|
||||
#[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>,
|
||||
}
|
||||
@ -109,7 +110,8 @@ pub struct DisputeListConstraints {
|
||||
/// limit on the number of objects to return
|
||||
pub limit: Option<i64>,
|
||||
/// The identifier for business profile
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
/// status of the dispute
|
||||
pub dispute_status: Option<DisputeStatus>,
|
||||
/// stage of the dispute
|
||||
|
||||
@ -480,7 +480,8 @@ pub struct PaymentsRequest {
|
||||
|
||||
/// The business profile to be used for this payment, if not passed the default business profile associated with the merchant account will be used. It is mandatory in case multiple business profiles have been set up.
|
||||
#[remove_in(PaymentsUpdateRequest, PaymentsConfirmRequest)]
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
|
||||
#[remove_in(PaymentsConfirmRequest)]
|
||||
#[schema(value_type = Option<RequestSurchargeDetails>)]
|
||||
@ -3815,7 +3816,8 @@ pub struct PaymentsResponse {
|
||||
/// Details for Payment link
|
||||
pub payment_link: Option<PaymentLinkResponse>,
|
||||
/// The business profile that is associated with this payment
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
|
||||
/// Details of surcharge applied on this payment
|
||||
pub surcharge_details: Option<RequestSurchargeDetails>,
|
||||
@ -4031,7 +4033,7 @@ pub struct PaymentListFilterConstraints {
|
||||
/// The identifier for payment
|
||||
pub payment_id: Option<String>,
|
||||
/// The identifier for business profile
|
||||
pub profile_id: Option<String>,
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
/// The identifier for customer
|
||||
pub customer_id: Option<id_type::CustomerId>,
|
||||
/// The limit on the number of objects. The default limit is 10 and max limit is 20
|
||||
|
||||
@ -144,7 +144,8 @@ pub struct PayoutCreateRequest {
|
||||
pub payout_token: Option<String>,
|
||||
|
||||
/// The business profile to use for this payout, especially if there are multiple business profiles associated with the account, otherwise default business profile associated with the merchant account will be used.
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
|
||||
/// The send method which will be required for processing payouts, check options for better understanding.
|
||||
#[schema(value_type = Option<PayoutSendPriority>, example = "instant")]
|
||||
@ -481,7 +482,8 @@ pub struct PayoutCreateResponse {
|
||||
pub error_code: Option<String>,
|
||||
|
||||
/// The business profile that is associated with this payout
|
||||
pub profile_id: String,
|
||||
#[schema(value_type = String)]
|
||||
pub profile_id: id_type::ProfileId,
|
||||
|
||||
/// Time when the payout was created
|
||||
#[schema(example = "2022-09-10T10:11:12Z")]
|
||||
@ -685,7 +687,8 @@ pub struct PayoutListFilterConstraints {
|
||||
)]
|
||||
pub payout_id: Option<String>,
|
||||
/// The identifier for business profile
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<id_type::ProfileId>,
|
||||
/// The identifier for customer
|
||||
#[schema(value_type = Option<String>,example = "cus_y3oqhf46pyzuxjbcn2giaqnb44")]
|
||||
pub customer_id: Option<id_type::CustomerId>,
|
||||
|
||||
@ -156,7 +156,8 @@ pub struct RefundResponse {
|
||||
#[schema(example = "stripe")]
|
||||
pub connector: String,
|
||||
/// The id of business profile for this refund
|
||||
pub profile_id: Option<String>,
|
||||
#[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>,
|
||||
/// Charge specific fields for controlling the revert of funds from either platform or connected account
|
||||
@ -171,7 +172,8 @@ pub struct RefundListRequest {
|
||||
/// The identifier for the refund
|
||||
pub refund_id: Option<String>,
|
||||
/// The identifier for business profile
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
/// Limit on the number of objects to return
|
||||
pub limit: Option<i64>,
|
||||
/// The starting point within a list of objects
|
||||
|
||||
@ -36,7 +36,8 @@ pub struct RoutingConfigRequest {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub algorithm: RoutingAlgorithm,
|
||||
pub profile_id: String,
|
||||
#[schema(value_type = String)]
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
|
||||
@ -45,12 +46,14 @@ pub struct RoutingConfigRequest {
|
||||
pub name: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub algorithm: Option<RoutingAlgorithm>,
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Serialize, ToSchema)]
|
||||
pub struct ProfileDefaultRoutingConfig {
|
||||
pub profile_id: String,
|
||||
#[schema(value_type = String)]
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
pub connectors: Vec<RoutableConnectorChoice>,
|
||||
}
|
||||
|
||||
@ -62,13 +65,13 @@ pub struct RoutingRetrieveQuery {
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct RoutingRetrieveLinkQuery {
|
||||
pub profile_id: Option<String>,
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, serde::Deserialize, serde::Serialize)]
|
||||
pub struct RoutingRetrieveLinkQueryWrapper {
|
||||
pub routing_query: RoutingRetrieveQuery,
|
||||
pub profile_id: String,
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
}
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
/// Response of the retrieved routing configs for a merchant account
|
||||
@ -87,7 +90,8 @@ pub enum LinkedRoutingConfigRetrieveResponse {
|
||||
/// Routing Algorithm specific to merchants
|
||||
pub struct MerchantRoutingAlgorithm {
|
||||
pub id: String,
|
||||
pub profile_id: String,
|
||||
#[schema(value_type = String)]
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub algorithm: RoutingAlgorithm,
|
||||
@ -257,10 +261,9 @@ pub enum RoutingAlgorithmKind {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
|
||||
pub struct RoutingPayloadWrapper {
|
||||
pub updated_config: Vec<RoutableConnectorChoice>,
|
||||
pub profile_id: String,
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
|
||||
@ -453,8 +456,8 @@ impl RoutingAlgorithmRef {
|
||||
|
||||
pub struct RoutingDictionaryRecord {
|
||||
pub id: String,
|
||||
|
||||
pub profile_id: String,
|
||||
#[schema(value_type = String)]
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
pub name: String,
|
||||
pub kind: RoutingAlgorithmKind,
|
||||
pub description: String,
|
||||
@ -485,6 +488,6 @@ pub struct RoutingAlgorithmId {
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct RoutingLinkWrapper {
|
||||
pub profile_id: String,
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
pub algorithm_id: RoutingAlgorithmId,
|
||||
}
|
||||
|
||||
@ -405,6 +405,6 @@ pub struct ListMerchantsForUserInOrgResponse {
|
||||
|
||||
#[derive(Debug, serde::Serialize)]
|
||||
pub struct ListProfilesForUserInOrgAndMerchantAccountResponse {
|
||||
pub profile_id: String,
|
||||
pub profile_id: id_type::ProfileId,
|
||||
pub profile_name: String,
|
||||
}
|
||||
|
||||
@ -19,5 +19,5 @@ pub struct SampleDataRequest {
|
||||
pub auth_type: Option<Vec<AuthenticationType>>,
|
||||
pub business_country: Option<CountryAlpha2>,
|
||||
pub business_label: Option<String>,
|
||||
pub profile_id: Option<String>,
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
}
|
||||
|
||||
@ -26,7 +26,8 @@ pub struct EventListConstraints {
|
||||
pub object_id: Option<String>,
|
||||
|
||||
/// Filter all events associated with the specified business profile ID.
|
||||
pub profile_id: Option<String>,
|
||||
#[schema(value_type = Option<String>)]
|
||||
pub profile_id: Option<common_utils::id_type::ProfileId>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@ -54,8 +55,8 @@ pub struct EventListItemResponse {
|
||||
pub merchant_id: common_utils::id_type::MerchantId,
|
||||
|
||||
/// The identifier for the Business Profile.
|
||||
#[schema(max_length = 64, example = "SqB0zwDGR5wHppWf0bx7GKr1f2")]
|
||||
pub profile_id: String,
|
||||
#[schema(max_length = 64, value_type = String, example = "SqB0zwDGR5wHppWf0bx7GKr1f2")]
|
||||
pub profile_id: common_utils::id_type::ProfileId,
|
||||
|
||||
/// The identifier for the object (Payment Intent ID, Refund ID, etc.)
|
||||
#[schema(max_length = 64, example = "QHrfd5LUDdZaKtAjdJmMu0dMa1")]
|
||||
|
||||
Reference in New Issue
Block a user