From 5e8fcda7d12f482e47be9ed672093cb45fac9e29 Mon Sep 17 00:00:00 2001 From: Kartikeya Hegde Date: Wed, 6 Mar 2024 07:49:38 +0000 Subject: [PATCH] chore(doc): add API ref for KV toggle (#3784) --- crates/openapi/src/openapi.rs | 3 + crates/openapi/src/routes/merchant_account.rs | 32 ++++++ openapi/openapi_spec.json | 99 +++++++++++++++++++ 3 files changed, 134 insertions(+) diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index bd2451291d..65c4619344 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -90,6 +90,7 @@ Never share your secret api keys. Keep them guarded and secure. routes::merchant_account::retrieve_merchant_account, routes::merchant_account::update_merchant_account, routes::merchant_account::delete_merchant_account, + routes::merchant_account::merchant_account_kv_status, // Routes for merchant connector account routes::merchant_connector_account::payment_connector_create, @@ -431,6 +432,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::admin::MerchantAccountResponse, api_models::admin::MerchantConnectorId, api_models::admin::MerchantDetails, + api_models::admin::ToggleKVRequest, + api_models::admin::ToggleKVResponse, api_models::admin::WebhookDetails, api_models::api_keys::ApiKeyExpiration, api_models::api_keys::CreateApiKeyRequest, diff --git a/crates/openapi/src/routes/merchant_account.rs b/crates/openapi/src/routes/merchant_account.rs index 967e28225c..6301844bf3 100644 --- a/crates/openapi/src/routes/merchant_account.rs +++ b/crates/openapi/src/routes/merchant_account.rs @@ -123,3 +123,35 @@ pub async fn update_merchant_account() {} security(("admin_api_key" = [])) )] pub async fn delete_merchant_account() {} + +/// Merchant Account - KV Status +/// +/// Toggle KV mode for the Merchant Account +#[utoipa::path( + post, + path = "/accounts/{account_id}/kv", + request_body ( + content = ToggleKVRequest, + examples ( + ("Enable KV for Merchant" = ( + value = json!({ + "kv_enabled": "true" + }) + )), + ("Disable KV for Merchant" = ( + value = json!({ + "kv_enabled": "false" + }) + ))) + ), + params (("account_id" = String, Path, description = "The unique identifier for the merchant account")), + responses( + (status = 200, description = "KV mode is enabled/disabled for Merchant Account", body = ToggleKVResponse), + (status = 400, description = "Invalid data"), + (status = 404, description = "Merchant account not found") + ), + tag = "Merchant Account", + operation_id = "Enable/Disable KV for a Merchant Account", + security(("admin_api_key" = [])) +)] +pub async fn merchant_account_kv_status() {} diff --git a/openapi/openapi_spec.json b/openapi/openapi_spec.json index 6b58b8e286..ac90185dac 100644 --- a/openapi/openapi_spec.json +++ b/openapi/openapi_spec.json @@ -913,6 +913,72 @@ ] } }, + "/accounts/{account_id}/kv": { + "post": { + "tags": [ + "Merchant Account" + ], + "summary": "Merchant Account - KV Status", + "description": "Merchant Account - KV Status\n\nToggle KV mode for the Merchant Account", + "operationId": "Enable/Disable KV for a Merchant Account", + "parameters": [ + { + "name": "account_id", + "in": "path", + "description": "The unique identifier for the merchant account", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ToggleKVRequest" + }, + "examples": { + "Disable KV for Merchant": { + "value": { + "kv_enabled": "false" + } + }, + "Enable KV for Merchant": { + "value": { + "kv_enabled": "true" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "KV mode is enabled/disabled for Merchant Account", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ToggleKVResponse" + } + } + } + }, + "400": { + "description": "Invalid data" + }, + "404": { + "description": "Merchant account not found" + } + }, + "security": [ + { + "admin_api_key": [] + } + ] + } + }, "/api_keys/{merchant_id)": { "post": { "tags": [ @@ -16736,6 +16802,39 @@ } } }, + "ToggleKVRequest": { + "type": "object", + "required": [ + "kv_enabled" + ], + "properties": { + "kv_enabled": { + "type": "boolean", + "description": "Status of KV for the specific merchant", + "example": true + } + } + }, + "ToggleKVResponse": { + "type": "object", + "required": [ + "merchant_id", + "kv_enabled" + ], + "properties": { + "merchant_id": { + "type": "string", + "description": "The identifier for the Merchant Account", + "example": "y3oqhf46pyzuxjbcn2giaqnb44", + "maxLength": 255 + }, + "kv_enabled": { + "type": "boolean", + "description": "Status of KV for the specific merchant", + "example": true + } + } + }, "TouchNGoRedirection": { "type": "object" },