mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-30 01:27:31 +08:00
feat(router): adding generic tokenization endpoint (#7905)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -157,6 +157,9 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
|
||||
// Routes for proxy
|
||||
routes::proxy::proxy_core,
|
||||
|
||||
// Route for tokenization
|
||||
routes::tokenization::create_token_vault_api,
|
||||
),
|
||||
components(schemas(
|
||||
common_utils::types::MinorUnit,
|
||||
@ -736,6 +739,8 @@ Never share your secret api keys. Keep them guarded and secure.
|
||||
api_models::proxy::ProxyResponse,
|
||||
api_models::proxy::TokenType,
|
||||
routes::payments::ForceSync,
|
||||
api_models::tokenization::GenericTokenizationRequest,
|
||||
api_models::tokenization::GenericTokenizationResponse,
|
||||
)),
|
||||
modifiers(&SecurityAddon)
|
||||
)]
|
||||
|
||||
@ -20,4 +20,5 @@ pub mod refunds;
|
||||
pub mod relay;
|
||||
pub mod revenue_recovery;
|
||||
pub mod routing;
|
||||
pub mod tokenization;
|
||||
pub mod webhook_events;
|
||||
|
||||
33
crates/openapi/src/routes/tokenization.rs
Normal file
33
crates/openapi/src/routes/tokenization.rs
Normal file
@ -0,0 +1,33 @@
|
||||
use serde_json::json;
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[cfg(feature = "v2")]
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/v2/tokenize",
|
||||
request_body(
|
||||
content = GenericTokenizationRequest,
|
||||
examples(("Create a token with customer_id" = (
|
||||
value = json!({
|
||||
"customer_id": "12345_cus_0196d94b9c207333a297cbcf31f2e8c8",
|
||||
"token_request": {
|
||||
"payment_method_data": {
|
||||
"card": {
|
||||
"card_holder_name": "test name"
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
)))
|
||||
),
|
||||
responses(
|
||||
(status = 200, description = "Token created successfully", body = GenericTokenizationResponse),
|
||||
(status = 400, description = "Invalid request"),
|
||||
(status = 401, description = "Unauthorized"),
|
||||
(status = 500, description = "Internal server error")
|
||||
),
|
||||
tag = "Tokenization",
|
||||
operation_id = "create_token_vault_api",
|
||||
security(("ephemeral_key" = []),("api_key" = []))
|
||||
)]
|
||||
pub async fn create_token_vault_api() {}
|
||||
Reference in New Issue
Block a user