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

Refactor(router): router_parameters field inclusion (#1251)

Prajjwal Kumar16cd32513bc6
diff --git a/crates/api_models/src/enums.rs b/crates/api_models/src/enums.rs
index f91732cfa7..7d50e6d402 100644
--- a/crates/api_models/src/enums.rs
+++ b/crates/api_models/src/enums.rs
@@ -655,6 +655,7 @@ impl Connector {
Copy,
Debug,
Eq,
+ Hash,
PartialEq,
serde::Serialize,
serde::Deserialize,
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index a90fa8313f..0b802c16a1 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -1,4 +1,4 @@
-use std::num::NonZeroI64;
+use std::{collections::HashMap, num::NonZeroI64};
use cards::CardNumber;
use common_utils::{pii, pii::Email};
@@ -1570,6 +1570,8 @@ pub struct OrderDetails {
pub struct Metadata {
/// Information about the product and quantity for specific connectors. (e.g. Klarna)
pub order_details: Option<Vec<OrderDetails>>,
+ /// Information used for routing
+ pub routing_parameters: Option<HashMap<String, String>>,
/// Any other metadata that is to be provided
#[schema(value_type = Object, example = r#"{ "city": "NY", "unit": "245" }"#)]
#[serde(flatten)]
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 2f82ca08c5..8628251d00 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -344,6 +344,7 @@ impl PaymentRedirectFlow for PaymentRedirectCompleteAuthorize {
payment_id: Some(req.resource_id.clone()),
merchant_id: req.merchant_id.clone(),
metadata: Some(Metadata {
+ routing_parameters: None,
order_details: None,
data: masking::Secret::new("{}".into()),
payload: Some(req.json_payload.unwrap_or(serde_json::json!({})).into()),