mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-02 21:07:58 +08:00
feat(ucs): transmit merchant order reference id to unified connector service (#9352)
This commit is contained in:
@ -14,11 +14,15 @@ pub mod errors;
|
||||
pub mod events;
|
||||
pub mod ext_traits;
|
||||
pub mod fp_utils;
|
||||
/// Used for hashing
|
||||
pub mod hashing;
|
||||
pub mod id_type;
|
||||
#[cfg(feature = "keymanager")]
|
||||
pub mod keymanager;
|
||||
pub mod link_utils;
|
||||
pub mod macros;
|
||||
#[cfg(feature = "metrics")]
|
||||
pub mod metrics;
|
||||
pub mod new_type;
|
||||
pub mod payout_method_utils;
|
||||
pub mod pii;
|
||||
@ -28,13 +32,14 @@ pub mod request;
|
||||
pub mod signals;
|
||||
pub mod transformers;
|
||||
pub mod types;
|
||||
/// Unified Connector Service (UCS) interface definitions.
|
||||
///
|
||||
/// This module defines types and traits for interacting with the Unified Connector Service.
|
||||
/// It includes reference ID types for payments and refunds, and a trait for extracting
|
||||
/// UCS reference information from requests.
|
||||
pub mod ucs_types;
|
||||
pub mod validation;
|
||||
|
||||
/// Used for hashing
|
||||
pub mod hashing;
|
||||
#[cfg(feature = "metrics")]
|
||||
pub mod metrics;
|
||||
|
||||
pub use base64_serializer::Base64Serializer;
|
||||
|
||||
/// Date-time utilities.
|
||||
|
||||
38
crates/common_utils/src/ucs_types.rs
Normal file
38
crates/common_utils/src/ucs_types.rs
Normal file
@ -0,0 +1,38 @@
|
||||
use crate::id_type;
|
||||
|
||||
/// Represents a reference ID for the Unified Connector Service (UCS).
|
||||
///
|
||||
/// This enum can hold either a payment reference ID or a refund reference ID,
|
||||
/// allowing for a unified way to handle different types of transaction references
|
||||
/// when interacting with the UCS.
|
||||
#[derive(Debug)]
|
||||
pub enum UcsReferenceId {
|
||||
/// A payment reference ID.
|
||||
///
|
||||
/// This variant wraps a [`PaymentReferenceId`](id_type::PaymentReferenceId)
|
||||
/// and is used to identify a payment transaction within the UCS.
|
||||
Payment(id_type::PaymentReferenceId),
|
||||
/// A refund reference ID.
|
||||
///
|
||||
/// This variant wraps a [`RefundReferenceId`](id_type::RefundReferenceId)
|
||||
/// and is used to identify a refund transaction within the UCS.
|
||||
Refund(id_type::RefundReferenceId),
|
||||
}
|
||||
|
||||
impl UcsReferenceId {
|
||||
/// Returns the string representation of the reference ID.
|
||||
///
|
||||
/// This method matches the enum variant and calls the `get_string_repr`
|
||||
/// method of the underlying ID type (either `PaymentReferenceId` or `RefundReferenceId`)
|
||||
/// to get its string representation.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A string slice (`&str`) representing the reference ID.
|
||||
pub fn get_string_repr(&self) -> &str {
|
||||
match self {
|
||||
Self::Payment(id) => id.get_string_repr(),
|
||||
Self::Refund(id) => id.get_string_repr(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user