diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index fd8419e7f9..61c7911170 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -4734,6 +4734,7 @@ impl PaymentListFilterConstraints { && self.payment_method_type.is_none() && self.authentication_type.is_none() && self.merchant_connector_id.is_none() + && self.card_network.is_none() } } diff --git a/crates/diesel_models/src/query/payment_attempt.rs b/crates/diesel_models/src/query/payment_attempt.rs index 549af3ace4..7141675c88 100644 --- a/crates/diesel_models/src/query/payment_attempt.rs +++ b/crates/diesel_models/src/query/payment_attempt.rs @@ -378,6 +378,7 @@ impl PaymentAttempt { payment_method_type: Option>, authentication_type: Option>, merchant_connector_id: Option>, + card_network: Option>, ) -> StorageResult { let mut filter = ::table() .count() @@ -401,6 +402,9 @@ impl PaymentAttempt { if let Some(merchant_connector_id) = merchant_connector_id { filter = filter.filter(dsl::merchant_connector_id.eq_any(merchant_connector_id)) } + if let Some(card_network) = card_network { + filter = filter.filter(dsl::card_network.eq_any(card_network)) + } router_env::logger::debug!(query = %debug_query::(&filter).to_string()); diff --git a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs index 76749097b3..4b3fd1f8cf 100644 --- a/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs +++ b/crates/hyperswitch_domain_models/src/payments/payment_attempt.rs @@ -161,6 +161,7 @@ pub trait PaymentAttemptInterface { payment_method_type: Option>, authentication_type: Option>, merchant_connector_id: Option>, + card_network: Option>, storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result; } diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index 2218197743..938d5e2923 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -4051,6 +4051,7 @@ pub async fn apply_filters_on_payments( constraints.payment_method_type, constraints.authentication_type, constraints.merchant_connector_id, + constraints.card_network, merchant.storage_scheme, ) .await diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index 7ff580e37e..8ca0b29376 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -1601,6 +1601,7 @@ impl PaymentAttemptInterface for KafkaStore { payment_method_type: Option>, authentication_type: Option>, merchant_connector_id: Option>, + card_network: Option>, storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.diesel_store @@ -1612,6 +1613,7 @@ impl PaymentAttemptInterface for KafkaStore { payment_method_type, authentication_type, merchant_connector_id, + card_network, storage_scheme, ) .await diff --git a/crates/storage_impl/src/mock_db/payment_attempt.rs b/crates/storage_impl/src/mock_db/payment_attempt.rs index 8171681d3e..8adeb70064 100644 --- a/crates/storage_impl/src/mock_db/payment_attempt.rs +++ b/crates/storage_impl/src/mock_db/payment_attempt.rs @@ -52,6 +52,7 @@ impl PaymentAttemptInterface for MockDb { _payment_method_type: Option>, _authentication_type: Option>, _merchanat_connector_id: Option>, + _card_network: Option>, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { Err(StorageError::MockDbError)? diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 36a9da5944..6c03bb718b 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -406,6 +406,7 @@ impl PaymentAttemptInterface for RouterStore { payment_method_type: Option>, authentication_type: Option>, merchant_connector_id: Option>, + card_network: Option>, _storage_scheme: MerchantStorageScheme, ) -> CustomResult { let conn = self @@ -429,6 +430,7 @@ impl PaymentAttemptInterface for RouterStore { payment_method_type, authentication_type, merchant_connector_id, + card_network, ) .await .map_err(|er| { @@ -1291,6 +1293,7 @@ impl PaymentAttemptInterface for KVRouterStore { payment_method_type: Option>, authentication_type: Option>, merchant_connector_id: Option>, + card_network: Option>, storage_scheme: MerchantStorageScheme, ) -> CustomResult { self.router_store @@ -1302,6 +1305,7 @@ impl PaymentAttemptInterface for KVRouterStore { payment_method_type, authentication_type, merchant_connector_id, + card_network, storage_scheme, ) .await