hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(router): adding generic tokenization endpoint

Open su-shivanshmathur opened this issue 8 months ago • 1 comments

Type of Change

  • [ ] Bugfix
  • [x] New feature
  • [ ] Enhancement
  • [ ] Refactoring
  • [ ] Dependency updates
  • [x] Documentation
  • [ ] CI/CD

Description

Create a new set of endpoints for giving tokenization as a service for generic usage, current motivation of the service is to be used in proxy payment service.

Additional Changes

  • [ ] This PR modifies the API contract
  • [x] This PR modifies the database schema
  • [ ] This PR modifies application configuration/environment variables

Motivation and Context

How did you test it?

Create a token

curl --location 'http: //localhost:8080/v2/tokenize' \
--header 'x-profile-id: pro_neU1Qn8gnIich0LAaQXm' \
--header 'Authorization: publishable-key=PUBLISHABLE_KEY,client-secret=CLIENT_SECRET' \
--header 'Content-Type: application/json' \
--data '{
    "customer_id": customer_id,
    "token_request": {
        "payment_method_data": {
            "card": {
                "card_holder_name": "Narayan Bhat"
            }
        }
    }
}'

Response

{
    "id": "12345_tok_01966c6515157c3193db1c2502435ad5",
    "created_at": "2025-04-25 10:01:26.037519",
    "flag": "enabled"
}

Checklist

  • [ ] I formatted the code cargo +nightly fmt --all
  • [ ] I addressed lints thrown by cargo clippy
  • [ ] I reviewed the submitted code
  • [ ] I added unit tests for my changes where possible

su-shivanshmathur avatar Apr 25 '25 11:04 su-shivanshmathur

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/db.rs  80% smaller
  crates/router/src/types/payment_methods.rs  78% smaller
  crates/diesel_models/src/enums.rs  41% smaller
  crates/hyperswitch_domain_models/src/payment_methods.rs  22% smaller
  crates/router/src/core/payment_methods.rs  1% smaller
  crates/common_enums/src/enums.rs  1% smaller
  api-reference-v2/api-reference/tokenization/tokenization--create.mdx Unsupported file format
  api-reference-v2/mint.json  0% smaller
  api-reference-v2/openapi_spec.json  0% smaller
  config/development.toml Unsupported file format
  crates/api_models/Cargo.toml Unsupported file format
  crates/api_models/src/events.rs  0% smaller
  crates/api_models/src/lib.rs  0% smaller
  crates/api_models/src/payment_methods.rs  0% smaller
  crates/api_models/src/tokenization.rs  0% smaller
  crates/common_types/Cargo.toml Unsupported file format
  crates/common_utils/Cargo.toml Unsupported file format
  crates/common_utils/src/consts.rs  0% smaller
  crates/common_utils/src/events.rs  0% smaller
  crates/common_utils/src/id_type.rs  0% smaller
  crates/common_utils/src/id_type/global_id.rs  0% smaller
  crates/common_utils/src/id_type/global_id/token.rs  0% smaller
  crates/common_utils/src/lib.rs  0% smaller
  crates/common_utils/src/tokenization.rs  0% smaller
  crates/diesel_models/Cargo.toml Unsupported file format
  crates/diesel_models/src/lib.rs  0% smaller
  crates/diesel_models/src/mod.rs  0% smaller
  crates/diesel_models/src/payment_methods_session.rs  0% smaller
  crates/diesel_models/src/query.rs  0% smaller
  crates/diesel_models/src/query/tokenization.rs  0% smaller
  crates/diesel_models/src/schema_v2.rs  0% smaller
  crates/diesel_models/src/tokenization.rs  0% smaller
  crates/diesel_models/src/types.rs  0% smaller
  crates/hyperswitch_domain_models/Cargo.toml Unsupported file format
  crates/hyperswitch_domain_models/src/lib.rs  0% smaller
  crates/hyperswitch_domain_models/src/tokenization.rs  0% smaller
  crates/masking/src/lib.rs  0% smaller
  crates/masking/src/secret.rs  0% smaller
  crates/openapi/Cargo.toml Unsupported file format
  crates/openapi/src/openapi_v2.rs  0% smaller
  crates/openapi/src/routes.rs  0% smaller
  crates/openapi/src/routes/tokenization.rs  0% smaller
  crates/router/Cargo.toml Unsupported file format
  crates/router/src/core.rs  0% smaller
  crates/router/src/core/payment_methods/transformers.rs  0% smaller
  crates/router/src/core/payment_methods/vault.rs  0% smaller
  crates/router/src/core/tokenization.rs  0% smaller
  crates/router/src/db/kafka_store.rs  0% smaller
  crates/router/src/lib.rs  0% smaller
  crates/router/src/routes.rs  0% smaller
  crates/router/src/routes/app.rs  0% smaller
  crates/router/src/routes/lock_utils.rs  0% smaller
  crates/router/src/routes/tokenization.rs  0% smaller
  crates/router_env/src/logger/types.rs  0% smaller
  crates/storage_impl/Cargo.toml Unsupported file format
  crates/storage_impl/src/lib.rs  0% smaller
  crates/storage_impl/src/mock_db.rs  0% smaller
  crates/storage_impl/src/tokenization.rs  0% smaller
  v2_migrations/2025-04-25-105138_tokenization_service_creation/down.sql Unsupported file format
  v2_migrations/2025-04-25-105138_tokenization_service_creation/up.sql Unsupported file format

semanticdiff-com[bot] avatar Apr 25 '25 11:04 semanticdiff-com[bot]