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

@ -53,7 +53,7 @@ Never share your secret api keys. Keep them guarded and secure.
),
tags(
(name = "Merchant Account", description = "Create and manage merchant accounts"),
(name = "Business Profile", description = "Create and manage business profiles"),
(name = "Profile", description = "Create and manage profiles"),
(name = "Merchant Connector Account", description = "Create and manage merchant connector accounts"),
(name = "Payments", description = "Create and manage one-time payments, recurring payments and mandates"),
(name = "Refunds", description = "Create and manage refunds for successful payments"),
@ -136,12 +136,12 @@ Never share your secret api keys. Keep them guarded and secure.
routes::payment_method::payment_method_update_api,
routes::payment_method::payment_method_delete_api,
// Routes for Business Profile
routes::business_profile::business_profile_create,
routes::business_profile::business_profile_list,
routes::business_profile::business_profile_retrieve,
routes::business_profile::business_profile_update,
routes::business_profile::business_profile_delete,
// Routes for Profile
routes::profile::profile_create,
routes::profile::profile_list,
routes::profile::profile_retrieve,
routes::profile::profile_update,
routes::profile::profile_delete,
// Routes for disputes
routes::disputes::retrieve_dispute,
@ -283,8 +283,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::MerchantConnectorDetailsWrap,
api_models::admin::MerchantConnectorDetails,
api_models::admin::MerchantConnectorWebhookDetails,
api_models::admin::BusinessProfileCreate,
api_models::admin::BusinessProfileResponse,
api_models::admin::ProfileCreate,
api_models::admin::ProfileResponse,
api_models::admin::BusinessPaymentLinkConfig,
api_models::admin::PaymentLinkConfigRequest,
api_models::admin::PaymentLinkConfig,

View File

@ -53,7 +53,7 @@ Never share your secret api keys. Keep them guarded and secure.
),
tags(
(name = "Merchant Account", description = "Create and manage merchant accounts"),
(name = "Business Profile", description = "Create and manage business profiles"),
(name = "Profile", description = "Create and manage profiles"),
(name = "Merchant Connector Account", description = "Create and manage merchant connector accounts"),
(name = "Payments", description = "Create and manage one-time payments, recurring payments and mandates"),
(name = "Refunds", description = "Create and manage refunds for successful payments"),
@ -85,20 +85,20 @@ Never share your secret api keys. Keep them guarded and secure.
routes::merchant_account::merchant_account_create,
routes::merchant_account::merchant_account_retrieve,
routes::merchant_account::merchant_account_update,
routes::merchant_account::business_profiles_list,
routes::merchant_account::profiles_list,
// Routes for business profile
routes::business_profile::business_profile_create,
routes::business_profile::business_profile_retrieve,
routes::business_profile::business_profile_update,
routes::business_profile::connector_list,
// Routes for profile
routes::profile::profile_create,
routes::profile::profile_retrieve,
routes::profile::profile_update,
routes::profile::connector_list,
// Routes for routing under business profile
routes::business_profile::routing_link_config,
routes::business_profile::routing_unlink_config,
routes::business_profile::routing_update_default_config,
routes::business_profile::routing_retrieve_default_config,
routes::business_profile::routing_retrieve_linked_config,
// Routes for routing under profile
routes::profile::routing_link_config,
routes::profile::routing_unlink_config,
routes::profile::routing_update_default_config,
routes::profile::routing_retrieve_default_config,
routes::profile::routing_retrieve_linked_config,
// Routes for routing
routes::routing::routing_create_config,
@ -209,8 +209,8 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::admin::MerchantConnectorDetailsWrap,
api_models::admin::MerchantConnectorDetails,
api_models::admin::MerchantConnectorWebhookDetails,
api_models::admin::BusinessProfileCreate,
api_models::admin::BusinessProfileResponse,
api_models::admin::ProfileCreate,
api_models::admin::ProfileResponse,
api_models::admin::BusinessPaymentLinkConfig,
api_models::admin::PaymentLinkConfigRequest,
api_models::admin::PaymentLinkConfig,

View File

@ -2,7 +2,6 @@
pub mod api_keys;
pub mod blocklist;
pub mod business_profile;
pub mod customers;
pub mod disputes;
pub mod gsm;
@ -15,6 +14,7 @@ pub mod payment_method;
pub mod payments;
pub mod payouts;
pub mod poll;
pub mod profile;
pub mod refunds;
pub mod routing;
pub mod webhook_events;

View File

@ -43,7 +43,7 @@ pub async fn retrieve_dispute() {}
)]
pub async fn retrieve_disputes_list() {}
/// Disputes - List Disputes for The Given Business Profiles
/// Disputes - List Disputes for The Given Profiles
/// Lists all the Disputes for a merchant
#[utoipa::path(
get,
@ -65,7 +65,7 @@ pub async fn retrieve_disputes_list() {}
(status = 401, description = "Unauthorized request")
),
tag = "Disputes",
operation_id = "List Disputes for The given Business Profiles",
operation_id = "List Disputes for The given Profiles",
security(("api_key" = []))
)]
pub async fn retrieve_disputes_list_profile() {}

