Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

fix(router): Use V1VaultEntityId to create fingerprint request (#11303)

Anurag Thakurdfe6f6d9493c
diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rs
index afa2d87dcd..795050a1bb 100644
--- a/crates/common_utils/src/id_type/customer.rs
+++ b/crates/common_utils/src/id_type/customer.rs
@@ -26,7 +26,7 @@ impl crate::events::ApiEventMetric for CustomerId {
}
impl CustomerId {
- /// Get a merchant id from String
+ /// Get a customer id from String
pub fn wrap(customer_id: String) -> CustomResult<Self, ValidationError> {
Self::try_from(std::borrow::Cow::from(customer_id))
}
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 832c479a5d..10e1e2f62e 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -632,7 +632,11 @@ impl PaymentMethodsController for PmCards<'_> {
.attach_printable("Failed to encode Vaulting data to string")?;
let payload = pm_types::VaultFingerprintRequest {
- key: customer_id.get_string_repr().to_owned(),
+ key: hyperswitch_domain_models::vault::V1VaultEntityId::new(
+ // The merchant_id should belong to the Provider
+ key_store.merchant_id.clone(),
+ customer_id.to_owned(),
+ ),
data,
}
.encode_to_vec()
diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rs
index 9626d62163..e01e2e26d8 100644
--- a/crates/router/src/types/payment_methods.rs
+++ b/crates/router/src/types/payment_methods.rs
@@ -25,6 +25,14 @@ pub trait VaultingInterface {
fn get_vaulting_flow_name() -> &'static str;
}
+#[cfg(feature = "v1")]
+#[derive(Debug, serde::Deserialize, serde::Serialize)]
+pub struct VaultFingerprintRequest {
+ pub data: String,
+ pub key: hyperswitch_domain_models::vault::V1VaultEntityId,
+}
+
+#[cfg(feature = "v2")]
#[derive(Debug, serde::Deserialize, serde::Serialize)]
pub struct VaultFingerprintRequest {
pub data: String,