Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: resolve v2 warnings in storage_impl #7371

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions crates/storage_impl/src/mock_db/payment_intent.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<PaymentIntent, StorageError> {
todo!()
Expand Down
23 changes: 14 additions & 9 deletions crates/storage_impl/src/payments/payment_attempt.rs
Original file line number Diff line number Diff line change
@@ -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},
};
Expand All @@ -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;
Expand All @@ -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<T: DatabaseStore> PaymentAttemptInterface for RouterStore<T> {
Expand Down
24 changes: 13 additions & 11 deletions crates/storage_impl/src/payments/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand All @@ -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::{
Expand All @@ -41,6 +40,7 @@ use hyperswitch_domain_models::{
PaymentIntent,
},
};
#[cfg(feature = "v1")]
use redis_interface::HsetnxReply;
#[cfg(feature = "olap")]
use router_env::logger;
Expand All @@ -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]
Expand Down Expand Up @@ -1137,8 +1141,6 @@ impl<T: DatabaseStore> PaymentIntentInterface for crate::RouterStore<T> {
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()
Expand Down
12 changes: 9 additions & 3 deletions crates/storage_impl/src/payouts/payouts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -905,8 +911,8 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
#[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<Vec<String>, StorageError> {
todo!()
}
Expand Down
Loading