hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(router): adding tokenization_fields to profile

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

Type of Change

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

Description

Adding fields for tokenization in Business profile which can be used by by SDK to create structure of what data to use for creating tokenization request.

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

Motivation was how will merchant be able to configure the tokenization fields which could be used in proxy payments

How did you test it?

Request

curl --location 'http://localhost:8080/v2/profiles' \
--header 'x-merchant-id: merchant_w6p929aHXGtsdwqdvSly' \
--header 'Authorization: admin-api-key=test_admin' \
--header 'Content-Type: application/json' \
--header 'api-key: test_admin' \
--data-raw '{
    "profile_name": "_test",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "tokenize_fields":["card_number", "card_cvc"]
}'

Response

{
    "merchant_id": "merchant_w6p929aHXGtsdwqdvSly",
    "id": "pro_ph6CKI2hmYV42vnoUNYE",
    "profile_name": "_test",
    "return_url": "https://google.com/success",
    "enable_payment_response_hash": true,
    "payment_response_hash_key": "eYcVJs7ynU8A5x9GrN0mg9cIHDvqQMW28RQEq2ucS9faaTNobzukBFMdj8Pq1PpS",
    "redirect_to_merchant_with_http_post": false,
    "webhook_details": {
        "webhook_version": "1.0.1",
        "webhook_username": "ekart_retail",
        "webhook_password": "password_ekart@123",
        "webhook_url": "https://webhook.site",
        "payment_created_enabled": true,
        "payment_succeeded_enabled": true,
        "payment_failed_enabled": true
    },
    "metadata": null,
    "applepay_verified_domains": null,
    "session_expiry": 900,
    "payment_link_config": null,
    "authentication_connector_details": null,
    "use_billing_as_payment_method_billing": true,
    "extended_card_info_config": null,
    "collect_shipping_details_from_wallet_connector_if_required": false,
    "collect_billing_details_from_wallet_connector_if_required": false,
    "always_collect_shipping_details_from_wallet_connector": false,
    "always_collect_billing_details_from_wallet_connector": false,
    "is_connector_agnostic_mit_enabled": false,
    "payout_link_config": null,
    "outgoing_webhook_custom_http_headers": null,
    "order_fulfillment_time": 900,
    "order_fulfillment_time_origin": "create",
    "tax_connector_id": null,
    "is_tax_connector_enabled": false,
    "is_network_tokenization_enabled": false,
    "should_collect_cvv_during_payment": null,
    "is_click_to_pay_enabled": false,
    "authentication_product_ids": null,
    "card_testing_guard_config": {
        "card_ip_blocking_status": "disabled",
        "card_ip_blocking_threshold": 3,
        "guest_user_card_blocking_status": "disabled",
        "guest_user_card_blocking_threshold": 10,
        "customer_id_blocking_status": "disabled",
        "customer_id_blocking_threshold": 5,
        "card_testing_guard_expiry": 3600
    },
    "is_clear_pan_retries_enabled": false,
    "is_debit_routing_enabled": false,
    "merchant_business_country": null,
    "is_external_vault_enabled": null,
    "external_vault_connector_details": null,
    "tokenize_fields": [
        "card_number",
        "card_cvc"
    ]
}

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 May 16 '25 07:05 su-shivanshmathur