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:
Prasunna Soppa
2025-06-12 00:07:24 +05:30
committed by GitHub
parent 6ea2e2a6f4
commit 000aa23c10
106 changed files with 896 additions and 1856 deletions

View File

@ -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,