Skip to content

fix(payment_method): update entity id used for Vault to global customer id #8380

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

Merged
merged 7 commits into from
Jul 8, 2025

Conversation

prasunna09
Copy link
Contributor

@prasunna09 prasunna09 commented Jun 18, 2025

Type of Change

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

Description

Currently, if payment method data is inserted in vault for customer c1, merchant id is being sent as entity id, this will not allow us to store same payment method data for customer c2.
Payment Method data is always tied to customer, not to merchant.

Hence updated entity id to Global customer id

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 case -

  • create a payment method with 4242 card for a customer c1
  • create new payment method with 4242 card for a customer c2
    Both api should return 200

Initially for a diff customer under same merchant, api is returning duplication error.
with this fix, the api should return 2xx

curl --location 'http://localhost:8080/v2/payment-methods' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Profile-Id: profile id' \
--header 'Authorization: api-key=api key' \
--data '{
    "customer_id": "12345_cus_0197ca90d3797040985aceb3da929431",
    "payment_method_type": "card",
    "payment_method_subtype": "credit",
    "payment_method_data": {
        "card": {
            "card_number": "card_number",
            "card_exp_month": "12",
            "card_exp_year": "2026",
            "card_holder_name": "joseph Doe"
        }
    },
    "network_tokenization":{
        "enable":"Enable"
    }

}'

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 self-assigned this Jun 18, 2025
@prasunna09 prasunna09 requested review from a team as code owners June 18, 2025 11:48
@prasunna09 prasunna09 added A-core Area: Core flows C-bug Category: Bug S-waiting-on-review Status: This PR has been implemented and needs to be reviewed A-payment-methods Area: Payment Methods labels Jun 18, 2025
Copy link

semanticdiff-com bot commented Jun 18, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payment_methods.rs  70% smaller
  crates/router/src/core/payment_methods/vault.rs  66% smaller
  crates/router/src/core/proxy/utils.rs  5% smaller
  crates/router/src/core/proxy.rs  0% smaller
  crates/router/src/core/tokenization.rs  0% smaller
  crates/router/src/types/domain.rs  0% smaller
  crates/router/src/types/payment_methods.rs  0% smaller

@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Jul 8, 2025
Merged via the queue into main with commit cf96c82 Jul 8, 2025
24 of 28 checks passed
@Gnanasundari24 Gnanasundari24 deleted the refactor-tokenization-apis branch July 8, 2025 17:49
pixincreate added a commit that referenced this pull request Jul 9, 2025
…ayload-webhooks

* 'main' of github.com:juspay/hyperswitch:
  refactor(connector): Move connector mappings and endpoints to dedicated modules (#8562)
  ci(cypress): fix `hipay` test cases (#8563)
  chore(version): 2025.07.09.0
  fix(payment_method): update entity id used for Vault to global customer id (#8380)
  refactor(routing): add conditional check for invoking DE routing flows (#8559)
  feat(connector): [AUTHIPAY] Integrate cards non 3ds payments (#8266)
  ci(cypress): add payu connector (#8567)
  feat(connector): [silverflow] template code (#8553)
  chore(version): 2025.07.08.0
  feat(cypress): [worldpayvantiv] add cypress test (#8234)
  feat(connectors): [worldpayvantiv] add connector mandate support  (#8546)
  feat(connector): [Celero] add Connector Template Code (#8489)
  feat(payment-methods): create payment_token in vault confirm / do payment-confirm with temp token from session (#8525)
  ci(cypress): Add Tsys,Square cypress test (#8543)
  chore(version): 2025.07.07.0
@hyperswitch-bot hyperswitch-bot bot removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows A-payment-methods Area: Payment Methods C-bug Category: Bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants