Skip to content

feat(ucs): Add profile ID to lineage tracking in Unified Connector Service#9559

Merged
likhinbopanna merged 8 commits intomainfrom
send-profile-id-as-lineage
Sep 30, 2025
Merged

feat(ucs): Add profile ID to lineage tracking in Unified Connector Service#9559
likhinbopanna merged 8 commits intomainfrom
send-profile-id-as-lineage

Conversation

@hrithikesh026
Copy link
Contributor

@hrithikesh026 hrithikesh026 commented Sep 25, 2025

Type of Change

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

Description

This PR enhances the Unified Connector Service (UCS) by adding profile ID tracking to the lineage system. Previously, the lineage tracking only included merchant IDs, but now it includes both merchant ID and profile ID to provide better traceability and context for payment operations.

Key Changes:

  1. Enhanced LineageIds Structure: Updated the LineageIds struct in crates/external_services/src/grpc_client.rs to include both merchant_id and profile_id fields.

  2. Updated UCS Header Builder: Modified the gRPC header builder types to include lineage IDs at the intermediate stage, ensuring profile IDs are properly propagated through the system.

  3. Payment Flow Integration: Updated multiple payment flow functions in crates/router/src/core/payments.rs to create and pass lineage IDs containing both merchant and profile information when calling UCS.

  4. Flow Trait Updates: Enhanced the payment flow traits in crates/router/src/core/payments/flows.rs to accept and handle lineage IDs in UCS calls.

  5. Constants Addition: Added a new constant PROFILE_ID_UNAVAILABLE in crates/router/src/consts.rs for handling cases where profile ID is not available.

Additional Changes

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

Files Modified:

  • crates/external_services/src/grpc_client.rs - LineageIds structure and gRPC header builder
  • crates/router/src/consts.rs - Added PROFILE_ID_UNAVAILABLE constant
  • crates/router/src/core/payments.rs - Updated UCS calls to include lineage IDs
  • crates/router/src/core/payments/flows.rs - Flow trait updates for lineage ID support
  • crates/router/src/core/payments/flows/authorize_flow.rs - Authorize flow lineage ID integration

Motivation and Context

The enhancement is required to improve traceability and debugging capabilities in the Unified Connector Service. By including profile ID in the lineage tracking, we can:

  1. Better Traceability: Track payment operations with both merchant and profile context
  2. Improved Debugging: Quickly identify which profile a payment operation belongs to
  3. Enhanced Monitoring: Provide more granular monitoring and logging capabilities
  4. Future-proofing: Lay groundwork for profile-specific features and analytics

This change supports the broader initiative to improve the observability and traceability of payment operations throughout the Hyperswitch system.

How did you test it?

Screenshot 2025-09-25 at 11 36 53 PM

unit test cases result:
image

The changes have been tested by:

  • Verifying that the new lineage IDs are properly constructed with both merchant and profile IDs
  • Ensuring that existing payment flows continue to work with the enhanced UCS calls
  • Validating that the gRPC header builder correctly handles the new lineage ID structure
  • Testing edge cases where profile ID might be unavailable using the new constant

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

@hrithikesh026 hrithikesh026 self-assigned this Sep 25, 2025
@hrithikesh026 hrithikesh026 requested review from a team as code owners September 25, 2025 08:31
@semanticdiff-com
Copy link

semanticdiff-com bot commented Sep 25, 2025

@hrithikesh026 hrithikesh026 changed the title feat(ucs): include profile_id in lineage id list feat(core): Introduce Profile ID based merchant context Sep 25, 2025
@hrithikesh026 hrithikesh026 added C-feature Category: Feature request or enhancement S-waiting-on-review Status: This PR has been implemented and needs to be reviewed ai-review AI: request for coderabbit review labels Sep 25, 2025
use common_utils::id_type::ProfileId;

pub use crate::{
business_profile::Profile, merchant_account::MerchantAccount,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
business_profile::Profile, merchant_account::MerchantAccount,
business_profile, merchant_account,


pub use crate::{
business_profile::Profile, merchant_account::MerchantAccount,
merchant_key_store::MerchantKeyStore,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
merchant_key_store::MerchantKeyStore,
merchant_key_store,

@@ -1,4 +1,9 @@
pub use crate::{merchant_account::MerchantAccount, merchant_key_store::MerchantKeyStore};
use common_utils::id_type::ProfileId;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
use common_utils::id_type::ProfileId;
use common_utils::id_type;

@hrithikesh026 hrithikesh026 changed the title feat(core): Introduce Profile ID based merchant context feat(ucs): Add profile ID to lineage tracking in Unified Connector Service Sep 25, 2025
@hrithikesh026 hrithikesh026 linked an issue Sep 26, 2025 that may be closed by this pull request
2 tasks
@Gnanasundari24 Gnanasundari24 added this pull request to the merge queue Sep 29, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to no response for status checks Sep 29, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Sep 30, 2025
Merged via the queue into main with commit 7654dbf Sep 30, 2025
21 of 25 checks passed
@likhinbopanna likhinbopanna deleted the send-profile-id-as-lineage branch September 30, 2025 07:33
pixincreate added a commit that referenced this pull request Sep 30, 2025
…pay-new-field

* 'main' of github.com:juspay/hyperswitch: (21 commits)
  feat(payments): add tokenization action handling to payment flow for braintree (#9506)
  feat(connector): [Loonio] Add template code (#9586)
  fix(connector): [paysafe] make `eci_indicator` field optional (#9591)
  fix(core): add should_call_connector_customer function to connector specification (#9569)
  feat(ucs): Add profile ID to lineage tracking in Unified Connector Service (#9559)
  feat(core): Add support for partial auth in proxy payments [V2] (#9503)
  chore(version): 2025.09.30.0
  fix(authorizedotnet): refund via ucs missing connector_metadata (#9581)
  feat(auth): add new authentication to communicate between microservices (#9547)
  Fix: Ideal Giropay Country Currency Config (#9552)
  feat(connector): [ACI] cypress added (#9502)
  feat(connector): Add Peachpayments Cypress (#9573)
  chore(version): 2025.09.29.0
  feat(finix): template code (#9557)
  feat(cypress): add cypress test-cases for manual retry (#9505)
  feat(core): update additional payment method data in psync response (#9519)
  feat(connector): [Checkout] Add Google Pay Predecrypt Flow (#9130)
  feat(framework): Added smithy, smithy-core and smithy-generator crates (#9249)
  fix(core): add request_extended_authorization in the payment attempt and populate it in the payment response (#9492)
  chore(version): 2025.09.26.0
  ...
@hyperswitch-bot hyperswitch-bot bot removed the S-waiting-on-review Status: This PR has been implemented and needs to be reviewed label Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review AI: request for coderabbit review C-feature Category: Feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Add support for sending lineage ids to UCS

4 participants