Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

chore: create v2 route for organization (#5679)

Hrithikesh0eaadc42b77e
diff --git a/api-reference-v2/api-reference/organization/organization--create.mdx b/api-reference-v2/api-reference/organization/organization--create.mdx
new file mode 100644
index 0000000000..07f4e13222
--- /dev/null
+++ b/api-reference-v2/api-reference/organization/organization--create.mdx
@@ -0,0 +1,3 @@
+---
+openapi: post /v2/organization
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/organization/organization--retrieve.mdx b/api-reference-v2/api-reference/organization/organization--retrieve.mdx
new file mode 100644
index 0000000000..5cd3175b04
--- /dev/null
+++ b/api-reference-v2/api-reference/organization/organization--retrieve.mdx
@@ -0,0 +1,3 @@
+---
+openapi: get /v2/organization/{organization_id}
+---
\ No newline at end of file
diff --git a/api-reference-v2/api-reference/organization/organization--update.mdx b/api-reference-v2/api-reference/organization/organization--update.mdx
new file mode 100644
index 0000000000..1ac924b71b
--- /dev/null
+++ b/api-reference-v2/api-reference/organization/organization--update.mdx
@@ -0,0 +1,3 @@
+---
+openapi: put /v2/organization/{organization_id}
+---
\ No newline at end of file
diff --git a/api-reference-v2/mint.json b/api-reference-v2/mint.json
index 375f50636a..b93e4e6000 100644
--- a/api-reference-v2/mint.json
+++ b/api-reference-v2/mint.json
@@ -34,6 +34,14 @@
"essentials/go-live"
]
},
+ {
+ "group": "Organization",
+ "pages": [
+ "api-reference/organization/organization--create",
+ "api-reference/organization/organization--retrieve",
+ "api-reference/organization/organization--update"
+ ]
+ },
{
"group": "Merchant Account",
"pages": [
diff --git a/api-reference-v2/openapi_spec.json b/api-reference-v2/openapi_spec.json
index 275a271616..d0f5152f15 100644
--- a/api-reference-v2/openapi_spec.json
+++ b/api-reference-v2/openapi_spec.json
@@ -20,7 +20,7 @@
}
],
"paths": {
- "/organization": {
+ "/v2/organization": {
"post": {
"tags": [
"Organization"
@@ -67,7 +67,7 @@
]
}
},
- "/organization/{organization_id}": {
+ "/v2/organization/{organization_id}": {
"get": {
"tags": [
"Organization"
diff --git a/crates/openapi/src/routes/organization.rs b/crates/openapi/src/routes/organization.rs
index 8f1a35f7d6..c31ff70a79 100644
--- a/crates/openapi/src/routes/organization.rs
+++ b/crates/openapi/src/routes/organization.rs
@@ -1,4 +1,4 @@
-#[cfg(any(feature = "v1", feature = "v2"))]
+#[cfg(feature = "v1")]
/// Organization - Create
///
/// Create a new organization
@@ -25,7 +25,7 @@
)]
pub async fn organization_create() {}
-#[cfg(any(feature = "v1", feature = "v2"))]
+#[cfg(feature = "v1")]
/// Organization - Retrieve
///
/// Retrieve an existing organization
@@ -43,7 +43,7 @@ pub async fn organization_create() {}
)]
pub async fn organization_retrieve() {}
-#[cfg(any(feature = "v1", feature = "v2"))]
+#[cfg(feature = "v1")]
/// Organization - Update
///
/// Create a new organization for .
@@ -70,3 +70,76 @@ pub async fn organization_retrieve() {}
security(("admin_api_key" = []))
)]
pub async fn organization_update() {}
+
+#[cfg(feature = "v2")]
+/// Organization - Create
+///
+/// Create a new organization
+#[utoipa::path(
+ post,
+ path = "/v2/organization",
+ request_body(
+ content = OrganizationRequest,
+ examples(
+ (
+ "Create an organization with organization_name" = (
+ value = json!({"organization_name": "organization_abc"})
+ )
+ ),
+ )
+ ),
+ responses(
+ (status = 200, description = "Organization Created", body =OrganizationResponse),
+ (status = 400, description = "Invalid data")
+ ),
+ tag = "Organization",
+ operation_id = "Create an Organization",
+ security(("admin_api_key" = []))
+)]
+pub async fn organization_create() {}
+
+#[cfg(feature = "v2")]
+/// Organization - Retrieve
+///
+/// Retrieve an existing organization
+#[utoipa::path(
+ get,
+ path = "/v2/organization/{organization_id}",
+ params (("organization_id" = String, Path, description = "The unique identifier for the Organization")),
+ responses(
+ (status = 200, description = "Organization Created", body =OrganizationResponse),
+ (status = 400, description = "Invalid data")
+ ),
+ tag = "Organization",
+ operation_id = "Retrieve an Organization",
+ security(("admin_api_key" = []))
+)]
+pub async fn organization_retrieve() {}
+
+#[cfg(feature = "v2")]
+/// Organization - Update
+///
+/// Create a new organization for .
+#[utoipa::path(
+ put,
+ path = "/v2/organization/{organization_id}",
+ request_body(
+ content = OrganizationRequest,
+ examples(
+ (
+ "Update organization_name of the organization" = (
+ value = json!({"organization_name": "organization_abcd"})
+ )
+ ),
+ )
+ ),
+ params (("organization_id" = String, Path, description = "The unique identifier for the Organization")),
+ responses(
+ (status = 200, description = "Organization Created", body =OrganizationResponse),
+ (status = 400, description = "Invalid data")
+ ),
+ tag = "Organization",
+ operation_id = "Update an Organization",
+ security(("admin_api_key" = []))
+)]
+pub async fn organization_update() {}
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index d8e1614110..4fb171996e 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1137,7 +1137,12 @@ impl Blocklist {
#[cfg(feature = "olap")]
pub struct Organization;
-#[cfg(feature = "olap")]
+
+#[cfg(all(
+ feature = "olap",
+ any(feature = "v1", feature = "v2"),
+ not(feature = "merchant_account_v2")
+))]
impl Organization {
pub fn server(state: AppState) -> Scope {
web::scope("/organization")
@@ -1151,6 +1156,20 @@ impl Organization {
}
}
+#[cfg(all(feature = "v2", feature = "olap", feature = "merchant_account_v2"))]
+impl Organization {
+ pub fn server(state: AppState) -> Scope {
+ web::scope("/v2/organization")
+ .app_data(web::Data::new(state))
+ .service(web::resource("").route(web::post().to(organization_create)))
+ .service(
+ web::resource("/{id}")
+ .route(web::get().to(organization_retrieve))
+ .route(web::put().to(organization_update)),
+ )
+ }
+}
+
pub struct MerchantAccount;
#[cfg(all(feature = "v2", feature = "olap", feature = "merchant_account_v2"))]