diff --git a/api-reference/README.md b/api-reference/README.md index ef3537d6b7..d8de73895d 100644 --- a/api-reference/README.md +++ b/api-reference/README.md @@ -44,5 +44,4 @@ npx @mintlify/scraping@latest openapi-file v1/openapi_spec_v1.json -o v1 This will generate files in [api-reference](api-reference) folder. These routes should be added to the [mint.json](mint.json) file under navigation, under respective group. - -NOTE: For working with V2 API reference, replace every occurrence of `v1` with `v2` in above commands \ No newline at end of file +NOTE: For working with V2 API reference, replace every occurrence of `v1` with `v2` in above commands diff --git a/api-reference/docs.json b/api-reference/docs.json index 9688afc324..ea1ab01bfc 100644 --- a/api-reference/docs.json +++ b/api-reference/docs.json @@ -146,6 +146,12 @@ "v1/business-profile/business-profile--list" ] }, + { + "group": "Platform Account", + "pages": [ + "v1/platform/platform--create" + ] + }, { "group": "API Key", "pages": [ diff --git a/api-reference/v1/openapi_spec_v1.json b/api-reference/v1/openapi_spec_v1.json index 835adefad8..13e93cc88f 100644 --- a/api-reference/v1/openapi_spec_v1.json +++ b/api-reference/v1/openapi_spec_v1.json @@ -6481,6 +6481,53 @@ } ] } + }, + "/create_platform": { + "post": { + "tags": [ + "Platform" + ], + "summary": "Platform - Create", + "description": "Create a new platform account", + "operationId": "Create a Platform Account", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlatformAccountCreateRequest" + }, + "examples": { + "Create a platform account with organization_name": { + "value": { + "organization_name": "organization_abc" + } + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "Platform Account Created", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PlatformAccountCreateResponse" + } + } + } + }, + "400": { + "description": "Invalid data" + } + }, + "security": [ + { + "jwt_key": [] + } + ] + } } }, "components": { @@ -26363,6 +26410,51 @@ } } }, + "PlatformAccountCreateRequest": { + "type": "object", + "required": [ + "organization_name" + ], + "properties": { + "organization_name": { + "type": "string", + "example": "organization_abc", + "maxLength": 64 + } + } + }, + "PlatformAccountCreateResponse": { + "type": "object", + "required": [ + "org_id", + "org_type", + "merchant_id", + "merchant_account_type" + ], + "properties": { + "org_id": { + "type": "string", + "example": "org_abc", + "maxLength": 64, + "minLength": 1 + }, + "org_name": { + "type": "string", + "example": "organization_abc", + "nullable": true + }, + "org_type": { + "$ref": "#/components/schemas/OrganizationType" + }, + "merchant_id": { + "type": "string", + "example": "merchant_abc" + }, + "merchant_account_type": { + "$ref": "#/components/schemas/MerchantAccountType" + } + } + }, "PollConfig": { "type": "object", "required": [ diff --git a/api-reference/v1/platform/platform--create.mdx b/api-reference/v1/platform/platform--create.mdx new file mode 100644 index 0000000000..61a12fdc6d --- /dev/null +++ b/api-reference/v1/platform/platform--create.mdx @@ -0,0 +1,3 @@ +--- +openapi: post /create_platform +--- \ No newline at end of file diff --git a/crates/api_models/src/user.rs b/crates/api_models/src/user.rs index 47608532b5..82d10a1621 100644 --- a/crates/api_models/src/user.rs +++ b/crates/api_models/src/user.rs @@ -3,6 +3,7 @@ use std::fmt::Debug; use common_enums::{EntityType, TokenPurpose}; use common_utils::{crypto::OptionalEncryptableName, id_type, pii}; use masking::Secret; +use utoipa::ToSchema; use crate::user_role::UserStatus; pub mod dashboard_metadata; @@ -150,17 +151,24 @@ pub struct UserOrgMerchantCreateRequest { pub merchant_name: Secret, } -#[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] +#[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct PlatformAccountCreateRequest { + #[schema(max_length = 64, value_type = String, example = "organization_abc")] pub organization_name: Secret, } -#[derive(Debug, serde::Deserialize, serde::Serialize)] +#[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)] pub struct PlatformAccountCreateResponse { + #[schema(value_type = String, max_length = 64, min_length = 1, example = "org_abc")] pub org_id: id_type::OrganizationId, + #[schema(value_type = Option, example = "organization_abc")] pub org_name: Option, + + #[schema(value_type = OrganizationType, example = "standard")] pub org_type: common_enums::OrganizationType, + #[schema(value_type = String, example = "merchant_abc")] pub merchant_id: id_type::MerchantId, + #[schema(value_type = MerchantAccountType, example = "standard")] pub merchant_account_type: common_enums::MerchantAccountType, } diff --git a/crates/openapi/src/openapi.rs b/crates/openapi/src/openapi.rs index 54b004e32b..a5e0a6d95c 100644 --- a/crates/openapi/src/openapi.rs +++ b/crates/openapi/src/openapi.rs @@ -213,6 +213,9 @@ Never share your secret api keys. Keep them guarded and secure. // Routes for authentication routes::authentication::authentication_create, + + // Routes for platform account + routes::platform::create_platform_account, ), components(schemas( common_utils::types::MinorUnit, @@ -362,8 +365,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::enums::MerchantProductType, api_models::enums::CtpServiceProvider, api_models::enums::PaymentLinkSdkLabelType, - api_models::enums::PaymentLinkShowSdkTerms, api_models::enums::OrganizationType, + api_models::enums::PaymentLinkShowSdkTerms, api_models::admin::MerchantConnectorCreate, api_models::admin::AdditionalMerchantData, api_models::admin::ConnectorWalletDetails, @@ -806,6 +809,8 @@ Never share your secret api keys. Keep them guarded and secure. api_models::authentication::ThreeDsData, api_models::authentication::AuthenticationEligibilityRequest, api_models::authentication::AuthenticationEligibilityResponse, + api_models::user::PlatformAccountCreateRequest, + api_models::user::PlatformAccountCreateResponse, )), modifiers(&SecurityAddon) )] diff --git a/crates/openapi/src/routes.rs b/crates/openapi/src/routes.rs index 50c7db98ab..7dcdf60571 100644 --- a/crates/openapi/src/routes.rs +++ b/crates/openapi/src/routes.rs @@ -14,6 +14,7 @@ pub mod payment_link; pub mod payment_method; pub mod payments; pub mod payouts; +pub mod platform; pub mod poll; pub mod profile; pub mod profile_acquirer; diff --git a/crates/openapi/src/routes/platform.rs b/crates/openapi/src/routes/platform.rs new file mode 100644 index 0000000000..6dc04076e5 --- /dev/null +++ b/crates/openapi/src/routes/platform.rs @@ -0,0 +1,26 @@ +#[cfg(feature = "v1")] +/// Platform - Create +/// +/// Create a new platform account +#[utoipa::path( + post, + path = "/create_platform", + request_body( + content = PlatformAccountCreateRequest, + examples( + ( + "Create a platform account with organization_name" = ( + value = json!({"organization_name": "organization_abc"}) + ) + ), + ) + ), + responses( + (status = 200, description = "Platform Account Created", body = PlatformAccountCreateResponse), + (status = 400, description = "Invalid data") + ), + tag = "Platform", + operation_id = "Create a Platform Account", + security(("jwt_key" = [])) +)] +pub async fn create_platform_account() {}