hyperswitch icon indicating copy to clipboard operation
hyperswitch copied to clipboard

feat(router): Add support for network token migration

Open prasunna09 opened this issue 4 months ago • 2 comments

Type of Change

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

Description

Add support for network token migration.

Additional Changes

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

Motivation and Context

How did you test it?

test migration api. req -

curl --location 'http://localhost:8080/payment_methods/migrate' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'api-key: api-key' \
--data '{
    "merchant_id": "merchant_id",
    "card": {
        "card_number": "card_number",
        "card_exp_month": "12",
        "card_exp_year": "21",
        "card_holder_name": "joseph Doe"
    },
    "customer_id": "customer_id",
    "network_transaction_id": "nt-transaction-id",
    "payment_method": "card",
    "network_token": {
        "network_token_data": {
            "network_token_number": "network_token_number",
            "network_token_exp_month": "12",
            "network_token_exp_year": "21"
        },
        "network_token_requestor_ref_id": "test-ref-id"
    }
}'

expected response -

{
    "payment_method_response": {
        "merchant_id": "merchant_1731400520",
        "customer_id": "cust-1731400905",
        "payment_method_id": "pm_LSk7YuLskFS8aBdWNvzk",
        "payment_method": "card",
        "payment_method_type": null,
        "card": {
            "scheme": null,
            "issuer_country": null,
            "last4_digits": "0000",
            "expiry_month": "12",
            "expiry_year": "21",
            "card_token": null,
            "card_holder_name": "joseph Doe",
            "card_fingerprint": null,
            "nick_name": null,
            "card_network": null,
            "card_isin": "420000",
            "card_issuer": null,
            "card_type": null,
            "saved_to_locker": true
        },
        "recurring_enabled": false,
        "installment_payment_enabled": false,
        "payment_experience": [
            "redirect_to_url"
        ],
        "metadata": null,
        "created": "2024-11-12T09:00:50.948Z",
        "last_used_at": "2024-11-12T09:00:50.949Z",
        "client_secret": "pm_LSk7YuLskFS8aBdWNvzk_secret_6B5AfKanyCDhy5hjeUce"
    },
    "card_migrated": true,
    "network_token_migrated": true,
    "connector_mandate_details_migrated": null,
    "network_transaction_id_migrated": true
}
Screenshot 2024-11-12 at 2 31 12 PM

Checklist

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

prasunna09 avatar Oct 13 '24 21:10 prasunna09