feat(business_profile): introduce business profile v2 update endpoint (#5641)

This commit is contained in:
Sanchith Hegde
2024-08-21 14:27:18 +05:30
committed by GitHub
parent cc5b06e725
commit beb4fb050f
23 changed files with 689 additions and 223 deletions

View File

@ -138,10 +138,10 @@ Never share your secret api keys. Keep them guarded and secure.
// Routes for Business Profile
routes::business_profile::business_profile_create,
routes::business_profile::business_profiles_list,
routes::business_profile::business_profiles_retrieve,
routes::business_profile::business_profiles_update,
routes::business_profile::business_profiles_delete,
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 disputes
routes::disputes::retrieve_dispute,

View File

@ -79,6 +79,11 @@ 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 for business profile
routes::business_profile::business_profile_create,
routes::business_profile::business_profile_retrieve,
routes::business_profile::business_profile_update,
),
components(schemas(
common_utils::types::MinorUnit,
@ -154,6 +159,7 @@ Never share your secret api keys. Keep them guarded and secure.
api_models::enums::ConnectorStatus,
api_models::enums::AuthorizationStatus,
api_models::enums::PaymentMethodStatus,
api_models::enums::OrderFulfillmentTimeOrigin,
api_models::admin::MerchantConnectorCreate,
api_models::admin::AdditionalMerchantData,
api_models::admin::MerchantRecipientData,

View File

@ -1,3 +1,4 @@
#[cfg(feature = "v1")]
/// Business Profile - Create
///
/// Creates a new *business profile* for a merchant
@ -34,6 +35,35 @@
)]
pub async fn business_profile_create() {}
#[cfg(feature = "v2")]
/// Business Profile - Create
///
/// Creates a new *business profile* for a merchant
#[utoipa::path(
post,
path = "/v2/profiles",
request_body(
content = BusinessProfileCreate,
examples(
(
"Create a business profile with profile name" = (
value = json!({
"profile_name": "shoe_business"
})
)
)
)
),
responses(
(status = 200, description = "Business Account Created", body = BusinessProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Create A Business Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_create() {}
/// Business Profile - List
///
/// Lists all the *business profiles* under a merchant
@ -50,8 +80,9 @@ pub async fn business_profile_create() {}
operation_id = "List Business Profiles",
security(("api_key" = []))
)]
pub async fn business_profiles_list() {}
pub async fn business_profile_list() {}
#[cfg(feature = "v1")]
/// Business Profile - Update
///
/// Update the *business profile*
@ -79,9 +110,40 @@ pub async fn business_profiles_list() {}
),
tag = "Business Profile",
operation_id = "Update a Business Profile",
security(("api_key" = []))
security(("admin_api_key" = []))
)]
pub async fn business_profiles_update() {}
pub async fn business_profile_update() {}
#[cfg(feature = "v2")]
/// Business Profile - Update
///
/// Update the *business profile*
#[utoipa::path(
post,
path = "/v2/profiles/{profile_id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile")
),
request_body(
content = BusinessProfileCreate,
examples(
(
"Update business profile with profile name fields" = (
value = json!({
"profile_name" : "shoe_business"
})
)
)
)),
responses(
(status = 200, description = "Business Profile Updated", body = BusinessProfileResponse),
(status = 400, description = "Invalid data")
),
tag = "Business Profile",
operation_id = "Update a Business Profile",
security(("admin_api_key" = []))
)]
pub async fn business_profile_update() {}
/// Business Profile - Delete
///
@ -101,8 +163,9 @@ pub async fn business_profiles_update() {}
operation_id = "Delete the Business Profile",
security(("api_key" = []))
)]
pub async fn business_profiles_delete() {}
pub async fn business_profile_delete() {}
#[cfg(feature = "v1")]
/// Business Profile - Retrieve
///
/// Retrieve existing *business profile*
@ -119,6 +182,26 @@ pub async fn business_profiles_delete() {}
),
tag = "Business Profile",
operation_id = "Retrieve a Business Profile",
security(("api_key" = []))
security(("admin_api_key" = []))
)]
pub async fn business_profiles_retrieve() {}
pub async fn business_profile_retrieve() {}
#[cfg(feature = "v2")]
/// Business Profile - Retrieve
///
/// 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() {}