View File

@ -270,20 +270,40 @@ pub async fn delete_merchant_account() {}
)]
pub async fn merchant_account_kv_status() {}
#[cfg(feature = "v2")]
/// Business Profile - List
/// Merchant Connector - List
///
/// List business profiles for an Merchant
/// List Merchant Connector Details for the merchant
#[utoipa::path(
get,
path = "/accounts/{account_id}/profile/connectors",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
),
responses(
(status = 200, description = "Merchant Connector list retrieved successfully", body = Vec<MerchantConnectorResponse>),
(status = 404, description = "Merchant Connector does not exist in records"),
(status = 401, description = "Unauthorized request")
),
tag = "Merchant Connector Account",
operation_id = "List all Merchant Connectors for The given Profile",
security(("admin_api_key" = []))
)]
pub async fn payment_connector_list_profile() {}
#[cfg(feature = "v2")]
/// Profile - List
///
/// List profiles for an Merchant
#[utoipa::path(
get,
path = "/v2/merchant_accounts/{account_id}/profiles",
params (("account_id" = String, Path, description = "The unique identifier for the Merchant")),
responses(
(status = 200, description = "Business profile list retrieved successfully", body = Vec<BusinessProfileResponse>),
(status = 200, description = "profile list retrieved successfully", body = Vec<ProfileResponse>),
(status = 400, description = "Invalid data")
),
tag = "Merchant Account",
operation_id = "List Business Profiles",
operation_id = "List Profiles",
security(("admin_api_key" = []))
)]
pub async fn business_profiles_list() {}
pub async fn profiles_list() {}

View File

