mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-27 03:13:56 +08:00
refactor(router): Remove payment_methods_v2 and customer_v2 feature flag (#8236)
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
@ -27,7 +27,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
type Error = StorageError;
|
||||
#[instrument(skip_all)]
|
||||
// check customer not found in kv and fallback to db
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -65,7 +65,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
|
||||
#[instrument(skip_all)]
|
||||
// check customer not found in kv and fallback to db
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -95,7 +95,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_optional_by_merchant_id_merchant_reference_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -131,7 +131,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -176,7 +176,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_merchant_reference_id_merchant_id(
|
||||
&self,
|
||||
@ -213,7 +213,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -263,7 +263,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn insert_customer(
|
||||
&self,
|
||||
@ -306,7 +306,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn insert_customer(
|
||||
&self,
|
||||
@ -350,7 +350,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn delete_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -362,7 +362,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_global_id(
|
||||
&self,
|
||||
@ -395,7 +395,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_customer_by_global_id(
|
||||
&self,
|
||||
@ -440,7 +440,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for kv_router_store::KVRouterSt
|
||||
impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
type Error = StorageError;
|
||||
#[instrument(skip_all)]
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -474,7 +474,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -497,7 +497,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
}
|
||||
|
||||
#[instrument(skip_all)]
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_optional_by_merchant_id_merchant_reference_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -530,7 +530,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -556,7 +556,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -584,7 +584,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_merchant_reference_id_merchant_id(
|
||||
&self,
|
||||
@ -648,7 +648,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn delete_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -664,7 +664,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn update_customer_by_global_id(
|
||||
&self,
|
||||
@ -685,7 +685,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_customer_by_global_id(
|
||||
&self,
|
||||
@ -713,8 +713,7 @@ impl<T: DatabaseStore> domain::CustomerInterface for RouterStore<T> {
|
||||
#[async_trait::async_trait]
|
||||
impl domain::CustomerInterface for MockDb {
|
||||
type Error = StorageError;
|
||||
#[allow(clippy::panic)]
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -730,8 +729,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::panic)]
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_optional_with_redacted_customer_details_by_customer_id_merchant_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -747,8 +745,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[allow(clippy::panic)]
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_optional_by_merchant_id_merchant_reference_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -792,7 +789,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
Ok(customers)
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
@ -808,7 +805,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
_state: &KeyManagerState,
|
||||
@ -821,7 +818,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_customer_by_merchant_reference_id_merchant_id(
|
||||
&self,
|
||||
_state: &KeyManagerState,
|
||||
@ -860,7 +857,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
.change_context(StorageError::DecryptionError)
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn delete_customer_by_customer_id_merchant_id(
|
||||
&self,
|
||||
_customer_id: &id_type::CustomerId,
|
||||
@ -870,7 +867,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn update_customer_by_global_id(
|
||||
&self,
|
||||
@ -886,7 +883,7 @@ impl domain::CustomerInterface for MockDb {
|
||||
Err(StorageError::MockDbError)?
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_customer_by_global_id(
|
||||
&self,
|
||||
_state: &KeyManagerState,
|
||||
|
||||
@ -441,10 +441,7 @@ impl UniqueConstraints for diesel_models::PayoutAttempt {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
impl UniqueConstraints for diesel_models::PaymentMethod {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("paymentmethod_{}", self.payment_method_id)]
|
||||
@ -454,7 +451,7 @@ impl UniqueConstraints for diesel_models::PaymentMethod {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
impl UniqueConstraints for diesel_models::PaymentMethod {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![self.id.get_string_repr().to_owned()]
|
||||
@ -477,7 +474,7 @@ impl UniqueConstraints for diesel_models::Mandate {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
|
||||
#[cfg(feature = "v1")]
|
||||
impl UniqueConstraints for diesel_models::Customer {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!(
|
||||
@ -491,7 +488,7 @@ impl UniqueConstraints for diesel_models::Customer {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
impl UniqueConstraints for diesel_models::Customer {
|
||||
fn unique_constraints(&self) -> Vec<String> {
|
||||
vec![format!("customer_{}", self.id.get_string_repr())]
|
||||
|
||||
@ -33,10 +33,7 @@ use crate::{
|
||||
#[async_trait::async_trait]
|
||||
impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
type Error = errors::StorageError;
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
@ -56,7 +53,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
@ -79,10 +76,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_locker_id(
|
||||
&self,
|
||||
@ -103,10 +97,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
}
|
||||
|
||||
// not supported in kv
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn get_payment_method_count_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -134,7 +125,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn insert_payment_method(
|
||||
&self,
|
||||
@ -148,10 +139,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn insert_payment_method(
|
||||
&self,
|
||||
@ -195,10 +183,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_payment_method(
|
||||
&self,
|
||||
@ -248,7 +233,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_payment_method(
|
||||
&self,
|
||||
@ -269,10 +254,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_list(
|
||||
&self,
|
||||
@ -293,12 +275,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
// Need to fix this once we start moving to v2 for payment method
|
||||
#[cfg(all(
|
||||
feature = "v2",
|
||||
feature = "customer_v2",
|
||||
feature = "payment_methods_v2"
|
||||
))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_list_by_global_customer_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -311,10 +288,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -351,7 +325,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_global_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -376,10 +350,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn delete_payment_method_by_merchant_id_payment_method_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -398,7 +369,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
}
|
||||
|
||||
// Soft delete, Check if KV stuff is needed here
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn delete_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -411,7 +382,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
}
|
||||
|
||||
// Check if KV stuff is needed here
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_by_fingerprint_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -429,10 +400,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for KVRouterStore<T> {
|
||||
impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
type Error = errors::StorageError;
|
||||
#[instrument(skip_all)]
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -449,7 +417,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -466,10 +434,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_locker_id(
|
||||
&self,
|
||||
@ -487,10 +452,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn get_payment_method_count_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -545,10 +507,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_payment_method(
|
||||
&self,
|
||||
@ -571,7 +530,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn update_payment_method(
|
||||
&self,
|
||||
@ -593,10 +552,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_list(
|
||||
&self,
|
||||
@ -616,7 +572,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
}
|
||||
|
||||
// Need to fix this once we move to payment method for customer
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_list_by_global_customer_id(
|
||||
&self,
|
||||
@ -634,10 +590,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -664,7 +617,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
#[instrument(skip_all)]
|
||||
async fn find_payment_method_by_global_customer_id_merchant_id_status(
|
||||
&self,
|
||||
@ -691,10 +644,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn delete_payment_method_by_merchant_id_payment_method_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -715,7 +665,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn delete_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -737,7 +687,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_by_fingerprint_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -757,10 +707,7 @@ impl<T: DatabaseStore> PaymentMethodInterface for RouterStore<T> {
|
||||
#[async_trait::async_trait]
|
||||
impl PaymentMethodInterface for MockDb {
|
||||
type Error = errors::StorageError;
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -779,7 +726,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -798,10 +745,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_payment_method_by_locker_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -820,10 +764,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn get_payment_method_count_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
customer_id: &id_type::CustomerId,
|
||||
@ -872,10 +813,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
Ok(payment_method)
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_list(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -896,7 +834,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
}
|
||||
|
||||
// Need to fix this once we complete v2 payment method
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_list_by_global_customer_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -907,10 +845,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
todo!()
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn find_payment_method_by_customer_id_merchant_id_status(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -936,7 +871,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_by_global_customer_id_merchant_id_status(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -956,10 +891,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "payment_methods_v2")
|
||||
))]
|
||||
#[cfg(feature = "v1")]
|
||||
async fn delete_payment_method_by_merchant_id_payment_method_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -1015,7 +947,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn delete_payment_method(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
@ -1042,7 +974,7 @@ impl PaymentMethodInterface for MockDb {
|
||||
.await
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "payment_methods_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
async fn find_payment_method_by_fingerprint_id(
|
||||
&self,
|
||||
state: &KeyManagerState,
|
||||
|
||||
@ -3,32 +3,19 @@ use api_models::enums::PayoutConnectors;
|
||||
#[cfg(feature = "olap")]
|
||||
use async_bb8_diesel::{AsyncConnection, AsyncRunQueryDsl};
|
||||
use common_utils::ext_traits::Encode;
|
||||
#[cfg(all(
|
||||
feature = "olap",
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
use diesel::JoinOnDsl;
|
||||
#[cfg(feature = "olap")]
|
||||
use diesel::{associations::HasTable, ExpressionMethods, NullableExpressionMethods, QueryDsl};
|
||||
#[cfg(all(
|
||||
feature = "olap",
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
use diesel_models::payout_attempt::PayoutAttempt as DieselPayoutAttempt;
|
||||
#[cfg(all(
|
||||
feature = "olap",
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
use diesel::{
|
||||
associations::HasTable, ExpressionMethods, JoinOnDsl, NullableExpressionMethods, QueryDsl,
|
||||
};
|
||||
#[cfg(all(feature = "olap", feature = "v1"))]
|
||||
use diesel_models::schema::{
|
||||
address::dsl as add_dsl, customers::dsl as cust_dsl, payout_attempt::dsl as poa_dsl,
|
||||
};
|
||||
#[cfg(feature = "olap")]
|
||||
use diesel_models::{
|
||||
address::Address as DieselAddress, customers::Customer as DieselCustomer,
|
||||
enums as storage_enums, query::generics::db_metrics, schema::payouts::dsl as po_dsl,
|
||||
enums as storage_enums, payout_attempt::PayoutAttempt as DieselPayoutAttempt,
|
||||
query::generics::db_metrics, schema::payouts::dsl as po_dsl,
|
||||
};
|
||||
use diesel_models::{
|
||||
enums::MerchantStorageScheme,
|
||||
@ -52,11 +39,7 @@ use router_env::{instrument, tracing};
|
||||
|
||||
#[cfg(feature = "olap")]
|
||||
use crate::connection;
|
||||
#[cfg(all(
|
||||
feature = "olap",
|
||||
any(feature = "v1", feature = "v2"),
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
#[cfg(all(feature = "olap", feature = "v1"))]
|
||||
use crate::store::schema::{
|
||||
address::all_columns as addr_all_columns, customers::all_columns as cust_all_columns,
|
||||
payout_attempt::all_columns as poa_all_columns, payouts::all_columns as po_all_columns,
|
||||
@ -583,11 +566,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
feature = "olap",
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
#[cfg(all(feature = "v1", feature = "olap"))]
|
||||
#[instrument(skip_all)]
|
||||
async fn filter_payouts_and_attempts(
|
||||
&self,
|
||||
@ -744,7 +723,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(all(feature = "olap", feature = "v2"))]
|
||||
#[instrument(skip_all)]
|
||||
async fn filter_payouts_and_attempts(
|
||||
&self,
|
||||
@ -815,11 +794,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "v1", feature = "v2"),
|
||||
feature = "olap",
|
||||
not(feature = "customer_v2")
|
||||
))]
|
||||
#[cfg(all(feature = "v1", feature = "olap"))]
|
||||
#[instrument(skip_all)]
|
||||
async fn filter_active_payout_ids_by_constraints(
|
||||
&self,
|
||||
@ -897,7 +872,7 @@ impl<T: DatabaseStore> PayoutsInterface for crate::RouterStore<T> {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(all(feature = "olap", feature = "v2"))]
|
||||
#[instrument(skip_all)]
|
||||
async fn filter_active_payout_ids_by_constraints(
|
||||
&self,
|
||||
|
||||
@ -34,7 +34,7 @@ pub enum PartitionKey<'a> {
|
||||
merchant_id: &'a common_utils::id_type::MerchantId,
|
||||
customer_id: &'a common_utils::id_type::CustomerId,
|
||||
},
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
MerchantIdMerchantReferenceId {
|
||||
merchant_id: &'a common_utils::id_type::MerchantId,
|
||||
merchant_reference_id: &'a str,
|
||||
@ -51,7 +51,7 @@ pub enum PartitionKey<'a> {
|
||||
merchant_id: &'a common_utils::id_type::MerchantId,
|
||||
mandate_id: &'a str,
|
||||
},
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
GlobalId {
|
||||
id: &'a str,
|
||||
},
|
||||
@ -77,7 +77,7 @@ impl std::fmt::Display for PartitionKey<'_> {
|
||||
merchant_id.get_string_repr(),
|
||||
customer_id.get_string_repr()
|
||||
)),
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
PartitionKey::MerchantIdMerchantReferenceId {
|
||||
merchant_id,
|
||||
merchant_reference_id,
|
||||
@ -107,7 +107,7 @@ impl std::fmt::Display for PartitionKey<'_> {
|
||||
merchant_id.get_string_repr()
|
||||
)),
|
||||
|
||||
#[cfg(all(feature = "v2", feature = "customer_v2"))]
|
||||
#[cfg(feature = "v2")]
|
||||
PartitionKey::GlobalId { id } => f.write_str(&format!("cust_{id}",)),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user