Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(router): Add support for network token migration #6300

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

prasunna09
Copy link
Contributor

@prasunna09 prasunna09 commented Oct 13, 2024

Type of Change

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

Description

Add support for network token migration.

Additional Changes

  • 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

  • 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

@prasunna09 prasunna09 added the enhancement New feature or request label Oct 13, 2024
@prasunna09 prasunna09 self-assigned this Oct 13, 2024
@prasunna09 prasunna09 requested review from a team as code owners October 13, 2024 21:59
Copy link

semanticdiff-com bot commented Oct 13, 2024

@prasunna09 prasunna09 linked an issue Nov 4, 2024 that may be closed by this pull request
.unwrap_or_default(),
)
}
Some(Err(_)) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't discard the error, log the error

Copy link
Member

@lsampras lsampras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

analytics lgtm

jarnura
jarnura previously approved these changes Nov 11, 2024
crates/api_models/src/payment_methods.rs Outdated Show resolved Hide resolved
crates/api_models/src/payment_methods.rs Outdated Show resolved Hide resolved
crates/api_models/src/payment_methods.rs Outdated Show resolved Hide resolved
crates/api_models/src/payment_methods.rs Outdated Show resolved Hide resolved
crates/router/src/core/payment_methods/cards.rs Outdated Show resolved Hide resolved
@Gnanasundari24
Copy link
Contributor

@prasunna09 Can you add the cypress testcases for migration api

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] Add support for network token migration
6 participants