Skip to content

Commit 332f7f1

Browse files
Comment resolution
1 parent ea3aee5 commit 332f7f1

File tree

8 files changed

+106
-20
lines changed

8 files changed

+106
-20
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
openapi: post /v2/tokenize
3+
---

api-reference-v2/mint.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@
146146
{
147147
"group": "Proxy",
148148
"pages": ["api-reference/proxy/proxy"]
149+
},
150+
{
151+
"group": "Tokenization",
152+
"pages": ["api-reference/tokenization/tokenization--create"]
149153
}
150154
],
151155
"footerSocials": {

api-reference-v2/openapi_spec.json

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3532,6 +3532,67 @@
35323532
}
35333533
]
35343534
}
3535+
},
3536+
"/v2/tokenize": {
3537+
"post": {
3538+
"tags": [
3539+
"Tokenization"
3540+
],
3541+
"operationId": "create_token_vault_api",
3542+
"requestBody": {
3543+
"content": {
3544+
"application/json": {
3545+
"schema": {
3546+
"$ref": "#/components/schemas/GenericTokenizationRequest"
3547+
},
3548+
"examples": {
3549+
"Create a token with customer_id": {
3550+
"value": {
3551+
"customer_id": "12345_cus_0196d94b9c207333a297cbcf31f2e8c8",
3552+
"token_request": {
3553+
"payment_method_data": {
3554+
"card": {
3555+
"card_holder_name": "test name"
3556+
}
3557+
}
3558+
}
3559+
}
3560+
}
3561+
}
3562+
}
3563+
},
3564+
"required": true
3565+
},
3566+
"responses": {
3567+
"200": {
3568+
"description": "Token created successfully",
3569+
"content": {
3570+
"application/json": {
3571+
"schema": {
3572+
"$ref": "#/components/schemas/GenericTokenizationResponse"
3573+
}
3574+
}
3575+
}
3576+
},
3577+
"400": {
3578+
"description": "Invalid request"
3579+
},
3580+
"401": {
3581+
"description": "Unauthorized"
3582+
},
3583+
"500": {
3584+
"description": "Internal server error"
3585+
}
3586+
},
3587+
"security": [
3588+
{
3589+
"ephemeral_key": []
3590+
},
3591+
{
3592+
"api_key": []
3593+
}
3594+
]
3595+
}
35353596
}
35363597
},
35373598
"components": {

crates/diesel_models/src/enums.rs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,22 +300,4 @@ pub enum UserRoleVersion {
300300
#[default]
301301
V1,
302302
V2,
303-
}
304-
305-
// #[cfg(all(feature = "v2", feature = "tokenization_v2"))]
306-
// #[derive(
307-
// Clone,
308-
// Copy,
309-
// Debug,
310-
// Eq,
311-
// PartialEq,
312-
// serde::Deserialize,
313-
// serde::Serialize,
314-
// diesel::deserialize::FromSqlRow,
315-
// diesel::expression::AsExpression,
316-
// )]
317-
// #[diesel(sql_type = diesel::sql_types::Text)]
318-
// pub enum TokenizationFlag {
319-
// Enabled,
320-
// Disabled,
321-
// }
303+
}

crates/openapi/src/openapi_v2.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ Never share your secret api keys. Keep them guarded and secure.
157157
158158
// Routes for proxy
159159
routes::proxy::proxy_core,
160+
161+
// Route for tokenization
162+
routes::tokenization::create_token_vault_api,
160163
),
161164
components(schemas(
162165
common_utils::types::MinorUnit,

crates/openapi/src/routes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ pub mod relay;
2121
pub mod revenue_recovery;
2222
pub mod routing;
2323
pub mod webhook_events;
24+
pub mod tokenization;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use utoipa::OpenApi;
2+
use serde_json::json;
3+
4+
#[cfg(feature = "v2")]
5+
#[utoipa::path(
6+
post,
7+
path = "/v2/tokenize",
8+
request_body(
9+
content = GenericTokenizationRequest,
10+
examples(("Create a token with customer_id" = (
11+
value = json!({
12+
"customer_id": "12345_cus_0196d94b9c207333a297cbcf31f2e8c8",
13+
"token_request": {
14+
"payment_method_data": {
15+
"card": {
16+
"card_holder_name": "test name"
17+
}
18+
}
19+
}
20+
})
21+
)))
22+
),
23+
responses(
24+
(status = 200, description = "Token created successfully", body = GenericTokenizationResponse),
25+
(status = 400, description = "Invalid request"),
26+
(status = 401, description = "Unauthorized"),
27+
(status = 500, description = "Internal server error")
28+
),
29+
tag = "Tokenization",
30+
operation_id = "create_token_vault_api",
31+
security(("ephemeral_key" = []),("api_key" = []))
32+
)]
33+
pub async fn create_token_vault_api() {}

crates/storage_impl/src/tokenization.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ impl<T: DatabaseStore> TokenizationInterface for RouterStore<T> {
9696
{
9797
let conn = connection::pg_connection_read(self).await?;
9898

99-
// Use the find_by_id method we just defined
10099
let tokenization = diesel_models::tokenization::Tokenization::find_by_id(&conn, token)
101100
.await
102101
.map_err(|error| report!(errors::StorageError::from(error)))?;

0 commit comments

Comments
 (0)