refactor: Rename business profile to profiles in api, diesel, domain, interface and error types (#5877)

Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
Arun Raj M
2024-09-19 23:30:25 +05:30
committed by GitHub
parent f4fa4cdab4
commit dee91b366a
99 changed files with 2243 additions and 2255 deletions

View File

@ -210,6 +210,15 @@ impl MerchantAccountCreate {
.transpose()
}
pub fn get_metadata_as_secret(
&self,
) -> CustomResult<Option<pii::SecretSerdeValue>, errors::ParsingError> {
self.metadata
.as_ref()
.map(|metadata| metadata.encode_to_value().map(Secret::new))
.transpose()
}
pub fn get_primary_details_as_value(
&self,
) -> CustomResult<serde_json::Value, errors::ParsingError> {
@ -304,7 +313,7 @@ pub struct MerchantAccountUpdate {
#[schema(value_type = Option<Object>,example = json!({"type": "single", "data": "signifyd"}))]
pub frm_routing_algorithm: Option<serde_json::Value>,
/// The default business profile that must be used for creating merchant accounts and payments
/// The default profile that must be used for creating merchant accounts and payments
#[schema(max_length = 64, value_type = Option<String>)]
pub default_profile: Option<id_type::ProfileId>,
@ -493,7 +502,7 @@ pub struct MerchantAccountResponse {
/// A boolean value to indicate if the merchant has recon service is enabled or not, by default value is false
pub is_recon_enabled: bool,
/// The default business profile that must be used for creating merchant accounts and payments
/// The default profile that must be used for creating merchant accounts and payments
#[schema(max_length = 64, value_type = Option<String>)]
pub default_profile: Option<id_type::ProfileId>,
@ -665,7 +674,7 @@ pub struct MerchantConnectorCreate {
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
pub profile_id: id_type::ProfileId,
@ -785,7 +794,7 @@ pub struct MerchantConnectorCreate {
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
/// Identifier for the business profile, if not provided default will be chosen from merchant account
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = Option<String>)]
pub profile_id: Option<id_type::ProfileId>,
@ -1013,7 +1022,7 @@ pub struct MerchantConnectorResponse {
#[schema(value_type = Connector, example = "stripe")]
pub connector_name: String,
/// A unique label to identify the connector account created under a business profile
/// A unique label to identify the connector account created under a profile
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
@ -1021,7 +1030,7 @@ pub struct MerchantConnectorResponse {
#[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
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
pub profile_id: id_type::ProfileId,
@ -1117,7 +1126,7 @@ pub struct MerchantConnectorResponse {
#[schema(value_type = Connector, example = "stripe")]
pub connector_name: String,
/// A unique label to identify the connector account created under a business profile
/// A unique label to identify the connector account created under a profile
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
@ -1125,7 +1134,7 @@ pub struct MerchantConnectorResponse {
#[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
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
pub profile_id: id_type::ProfileId,
@ -1235,7 +1244,7 @@ pub struct MerchantConnectorListResponse {
#[schema(value_type = Connector, example = "stripe")]
pub connector_name: String,
/// A unique label to identify the connector account created under a business profile
/// A unique label to identify the connector account created under a profile
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
@ -1243,7 +1252,7 @@ pub struct MerchantConnectorListResponse {
#[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
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
pub profile_id: id_type::ProfileId,
@ -1341,7 +1350,7 @@ pub struct MerchantConnectorListResponse {
#[schema(value_type = Connector, example = "stripe")]
pub connector_name: String,
/// A unique label to identify the connector account created under a business profile
/// A unique label to identify the connector account created under a profile
#[schema(example = "stripe_US_travel")]
pub connector_label: Option<String>,
@ -1349,7 +1358,7 @@ pub struct MerchantConnectorListResponse {
#[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
/// Identifier for the profile, if not provided default will be chosen from merchant account
#[schema(max_length = 64, value_type = String)]
pub profile_id: id_type::ProfileId,
@ -1806,8 +1815,8 @@ pub struct MerchantConnectorDetails {
#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileCreate {
/// The name of business profile
pub struct ProfileCreate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: Option<String>,
@ -1853,11 +1862,11 @@ pub struct BusinessProfileCreate {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
@ -1924,8 +1933,8 @@ pub struct OrderFulfillmentTime(i64);
#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileCreate {
/// The name of business profile
pub struct ProfileCreate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: String,
@ -1962,11 +1971,11 @@ pub struct BusinessProfileCreate {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
@ -2026,16 +2035,16 @@ pub struct BusinessProfileCreate {
#[cfg(feature = "v1")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct BusinessProfileResponse {
pub struct ProfileResponse {
/// The identifier for Merchant Account
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
/// The identifier for 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
/// Name of the profile
#[schema(max_length = 64)]
pub profile_name: String,
@ -2081,11 +2090,11 @@ pub struct BusinessProfileResponse {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<i64>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
#[schema(value_type = Option<BusinessPaymentLinkConfig>)]
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
@ -2148,16 +2157,16 @@ pub struct BusinessProfileResponse {
#[cfg(feature = "v2")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct BusinessProfileResponse {
pub struct ProfileResponse {
/// The identifier for Merchant Account
#[schema(max_length = 64, example = "y3oqhf46pyzuxjbcn2giaqnb44", value_type = String)]
pub merchant_id: id_type::MerchantId,
/// The identifier for business profile. This must be used for creating merchant accounts, payments and payouts
/// The identifier for profile. This must be used for creating merchant accounts, payments and payouts
#[schema(max_length = 64, value_type = String, example = "pro_abcdefghijklmnopqrstuvwxyz")]
pub id: id_type::ProfileId,
/// Name of the business profile
/// Name of the profile
#[schema(max_length = 64)]
pub profile_name: String,
@ -2186,11 +2195,11 @@ pub struct BusinessProfileResponse {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<i64>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
#[schema(value_type = Option<BusinessPaymentLinkConfig>)]
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
@ -2262,8 +2271,8 @@ pub struct BusinessProfileResponse {
#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileUpdate {
/// The name of business profile
pub struct ProfileUpdate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: Option<String>,
@ -2309,11 +2318,11 @@ pub struct BusinessProfileUpdate {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details
@ -2378,8 +2387,8 @@ pub struct BusinessProfileUpdate {
#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileUpdate {
/// The name of business profile
pub struct ProfileUpdate {
/// The name of profile
#[schema(max_length = 64)]
pub profile_name: Option<String>,
@ -2416,11 +2425,11 @@ pub struct BusinessProfileUpdate {
/// Verified Apple Pay domains for a particular profile
pub applepay_verified_domains: Option<Vec<String>>,
/// Client Secret Default expiry for all payments created under this business profile
/// Client Secret Default expiry for all payments created under this profile
#[schema(example = 900)]
pub session_expiry: Option<u32>,
/// Default Payment Link config for all payment links created under this business profile
/// Default Payment Link config for all payment links created under this profile
pub payment_link_config: Option<BusinessPaymentLinkConfig>,
/// External 3DS authentication details

View File

@ -75,9 +75,9 @@ impl_api_event_type!(
MandateId,
DisputeListConstraints,
RetrieveApiKeyResponse,
BusinessProfileResponse,
BusinessProfileUpdate,
BusinessProfileCreate,
ProfileResponse,
ProfileUpdate,
ProfileCreate,
RevokeApiKeyResponse,
ToggleKVResponse,
ToggleKVRequest,