diff --git a/crates/storage_impl/src/mock_db/payment_intent.rs b/crates/storage_impl/src/mock_db/payment_intent.rs index 3c90ecbdc7f..172405e3578 100644 --- a/crates/storage_impl/src/mock_db/payment_intent.rs +++ b/crates/storage_impl/src/mock_db/payment_intent.rs @@ -1,8 +1,10 @@ use common_utils::{errors::CustomResult, types::keymanager::KeyManagerState}; use diesel_models::enums as storage_enums; +#[cfg(feature = "v1")] use error_stack::ResultExt; +#[cfg(feature = "v1")] +use hyperswitch_domain_models::behaviour::Conversion; use hyperswitch_domain_models::{ - behaviour::Conversion, errors::StorageError, merchant_key_store::MerchantKeyStore, payments::{ @@ -31,11 +33,11 @@ impl PaymentIntentInterface for MockDb { #[cfg(all(feature = "v2", feature = "olap"))] async fn get_filtered_payment_intents_attempt( &self, - state: &KeyManagerState, - merchant_id: &common_utils::id_type::MerchantId, - constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, - merchant_key_store: &MerchantKeyStore, - storage_scheme: storage_enums::MerchantStorageScheme, + _state: &KeyManagerState, + _merchant_id: &common_utils::id_type::MerchantId, + _constraints: &hyperswitch_domain_models::payments::payment_intent::PaymentIntentFetchConstraints, + _merchant_key_store: &MerchantKeyStore, + _storage_scheme: storage_enums::MerchantStorageScheme, ) -> error_stack::Result< Vec<( PaymentIntent, @@ -165,10 +167,10 @@ impl PaymentIntentInterface for MockDb { #[allow(clippy::unwrap_used)] async fn update_payment_intent( &self, - state: &KeyManagerState, - this: PaymentIntent, - update: PaymentIntentUpdate, - key_store: &MerchantKeyStore, + _state: &KeyManagerState, + _this: PaymentIntent, + _update: PaymentIntentUpdate, + _key_store: &MerchantKeyStore, _storage_scheme: storage_enums::MerchantStorageScheme, ) -> CustomResult { todo!() diff --git a/crates/storage_impl/src/payments/payment_attempt.rs b/crates/storage_impl/src/payments/payment_attempt.rs index 96643cefc06..4c6167976d8 100644 --- a/crates/storage_impl/src/payments/payment_attempt.rs +++ b/crates/storage_impl/src/payments/payment_attempt.rs @@ -1,7 +1,8 @@ +use common_utils::errors::CustomResult; #[cfg(feature = "v2")] use common_utils::types::keymanager::KeyManagerState; +#[cfg(feature = "v1")] use common_utils::{ - errors::CustomResult, fallback_reverse_lookup_not_found, types::{ConnectorTransactionId, ConnectorTransactionIdTrait}, }; @@ -10,12 +11,11 @@ use diesel_models::{ MandateAmountData as DieselMandateAmountData, MandateDataType as DieselMandateType, MandateDetails as DieselMandateDetails, MerchantStorageScheme, }, - kv, - payment_attempt::{ - PaymentAttempt as DieselPaymentAttempt, PaymentAttemptNew as DieselPaymentAttemptNew, - }, + payment_attempt::PaymentAttempt as DieselPaymentAttempt, reverse_lookup::{ReverseLookup, ReverseLookupNew}, }; +#[cfg(feature = "v1")] +use diesel_models::{kv, PaymentAttemptNew as DieselPaymentAttemptNew}; use error_stack::ResultExt; #[cfg(feature = "v1")] use hyperswitch_domain_models::payments::payment_attempt::PaymentAttemptNew; @@ -29,21 +29,26 @@ use hyperswitch_domain_models::{ mandates::{MandateAmountData, MandateDataType, MandateDetails}, payments::payment_attempt::{PaymentAttempt, PaymentAttemptInterface, PaymentAttemptUpdate}, }; -#[cfg(feature = "olap")] +#[cfg(all(feature = "v1", feature = "olap"))] use hyperswitch_domain_models::{ payments::payment_attempt::PaymentListFilters, payments::PaymentIntent, }; +#[cfg(feature = "v1")] use redis_interface::HsetnxReply; use router_env::{instrument, tracing}; use crate::{ diesel_error_to_data_error, - errors::RedisErrorExt, lookup::ReverseLookupInterface, - redis::kv_store::{decide_storage_scheme, kv_wrapper, KvOperation, Op, PartitionKey}, - utils::{pg_connection_read, pg_connection_write, try_redis_get_else_try_database_get}, + utils::{pg_connection_read, pg_connection_write}, DataModelExt, DatabaseStore, KVRouterStore, RouterStore, }; +#[cfg(feature = "v1")] +use crate::{ + errors::RedisErrorExt, + redis::kv_store::{decide_storage_scheme, kv_wrapper, KvOperation, Op, PartitionKey}, + utils::try_redis_get_else_try_database_get, +}; #[async_trait::async_trait] impl PaymentAttemptInterface for RouterStore { diff --git a/crates/storage_impl/src/payments/payment_intent.rs b/crates/storage_impl/src/payments/payment_intent.rs index e53a72c8734..d605c683686 100644 --- a/crates/storage_impl/src/payments/payment_intent.rs +++ b/crates/storage_impl/src/payments/payment_intent.rs @@ -4,14 +4,11 @@ use api_models::payments::{AmountFilter, Order, SortBy, SortOn}; use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl}; #[cfg(feature = "olap")] use common_utils::errors::ReportSwitchExt; -use common_utils::{ - ext_traits::{AsyncExt, Encode}, - types::keymanager::KeyManagerState, -}; +#[cfg(feature = "v1")] +use common_utils::ext_traits::Encode; +use common_utils::{ext_traits::AsyncExt, types::keymanager::KeyManagerState}; #[cfg(feature = "olap")] use diesel::{associations::HasTable, ExpressionMethods, JoinOnDsl, QueryDsl}; -#[cfg(feature = "v1")] -use diesel_models::payment_intent::PaymentIntentUpdate as DieselPaymentIntentUpdate; #[cfg(feature = "olap")] use diesel_models::query::generics::db_metrics; #[cfg(all(feature = "v1", feature = "olap"))] @@ -25,8 +22,10 @@ use diesel_models::schema_v2::{ payment_intent::dsl as pi_dsl, }; use diesel_models::{ - enums::MerchantStorageScheme, kv, payment_intent::PaymentIntent as DieselPaymentIntent, + enums::MerchantStorageScheme, payment_intent::PaymentIntent as DieselPaymentIntent, }; +#[cfg(feature = "v1")] +use diesel_models::{kv, payment_intent::PaymentIntentUpdate as DieselPaymentIntentUpdate}; use error_stack::ResultExt; #[cfg(feature = "olap")] use hyperswitch_domain_models::payments::{ @@ -41,6 +40,7 @@ use hyperswitch_domain_models::{ PaymentIntent, }, }; +#[cfg(feature = "v1")] use redis_interface::HsetnxReply; #[cfg(feature = "olap")] use router_env::logger; @@ -50,10 +50,14 @@ use router_env::{instrument, tracing}; use crate::connection; use crate::{ diesel_error_to_data_error, + utils::{pg_connection_read, pg_connection_write}, + DatabaseStore, KVRouterStore, +}; +#[cfg(feature = "v1")] +use crate::{ errors::RedisErrorExt, redis::kv_store::{decide_storage_scheme, kv_wrapper, KvOperation, Op, PartitionKey}, - utils::{self, pg_connection_read, pg_connection_write}, - DatabaseStore, KVRouterStore, + utils::{self}, }; #[async_trait::async_trait] @@ -1137,8 +1141,6 @@ impl PaymentIntentInterface for crate::RouterStore { use diesel::NullableExpressionMethods as _; use futures::{future::try_join_all, FutureExt}; - use crate::DataModelExt; - let conn = connection::pg_connection_read(self).await.switch()?; let conn = async_bb8_diesel::Connection::as_async_conn(&conn); let mut query = DieselPaymentIntent::table() diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs index 0c69b2f2412..d43774c85f6 100644 --- a/crates/storage_impl/src/payouts/payouts.rs +++ b/crates/storage_impl/src/payouts/payouts.rs @@ -11,8 +11,14 @@ use common_utils::ext_traits::Encode; not(feature = "customer_v2") ))] use diesel::JoinOnDsl; +#[cfg(all( + any(feature = "v1", feature = "v2"), + feature = "olap", + not(feature = "customer_v2") +))] +use diesel::NullableExpressionMethods; #[cfg(feature = "olap")] -use diesel::{associations::HasTable, ExpressionMethods, NullableExpressionMethods, QueryDsl}; +use diesel::{associations::HasTable, ExpressionMethods, QueryDsl}; #[cfg(all( feature = "olap", any(feature = "v1", feature = "v2"), @@ -905,8 +911,8 @@ impl PayoutsInterface for crate::RouterStore { #[instrument(skip_all)] async fn filter_active_payout_ids_by_constraints( &self, - merchant_id: &common_utils::id_type::MerchantId, - constraints: &PayoutFetchConstraints, + _merchant_id: &common_utils::id_type::MerchantId, + _constraints: &PayoutFetchConstraints, ) -> error_stack::Result, StorageError> { todo!() }