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
Rust adyenbeginner-friendlyfeaturedfinancefintechhacktoberfesthigh-performanceopen-sourceorchestrationpaymentpayment-gatewaypayment-integrationpayment-processingpaymentspayments-platformrestful-apirustsdkstripeworks-with-react
feat(payments): support for card_network filter in payments list (#5994)
Riddhiagrawal0011ac8c92c4bd2
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rsindex cda790b595..c7c998cc2b 100644--- a/crates/api_models/src/payments.rs+++ b/crates/api_models/src/payments.rs@@ -4389,6 +4389,8 @@ pub struct PaymentListFilterConstraints {/// The order in which payments list should be sorted#[serde(default)]pub order: Order,+ /// The List of all the card networks to filter payments list+ pub card_network: Option<Vec<enums::CardNetwork>>,}#[derive(Clone, Debug, serde::Serialize)]pub struct PaymentListFilters {@@ -4418,6 +4420,8 @@ pub struct PaymentListFiltersV2 {pub payment_method: HashMap<enums::PaymentMethod, HashSet<enums::PaymentMethodType>>,/// The list of available authentication typespub authentication_type: Vec<enums::AuthenticationType>,+ /// The list of available card networks+ pub card_network: Vec<enums::CardNetwork>,}#[derive(Clone, Debug, serde::Serialize)]diff --git a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs b/crates/hyperswitch_domain_models/src/payments/payment_intent.rsindex 562e5d205c..be2b354711 100644--- a/crates/hyperswitch_domain_models/src/payments/payment_intent.rs+++ b/crates/hyperswitch_domain_models/src/payments/payment_intent.rs@@ -1294,6 +1294,7 @@ pub struct PaymentIntentListParams {pub ending_before_id: Option<id_type::PaymentId>,pub limit: Option<u32>,pub order: api_models::payments::Order,+ pub card_network: Option<Vec<storage_enums::CardNetwork>>,}impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchConstraints {@@ -1327,6 +1328,7 @@ impl From<api_models::payments::PaymentListConstraints> for PaymentIntentFetchCoending_before_id: ending_before,limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V1)),order: Default::default(),+ card_network: None,}))}}@@ -1351,6 +1353,7 @@ impl From<common_utils::types::TimeRange> for PaymentIntentFetchConstraints {ending_before_id: None,limit: None,order: Default::default(),+ card_network: None,}))}}@@ -1373,6 +1376,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentFauthentication_type,merchant_connector_id,order,+ card_network,} = value;if let Some(payment_intent_id) = payment_id {Self::Single { payment_intent_id }@@ -1395,6 +1399,7 @@ impl From<api_models::payments::PaymentListFilterConstraints> for PaymentIntentFending_before_id: None,limit: Some(std::cmp::min(limit, PAYMENTS_LIST_MAX_LIMIT_V2)),order,+ card_network,}))}}diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rsindex c581b10473..f148bcdfbf 100644--- a/crates/router/src/core/payments.rs+++ b/crates/router/src/core/payments.rs@@ -3902,6 +3902,7 @@ pub async fn get_payment_filters(status: enums::IntentStatus::iter().collect(),payment_method: payment_method_types_map,authentication_type: enums::AuthenticationType::iter().collect(),+ card_network: enums::CardNetwork::iter().collect(),},))}diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rsindex 4c7232f6f3..f5c3deeb18 100644--- a/crates/storage_impl/src/payments/payment_intent.rs+++ b/crates/storage_impl/src/payments/payment_intent.rs@@ -939,6 +939,9 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {None => query,};+ if let Some(card_network) = ¶ms.card_network {+ query = query.filter(pa_dsl::card_network.eq_any(card_network.clone()));+ }query}};