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

chore(keymanager): add tenant-id to keymanager requests #6968

Merged
merged 6 commits into from
Jan 6, 2025

Conversation

dracarys18
Copy link
Member

@dracarys18 dracarys18 commented Jan 2, 2025

Type of Change

  • Enhancement

Description

Adds tenant-id for every requests to keymanager

Motivation and Context

Added tenant id header for the keymanager service to classify key ids based on tenants.

How did you test it?

  • Create Merchant Account with x-tenant-id as public
curl --location 'http://localhost:8080/accounts' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'x-feature: integ-custom' \
--header 'x-tenant-id: public' \
--header 'api-key: test_admin' \
--data-raw '{
  "merchant_id": "1735815159",
  "locker_id": "m0010",
  "merchant_name": "NewAge Retailer",
  "merchant_details": {
    "primary_contact_person": "John Test",
    "primary_email": "JohnTest@test.com",
    "primary_phone": "sunt laborum",
    "secondary_contact_person": "John Test2",
    "secondary_email": "JohnTest2@test.com",
    "secondary_phone": "cillum do dolor id",
    "website": "www.example.com",
    "about_business": "Online Retail with a wide selection of organic products for North America",
    "address": {
      "line1": "1467",
      "line2": "Harrison Street",
      "line3": "Harrison Street",
      "city": "San Fransico",
      "state": "California",
      "zip": "94122",
      "country": "US"
    }
  },
  "return_url": "https://google.com/success",
  "webhook_details": {
    "webhook_version": "1.0.1",
    "webhook_username": "ekart_retail",
    "webhook_password": "password_ekart@123",
    "payment_created_enabled": true,
    "payment_succeeded_enabled": true,
    "payment_failed_enabled": true
  },
  "sub_merchants_enabled": false,
  "metadata": {
    "city": "NY",
    "unit": "245"
  },
  "primary_business_details": [
    {
      "country": "US",
      "business": "default"
    }
  ]
}'
  • Get the x-request-id for the request and query it in grafana and see the if the tenant_id is public
    Screenshot 2025-01-02 at 4 24 01 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code

@dracarys18 dracarys18 added A-core Area: Core flows S-waiting-on-review Status: This PR has been implemented and needs to be reviewed labels Jan 2, 2025
@dracarys18 dracarys18 added this to the December 2024 Release milestone Jan 2, 2025
@dracarys18 dracarys18 self-assigned this Jan 2, 2025
@dracarys18 dracarys18 requested a review from a team as a code owner January 2, 2025 09:46
Copy link

semanticdiff-com bot commented Jan 2, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  crates/common_utils/src/id_type/tenant.rs  28% smaller
  crates/router/src/configs/settings.rs  19% smaller
  crates/common_utils/src/keymanager.rs  1% smaller
  config/config.example.toml Unsupported file format
  config/deployments/env_specific.toml Unsupported file format
  config/development.toml Unsupported file format
  config/docker_compose.toml Unsupported file format
  crates/common_utils/src/consts.rs  0% smaller
  crates/common_utils/src/types/keymanager.rs  0% smaller
  crates/router/src/configs/defaults.rs  0% smaller
  crates/router/src/types/domain/types.rs  0% smaller
  loadtest/config/development.toml Unsupported file format

@dracarys18 dracarys18 linked an issue Jan 2, 2025 that may be closed by this pull request
crates/common_utils/src/id_type/tenant.rs Outdated Show resolved Hide resolved
crates/router/src/configs/settings.rs Outdated Show resolved Hide resolved
crates/router/src/configs/defaults.rs Outdated Show resolved Hide resolved
config/development.toml Show resolved Hide resolved
Comment on lines +200 to +201
#[serde(default = "id_type::TenantId::get_default_global_tenant_id")]
pub tenant_id: id_type::TenantId,
Copy link
Member

Choose a reason for hiding this comment

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

Why did we need this serde(default)?

@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 6, 2025
@likhinbopanna likhinbopanna removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Jan 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 6, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 6, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Jan 6, 2025
Merged via the queue into main with commit 7901302 Jan 6, 2025
19 checks passed
@likhinbopanna likhinbopanna deleted the add_multitenancy_keymanager branch January 6, 2025 15:34
pixincreate added a commit to Ankesh2004/hyperswitch that referenced this pull request Jan 9, 2025
…r-verifyurl-in-redirection-handler

* 'main' of github.com:juspay/hyperswitch: (30 commits)
  test(cypress): add test for In Memory Cache (juspay#6961)
  chore(version): 2025.01.09.1
  fix(dummyconnector): add tenant id in dummyconnector requests (juspay#7008)
  chore(version): 2025.01.09.0
  fix(cypress): backup and restore sessions when using user apis (juspay#6978)
  feat(users): handle edge features for users in tenancy (juspay#6990)
  chore(dynamic-fields): [Worldpay] update dynamic fields for payments (juspay#7002)
  chore(version): 2025.01.08.0
  fix: consider status of payment method before filtering wallets in list pm (juspay#7004)
  feat(core): add columns unified error code and error message in refund table (juspay#6933)
  feat(connector): [Fiuu] Consume transaction id for error cases for Fiuu (juspay#6998)
  docs(cypress): update cypress documentation (juspay#6956)
  chore(version): 2025.01.07.0
  chore(keymanager): add tenant-id to keymanager requests (juspay#6968)
  ci(cypress): Add Session Token Testcases (juspay#6683)
  Ci(Cypress): Add PML test and Dynamic Fields Test for Novalnet (juspay#6544)
  chore(version): 2025.01.06.0
  ci(cypress): fix adyen sofort in cypress (juspay#6984)
  chore: add migrations for Currency type in DB (juspay#6980)
  chore(version): 2025.01.03.0
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core flows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] add multitenancy support to keymanager
5 participants