docs(openapi): Fixed API documentation for V2 (#6496)

This commit is contained in:
Anurag Thakur
2024-11-12 12:14:54 +05:30
committed by GitHub
parent 78857e9da3
commit 7dfcd514cf
27 changed files with 100 additions and 86 deletions

View File

@ -614,7 +614,7 @@ impl utoipa::Modify for SecurityAddon {
SecurityScheme::ApiKey(ApiKey::Header(ApiKeyValue::with_description(
"api-key",
"Admin API keys allow you to perform some privileged actions such as \
creating a merchant account and Merchant Connector account."
creating a merchant account and Connector account."
))),
),
(

View File

@ -64,9 +64,9 @@ pub async fn api_key_retrieve() {}
/// Retrieve information about the specified API Key.
#[utoipa::path(
get,
path = "/v2/api_keys/{key_id}",
path = "/v2/api_keys/{id}",
params (
("key_id" = String, Path, description = "The unique identifier for the API Key")
("id" = String, Path, description = "The unique identifier for the API Key")
),
responses(
(status = 200, description = "API Key retrieved", body = RetrieveApiKeyResponse),
@ -106,10 +106,10 @@ pub async fn api_key_update() {}
/// Update information for the specified API Key.
#[utoipa::path(
put,
path = "/v2/api_keys/{key_id}",
path = "/v2/api_keys/{id}",
request_body = UpdateApiKeyRequest,
params (
("key_id" = String, Path, description = "The unique identifier for the API Key")
("id" = String, Path, description = "The unique identifier for the API Key")
),
responses(
(status = 200, description = "API Key updated", body = RetrieveApiKeyResponse),
@ -150,9 +150,9 @@ pub async fn api_key_revoke() {}
/// authenticating with our APIs.
#[utoipa::path(
delete,
path = "/v2/api_keys/{key_id}",
path = "/v2/api_keys/{id}",
params (
("key_id" = String, Path, description = "The unique identifier for the API Key")
("id" = String, Path, description = "The unique identifier for the API Key")
),
responses(
(status = 200, description = "API Key revoked", body = RevokeApiKeyResponse),

View File

@ -212,7 +212,7 @@ pub async fn update_merchant_account() {}
)
),
)),
params (("account_id" = String, Path, description = "The unique identifier for the merchant account")),
params (("id" = String, Path, description = "The unique identifier for the merchant account")),
responses(
(status = 200, description = "Merchant Account Updated", body = MerchantAccountResponse),
(status = 404, description = "Merchant account not found")
@ -295,13 +295,13 @@ pub async fn merchant_account_kv_status() {}
pub async fn payment_connector_list_profile() {}
#[cfg(feature = "v2")]
/// Profile - List
/// Merchant Account - 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")),
path = "/v2/merchant_accounts/{id}/profiles",
params (("id" = String, Path, description = "The unique identifier for the Merchant")),
responses(
(status = 200, description = "profile list retrieved successfully", body = Vec<ProfileResponse>),
(status = 400, description = "Invalid data")

View File

@ -61,9 +61,9 @@
)]
pub async fn connector_create() {}
/// Merchant Connector - Create
/// Connector Account - Create
///
/// Creates a new Merchant Connector for the merchant account. The connector could be a payment processor/facilitator/acquirer or a provider of specialized services like Fraud/Accounting etc.
/// Creates a new Connector Account for the merchant account. The connector could be a payment processor/facilitator/acquirer or a provider of specialized services like Fraud/Accounting etc.
#[cfg(feature = "v2")]
#[utoipa::path(
post,
@ -146,7 +146,7 @@ pub async fn connector_create() {}
)]
pub async fn connector_retrieve() {}
/// Merchant Connector - Retrieve
/// Connector Account - Retrieve
///
/// Retrieves details of a Connector account
#[cfg(feature = "v2")]
@ -235,9 +235,9 @@ pub async fn connector_list() {}
)]
pub async fn connector_update() {}
/// Merchant Connector - Update
/// Connector Account - Update
///
/// To update an existing Merchant Connector account. Helpful in enabling/disabling different payment methods and other settings for the connector
/// To update an existing Connector account. Helpful in enabling/disabling different payment methods and other settings for the connector
#[cfg(feature = "v2")]
#[utoipa::path(
put,

View File

@ -406,6 +406,9 @@ pub fn payments_connector_session() {}
#[utoipa::path(
post,
path = "/v2/payments/{payment_id}/create-external-sdk-tokens",
params(
("payment_id" = String, Path, description = "The identifier for payment")
),
request_body=PaymentsSessionRequest,
responses(
(status = 200, description = "Payment session object created or session token was retrieved from wallets", body = PaymentsSessionResponse),

View File

@ -174,9 +174,9 @@ pub async fn profile_create() {}
/// Update the *profile*
#[utoipa::path(
put,
path = "/v2/profiles/{profile_id}",
path = "/v2/profiles/{id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("id" = String, Path, description = "The unique identifier for the profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
@ -210,7 +210,7 @@ pub async fn profile_update() {}
/// Activates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{profile_id}/activate_routing_algorithm",
path = "/v2/profiles/{id}/activate_routing_algorithm",
request_body ( content = RoutingAlgorithmId,
examples( (
"Activate a routing algorithm" = (
@ -220,7 +220,7 @@ pub async fn profile_update() {}
)
))),
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Routing Algorithm is activated", body = RoutingDictionaryRecord),
@ -240,9 +240,9 @@ pub async fn routing_link_config() {}
/// Deactivates a routing algorithm under a profile
#[utoipa::path(
patch,
path = "/v2/profiles/{profile_id}/deactivate_routing_algorithm",
path = "/v2/profiles/{id}/deactivate_routing_algorithm",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully deactivated routing config", body = RoutingDictionaryRecord),
@ -263,10 +263,10 @@ pub async fn routing_unlink_config() {}
/// Update the default fallback routing algorithm for the profile
#[utoipa::path(
patch,
path = "/v2/profiles/{profile_id}/fallback_routing",
path = "/v2/profiles/{id}/fallback_routing",
request_body = Vec<RoutableConnectorChoice>,
params(
("profile_id" = String, Path, description = "The unique identifier for the 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>),
@ -286,9 +286,9 @@ pub async fn routing_update_default_config() {}
/// Retrieve existing *profile*
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}",
path = "/v2/profiles/{id}",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("id" = String, Path, description = "The unique identifier for the profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",
@ -311,9 +311,9 @@ pub async fn profile_retrieve() {}
/// Retrieve active routing algorithm under the profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/routing_algorithm",
path = "/v2/profiles/{id}/routing_algorithm",
params(
("profile_id" = String, Path, description = "The unique identifier for the 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(
@ -334,9 +334,9 @@ pub async fn routing_retrieve_linked_config() {}
/// Retrieve the default fallback routing algorithm for the profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/fallback_routing",
path = "/v2/profiles/{id}/fallback_routing",
params(
("profile_id" = String, Path, description = "The unique identifier for the profile"),
("id" = String, Path, description = "The unique identifier for the profile"),
),
responses(
(status = 200, description = "Successfully retrieved default fallback routing algorithm", body = Vec<RoutableConnectorChoice>),
@ -348,14 +348,14 @@ pub async fn routing_retrieve_linked_config() {}
)]
pub async fn routing_retrieve_default_config() {}
/// Merchant Connector - List
/// Profile - Connector Accounts List
///
/// List Merchant Connector Details for the business profile
/// List Connector Accounts for the profile
#[utoipa::path(
get,
path = "/v2/profiles/{profile_id}/connector_accounts",
path = "/v2/profiles/{id}/connector_accounts",
params(
("profile_id" = String, Path, description = "The unique identifier for the business profile"),
("id" = String, Path, description = "The unique identifier for the business profile"),
(
"X-Merchant-Id" = String, Header,
description = "Merchant ID of the profile.",

View File

@ -94,9 +94,9 @@ pub async fn routing_retrieve_config() {}
#[utoipa::path(
get,
path = "/v2/routing_algorithm/{routing_algorithm_id}",
path = "/v2/routing_algorithm/{id}",
params(
("routing_algorithm_id" = String, Path, description = "The unique identifier for a routing algorithm"),
("id" = String, Path, description = "The unique identifier for a routing algorithm"),
),
responses(
(status = 200, description = "Successfully fetched routing algorithm", body = MerchantRoutingAlgorithm),