@ -22,7 +22,7 @@
)
),
(
"Create a merchant connector account under a specific business profile" = (
"Create a merchant connector account under a specific profile" = (
value = json!({
"connector_type": "payment_processor",
"connector_name": "adyen",
@ -85,7 +85,7 @@ pub async fn connector_create() {}
)
),
(
"Create a merchant connector account under a specific business profile" = (
"Create a merchant connector account under a specific profile" = (
value = json!({
"connector_type": "payment_processor",
"connector_name": "adyen",

View File

@ -459,7 +459,7 @@ pub fn payments_cancel() {}
)]
pub fn payments_list() {}
/// Business Profile level Payments - List
/// Profile level Payments - List
///
/// To list the payments
#[utoipa::path(

View File

@ -1,7 +1,9 @@
// ******************************************** V1 profile routes ******************************************** //
#[cfg(feature = "v1")]
/// Business Profile - Create
/// Profile - Create
///
/// Creates a new *business profile* for a merchant
/// Creates a new *profile* for a merchant
#[utoipa::path(
post,
path = "/account/{account_id}/business_profile",
@ -9,15 +11,15 @@
("account_id" = String, Path, description = "The unique identifier for the merchant account")
),
request_body(
content = BusinessProfileCreate,
content = ProfileCreate,
examples(
(
"Create a business profile with minimal fields" = (
"Create a profile with minimal fields" = (
value = json!({})
)
),
(
"Create a business profile with profile name" = (
"Create a profile with profile name" = (
value = json!({
"profile_name": "shoe_business"
})
@ -26,47 +28,93 @@
)
),
responses(
(status = 200, description = "Business Account Created", body = BusinessProfileResponse),
(status = 200, description = "Profile Created", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Create A Business Profile",
tag = "Profile",
operation_id = "Create A Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_create() {}
pub async fn profile_create() {}
#[cfg(feature = "v2")]
/// Business Profile - Create
#[cfg(feature = "v1")]
/// Profile - Update
///
/// Creates a new *business profile* for a merchant
/// Update the *profile*
#[utoipa::path(
post,
path = "/v2/profiles",
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
request_body(
content = BusinessProfileCreate,
content = ProfileCreate,
examples(
(
"Create a business profile with profile name" = (
"Update profile with profile name fields" = (
value = json!({
"profile_name": "shoe_business"
"profile_name" : "shoe_business"
})
)
)
)
),
)),
responses(
(status = 200, description = "Business Account Created", body = BusinessProfileResponse),
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Create A Business Profile",
tag = "Profile",
operation_id = "Update a Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_create() {}
pub async fn profile_update() {}
/// Business Profile - List
#[cfg(feature = "v1")]
/// Profile - Retrieve
///
/// Lists all the *business profiles* under a merchant
/// Retrieve existing *profile*
#[utoipa::path(
get,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Retrieve a Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_retrieve() {}
// ******************************************** Common profile routes ******************************************** //
/// Profile - Delete
///
/// Delete the *profile*
#[utoipa::path(
delete,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
responses(
(status = 200, description = "Profiles Deleted", body = bool),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Delete the Profile",
security(("api_key" = []))
)]
pub async fn profile_delete() {}
/// Profile - List
///
/// Lists all the *profiles* under a merchant
#[utoipa::path(
get,
path = "/account/{account_id}/business_profile",
@ -74,61 +122,60 @@ pub async fn business_profile_create() {}
("account_id" = String, Path, description = "Merchant Identifier"),
),
responses(
(status = 200, description = "Business profiles Retrieved", body = Vec<BusinessProfileResponse>)
(status = 200, description = "Profiles Retrieved", body = Vec<ProfileResponse>)
),
tag = "Business Profile",
operation_id = "List Business Profiles",
tag = "Profile",
operation_id = "List Profiles",
security(("api_key" = []))
)]
pub async fn business_profile_list() {}
pub async fn profile_list() {}
#[cfg(feature = "v1")]
/// Business Profile - Update
// ******************************************** V2 profile routes ******************************************** //
#[cfg(feature = "v2")]
/// Profile - Create
///
/// Update the *business profile*
/// Creates a new *profile* for a merchant
#[utoipa::path(
post,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the business profile")
),
path = "/v2/profiles",
request_body(
content = BusinessProfileCreate,
content = ProfileCreate,
examples(
(
"Update business profile with profile name fields" = (
"Create a profile with profile name" = (
value = json!({
"profile_name" : "shoe_business"
"profile_name": "shoe_business"
})
)
)
)),
)
),
responses(
(status = 200, description = "Business Profile Updated", body = BusinessProfileResponse),
(status = 200, description = "Account Created", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Update a Business Profile",
tag = "Profile",
operation_id = "Create A Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_update() {}
pub async fn profile_create() {}
#[cfg(feature = "v2")]
/// Business Profile - Update
/// Profile - Update
///
/// Update the *business profile*
/// Update the *profile*
#[utoipa::path(
put,
path = "/v2/profiles/{profile_id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile")
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
request_body(
content = BusinessProfileCreate,
content = ProfileCreate,
examples(
(
"Update business profile with profile name fields" = (
"Update profile with profile name fields" = (
value = json!({
"profile_name" : "shoe_business"
})
@ -136,102 +183,19 @@ pub async fn business_profile_update() {}
)
)),
responses(
(status = 200, description = "Business Profile Updated", body = BusinessProfileResponse),
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Update a Business Profile",
tag = "Profile",
operation_id = "Update a Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_update() {}
/// Business Profile - Delete
///
/// Delete the *business profile*
#[utoipa::path(
delete,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the business profile")
),
responses(
(status = 200, description = "Business profiles Deleted", body = bool),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Delete the Business Profile",
security(("api_key" = []))
)]
pub async fn business_profile_delete() {}
#[cfg(feature = "v1")]
/// Business Profile - Retrieve
///
/// Retrieve existing *business profile*
#[utoipa::path(
get,
path = "/account/{account_id}/business_profile/{profile_id}",
params(
("account_id" = String, Path, description = "The unique identifier for the merchant account"),
("profile_id" = String, Path, description = "The unique identifier for the business profile")
),
responses(
(status = 200, description = "Business Profile Updated", body = BusinessProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Retrieve a Business Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_retrieve() {}
pub async fn profile_update() {}
#[cfg(feature = "v2")]
/// Business Profile - Retrieve
/// Profile - Activate routing algorithm
///
/// Retrieve existing *business profile*
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile")
),
responses(
(status = 200, description = "Business Profile Updated", body = BusinessProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Retrieve a Business Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_retrieve() {}
#[cfg(feature = "v2")]
/// Business Profile - Retrieve Active Routing Algorithm
///
/// Retrieve active routing algorithm under the business profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/routing_algorithm",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("limit" = Option<u16>, Query, description = "The number of records of the algorithms to be returned"),
("offset" = Option<u8>, Query, description = "The record offset of the algorithm from which to start gathering the results")),
responses(
(status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse),
(status = 500, description = "Internal server error"),
(status = 404, description = "Resource missing"),
(status = 403, description = "Forbidden")
),
tag = "Business Profile",
operation_id = "Retrieve the active routing algorithm under the business profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_retrieve_linked_config() {}
#[cfg(feature = "v2")]
/// Business Profile - Activate routing algorithm
///
/// Activates a routing algorithm under a business profile
/// Activates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{profile_id}/activate_routing_algorithm",
@ -244,7 +208,7 @@ pub async fn routing_retrieve_linked_config() {}
)
))),
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("profile_id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Routing Algorithm is activated", body = RoutingDictionaryRecord),
@ -252,21 +216,21 @@ pub async fn routing_retrieve_linked_config() {}
(status = 404, description = "Resource missing"),
(status = 400, description = "Bad request")
),
tag = "Business Profile",
operation_id = "Activates a routing algorithm under a business profile",
tag = "Profile",
operation_id = "Activates a routing algorithm under a profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_link_config() {}
#[cfg(feature = "v2")]
/// Business Profile - Deactivate routing algorithm
/// Profile - Deactivate routing algorithm
///
/// Deactivates a routing algorithm under a business profile
/// Deactivates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{profile_id}/deactivate_routing_algorithm",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("profile_id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord),
@ -275,22 +239,22 @@ pub async fn routing_link_config() {}
(status = 403, description = "Malformed request"),
(status = 422, description = "Unprocessable request")
),
tag = "Business Profile",
operation_id = " Deactivates a routing algorithm under a business profile",
tag = "Profile",
operation_id = " Deactivates a routing algorithm under a profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_unlink_config() {}
#[cfg(feature = "v2")]
/// Business Profile - Update Default Fallback Routing Algorithm
/// Profile - Update Default Fallback Routing Algorithm
///
/// Update the default fallback routing algorithm for the business profile
/// Update the default fallback routing algorithm for the profile
#[utoipa::path(
post,
patch,
path = "/v2/profiles/{profile_id}/fallback_routing",
request_body = Vec<RoutableConnectorChoice>,
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("profile_id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully updated the default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),
@ -298,28 +262,71 @@ pub async fn routing_unlink_config() {}
(status = 400, description = "Malformed request"),
(status = 422, description = "Unprocessable request")
),
tag = "Business Profile",
operation_id = "Update the default fallback routing algorithm for the business profile",
tag = "Profile",
operation_id = "Update the default fallback routing algorithm for the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_update_default_config() {}
#[cfg(feature = "v2")]
/// Business Profile - Retrieve Default Fallback Routing Algorithm
/// Profile - Retrieve
///
/// Retrieve the default fallback routing algorithm for the business profile
/// Retrieve existing *profile*
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile")
),
responses(
(status = 200, description = "Profile Updated", body = ProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Profile",
operation_id = "Retrieve a Profile",
security(("admin_api_key" = []))
)]
pub async fn profile_retrieve() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve Active Routing Algorithm
///
/// Retrieve active routing algorithm under the profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/routing_algorithm",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("limit" = Option<u16>, Query, description = "The number of records of the algorithms to be returned"),
("offset" = Option<u8>, Query, description = "The record offset of the algorithm from which to start gathering the results")),
responses(
(status = 200, description = "Successfully retrieved active config", body = LinkedRoutingConfigRetrieveResponse),
(status = 500, description = "Internal server error"),
(status = 404, description = "Resource missing"),
(status = 403, description = "Forbidden")
),
tag = "Profile",
operation_id = "Retrieve the active routing algorithm under the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_retrieve_linked_config() {}
#[cfg(feature = "v2")]
/// Profile - Retrieve Default Fallback Routing Algorithm
///
/// Retrieve the default fallback routing algorithm for the profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/fallback_routing",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("profile_id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully retrieved default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),
(status = 500, description = "Internal server error")
),
tag = "Business Profile",
operation_id = "Retrieve the default fallback routing algorithm for the business profile",
tag = "Profile",
operation_id = "Retrieve the default fallback routing algorithm for the profile",
security(("api_key" = []), ("jwt_key" = []))
)]
pub async fn routing_retrieve_default_config() {}

View File

@ -1,6 +1,6 @@
/// Events - List
///
/// List all Events associated with a Merchant Account or Business Profile.
/// List all Events associated with a Merchant Account or Profile.
#[utoipa::path(
get,
path = "/events/{merchant_id}",
@ -43,14 +43,14 @@
(
"profile_id" = Option<String>,
Query,
description = "Only include Events associated with the Business Profile identified by the specified Business Profile ID."
description = "Only include Events associated with the Profile identified by the specified Profile ID."
),
),
responses(
(status = 200, description = "List of Events retrieved successfully", body = Vec<EventListItemResponse>),
),
tag = "Event",
operation_id = "List all Events associated with a Merchant Account or Business Profile",
operation_id = "List all Events associated with a Merchant Account or Profile",
security(("admin_api_key" = []))
)]
pub fn list_initial_webhook_delivery_attempts() {}