feat(ucs): transmit merchant order reference id to unified connector service#9352
Merged
Gnanasundari24 merged 6 commits intomainfrom Sep 18, 2025
Merged
feat(ucs): transmit merchant order reference id to unified connector service#9352Gnanasundari24 merged 6 commits intomainfrom
Gnanasundari24 merged 6 commits intomainfrom
Conversation
jarnura
previously approved these changes
Sep 11, 2025
sai-harsha-vardhan
previously approved these changes
Sep 16, 2025
06dd67e
jarnura
approved these changes
Sep 17, 2025
2 tasks
2 tasks
sai-harsha-vardhan
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR introduces the capability to send the Merchant Order Reference ID to the Unified Connector Service (UCS) as part of gRPC request headers. This enhancement allows the UCS to be aware of the merchant's original identifier for a transaction, which can be crucial for tracking, reconciliation, and reporting purposes.
Key Changes:
New
UcsReferenceIdType:UcsReferenceIdincrates/common_utils/src/ucs_types.rs. This type can represent either aPaymentReferenceIdor aRefundReferenceId, providing a unified structure for reference IDs in UCS communications.get_string_repr()method for easy string conversion.gRPC Header Enhancement:
GrpcHeadersUcsincrates/external_services/src/grpc_client.rsto include an optionalmerchant_reference_idfield of typeUcsReferenceId.UCS_HEADER_REFERENCE_ID("x-reference-id"), has been added incrates/external_services/src/lib.rsto transmit this ID.Integration in Payment Flows:
merchant_order_reference_idis now parsed from the request, validated, and wrapped inUcsReferenceId::Paymentbefore being added to the UCS gRPC headers.merchant_order_reference_idis directly mapped and sent to UCS.psync_flow) and Setup Mandate (setup_mandate_flow) have been updated to explicitly setmerchant_reference_idtoNonein their UCS headers, maintaining consistency.Data Type and Transformer Updates:
merchant_order_reference_idinExternalVaultProxyPaymentsData(hyperswitch_domain_models) is now strongly typed asOption<id_type::PaymentReferenceId>instead ofOption<String>.UcsReferenceIdtype, ensuring the string representation is used when constructing payloads for UCS.Additional Changes
Motivation and Context
By providing the UCS with the merchant's original order reference ID, we enable better traceability and linking of transactions between the merchant's system and Hyperswitch/UCS. This is a foundational step for features that might rely on this identifier for enhanced customer support, detailed analytics, or streamlined reconciliation processes within the UCS.
How did you test it?
Verified is the headers send from Hyperwitch are included in UCS events.
Checklist
cargo +nightly fmt --allcargo clippy