From 000aa23c105804da4dbd5eb1bf168bd9ca5b501a Mon Sep 17 00:00:00 2001 From: Prasunna Soppa <70575890+prasunna09@users.noreply.github.com> Date: Thu, 12 Jun 2025 00:07:24 +0530 Subject: [PATCH] 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> --- crates/api_models/Cargo.toml | 4 +- crates/api_models/src/customers.rs | 32 +-- crates/api_models/src/events.rs | 4 +- crates/api_models/src/events/customer.rs | 16 +- crates/api_models/src/events/payment.rs | 14 +- crates/api_models/src/lib.rs | 2 +- crates/api_models/src/payment_methods.rs | 187 +++++---------- crates/api_models/src/payments.rs | 2 +- crates/common_utils/Cargo.toml | 2 - crates/common_utils/src/events.rs | 6 +- crates/common_utils/src/id_type/customer.rs | 2 +- crates/diesel_models/Cargo.toml | 2 - crates/diesel_models/src/customers.rs | 32 ++- crates/diesel_models/src/kv.rs | 11 +- crates/diesel_models/src/payment_method.rs | 82 ++----- crates/diesel_models/src/query/customers.rs | 31 +-- crates/diesel_models/src/query/mandate.rs | 2 +- .../diesel_models/src/query/payment_method.rs | 19 +- crates/hyperswitch_domain_models/Cargo.toml | 2 - .../hyperswitch_domain_models/src/customer.rs | 46 ++-- .../hyperswitch_domain_models/src/mandates.rs | 7 +- .../src/network_tokenization.rs | 14 +- .../src/payment_method_data.rs | 34 ++- .../src/payment_methods.rs | 99 +++----- crates/hyperswitch_domain_models/src/vault.rs | 8 +- crates/openapi/Cargo.toml | 2 +- crates/payment_methods/Cargo.toml | 4 +- crates/payment_methods/src/controller.rs | 64 ++--- crates/payment_methods/src/core/migration.rs | 5 +- .../src/core/migration/payment_methods.rs | 43 +--- crates/payment_methods/src/helpers.rs | 14 +- crates/payment_methods/src/state.rs | 10 +- crates/router/Cargo.toml | 4 +- crates/router/src/compatibility/stripe.rs | 8 +- crates/router/src/compatibility/stripe/app.rs | 12 +- .../src/compatibility/stripe/customers.rs | 40 +-- .../compatibility/stripe/customers/types.rs | 32 +-- .../compatibility/stripe/payment_intents.rs | 18 +- .../src/compatibility/stripe/setup_intents.rs | 16 +- crates/router/src/connector/utils.rs | 42 +--- crates/router/src/consts.rs | 18 +- crates/router/src/core.rs | 2 +- crates/router/src/core/customers.rs | 68 ++---- crates/router/src/core/errors/utils.rs | 4 +- .../core/fraud_check/flows/checkout_flow.rs | 4 +- .../core/fraud_check/flows/record_return.rs | 4 +- .../src/core/fraud_check/flows/sale_flow.rs | 4 +- .../fraud_check/flows/transaction_flow.rs | 4 +- .../fraud_check/operation/fraud_check_pre.rs | 4 +- crates/router/src/core/locker_migration.rs | 54 +---- crates/router/src/core/mandate.rs | 2 +- crates/router/src/core/payment_methods.rs | 114 ++++----- .../router/src/core/payment_methods/cards.rs | 227 ++++-------------- .../payment_methods/network_tokenization.rs | 52 ++-- .../surcharge_decision_configs.rs | 14 +- .../src/core/payment_methods/transformers.rs | 36 +-- .../router/src/core/payment_methods/utils.rs | 10 +- .../src/core/payment_methods/validator.rs | 6 +- .../router/src/core/payment_methods/vault.rs | 34 +-- crates/router/src/core/payments.rs | 11 +- crates/router/src/core/payments/customers.rs | 8 +- crates/router/src/core/payments/helpers.rs | 66 ++--- .../payments/operations/payment_confirm.rs | 12 +- .../payments/operations/payment_create.rs | 7 +- .../payments/operations/payment_response.rs | 14 +- .../payments/operations/payment_status.rs | 7 +- .../payments/operations/payment_update.rs | 4 +- .../src/core/payments/payment_methods.rs | 6 +- .../router/src/core/payments/tokenization.rs | 36 +-- .../router/src/core/payments/transformers.rs | 16 +- crates/router/src/core/payout_link.rs | 4 +- crates/router/src/core/payouts.rs | 47 ++-- crates/router/src/core/payouts/helpers.rs | 21 +- .../router/src/core/payouts/transformers.rs | 14 +- crates/router/src/core/payouts/validator.rs | 10 +- crates/router/src/core/pm_auth.rs | 59 +---- .../core/unified_authentication_service.rs | 5 +- crates/router/src/core/utils.rs | 14 +- crates/router/src/db/kafka_store.rs | 60 ++--- crates/router/src/db/mandate.rs | 8 +- crates/router/src/lib.rs | 14 +- crates/router/src/routes.rs | 10 +- crates/router/src/routes/app.rs | 49 +--- crates/router/src/routes/cards_info.rs | 5 +- crates/router/src/routes/customers.rs | 22 +- crates/router/src/routes/ephemeral_key.rs | 2 +- crates/router/src/routes/payment_methods.rs | 93 ++----- crates/router/src/routes/payments.rs | 2 +- crates/router/src/services/authentication.rs | 12 +- crates/router/src/types/api.rs | 2 +- crates/router/src/types/api/customers.rs | 8 +- crates/router/src/types/api/mandates.rs | 14 +- .../router/src/types/api/payment_methods.rs | 18 +- crates/router/src/types/domain.rs | 4 +- crates/router/src/types/payment_methods.rs | 97 +++----- crates/router/src/types/storage/customers.rs | 2 +- .../src/types/storage/payment_method.rs | 27 +-- crates/router/src/types/transformers.rs | 11 +- crates/router/src/utils.rs | 16 +- .../workflows/payment_method_status_update.rs | 5 +- crates/storage_impl/Cargo.toml | 2 - crates/storage_impl/src/customers.rs | 61 +++-- crates/storage_impl/src/lib.rs | 11 +- crates/storage_impl/src/payment_method.rs | 146 +++-------- crates/storage_impl/src/payouts/payouts.rs | 47 +--- crates/storage_impl/src/redis/kv_store.rs | 8 +- 106 files changed, 896 insertions(+), 1856 deletions(-) diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml index f94665d3cf..4aaad3b9be 100644 --- a/crates/api_models/Cargo.toml +++ b/crates/api_models/Cargo.toml @@ -17,9 +17,7 @@ olap = [] openapi = ["common_enums/openapi", "olap", "recon", "dummy_connector", "olap"] recon = [] v1 = ["common_utils/v1"] -v2 = ["common_types/v2", "common_utils/v2", "customer_v2", "refunds_v2", "tokenization_v2"] -customer_v2 = ["common_utils/customer_v2"] -payment_methods_v2 = ["common_utils/payment_methods_v2", "dep:reqwest"] +v2 = ["common_types/v2", "common_utils/v2", "refunds_v2", "tokenization_v2", "dep:reqwest"] refunds_v2 = [] dynamic_routing = [] control_center_theme = ["dep:actix-web", "dep:actix-multipart"] diff --git a/crates/api_models/src/customers.rs b/crates/api_models/src/customers.rs index 90f849971b..56808113fc 100644 --- a/crates/api_models/src/customers.rs +++ b/crates/api_models/src/customers.rs @@ -6,7 +6,7 @@ use utoipa::ToSchema; use crate::payments; /// The customer details -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)] pub struct CustomerRequest { /// The identifier for the customer object. If not provided the customer ID will be autogenerated. @@ -51,7 +51,7 @@ pub struct CustomerListRequest { pub limit: Option, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl CustomerRequest { pub fn get_merchant_reference_id(&self) -> Option { Some( @@ -69,7 +69,7 @@ impl CustomerRequest { } /// The customer details -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)] #[serde(deny_unknown_fields)] pub struct CustomerRequest { @@ -104,7 +104,7 @@ pub struct CustomerRequest { pub metadata: Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl CustomerRequest { pub fn get_merchant_reference_id(&self) -> Option { self.merchant_reference_id.clone() @@ -123,7 +123,7 @@ impl CustomerRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, Serialize, ToSchema)] pub struct CustomerResponse { /// The identifier for the customer object @@ -161,14 +161,14 @@ pub struct CustomerResponse { pub default_payment_method_id: Option, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl CustomerResponse { pub fn get_merchant_reference_id(&self) -> Option { Some(self.customer_id.clone()) } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, Serialize, ToSchema)] pub struct CustomerResponse { /// Unique identifier for the customer @@ -220,14 +220,14 @@ pub struct CustomerResponse { pub default_payment_method_id: Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl CustomerResponse { pub fn get_merchant_reference_id(&self) -> Option { self.merchant_reference_id.clone() } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug, Deserialize, Serialize, ToSchema)] pub struct CustomerDeleteResponse { /// The identifier for the customer object @@ -244,7 +244,7 @@ pub struct CustomerDeleteResponse { pub payment_methods_deleted: bool, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Deserialize, Serialize, ToSchema)] pub struct CustomerDeleteResponse { /// Unique identifier for the customer @@ -270,7 +270,7 @@ pub struct CustomerDeleteResponse { } /// The identifier for the customer object. If not provided the customer ID will be autogenerated. -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)] pub struct CustomerUpdateRequest { /// The identifier for the Merchant Account @@ -302,14 +302,14 @@ pub struct CustomerUpdateRequest { pub metadata: Option, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl CustomerUpdateRequest { pub fn get_address(&self) -> Option { self.address.clone() } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Default, Clone, Deserialize, Serialize, ToSchema)] #[serde(deny_unknown_fields)] pub struct CustomerUpdateRequest { @@ -344,7 +344,7 @@ pub struct CustomerUpdateRequest { pub default_payment_method_id: Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl CustomerUpdateRequest { pub fn get_default_customer_billing_address(&self) -> Option { self.default_billing_address.clone() @@ -355,14 +355,14 @@ impl CustomerUpdateRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize)] pub struct CustomerUpdateRequestInternal { pub customer_id: id_type::CustomerId, pub request: CustomerUpdateRequest, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize)] pub struct CustomerUpdateRequestInternal { pub id: id_type::GlobalCustomerId, diff --git a/crates/api_models/src/events.rs b/crates/api_models/src/events.rs index 0038590a54..768aed75a7 100644 --- a/crates/api_models/src/events.rs +++ b/crates/api_models/src/events.rs @@ -194,7 +194,7 @@ impl ApiEventMetric for AuthEventMetricsResponse { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for PaymentMethodIntentConfirmInternal { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { @@ -205,7 +205,7 @@ impl ApiEventMetric for PaymentMethodIntentConfirmInternal { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for PaymentMethodIntentCreate { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethodCreate) diff --git a/crates/api_models/src/events/customer.rs b/crates/api_models/src/events/customer.rs index 55a55fbcec..290ccfdd46 100644 --- a/crates/api_models/src/events/customer.rs +++ b/crates/api_models/src/events/customer.rs @@ -4,7 +4,7 @@ use crate::customers::{ CustomerDeleteResponse, CustomerRequest, CustomerResponse, CustomerUpdateRequestInternal, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ApiEventMetric for CustomerDeleteResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { @@ -13,7 +13,7 @@ impl ApiEventMetric for CustomerDeleteResponse { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for CustomerDeleteResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { @@ -22,7 +22,7 @@ impl ApiEventMetric for CustomerDeleteResponse { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ApiEventMetric for CustomerRequest { fn get_api_event_type(&self) -> Option { self.get_merchant_reference_id() @@ -31,14 +31,14 @@ impl ApiEventMetric for CustomerRequest { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for CustomerRequest { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { customer_id: None }) } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ApiEventMetric for CustomerResponse { fn get_api_event_type(&self) -> Option { self.get_merchant_reference_id() @@ -47,7 +47,7 @@ impl ApiEventMetric for CustomerResponse { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for CustomerResponse { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { @@ -56,7 +56,7 @@ impl ApiEventMetric for CustomerResponse { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ApiEventMetric for CustomerUpdateRequestInternal { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { @@ -65,7 +65,7 @@ impl ApiEventMetric for CustomerUpdateRequestInternal { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ApiEventMetric for CustomerUpdateRequestInternal { fn get_api_event_type(&self) -> Option { Some(ApiEventsType::Customer { diff --git a/crates/api_models/src/events/payment.rs b/crates/api_models/src/events/payment.rs index 851e2500f7..ef55763b0a 100644 --- a/crates/api_models/src/events/payment.rs +++ b/crates/api_models/src/events/payment.rs @@ -213,10 +213,7 @@ impl ApiEventMetric for payments::PaymentsResponse { } impl ApiEventMetric for PaymentMethodResponse { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_id.clone(), @@ -225,7 +222,7 @@ impl ApiEventMetric for PaymentMethodResponse { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.id.clone(), @@ -236,10 +233,7 @@ impl ApiEventMetric for PaymentMethodResponse { } impl ApiEventMetric for PaymentMethodMigrateResponse { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_response.payment_method_id.clone(), @@ -248,7 +242,7 @@ impl ApiEventMetric for PaymentMethodMigrateResponse { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_api_event_type(&self) -> Option { Some(ApiEventsType::PaymentMethod { payment_method_id: self.payment_method_response.id.clone(), diff --git a/crates/api_models/src/lib.rs b/crates/api_models/src/lib.rs index 5fdb56e696..45533cd345 100644 --- a/crates/api_models/src/lib.rs +++ b/crates/api_models/src/lib.rs @@ -33,7 +33,7 @@ pub mod pm_auth; pub mod poll; pub mod process_tracker; pub mod profile_acquirer; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub mod proxy; #[cfg(feature = "recon")] pub mod recon; diff --git a/crates/api_models/src/payment_methods.rs b/crates/api_models/src/payment_methods.rs index ea59fde756..6b0e9dcb38 100644 --- a/crates/api_models/src/payment_methods.rs +++ b/crates/api_models/src/payment_methods.rs @@ -1,5 +1,5 @@ use std::collections::{HashMap, HashSet}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use std::str::FromStr; use cards::CardNumber; @@ -16,7 +16,7 @@ use masking::PeekInterface; use serde::de; use utoipa::{schema, ToSchema}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::customers; #[cfg(feature = "payouts")] use crate::payouts; @@ -25,10 +25,7 @@ use crate::{ payments::{self, BankCodeResponse}, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodCreate { @@ -105,7 +102,7 @@ pub struct PaymentMethodCreate { pub network_transaction_id: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodCreate { @@ -146,7 +143,7 @@ pub struct PaymentMethodCreate { pub network_tokenization: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodIntentCreate { @@ -168,7 +165,7 @@ pub struct PaymentMethodIntentCreate { pub customer_id: id_type::GlobalCustomerId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodIntentConfirm { @@ -188,7 +185,7 @@ pub struct PaymentMethodIntentConfirm { pub payment_method_subtype: api_enums::PaymentMethodType, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodIntentConfirm { pub fn validate_payment_method_data_against_payment_method( payment_method_type: api_enums::PaymentMethod, @@ -204,14 +201,14 @@ impl PaymentMethodIntentConfirm { } /// This struct is used internally only -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct PaymentMethodIntentConfirmInternal { pub id: id_type::GlobalPaymentMethodId, pub request: PaymentMethodIntentConfirm, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for PaymentMethodIntentConfirm { fn from(item: PaymentMethodIntentConfirmInternal) -> Self { item.request @@ -388,10 +385,7 @@ where })) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl PaymentMethodCreate { pub fn get_payment_method_create_from_payment_method_migrate( card_number: CardNumber, @@ -440,7 +434,7 @@ impl PaymentMethodCreate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodCreate { pub fn validate_payment_method_data_against_payment_method( payment_method_type: api_enums::PaymentMethod, @@ -464,10 +458,7 @@ impl PaymentMethodCreate { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodUpdate { @@ -484,7 +475,7 @@ pub struct PaymentMethodUpdate { pub client_secret: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct PaymentMethodUpdate { @@ -495,7 +486,7 @@ pub struct PaymentMethodUpdate { pub connector_token_details: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] #[serde(rename_all = "snake_case")] @@ -504,7 +495,7 @@ pub enum PaymentMethodUpdateData { Card(CardDetailUpdate), } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] #[serde(rename_all = "snake_case")] @@ -513,10 +504,7 @@ pub enum PaymentMethodCreateData { Card(CardDetail), } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] #[serde(rename_all = "snake_case")] @@ -525,10 +513,7 @@ pub enum PaymentMethodCreateData { Card(CardDetail), } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct CardDetail { @@ -588,7 +573,7 @@ pub enum CardType { // but when vaulting the card, we do not need cvc to be collected from the user // This is because, the vaulted payment method can be used for future transactions in the presence of the customer // when the customer is on_session again, the cvc can be collected from the customer -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct CardDetail { @@ -716,10 +701,7 @@ pub struct MigrateNetworkTokenDetail { pub network_token_requestor_ref_id: String, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct CardDetailUpdate { @@ -740,10 +722,7 @@ pub struct CardDetailUpdate { pub nick_name: Option>, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl CardDetailUpdate { pub fn apply(&self, card_data_from_locker: Card) -> CardDetail { CardDetail { @@ -772,7 +751,7 @@ impl CardDetailUpdate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] pub struct CardDetailUpdate { @@ -785,7 +764,7 @@ pub struct CardDetailUpdate { pub nick_name: Option>, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl CardDetailUpdate { pub fn apply(&self, card_data_from_locker: Card) -> CardDetail { CardDetail { @@ -809,7 +788,7 @@ impl CardDetailUpdate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] #[serde(deny_unknown_fields)] #[serde(rename_all = "snake_case")] @@ -818,10 +797,7 @@ pub enum PaymentMethodResponseData { Card(CardDetailFromLocker), } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema)] pub struct PaymentMethodResponse { /// Unique identifier for a merchant @@ -883,7 +859,7 @@ pub struct PaymentMethodResponse { pub client_secret: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, ToSchema, Clone)] pub struct ConnectorTokenDetails { /// The unique identifier of the connector account through which the token was generated @@ -913,7 +889,8 @@ pub struct ConnectorTokenDetails { /// The value of the connector token. This token can be used to make merchant initiated payments ( MIT ), directly with the connector. pub token: masking::Secret, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, serde::Deserialize, ToSchema, Clone)] pub struct PaymentMethodResponse { /// The unique identifier of the Payment method @@ -1090,10 +1067,7 @@ pub struct Card { pub nick_name: Option, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct CardDetailFromLocker { pub scheme: Option, @@ -1130,7 +1104,7 @@ pub struct CardDetailFromLocker { pub saved_to_locker: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct CardDetailFromLocker { #[schema(value_type = Option)] @@ -1164,7 +1138,7 @@ pub struct CardDetailFromLocker { pub saved_to_locker: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone, ToSchema)] pub struct NetworkTokenResponse { pub payment_method_data: NetworkTokenDetailsPaymentMethod, @@ -1174,10 +1148,7 @@ fn saved_in_locker_default() -> bool { true } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for payments::AdditionalCardInfo { fn from(item: CardDetailFromLocker) -> Self { Self { @@ -1200,7 +1171,7 @@ impl From for payments::AdditionalCardInfo { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for payments::AdditionalCardInfo { fn from(item: CardDetailFromLocker) -> Self { Self { @@ -1233,10 +1204,7 @@ pub struct PaymentMethodListResponseForSession { pub customer_payment_methods: Vec, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for CardDetailFromLocker { fn from(item: CardDetailsPaymentMethod) -> Self { Self { @@ -1259,7 +1227,7 @@ impl From for CardDetailFromLocker { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for CardDetailFromLocker { fn from(item: CardDetailsPaymentMethod) -> Self { Self { @@ -1286,7 +1254,7 @@ impl From for CardDetailFromLocker { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for CardDetailFromLocker { fn from(item: CardDetail) -> Self { Self { @@ -1307,7 +1275,7 @@ impl From for CardDetailFromLocker { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for CardDetailsPaymentMethod { fn from(item: CardDetail) -> Self { Self { @@ -1327,10 +1295,7 @@ impl From for CardDetailsPaymentMethod { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From<(CardDetailFromLocker, Option<&CoBadgedCardData>)> for CardDetailsPaymentMethod { fn from( (item, co_badged_card_data): (CardDetailFromLocker, Option<&CoBadgedCardData>), @@ -1352,7 +1317,7 @@ impl From<(CardDetailFromLocker, Option<&CoBadgedCardData>)> for CardDetailsPaym } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for CardDetailsPaymentMethod { fn from(item: CardDetailFromLocker) -> Self { Self { @@ -1402,10 +1367,7 @@ pub struct BankDebitTypes { pub eligible_connectors: Vec, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypes { /// The payment method type enabled @@ -1437,7 +1399,7 @@ pub struct ResponsePaymentMethodTypes { pub pm_auth_connector: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] #[serde(untagged)] // Untagged used for serialization only pub enum PaymentMethodSubtypeSpecificData { @@ -1449,7 +1411,7 @@ pub enum PaymentMethodSubtypeSpecificData { Bank { bank_names: Vec }, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypes { /// The payment method type enabled @@ -1627,10 +1589,7 @@ impl RequestPaymentMethodTypes { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] //List Payment Method #[derive(Debug, Clone, serde::Serialize, Default, ToSchema)] #[serde(deny_unknown_fields)] @@ -1668,10 +1627,7 @@ pub struct PaymentMethodListRequest { pub limit: Option, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl<'de> serde::Deserialize<'de> for PaymentMethodListRequest { fn deserialize(deserializer: D) -> Result where @@ -1753,7 +1709,7 @@ impl<'de> serde::Deserialize<'de> for PaymentMethodListRequest { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] //List Payment Method #[derive(Debug, Clone, serde::Serialize, Default, ToSchema)] #[serde(deny_unknown_fields)] @@ -1787,7 +1743,7 @@ pub struct PaymentMethodListRequest { pub limit: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl<'de> serde::Deserialize<'de> for PaymentMethodListRequest { fn deserialize(deserializer: D) -> Result where @@ -1918,10 +1874,7 @@ pub struct PaymentMethodListResponse { pub is_tax_calculation_enabled: bool, } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct CustomerPaymentMethodsListResponse { /// List of payment methods for customer @@ -1931,14 +1884,14 @@ pub struct CustomerPaymentMethodsListResponse { } // OLAP PML Response -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct CustomerPaymentMethodsListResponse { /// List of payment methods for customer pub customer_payment_methods: Vec, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Deserialize, serde::Serialize, ToSchema)] #[serde(deny_unknown_fields)] pub struct GetTokenDataRequest { @@ -1946,10 +1899,10 @@ pub struct GetTokenDataRequest { pub token_type: api_enums::TokenDataType, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl common_utils::events::ApiEventMetric for GetTokenDataRequest {} -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct TokenDataResponse { /// The unique identifier of the payment method. @@ -1964,17 +1917,17 @@ pub struct TokenDataResponse { pub token_details: TokenDetailsResponse, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl common_utils::events::ApiEventMetric for TokenDataResponse {} -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] #[serde(untagged)] pub enum TokenDetailsResponse { NetworkTokenDetails(NetworkTokenDetailsResponse), } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct NetworkTokenDetailsResponse { /// Network token generated against the Card Number @@ -2022,20 +1975,17 @@ pub struct NetworkTokenDetailsResponse { pub eci: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct TotalPaymentMethodCountResponse { /// total count of payment methods under the merchant pub total_count: i64, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl common_utils::events::ApiEventMetric for TotalPaymentMethodCountResponse {} -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodDeleteResponse { /// The unique identifier of the Payment method @@ -2047,7 +1997,7 @@ pub struct PaymentMethodDeleteResponse { pub deleted: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Serialize, ToSchema)] pub struct PaymentMethodDeleteResponse { /// The unique identifier of the Payment method @@ -2072,7 +2022,7 @@ pub struct CustomerDefaultPaymentMethodResponse { pub payment_method_type: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema)] pub struct PaymentMethodResponseItem { /// The unique identifier of the payment method. @@ -2137,7 +2087,7 @@ pub struct PaymentMethodResponseItem { pub psp_tokenization_enabled: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema)] pub struct CustomerPaymentMethodResponseItem { /// The unique identifier of the payment method. @@ -2199,7 +2149,7 @@ pub struct CustomerPaymentMethodResponseItem { pub billing: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema)] #[serde(rename_all = "snake_case")] pub enum PaymentMethodListData { @@ -2209,10 +2159,7 @@ pub enum PaymentMethodListData { Bank(payouts::Bank), } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, ToSchema)] pub struct CustomerPaymentMethod { /// Token for payment method in temporary card locker which gets refreshed often @@ -2590,19 +2537,13 @@ pub enum MigrationStatus { Failed, } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] type PaymentMethodMigrationResponseType = ( Result, PaymentMethodRecord, ); -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for PaymentMethodMigrationResponse { fn from((response, record): PaymentMethodMigrationResponseType) -> Self { match response { @@ -2736,7 +2677,7 @@ impl } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From<(PaymentMethodRecord, id_type::MerchantId)> for customers::CustomerRequest { fn from(value: (PaymentMethodRecord, id_type::MerchantId)) -> Self { let (record, merchant_id) = value; diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs index 47c1b5a83d..c1451c7bae 100644 --- a/crates/api_models/src/payments.rs +++ b/crates/api_models/src/payments.rs @@ -7640,7 +7640,7 @@ pub struct PaymentMethodListResponseForPayments { pub customer_payment_methods: Option>, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, ToSchema, PartialEq)] pub struct ResponsePaymentMethodTypesForPayments { /// The payment method type enabled diff --git a/crates/common_utils/Cargo.toml b/crates/common_utils/Cargo.toml index fc3560b6e7..8d81b5b367 100644 --- a/crates/common_utils/Cargo.toml +++ b/crates/common_utils/Cargo.toml @@ -20,8 +20,6 @@ metrics = ["dep:router_env", "dep:futures"] payouts = ["common_enums/payouts"] v1 = [] v2 = [] -customer_v2 = [] -payment_methods_v2 = [] crypto_openssl = ["dep:openssl"] tokenization_v2 = [] diff --git a/crates/common_utils/src/events.rs b/crates/common_utils/src/events.rs index b06fea4e1e..53e45ef9d0 100644 --- a/crates/common_utils/src/events.rs +++ b/crates/common_utils/src/events.rs @@ -44,13 +44,13 @@ pub enum ApiEventsType { payment_method_type: Option, payment_method_subtype: Option, }, - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] PaymentMethodCreate, - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] Customer { customer_id: Option, }, - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] Customer { customer_id: id_type::CustomerId, }, diff --git a/crates/common_utils/src/id_type/customer.rs b/crates/common_utils/src/id_type/customer.rs index 54c44020b8..6b2ca23ef2 100644 --- a/crates/common_utils/src/id_type/customer.rs +++ b/crates/common_utils/src/id_type/customer.rs @@ -14,7 +14,7 @@ crate::impl_serializable_secret_id_type!(CustomerId); crate::impl_queryable_id_type!(CustomerId); crate::impl_to_sql_from_sql_id_type!(CustomerId); -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl crate::events::ApiEventMetric for CustomerId { fn get_api_event_type(&self) -> Option { Some(crate::events::ApiEventsType::Customer { diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml index be766552ae..2df1b87bf0 100644 --- a/crates/diesel_models/Cargo.toml +++ b/crates/diesel_models/Cargo.toml @@ -12,8 +12,6 @@ default = ["kv_store"] kv_store = [] v1 = ["common_utils/v1", "common_types/v1"] v2 = ["common_utils/v2", "common_types/v2"] -customer_v2 = [] -payment_methods_v2 = [] refunds_v2 = [] tokenization_v2 = [] diff --git a/crates/diesel_models/src/customers.rs b/crates/diesel_models/src/customers.rs index 24fe34c15d..ae6ff49d10 100644 --- a/crates/diesel_models/src/customers.rs +++ b/crates/diesel_models/src/customers.rs @@ -3,14 +3,12 @@ use common_utils::{encryption::Encryption, pii, types::Description}; use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable}; use time::PrimitiveDateTime; -#[cfg(all(feature = "v2", feature = "customer_v2"))] -use crate::enums::DeleteStatus; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::schema::customers; -#[cfg(all(feature = "v2", feature = "customer_v2"))] -use crate::schema_v2::customers; +#[cfg(feature = "v2")] +use crate::{enums::DeleteStatus, schema_v2::customers}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive( Clone, Debug, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize, Insertable, )] @@ -32,14 +30,14 @@ pub struct CustomerNew { pub version: ApiVersion, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl CustomerNew { pub fn update_storage_scheme(&mut self, storage_scheme: common_enums::MerchantStorageScheme) { self.updated_by = Some(storage_scheme.to_string()); } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for Customer { fn from(customer_new: CustomerNew) -> Self { Self { @@ -62,7 +60,7 @@ impl From for Customer { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive( Clone, Debug, Insertable, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize, )] @@ -88,14 +86,14 @@ pub struct CustomerNew { pub id: common_utils::id_type::GlobalCustomerId, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl CustomerNew { pub fn update_storage_scheme(&mut self, storage_scheme: common_enums::MerchantStorageScheme) { self.updated_by = Some(storage_scheme.to_string()); } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl From for Customer { fn from(customer_new: CustomerNew) -> Self { Self { @@ -121,7 +119,7 @@ impl From for Customer { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive( Clone, Debug, Identifiable, Queryable, Selectable, serde::Deserialize, serde::Serialize, )] @@ -144,7 +142,7 @@ pub struct Customer { pub version: ApiVersion, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive( Clone, Debug, Identifiable, Queryable, Selectable, serde::Serialize, serde::Deserialize, )] @@ -170,7 +168,7 @@ pub struct Customer { pub id: common_utils::id_type::GlobalCustomerId, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive( Clone, Debug, AsChangeset, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize, )] @@ -189,7 +187,7 @@ pub struct CustomerUpdateInternal { pub updated_by: Option, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl CustomerUpdateInternal { pub fn apply_changeset(self, source: Customer) -> Customer { let Self { @@ -223,7 +221,7 @@ impl CustomerUpdateInternal { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive( Clone, Debug, AsChangeset, router_derive::DebugAsDisplay, serde::Deserialize, serde::Serialize, )] @@ -244,7 +242,7 @@ pub struct CustomerUpdateInternal { pub status: Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl CustomerUpdateInternal { pub fn apply_changeset(self, source: Customer) -> Customer { let Self { diff --git a/crates/diesel_models/src/kv.rs b/crates/diesel_models/src/kv.rs index 260b0e4c86..8f76b8ab58 100644 --- a/crates/diesel_models/src/kv.rs +++ b/crates/diesel_models/src/kv.rs @@ -150,16 +150,13 @@ impl DBOperation { Updateable::PayoutAttemptUpdate(a) => DBResult::PayoutAttempt(Box::new( a.orig.update_with_attempt_id(conn, a.update_data).await?, )), - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] Updateable::PaymentMethodUpdate(v) => DBResult::PaymentMethod(Box::new( v.orig .update_with_payment_method_id(conn, v.update_data) .await?, )), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] Updateable::PaymentMethodUpdate(v) => DBResult::PaymentMethod(Box::new( v.orig.update_with_id(conn, v.update_data).await?, )), @@ -172,7 +169,7 @@ impl DBOperation { ) .await?, )), - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] Updateable::CustomerUpdate(cust) => DBResult::Customer(Box::new( Customer::update_by_customer_id_merchant_id( conn, @@ -182,7 +179,7 @@ impl DBOperation { ) .await?, )), - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] Updateable::CustomerUpdate(cust) => DBResult::Customer(Box::new( Customer::update_by_id(conn, cust.orig.id, cust.update_data).await?, )), diff --git a/crates/diesel_models/src/payment_method.rs b/crates/diesel_models/src/payment_method.rs index 6195cb3141..472a56700c 100644 --- a/crates/diesel_models/src/payment_method.rs +++ b/crates/diesel_models/src/payment_method.rs @@ -8,26 +8,17 @@ use common_utils::{ }; use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable}; use error_stack::ResultExt; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use masking::{ExposeInterface, Secret}; use serde::{Deserialize, Serialize}; use time::PrimitiveDateTime; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use crate::{enums as storage_enums, schema::payment_methods}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{enums as storage_enums, schema_v2::payment_methods}; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive( Clone, Debug, Eq, PartialEq, Identifiable, Queryable, Selectable, Serialize, Deserialize, )] @@ -71,7 +62,7 @@ pub struct PaymentMethod { pub network_token_payment_method_data: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, Identifiable, Queryable, Selectable, Serialize, Deserialize)] #[diesel(table_name = payment_methods, primary_key(id), check_for_backend(diesel::pg::Pg))] pub struct PaymentMethod { @@ -101,24 +92,18 @@ pub struct PaymentMethod { } impl PaymentMethod { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_id(&self) -> &String { &self.payment_method_id } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_id(&self) -> &common_utils::id_type::GlobalPaymentMethodId { &self.id } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive( Clone, Debug, Eq, PartialEq, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize, )] @@ -160,7 +145,7 @@ pub struct PaymentMethodNew { pub network_token_payment_method_data: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay, Serialize, Deserialize)] #[diesel(table_name = payment_methods)] pub struct PaymentMethodNew { @@ -193,15 +178,12 @@ impl PaymentMethodNew { self.updated_by = Some(storage_scheme.to_string()); } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_id(&self) -> &String { &self.payment_method_id } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_id(&self) -> &common_utils::id_type::GlobalPaymentMethodId { &self.id } @@ -213,10 +195,7 @@ pub struct TokenizeCoreWorkflow { pub pm: storage_enums::PaymentMethod, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize, Deserialize)] pub enum PaymentMethodUpdate { MetadataUpdateAndLastUsed { @@ -266,7 +245,7 @@ pub enum PaymentMethodUpdate { }, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize, Deserialize)] pub enum PaymentMethodUpdate { UpdatePaymentMethodDataAndLastUsed { @@ -316,7 +295,7 @@ impl PaymentMethodUpdate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay, Serialize, Deserialize)] #[diesel(table_name = payment_methods)] pub struct PaymentMethodUpdateInternal { @@ -337,7 +316,7 @@ pub struct PaymentMethodUpdateInternal { external_vault_source: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodUpdateInternal { pub fn apply_changeset(self, source: PaymentMethod) -> PaymentMethod { let Self { @@ -389,10 +368,7 @@ impl PaymentMethodUpdateInternal { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay, Serialize, Deserialize)] #[diesel(table_name = payment_methods)] pub struct PaymentMethodUpdateInternal { @@ -414,10 +390,7 @@ pub struct PaymentMethodUpdateInternal { scheme: Option, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl PaymentMethodUpdateInternal { pub fn apply_changeset(self, source: PaymentMethod) -> PaymentMethod { let Self { @@ -481,10 +454,7 @@ impl PaymentMethodUpdateInternal { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for PaymentMethodUpdateInternal { fn from(payment_method_update: PaymentMethodUpdate) -> Self { match payment_method_update { @@ -704,7 +674,7 @@ impl From for PaymentMethodUpdateInternal { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for PaymentMethodUpdateInternal { fn from(payment_method_update: PaymentMethodUpdate) -> Self { match payment_method_update { @@ -854,10 +824,7 @@ impl From for PaymentMethodUpdateInternal { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From<&PaymentMethodNew> for PaymentMethod { fn from(payment_method_new: &PaymentMethodNew) -> Self { Self { @@ -905,7 +872,7 @@ impl From<&PaymentMethodNew> for PaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From<&PaymentMethodNew> for PaymentMethod { fn from(payment_method_new: &PaymentMethodNew) -> Self { Self { @@ -942,10 +909,7 @@ impl From<&PaymentMethodNew> for PaymentMethod { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct PaymentsMandateReferenceRecord { pub connector_mandate_id: String, @@ -957,7 +921,7 @@ pub struct PaymentsMandateReferenceRecord { pub connector_mandate_request_reference_id: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct ConnectorTokenReferenceRecord { pub connector_token: String, diff --git a/crates/diesel_models/src/query/customers.rs b/crates/diesel_models/src/query/customers.rs index 5caad88c8d..def8d77fe7 100644 --- a/crates/diesel_models/src/query/customers.rs +++ b/crates/diesel_models/src/query/customers.rs @@ -1,20 +1,14 @@ use common_utils::id_type; -#[cfg(all(feature = "v2", feature = "customer_v2"))] -use diesel::BoolExpressionMethods; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use diesel::BoolExpressionMethods; -use diesel::{associations::HasTable, ExpressionMethods}; +use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods}; use super::generics; -// #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use crate::errors; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::schema::customers::dsl; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] use crate::schema_v2::customers::dsl; use crate::{ customers::{Customer, CustomerNew, CustomerUpdateInternal}, - PgPooledConn, StorageResult, + errors, PgPooledConn, StorageResult, }; impl CustomerNew { @@ -28,9 +22,8 @@ pub struct CustomerListConstraints { pub offset: Option, } -// #[cfg(all(feature = "v2", feature = "customer_v2"))] impl Customer { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub async fn update_by_id( conn: &PgPooledConn, id: id_type::GlobalCustomerId, @@ -53,7 +46,7 @@ impl Customer { } } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub async fn find_by_global_id( conn: &PgPooledConn, id: &id_type::GlobalCustomerId, @@ -76,7 +69,7 @@ impl Customer { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub async fn find_optional_by_merchant_id_merchant_reference_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, @@ -91,7 +84,7 @@ impl Customer { .await } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub async fn find_optional_by_customer_id_merchant_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, @@ -104,7 +97,7 @@ impl Customer { .await } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub async fn update_by_customer_id_merchant_id( conn: &PgPooledConn, customer_id: id_type::CustomerId, @@ -132,7 +125,7 @@ impl Customer { } } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub async fn delete_by_customer_id_merchant_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, @@ -147,7 +140,7 @@ impl Customer { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub async fn find_by_merchant_reference_id_merchant_id( conn: &PgPooledConn, merchant_reference_id: &id_type::CustomerId, @@ -162,7 +155,7 @@ impl Customer { .await } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub async fn find_by_customer_id_merchant_id( conn: &PgPooledConn, customer_id: &id_type::CustomerId, diff --git a/crates/diesel_models/src/query/mandate.rs b/crates/diesel_models/src/query/mandate.rs index 96e6850f0f..4701473047 100644 --- a/crates/diesel_models/src/query/mandate.rs +++ b/crates/diesel_models/src/query/mandate.rs @@ -62,7 +62,7 @@ impl Mandate { } //Fix this function once V2 mandate is schema is being built - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub async fn find_by_global_customer_id( conn: &PgPooledConn, customer_id: &common_utils::id_type::GlobalCustomerId, diff --git a/crates/diesel_models/src/query/payment_method.rs b/crates/diesel_models/src/query/payment_method.rs index efb9198a28..72333d5f0f 100644 --- a/crates/diesel_models/src/query/payment_method.rs +++ b/crates/diesel_models/src/query/payment_method.rs @@ -1,8 +1,5 @@ use async_bb8_diesel::AsyncRunQueryDsl; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use diesel::Table; use diesel::{ associations::HasTable, debug_query, pg::Pg, BoolExpressionMethods, ExpressionMethods, QueryDsl, @@ -10,12 +7,9 @@ use diesel::{ use error_stack::ResultExt; use super::generics; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use crate::schema::payment_methods::dsl; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::schema_v2::payment_methods::dsl::{self, id as pm_id}; use crate::{ enums as storage_enums, errors, @@ -29,10 +23,7 @@ impl PaymentMethodNew { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl PaymentMethod { pub async fn delete_by_payment_method_id( conn: &PgPooledConn, @@ -210,7 +201,7 @@ impl PaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethod { pub async fn find_by_id( conn: &PgPooledConn, diff --git a/crates/hyperswitch_domain_models/Cargo.toml b/crates/hyperswitch_domain_models/Cargo.toml index d1b90a16e0..62b2105cba 100644 --- a/crates/hyperswitch_domain_models/Cargo.toml +++ b/crates/hyperswitch_domain_models/Cargo.toml @@ -15,8 +15,6 @@ payouts = ["api_models/payouts"] frm = ["api_models/frm"] v2 = ["api_models/v2", "diesel_models/v2", "common_utils/v2", "common_types/v2"] v1 = ["api_models/v1", "diesel_models/v1", "common_utils/v1", "common_types/v1"] -customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2"] -payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2"] tokenization_v2 = ["api_models/tokenization_v2", "diesel_models/tokenization_v2"] refunds_v2 = ["api_models/refunds_v2"] dummy_connector = [] diff --git a/crates/hyperswitch_domain_models/src/customer.rs b/crates/hyperswitch_domain_models/src/customer.rs index 68d3408e00..dd7d87a290 100644 --- a/crates/hyperswitch_domain_models/src/customer.rs +++ b/crates/hyperswitch_domain_models/src/customer.rs @@ -1,5 +1,5 @@ use common_enums::enums::MerchantStorageScheme; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] use common_enums::DeleteStatus; use common_utils::{ crypto::{self, Encryptable}, @@ -22,7 +22,7 @@ use time::PrimitiveDateTime; use crate::{behaviour, merchant_key_store::MerchantKeyStore, type_encryption as types}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Clone, Debug, router_derive::ToEncryption)] pub struct Customer { pub customer_id: id_type::CustomerId, @@ -45,7 +45,7 @@ pub struct Customer { pub version: common_enums::ApiVersion, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, router_derive::ToEncryption)] pub struct Customer { pub merchant_id: id_type::MerchantId, @@ -73,19 +73,19 @@ pub struct Customer { impl Customer { /// Get the unique identifier of Customer - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub fn get_id(&self) -> &id_type::CustomerId { &self.customer_id } /// Get the global identifier of Customer - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub fn get_id(&self) -> &id_type::GlobalCustomerId { &self.id } /// Get the connector customer ID for the specified connector label, if present - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] pub fn get_connector_customer_id(&self, connector_label: &str) -> Option<&str> { use masking::PeekInterface; @@ -98,7 +98,7 @@ impl Customer { } /// Get the connector customer ID for the specified merchant connector account ID, if present - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] pub fn get_connector_customer_id( &self, merchant_connector_id: &id_type::MerchantConnectorAccountId, @@ -110,7 +110,7 @@ impl Customer { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl behaviour::Conversion for Customer { type DstType = diesel_models::customers::Customer; @@ -214,7 +214,7 @@ impl behaviour::Conversion for Customer { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl behaviour::Conversion for Customer { type DstType = diesel_models::customers::Customer; @@ -328,7 +328,7 @@ impl behaviour::Conversion for Customer { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug)] pub struct CustomerGeneralUpdate { pub name: crypto::OptionalEncryptableName, @@ -344,7 +344,7 @@ pub struct CustomerGeneralUpdate { pub status: Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug)] pub enum CustomerUpdate { Update(Box), @@ -356,7 +356,7 @@ pub enum CustomerUpdate { }, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl From for CustomerUpdateInternal { fn from(customer_update: CustomerUpdate) -> Self { match customer_update { @@ -426,7 +426,7 @@ impl From for CustomerUpdateInternal { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Clone, Debug)] pub enum CustomerUpdate { Update { @@ -447,7 +447,7 @@ pub enum CustomerUpdate { }, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for CustomerUpdateInternal { fn from(customer_update: CustomerUpdate) -> Self { match customer_update { @@ -528,14 +528,14 @@ where >, { type Error; - #[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, merchant_id: &id_type::MerchantId, ) -> CustomResult; - #[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, @@ -545,7 +545,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult, Self::Error>; - #[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, @@ -555,7 +555,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult, Self::Error>; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_optional_by_merchant_id_merchant_reference_id( &self, state: &KeyManagerState, @@ -565,7 +565,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult, Self::Error>; - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn update_customer_by_customer_id_merchant_id( &self, @@ -578,7 +578,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[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, @@ -588,7 +588,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_customer_by_merchant_reference_id_merchant_id( &self, state: &KeyManagerState, @@ -614,7 +614,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] async fn update_customer_by_global_id( &self, @@ -627,7 +627,7 @@ where storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_customer_by_global_id( &self, state: &KeyManagerState, diff --git a/crates/hyperswitch_domain_models/src/mandates.rs b/crates/hyperswitch_domain_models/src/mandates.rs index 27ede3ba18..5e5b9e1828 100644 --- a/crates/hyperswitch_domain_models/src/mandates.rs +++ b/crates/hyperswitch_domain_models/src/mandates.rs @@ -262,10 +262,7 @@ impl MandateAmountData { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct PaymentsMandateReferenceRecord { pub connector_mandate_id: String, @@ -277,7 +274,7 @@ pub struct PaymentsMandateReferenceRecord { pub connector_mandate_request_reference_id: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct ConnectorTokenReferenceRecord { pub connector_token: String, diff --git a/crates/hyperswitch_domain_models/src/network_tokenization.rs b/crates/hyperswitch_domain_models/src/network_tokenization.rs index 4dd54fe332..06773caa68 100644 --- a/crates/hyperswitch_domain_models/src/network_tokenization.rs +++ b/crates/hyperswitch_domain_models/src/network_tokenization.rs @@ -1,16 +1,10 @@ -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use cards::CardNumber; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use cards::{CardNumber, NetworkToken}; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub type NetworkTokenNumber = CardNumber; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub type NetworkTokenNumber = NetworkToken; diff --git a/crates/hyperswitch_domain_models/src/payment_method_data.rs b/crates/hyperswitch_domain_models/src/payment_method_data.rs index 6b93394d13..62688236a5 100644 --- a/crates/hyperswitch_domain_models/src/payment_method_data.rs +++ b/crates/hyperswitch_domain_models/src/payment_method_data.rs @@ -650,10 +650,7 @@ pub struct SepaAndBacsBillingDetails { pub name: Secret, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)] pub struct NetworkTokenData { pub token_number: cards::CardNumber, @@ -669,7 +666,7 @@ pub struct NetworkTokenData { pub eci: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)] pub struct NetworkTokenData { pub network_token: cards::NetworkToken, @@ -686,7 +683,7 @@ pub struct NetworkTokenData { pub eci: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize, Default)] pub struct NetworkTokenDetails { pub network_token: cards::NetworkToken, @@ -711,7 +708,7 @@ pub enum MobilePaymentData { }, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl TryFrom for PaymentMethodData { type Error = error_stack::Report; @@ -843,7 +840,7 @@ impl } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From<( payment_methods::CardDetail, @@ -875,7 +872,7 @@ impl } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for payment_methods::CardDetail { fn from(card: Card) -> Self { Self { @@ -1965,7 +1962,7 @@ impl PaymentMethodsData { None } } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_co_badged_card_data(&self) -> Option { todo!() } @@ -1991,10 +1988,7 @@ fn saved_in_locker_default() -> bool { true } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct CardDetailsPaymentMethod { pub last4_digits: Option, @@ -2012,7 +2006,7 @@ pub struct CardDetailsPaymentMethod { pub co_badged_card_data: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct CardDetailsPaymentMethod { pub last4_digits: Option, @@ -2029,7 +2023,7 @@ pub struct CardDetailsPaymentMethod { pub saved_to_locker: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl CardDetailsPaymentMethod { pub fn to_card_details_from_locker(self) -> payment_methods::CardDetailFromLocker { payment_methods::CardDetailFromLocker { @@ -2079,7 +2073,7 @@ impl From for CardDetailsPaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for CardDetailsPaymentMethod { fn from(item: payment_methods::CardDetail) -> Self { Self { @@ -2098,7 +2092,7 @@ impl From for CardDetailsPaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for NetworkTokenDetailsPaymentMethod { fn from(item: NetworkTokenDetails) -> Self { Self { @@ -2117,14 +2111,14 @@ impl From for NetworkTokenDetailsPaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, Eq, PartialEq, serde::Deserialize, serde::Serialize)] pub struct SingleUsePaymentMethodToken { pub token: Secret, pub merchant_connector_id: id_type::MerchantConnectorAccountId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl SingleUsePaymentMethodToken { pub fn get_single_use_token_from_payment_method_token( token: Secret, diff --git a/crates/hyperswitch_domain_models/src/payment_methods.rs b/crates/hyperswitch_domain_models/src/payment_methods.rs index 2f135ca881..f73621b49a 100644 --- a/crates/hyperswitch_domain_models/src/payment_methods.rs +++ b/crates/hyperswitch_domain_models/src/payment_methods.rs @@ -2,7 +2,7 @@ use api_models::payment_methods::PaymentMethodsData; // specific imports because of using the macro use common_enums::enums::MerchantStorageScheme; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::{crypto::Encryptable, encryption::Encryption, types::keymanager::ToEncryptable}; use common_utils::{ crypto::OptionalEncryptableValue, @@ -23,7 +23,7 @@ use rustc_hash::FxHashMap; use serde_json::Value; use time::PrimitiveDateTime; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{address::Address, type_encryption::OptionalEncryptableJsonType}; use crate::{ mandates::{self, CommonMandateReference}, @@ -32,15 +32,11 @@ use crate::{ type_encryption::{crypto_operation, AsyncLift, CryptoOperation}, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct VaultId(String); -#[cfg(any( - feature = "v2", - feature = "payment_methods_v2", - feature = "tokenization_v2" -))] +#[cfg(any(feature = "v2", feature = "tokenization_v2"))] impl VaultId { pub fn get_string_repr(&self) -> &String { &self.0 @@ -50,10 +46,7 @@ impl VaultId { Self(id) } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Clone, Debug)] pub struct PaymentMethod { pub customer_id: id_type::CustomerId, @@ -92,7 +85,7 @@ pub struct PaymentMethod { pub network_token_payment_method_data: OptionalEncryptableValue, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug, router_derive::ToEncryption)] pub struct PaymentMethod { /// The identifier for the payment method. Using this recurring payments can be made @@ -131,10 +124,7 @@ pub struct PaymentMethod { } impl PaymentMethod { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_id(&self) -> &String { &self.payment_method_id } @@ -158,41 +148,32 @@ impl PaymentMethod { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_id(&self) -> &id_type::GlobalPaymentMethodId { &self.id } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_payment_method_type(&self) -> Option { self.payment_method } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_payment_method_type(&self) -> Option { self.payment_method_type } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_payment_method_subtype(&self) -> Option { self.payment_method_type } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_payment_method_subtype(&self) -> Option { self.payment_method_subtype } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn get_common_mandate_reference(&self) -> Result { let payments_data = self .connector_mandate_details @@ -239,7 +220,7 @@ impl PaymentMethod { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_common_mandate_reference(&self) -> Result { if let Some(value) = &self.connector_mandate_details { Ok(value.clone()) @@ -265,10 +246,7 @@ impl PaymentMethod { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl super::behaviour::Conversion for PaymentMethod { type DstType = diesel_models::payment_method::PaymentMethod; @@ -452,7 +430,7 @@ impl super::behaviour::Conversion for PaymentMethod { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl super::behaviour::Conversion for PaymentMethod { type DstType = diesel_models::payment_method::PaymentMethod; @@ -736,10 +714,7 @@ impl super::behaviour::Conversion for PaymentMethodSession { #[async_trait::async_trait] pub trait PaymentMethodInterface { type Error; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn find_payment_method( &self, state: &keymanager::KeyManagerState, @@ -748,7 +723,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method( &self, state: &keymanager::KeyManagerState, @@ -757,10 +732,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[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: &keymanager::KeyManagerState, @@ -769,10 +741,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[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: &keymanager::KeyManagerState, @@ -783,7 +752,7 @@ pub trait PaymentMethodInterface { ) -> CustomResult, Self::Error>; // Need to fix this once we start moving to v2 for payment method - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method_list_by_global_customer_id( &self, state: &keymanager::KeyManagerState, @@ -792,10 +761,7 @@ pub trait PaymentMethodInterface { limit: Option, ) -> CustomResult, Self::Error>; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn find_payment_method_by_customer_id_merchant_id_status( &self, @@ -808,7 +774,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult, Self::Error>; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] async fn find_payment_method_by_global_customer_id_merchant_id_status( &self, @@ -821,10 +787,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult, Self::Error>; - #[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, @@ -855,7 +818,7 @@ pub trait PaymentMethodInterface { storage_scheme: MerchantStorageScheme, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn delete_payment_method( &self, state: &keymanager::KeyManagerState, @@ -863,7 +826,7 @@ pub trait PaymentMethodInterface { payment_method: PaymentMethod, ) -> CustomResult; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method_by_fingerprint_id( &self, state: &keymanager::KeyManagerState, @@ -871,10 +834,7 @@ pub trait PaymentMethodInterface { fingerprint_id: &str, ) -> CustomResult; - #[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: &keymanager::KeyManagerState, @@ -953,10 +913,7 @@ pub struct PaymentMethodsSessionUpdateInternal { pub tokenization_data: Option, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[cfg(test)] mod tests { #![allow(clippy::unwrap_used)] diff --git a/crates/hyperswitch_domain_models/src/vault.rs b/crates/hyperswitch_domain_models/src/vault.rs index 03ced1cdc9..b68e1d1543 100644 --- a/crates/hyperswitch_domain_models/src/vault.rs +++ b/crates/hyperswitch_domain_models/src/vault.rs @@ -6,7 +6,7 @@ use crate::payment_method_data; #[derive(Debug, Deserialize, Serialize, Clone)] pub enum PaymentMethodVaultingData { Card(payment_methods::CardDetail), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] NetworkToken(payment_method_data::NetworkTokenDetails), } @@ -14,7 +14,7 @@ impl PaymentMethodVaultingData { pub fn get_card(&self) -> Option<&payment_methods::CardDetail> { match self { Self::Card(card) => Some(card), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] Self::NetworkToken(_) => None, } } @@ -23,7 +23,7 @@ impl PaymentMethodVaultingData { Self::Card(card) => payment_method_data::PaymentMethodsData::Card( payment_method_data::CardDetailsPaymentMethod::from(card.clone()), ), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] Self::NetworkToken(network_token) => { payment_method_data::PaymentMethodsData::NetworkToken( payment_method_data::NetworkTokenDetailsPaymentMethod::from( @@ -43,7 +43,7 @@ impl VaultingDataInterface for PaymentMethodVaultingData { fn get_vaulting_data_key(&self) -> String { match &self { Self::Card(card) => card.card_number.to_string(), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] Self::NetworkToken(network_token) => network_token.network_token.to_string(), } } diff --git a/crates/openapi/Cargo.toml b/crates/openapi/Cargo.toml index fd6ba0d0e6..0ddc27e797 100644 --- a/crates/openapi/Cargo.toml +++ b/crates/openapi/Cargo.toml @@ -18,7 +18,7 @@ router_env = { version = "0.1.0", path = "../router_env" } euclid = { version = "0.1.0", path = "../euclid" } [features] -v2 = ["api_models/v2", "api_models/customer_v2", "common_utils/v2", "api_models/payment_methods_v2", "common_utils/payment_methods_v2", "api_models/refunds_v2", "api_models/tokenization_v2"] +v2 = ["api_models/v2", "common_utils/v2", "api_models/refunds_v2", "api_models/tokenization_v2"] v1 = ["api_models/v1", "common_utils/v1"] [lints] diff --git a/crates/payment_methods/Cargo.toml b/crates/payment_methods/Cargo.toml index 2e63964455..9e25a8375d 100644 --- a/crates/payment_methods/Cargo.toml +++ b/crates/payment_methods/Cargo.toml @@ -34,10 +34,8 @@ hyperswitch_interfaces = { version = "0.1.0", path = "../hyperswitch_interfaces" workspace = true [features] -customer_v2 = ["api_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"] default = ["dummy_connector", "payouts"] v1 = ["hyperswitch_domain_models/v1", "storage_impl/v1", "common_utils/v1", "scheduler/v1", "common_types/v1"] -v2 = ["customer_v2", "payment_methods_v2", "common_utils/v2", "scheduler/v2", "common_types/v2"] -payment_methods_v2 = [ "hyperswitch_domain_models/payment_methods_v2", "storage_impl/payment_methods_v2", "common_utils/payment_methods_v2"] +v2 = ["common_utils/v2", "scheduler/v2", "common_types/v2"] dummy_connector = ["api_models/dummy_connector", "hyperswitch_interfaces/dummy_connector"] payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_domain_models/payouts", "storage_impl/payouts", "hyperswitch_interfaces/payouts"] diff --git a/crates/payment_methods/src/controller.rs b/crates/payment_methods/src/controller.rs index c8b150af19..f93d556932 100644 --- a/crates/payment_methods/src/controller.rs +++ b/crates/payment_methods/src/controller.rs @@ -4,7 +4,7 @@ use std::fmt::Debug; use api_models::payouts; use api_models::{enums as api_enums, payment_methods as api}; use common_enums::enums as common_enums; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::encryption; use common_utils::{crypto, ext_traits, id_type, type_name, types::keymanager}; use error_stack::ResultExt; @@ -32,11 +32,7 @@ pub enum DataDuplicationCheck { #[async_trait::async_trait] pub trait PaymentMethodsController { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn create_payment_method( &self, @@ -58,10 +54,7 @@ pub trait PaymentMethodsController { network_token_payment_method_data: crypto::OptionalEncryptableValue, ) -> errors::PmResult; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn insert_payment_method( &self, @@ -81,7 +74,7 @@ pub trait PaymentMethodsController { network_token_payment_method_data: crypto::OptionalEncryptableValue, ) -> errors::PmResult; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] async fn insert_payment_method( &self, @@ -98,25 +91,19 @@ pub trait PaymentMethodsController { payment_method_billing_address: Option, ) -> errors::PmResult; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn add_payment_method( &self, req: &api::PaymentMethodCreate, ) -> errors::PmResponse; - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn retrieve_payment_method( &self, pm: api::PaymentMethodId, ) -> errors::PmResponse; - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] async fn delete_payment_method( &self, pm_id: api::PaymentMethodId, @@ -149,10 +136,7 @@ pub trait PaymentMethodsController { customer_id: &id_type::CustomerId, ) -> errors::VaultResult<(api::PaymentMethodResponse, Option)>; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn get_or_insert_payment_method( &self, req: api::PaymentMethodCreate, @@ -161,7 +145,7 @@ pub trait PaymentMethodsController { key_store: &merchant_key_store::MerchantKeyStore, ) -> errors::PmResult; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn get_or_insert_payment_method( &self, req: api::PaymentMethodCreate, @@ -172,19 +156,13 @@ pub trait PaymentMethodsController { todo!() } - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn get_card_details_with_locker_fallback( &self, pm: &payment_methods::PaymentMethod, ) -> errors::PmResult>; - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn get_card_details_without_locker_fallback( &self, pm: &payment_methods::PaymentMethod, @@ -197,10 +175,7 @@ pub trait PaymentMethodsController { card_reference: &str, ) -> errors::PmResult; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn store_default_payment_method( &self, req: &api::PaymentMethodCreate, @@ -208,7 +183,7 @@ pub trait PaymentMethodsController { merchant_id: &id_type::MerchantId, ) -> (api::PaymentMethodResponse, Option); - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn store_default_payment_method( &self, req: &api::PaymentMethodCreate, @@ -216,11 +191,7 @@ pub trait PaymentMethodsController { merchant_id: &id_type::MerchantId, ) -> (api::PaymentMethodResponse, Option); - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn save_network_token_and_update_payment_method( &self, @@ -231,7 +202,7 @@ pub trait PaymentMethodsController { pm_id: String, ) -> errors::PmResult; - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] async fn set_default_payment_method( &self, merchant_id: &id_type::MerchantId, @@ -239,10 +210,7 @@ pub trait PaymentMethodsController { payment_method_id: String, ) -> errors::PmResponse; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn add_payment_method_status_update_task( &self, payment_method: &payment_methods::PaymentMethod, diff --git a/crates/payment_methods/src/core/migration.rs b/crates/payment_methods/src/core/migration.rs index 1166dd82ee..069a2c460c 100644 --- a/crates/payment_methods/src/core/migration.rs +++ b/crates/payment_methods/src/core/migration.rs @@ -14,10 +14,7 @@ pub use payment_methods::migrate_payment_method; type PmMigrationResult = errors::CustomResult, errors::ApiErrorResponse>; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn migrate_payment_methods( state: &state::PaymentMethodsState, payment_methods: Vec, diff --git a/crates/payment_methods/src/core/migration/payment_methods.rs b/crates/payment_methods/src/core/migration/payment_methods.rs index a957d2375b..d8dc1abdd0 100644 --- a/crates/payment_methods/src/core/migration/payment_methods.rs +++ b/crates/payment_methods/src/core/migration/payment_methods.rs @@ -1,6 +1,6 @@ use std::str::FromStr; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use api_models::enums as api_enums; use api_models::{enums, payment_methods as pm_api}; use common_utils::{ @@ -27,10 +27,7 @@ use crate::{ state, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn migrate_payment_method( state: &state::PaymentMethodsState, req: pm_api::PaymentMethodMigrate, @@ -154,7 +151,7 @@ pub async fn migrate_payment_method( )) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn migrate_payment_method( _state: &state::PaymentMethodsState, _req: pm_api::PaymentMethodMigrate, @@ -166,10 +163,7 @@ pub async fn migrate_payment_method( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn populate_bin_details_for_masked_card( card_details: &api_models::payment_methods::MigrateCardDetail, db: &dyn state::PaymentMethodsStorageInterface, @@ -203,10 +197,7 @@ pub async fn populate_bin_details_for_masked_card( Ok(card_bin_details) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl ForeignTryFrom<( &api_models::payment_methods::MigrateCardDetail, @@ -281,7 +272,7 @@ impl } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl ForeignTryFrom<( &api_models::payment_methods::MigrateCardDetail, @@ -361,10 +352,7 @@ impl } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn get_client_secret_or_add_payment_method_for_migration( state: &state::PaymentMethodsState, @@ -467,11 +455,7 @@ pub async fn get_client_secret_or_add_payment_method_for_migration( )) } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn skip_locker_call_and_migrate_payment_method( state: &state::PaymentMethodsState, @@ -640,11 +624,7 @@ pub async fn skip_locker_call_and_migrate_payment_method( } // need to discuss regarding the migration APIs for v2 -#[cfg(all( - feature = "v2", - feature = "payment_methods_v2", - feature = "customer_v2" -))] +#[cfg(feature = "v2")] pub async fn skip_locker_call_and_migrate_payment_method( _state: state::PaymentMethodsState, _req: &pm_api::PaymentMethodMigrate, @@ -673,10 +653,7 @@ pub fn get_card_bin_and_last4_digits_for_masked_card( Ok((card_isin, last4_digits)) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn save_migration_payment_method( req: pm_api::PaymentMethodCreate, diff --git a/crates/payment_methods/src/helpers.rs b/crates/payment_methods/src/helpers.rs index 3883393279..71e975bd1c 100644 --- a/crates/payment_methods/src/helpers.rs +++ b/crates/payment_methods/src/helpers.rs @@ -4,10 +4,7 @@ pub use hyperswitch_domain_models::{errors::api_error_response, payment_methods use router_env::logger; use crate::state; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn populate_bin_details_for_payment_method_create( card_details: api_models::payment_methods::CardDetail, db: Box, @@ -65,7 +62,7 @@ pub async fn populate_bin_details_for_payment_method_create( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn populate_bin_details_for_payment_method_create( _card_details: api_models::payment_methods::CardDetail, _db: &dyn state::PaymentMethodsStorageInterface, @@ -246,10 +243,7 @@ pub trait ForeignTryFrom: Sized { fn foreign_try_from(from: F) -> Result; } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl ForeignFrom<(Option, domain::PaymentMethod)> for api::PaymentMethodResponse { @@ -276,7 +270,7 @@ impl ForeignFrom<(Option, domain::PaymentMethod)> } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl ForeignFrom<(Option, domain::PaymentMethod)> for api::PaymentMethodResponse { diff --git a/crates/payment_methods/src/state.rs b/crates/payment_methods/src/state.rs index 65cfe3699b..9782a32818 100644 --- a/crates/payment_methods/src/state.rs +++ b/crates/payment_methods/src/state.rs @@ -1,7 +1,4 @@ -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use common_utils::errors::CustomResult; use common_utils::types::keymanager; use hyperswitch_domain_models::{ @@ -42,10 +39,7 @@ impl From<&PaymentMethodsState> for keymanager::KeyManagerState { state.key_manager_state.clone() } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl PaymentMethodsState { pub async fn find_payment_method( &self, diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml index 6f52e9354c..82ea494594 100644 --- a/crates/router/Cargo.toml +++ b/crates/router/Cargo.toml @@ -33,10 +33,8 @@ payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_connectors payout_retry = ["payouts"] recon = ["email", "api_models/recon"] retry = [] -v2 = ["customer_v2", "payment_methods_v2", "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2", "hyperswitch_connectors/v2", "hyperswitch_interfaces/v2", "common_types/v2", "revenue_recovery", "scheduler/v2", "refunds_v2", "euclid/v2", "payment_methods/v2", "tokenization_v2"] +v2 = [ "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2", "common_utils/v2", "hyperswitch_connectors/v2", "hyperswitch_interfaces/v2", "common_types/v2", "revenue_recovery", "scheduler/v2", "refunds_v2", "euclid/v2", "payment_methods/v2", "tokenization_v2"] v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1", "common_utils/v1", "hyperswitch_connectors/v1", "common_types/v1", "scheduler/v1", "payment_methods/v1"] -customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"] -payment_methods_v2 = ["api_models/payment_methods_v2", "diesel_models/payment_methods_v2", "hyperswitch_domain_models/payment_methods_v2", "storage_impl/payment_methods_v2", "common_utils/payment_methods_v2"] dynamic_routing = ["external_services/dynamic_routing", "storage_impl/dynamic_routing", "api_models/dynamic_routing"] revenue_recovery = ["api_models/revenue_recovery", "hyperswitch_interfaces/revenue_recovery", "hyperswitch_domain_models/revenue_recovery", "hyperswitch_connectors/revenue_recovery"] refunds_v2 = ["api_models/refunds_v2", "diesel_models/refunds_v2", "storage_impl/refunds_v2", "hyperswitch_domain_models/refunds_v2"] diff --git a/crates/router/src/compatibility/stripe.rs b/crates/router/src/compatibility/stripe.rs index 7946bb0d9e..e83e5c8c9e 100644 --- a/crates/router/src/compatibility/stripe.rs +++ b/crates/router/src/compatibility/stripe.rs @@ -4,16 +4,16 @@ pub mod payment_intents; pub mod refunds; pub mod setup_intents; pub mod webhooks; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use actix_web::{web, Scope}; pub mod errors; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::routes; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub struct StripeApis; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl StripeApis { pub fn server(state: routes::AppState) -> Scope { let max_depth = 10; diff --git a/crates/router/src/compatibility/stripe/app.rs b/crates/router/src/compatibility/stripe/app.rs index 639e4ce29e..539670e3f0 100644 --- a/crates/router/src/compatibility/stripe/app.rs +++ b/crates/router/src/compatibility/stripe/app.rs @@ -1,15 +1,13 @@ use actix_web::{web, Scope}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use super::customers::*; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use super::{payment_intents::*, setup_intents::*}; +#[cfg(feature = "v1")] +use super::{customers::*, payment_intents::*, setup_intents::*}; use super::{refunds::*, webhooks::*}; use crate::routes::{self, mandates, webhooks}; pub struct PaymentIntents; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl PaymentIntents { pub fn server(state: routes::AppState) -> Scope { let mut route = web::scope("/payment_intents").app_data(web::Data::new(state)); @@ -45,7 +43,7 @@ impl PaymentIntents { pub struct SetupIntents; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl SetupIntents { pub fn server(state: routes::AppState) -> Scope { web::scope("/setup_intents") @@ -82,7 +80,7 @@ impl Refunds { pub struct Customers; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl Customers { pub fn server(config: routes::AppState) -> Scope { web::scope("/customers") diff --git a/crates/router/src/compatibility/stripe/customers.rs b/crates/router/src/compatibility/stripe/customers.rs index bdc720e14a..8acd4d10d4 100644 --- a/crates/router/src/compatibility/stripe/customers.rs +++ b/crates/router/src/compatibility/stripe/customers.rs @@ -1,14 +1,14 @@ pub mod types; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use actix_web::{web, HttpRequest, HttpResponse}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use common_utils::id_type; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use error_stack::report; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use router_env::{instrument, tracing, Flow}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ compatibility::{stripe::errors, wrap}, core::{api_locking, customers, payment_methods::cards}, @@ -20,11 +20,7 @@ use crate::{ }, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersCreate))] pub async fn customer_create( state: web::Data, @@ -72,11 +68,7 @@ pub async fn customer_create( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersRetrieve))] pub async fn customer_retrieve( state: web::Data, @@ -116,11 +108,7 @@ pub async fn customer_retrieve( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersUpdate))] pub async fn customer_update( state: web::Data, @@ -174,11 +162,7 @@ pub async fn customer_update( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersDelete))] pub async fn customer_delete( state: web::Data, @@ -218,11 +202,7 @@ pub async fn customer_delete( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomerPaymentMethodsList))] pub async fn list_customer_payment_method_api( state: web::Data, diff --git a/crates/router/src/compatibility/stripe/customers/types.rs b/crates/router/src/compatibility/stripe/customers/types.rs index 83649f9823..555ed4e992 100644 --- a/crates/router/src/compatibility/stripe/customers/types.rs +++ b/crates/router/src/compatibility/stripe/customers/types.rs @@ -1,12 +1,9 @@ use std::{convert::From, default::Default}; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use api_models::payment_methods as api_types; use api_models::payments; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use common_utils::{crypto::Encryptable, date_time}; use common_utils::{ id_type, @@ -15,7 +12,7 @@ use common_utils::{ }; use serde::{Deserialize, Serialize}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::logger; use crate::types::{api, api::enums as api_enums}; @@ -123,7 +120,7 @@ impl From for payments::AddressDetails { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for api::CustomerRequest { fn from(req: CreateCustomerRequest) -> Self { Self { @@ -139,7 +136,7 @@ impl From for api::CustomerRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for api::CustomerUpdateRequest { fn from(req: CustomerUpdateRequest) -> Self { Self { @@ -154,7 +151,7 @@ impl From for api::CustomerUpdateRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for CreateCustomerResponse { fn from(cust: api::CustomerResponse) -> Self { let cust = cust.into_inner(); @@ -182,7 +179,7 @@ impl From for CreateCustomerResponse { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl From for CustomerDeleteResponse { fn from(cust: api::CustomerDeleteResponse) -> Self { Self { @@ -215,10 +212,7 @@ pub struct CardDetails { pub fingerprint: Option>, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for CustomerPaymentMethodListResponse { fn from(item: api::CustomerPaymentMethodsListResponse) -> Self { let customer_payment_methods = item.customer_payment_methods; @@ -233,10 +227,7 @@ impl From for CustomerPaymentMethodList } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for PaymentMethodData { fn from(item: api_types::CustomerPaymentMethod) -> Self { let card = item.card.map(From::from); @@ -249,10 +240,7 @@ impl From for PaymentMethodData { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for CardDetails { fn from(item: api_types::CardDetailFromLocker) -> Self { Self { diff --git a/crates/router/src/compatibility/stripe/payment_intents.rs b/crates/router/src/compatibility/stripe/payment_intents.rs index 77e7761e67..c1666386c5 100644 --- a/crates/router/src/compatibility/stripe/payment_intents.rs +++ b/crates/router/src/compatibility/stripe/payment_intents.rs @@ -2,9 +2,9 @@ pub mod types; use actix_web::{web, HttpRequest, HttpResponse}; use api_models::payments as payment_types; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use error_stack::report; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use router_env::Tag; use router_env::{instrument, tracing, Flow}; @@ -14,7 +14,7 @@ use crate::{ routes::{self}, services::{api, authentication as auth}, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ core::api_locking::GetLockingInput, logger, @@ -22,7 +22,7 @@ use crate::{ types::{api as api_types, domain}, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsCreate, payment_id))] pub async fn payment_intents_create( state: web::Data, @@ -185,7 +185,7 @@ pub async fn payment_intents_retrieve( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow))] pub async fn payment_intents_retrieve_with_gateway_creds( state: web::Data, @@ -271,7 +271,7 @@ pub async fn payment_intents_retrieve_with_gateway_creds( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsUpdate))] pub async fn payment_intents_update( state: web::Data, @@ -354,7 +354,7 @@ pub async fn payment_intents_update( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsConfirm, payment_id))] pub async fn payment_intents_confirm( state: web::Data, @@ -446,7 +446,7 @@ pub async fn payment_intents_confirm( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsCapture, payment_id))] pub async fn payment_intents_capture( state: web::Data, @@ -522,7 +522,7 @@ pub async fn payment_intents_capture( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsCancel, payment_id))] pub async fn payment_intents_cancel( state: web::Data, diff --git a/crates/router/src/compatibility/stripe/setup_intents.rs b/crates/router/src/compatibility/stripe/setup_intents.rs index 00baf1ddfb..8e4e8eb101 100644 --- a/crates/router/src/compatibility/stripe/setup_intents.rs +++ b/crates/router/src/compatibility/stripe/setup_intents.rs @@ -1,14 +1,14 @@ pub mod types; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use actix_web::{web, HttpRequest, HttpResponse}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use api_models::payments as payment_types; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use error_stack::report; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use router_env::{instrument, tracing, Flow}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ compatibility::{ stripe::{errors, payment_intents::types as stripe_payment_types}, @@ -20,7 +20,7 @@ use crate::{ types::{api as api_types, domain}, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsCreate))] pub async fn setup_intents_create( state: web::Data, @@ -169,7 +169,7 @@ pub async fn setup_intents_retrieve( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsUpdate))] pub async fn setup_intents_update( state: web::Data, @@ -252,7 +252,7 @@ pub async fn setup_intents_update( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentsConfirm))] pub async fn setup_intents_confirm( state: web::Data, diff --git a/crates/router/src/connector/utils.rs b/crates/router/src/connector/utils.rs index 9e834a6d19..d4961e724d 100644 --- a/crates/router/src/connector/utils.rs +++ b/crates/router/src/connector/utils.rs @@ -2764,23 +2764,17 @@ pub trait NetworkTokenData { } impl NetworkTokenData for domain::NetworkTokenData { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_card_issuer(&self) -> Result { get_card_issuer(self.token_number.peek()) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_card_issuer(&self) -> Result { get_card_issuer(self.network_token.peek()) } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.token_exp_year.peek().clone(); if year.len() == 2 { @@ -2789,7 +2783,7 @@ impl NetworkTokenData for domain::NetworkTokenData { Secret::new(year) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_expiry_year_4_digit(&self) -> Secret { let mut year = self.network_token_exp_year.peek().clone(); if year.len() == 2 { @@ -2798,54 +2792,42 @@ impl NetworkTokenData for domain::NetworkTokenData { Secret::new(year) } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_network_token(&self) -> NetworkTokenNumber { self.token_number.clone() } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_network_token(&self) -> NetworkTokenNumber { self.network_token.clone() } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_network_token_expiry_month(&self) -> Secret { self.token_exp_month.clone() } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_network_token_expiry_month(&self) -> Secret { self.network_token_exp_month.clone() } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_network_token_expiry_year(&self) -> Secret { self.token_exp_year.clone() } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_network_token_expiry_year(&self) -> Secret { self.network_token_exp_year.clone() } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn get_cryptogram(&self) -> Option> { self.token_cryptogram.clone() } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn get_cryptogram(&self) -> Option> { self.cryptogram.clone() } diff --git a/crates/router/src/consts.rs b/crates/router/src/consts.rs index 19b28f36d1..db50e81fb1 100644 --- a/crates/router/src/consts.rs +++ b/crates/router/src/consts.rs @@ -172,39 +172,39 @@ pub const DEFAULT_PRODUCT_IMG: &str = pub const DEFAULT_SDK_LAYOUT: &str = "tabs"; /// Vault Add request url -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const ADD_VAULT_REQUEST_URL: &str = "/api/v2/vault/add"; /// Vault Get Fingerprint request url -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_FINGERPRINT_REQUEST_URL: &str = "/api/v2/vault/fingerprint"; /// Vault Retrieve request url -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_RETRIEVE_REQUEST_URL: &str = "/api/v2/vault/retrieve"; /// Vault Delete request url -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_DELETE_REQUEST_URL: &str = "/api/v2/vault/delete"; /// Vault Header content type -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_HEADER_CONTENT_TYPE: &str = "application/json"; /// Vault Add flow type -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_ADD_FLOW_TYPE: &str = "add_to_vault"; /// Vault Retrieve flow type -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_RETRIEVE_FLOW_TYPE: &str = "retrieve_from_vault"; /// Vault Delete flow type -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_DELETE_FLOW_TYPE: &str = "delete_from_vault"; /// Vault Fingerprint fetch flow type -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub const VAULT_GET_FINGERPRINT_FLOW_TYPE: &str = "get_fingerprint_vault"; /// Max volume split for Dynamic routing diff --git a/crates/router/src/core.rs b/crates/router/src/core.rs index a46f974279..4cbaa943b2 100644 --- a/crates/router/src/core.rs +++ b/crates/router/src/core.rs @@ -64,7 +64,7 @@ pub mod webhooks; pub mod profile_acquirer; pub mod unified_authentication_service; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub mod proxy; pub mod relay; #[cfg(feature = "v2")] diff --git a/crates/router/src/core/customers.rs b/crates/router/src/core/customers.rs index b4d95fe9e2..5ad3d95405 100644 --- a/crates/router/src/core/customers.rs +++ b/crates/router/src/core/customers.rs @@ -13,9 +13,9 @@ use masking::{ExposeInterface, Secret, SwitchStrategy}; use payment_methods::controller::PaymentMethodsController; use router_env::{instrument, tracing}; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] use crate::core::payment_methods::cards::create_encrypted_data; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::utils::CustomerAddress; use crate::{ core::{ @@ -107,7 +107,7 @@ trait CustomerCreateBridge { ) -> errors::CustomerResponse; } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl CustomerCreateBridge for customers::CustomerRequest { async fn create_domain_model_from_request<'a>( @@ -209,7 +209,7 @@ impl CustomerCreateBridge for customers::CustomerRequest { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl CustomerCreateBridge for customers::CustomerRequest { async fn create_domain_model_from_request<'a>( @@ -321,7 +321,7 @@ impl CustomerCreateBridge for customers::CustomerRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] struct AddressStructForDbEntry<'a> { address: Option<&'a api_models::payments::AddressDetails>, customer_data: &'a customers::CustomerRequest, @@ -333,7 +333,7 @@ struct AddressStructForDbEntry<'a> { state: &'a SessionState, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl AddressStructForDbEntry<'_> { async fn encrypt_customer_address_and_set_to_db( &self, @@ -379,7 +379,7 @@ struct MerchantReferenceIdForCustomer<'a> { key_manager_state: &'a KeyManagerState, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl<'a> MerchantReferenceIdForCustomer<'a> { async fn verify_if_merchant_reference_not_present_by_optional_merchant_reference_id( &self, @@ -423,7 +423,7 @@ impl<'a> MerchantReferenceIdForCustomer<'a> { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl<'a> MerchantReferenceIdForCustomer<'a> { async fn verify_if_merchant_reference_not_present_by_optional_merchant_reference_id( &self, @@ -470,7 +470,7 @@ impl<'a> MerchantReferenceIdForCustomer<'a> { } } -#[cfg(all(any(feature = "v1", feature = "v2",), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip(state))] pub async fn retrieve_customer( state: SessionState, @@ -510,7 +510,7 @@ pub async fn retrieve_customer( )) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip(state))] pub async fn retrieve_customer( state: SessionState, @@ -563,13 +563,13 @@ pub async fn list_customers( .await .switch()?; - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] let customers = domain_customers .into_iter() .map(|domain_customer| customers::CustomerResponse::foreign_from((domain_customer, None))) .collect(); - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] let customers = domain_customers .into_iter() .map(customers::CustomerResponse::foreign_from) @@ -578,11 +578,7 @@ pub async fn list_customers( Ok(services::ApplicationResponse::Json(customers)) } -#[cfg(all( - feature = "v2", - feature = "customer_v2", - feature = "payment_methods_v2" -))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn delete_customer( state: SessionState, @@ -600,11 +596,7 @@ pub async fn delete_customer( .await } -#[cfg(all( - feature = "v2", - feature = "customer_v2", - feature = "payment_methods_v2" -))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl CustomerDeleteBridge for id_type::GlobalCustomerId { async fn redact_customer_details_and_generate_response<'a>( @@ -761,11 +753,7 @@ trait CustomerDeleteBridge { ) -> errors::CustomerResponse; } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn delete_customer( state: SessionState, @@ -784,11 +772,7 @@ pub async fn delete_customer( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl CustomerDeleteBridge for id_type::CustomerId { async fn redact_customer_details_and_generate_response<'a>( @@ -1017,7 +1001,7 @@ pub async fn update_customer( let key_manager_state = &(&state).into(); //Add this in update call if customer can be updated anywhere else - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] let verify_id_for_update_customer = VerifyIdForUpdateCustomer { merchant_reference_id: &update_customer.customer_id, merchant_account: merchant_context.get_merchant_account(), @@ -1025,7 +1009,7 @@ pub async fn update_customer( key_manager_state, }; - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] let verify_id_for_update_customer = VerifyIdForUpdateCustomer { id: &update_customer.id, merchant_account: merchant_context.get_merchant_account(), @@ -1068,7 +1052,7 @@ trait CustomerUpdateBridge { ) -> errors::CustomerResponse; } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] struct AddressStructForDbUpdate<'a> { update_customer: &'a customers::CustomerUpdateRequest, merchant_account: &'a domain::MerchantAccount, @@ -1078,7 +1062,7 @@ struct AddressStructForDbUpdate<'a> { domain_customer: &'a domain::Customer, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl AddressStructForDbUpdate<'_> { async fn update_address_if_sent( &self, @@ -1162,7 +1146,7 @@ impl AddressStructForDbUpdate<'_> { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[derive(Debug)] struct VerifyIdForUpdateCustomer<'a> { merchant_reference_id: &'a id_type::CustomerId, @@ -1171,7 +1155,7 @@ struct VerifyIdForUpdateCustomer<'a> { key_manager_state: &'a KeyManagerState, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug)] struct VerifyIdForUpdateCustomer<'a> { id: &'a id_type::GlobalCustomerId, @@ -1180,7 +1164,7 @@ struct VerifyIdForUpdateCustomer<'a> { key_manager_state: &'a KeyManagerState, } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl VerifyIdForUpdateCustomer<'_> { async fn verify_id_and_get_customer_object( &self, @@ -1201,7 +1185,7 @@ impl VerifyIdForUpdateCustomer<'_> { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl VerifyIdForUpdateCustomer<'_> { async fn verify_id_and_get_customer_object( &self, @@ -1222,7 +1206,7 @@ impl VerifyIdForUpdateCustomer<'_> { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl CustomerUpdateBridge for customers::CustomerUpdateRequest { async fn create_domain_model_from_request<'a>( @@ -1326,7 +1310,7 @@ impl CustomerUpdateBridge for customers::CustomerUpdateRequest { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl CustomerUpdateBridge for customers::CustomerUpdateRequest { async fn create_domain_model_from_request<'a>( diff --git a/crates/router/src/core/errors/utils.rs b/crates/router/src/core/errors/utils.rs index b258e43b5a..8e5862909e 100644 --- a/crates/router/src/core/errors/utils.rs +++ b/crates/router/src/core/errors/utils.rs @@ -88,7 +88,7 @@ pub trait ConnectorErrorExt { #[cfg(feature = "payouts")] #[track_caller] fn to_payout_failed_response(self) -> error_stack::Result; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] #[track_caller] fn to_vault_failed_response(self) -> error_stack::Result; @@ -475,7 +475,7 @@ impl ConnectorErrorExt for error_stack::Result }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn to_vault_failed_response(self) -> error_stack::Result { self.map_err(|err| { let error = match err.current_context() { diff --git a/crates/router/src/core/fraud_check/flows/checkout_flow.rs b/crates/router/src/core/fraud_check/flows/checkout_flow.rs index d71d810335..4068453862 100644 --- a/crates/router/src/core/fraud_check/flows/checkout_flow.rs +++ b/crates/router/src/core/fraud_check/flows/checkout_flow.rs @@ -28,7 +28,7 @@ use crate::{ impl ConstructFlowSpecificData for FrmData { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn construct_router_data<'a>( &self, _state: &SessionState, @@ -43,7 +43,7 @@ impl ConstructFlowSpecificData( &self, state: &SessionState, diff --git a/crates/router/src/core/fraud_check/flows/record_return.rs b/crates/router/src/core/fraud_check/flows/record_return.rs index 02d87853ea..58b044c585 100644 --- a/crates/router/src/core/fraud_check/flows/record_return.rs +++ b/crates/router/src/core/fraud_check/flows/record_return.rs @@ -26,7 +26,7 @@ use crate::{ impl ConstructFlowSpecificData for FrmData { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn construct_router_data<'a>( &self, _state: &SessionState, @@ -41,7 +41,7 @@ impl ConstructFlowSpecificData( &self, state: &SessionState, diff --git a/crates/router/src/core/fraud_check/flows/sale_flow.rs b/crates/router/src/core/fraud_check/flows/sale_flow.rs index 138097333c..00223e524a 100644 --- a/crates/router/src/core/fraud_check/flows/sale_flow.rs +++ b/crates/router/src/core/fraud_check/flows/sale_flow.rs @@ -24,7 +24,7 @@ use crate::{ impl ConstructFlowSpecificData for FrmData { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn construct_router_data<'a>( &self, _state: &SessionState, @@ -38,7 +38,7 @@ impl ConstructFlowSpecificData( &self, state: &SessionState, diff --git a/crates/router/src/core/fraud_check/flows/transaction_flow.rs b/crates/router/src/core/fraud_check/flows/transaction_flow.rs index ded83e9b7b..2f75e4796c 100644 --- a/crates/router/src/core/fraud_check/flows/transaction_flow.rs +++ b/crates/router/src/core/fraud_check/flows/transaction_flow.rs @@ -29,7 +29,7 @@ impl FraudCheckResponseData, > for FrmData { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn construct_router_data<'a>( &self, _state: &SessionState, @@ -45,7 +45,7 @@ impl todo!() } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] async fn construct_router_data<'a>( &self, state: &SessionState, diff --git a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs index 530ee95d47..0c42bdeacb 100644 --- a/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs +++ b/crates/router/src/core/fraud_check/operation/fraud_check_pre.rs @@ -159,7 +159,7 @@ where F: Clone + Send, D: payments::OperationSessionGetters + Send + Sync + Clone, { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[instrument(skip_all)] async fn post_payment_frm<'a>( &'a self, @@ -173,7 +173,7 @@ where todo!() } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn post_payment_frm<'a>( &'a self, diff --git a/crates/router/src/core/locker_migration.rs b/crates/router/src/core/locker_migration.rs index 7738b67dee..e2680666e4 100644 --- a/crates/router/src/core/locker_migration.rs +++ b/crates/router/src/core/locker_migration.rs @@ -1,46 +1,23 @@ use ::payment_methods::controller::PaymentMethodsController; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use api_models::enums as api_enums; use api_models::locker_migration::MigrateCardResponse; use common_utils::{errors::CustomResult, id_type}; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use diesel_models::enums as storage_enums; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use error_stack::FutureExt; use error_stack::ResultExt; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use futures::TryFutureExt; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use super::errors::StorageErrorExt; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] -use super::payment_methods::cards; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] -use crate::services::logger; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] -use crate::types::api; +#[cfg(feature = "v1")] +use super::{errors::StorageErrorExt, payment_methods::cards}; use crate::{errors, routes::SessionState, services, types::domain}; +#[cfg(feature = "v1")] +use crate::{services::logger, types::api}; -#[cfg(all( - feature = "v2", - feature = "customer_v2", - feature = "payment_methods_v2" -))] +#[cfg(feature = "v2")] pub async fn rust_locker_migration( _state: SessionState, _merchant_id: &id_type::MerchantId, @@ -48,11 +25,7 @@ pub async fn rust_locker_migration( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn rust_locker_migration( state: SessionState, merchant_id: &id_type::MerchantId, @@ -130,10 +103,7 @@ pub async fn rust_locker_migration( )) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn call_to_locker( state: &SessionState, payment_methods: Vec, @@ -234,7 +204,7 @@ pub async fn call_to_locker( Ok(cards_moved) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn call_to_locker( _state: &SessionState, _payment_methods: Vec, diff --git a/crates/router/src/core/mandate.rs b/crates/router/src/core/mandate.rs index e32709320c..fc66f6489f 100644 --- a/crates/router/src/core/mandate.rs +++ b/crates/router/src/core/mandate.rs @@ -219,7 +219,7 @@ pub async fn update_connector_mandate_id( } Ok(services::ApplicationResponse::StatusOk) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip(state))] pub async fn get_customer_mandates( state: SessionState, diff --git a/crates/router/src/core/payment_methods.rs b/crates/router/src/core/payment_methods.rs index f41b83dad7..d6182c28f6 100644 --- a/crates/router/src/core/payment_methods.rs +++ b/crates/router/src/core/payment_methods.rs @@ -1,31 +1,28 @@ pub mod cards; pub mod network_tokenization; pub mod surcharge_decision_configs; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub mod tokenize; pub mod transformers; pub mod utils; mod validator; pub mod vault; use std::borrow::Cow; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use std::collections::HashSet; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use std::str::FromStr; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub use api_models::enums as api_enums; pub use api_models::enums::Connector; use api_models::payment_methods; #[cfg(feature = "payouts")] pub use api_models::{enums::PayoutConnectors, payouts as payout_types}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use common_utils::ext_traits::{Encode, OptionExt}; use common_utils::{consts::DEFAULT_LOCALE, id_type}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::{ crypto::Encryptable, errors::CustomResult, @@ -37,26 +34,22 @@ use diesel_models::{ enums, GenericLinkNew, PaymentMethodCollectLink, PaymentMethodCollectLinkData, }; use error_stack::{report, ResultExt}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use futures::TryStreamExt; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use hyperswitch_domain_models::api::{GenericLinks, GenericLinksData}; -#[cfg(all( - feature = "v2", - feature = "payment_methods_v2", - feature = "customer_v2" -))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::mandates::CommonMandateReference; use hyperswitch_domain_models::payments::{ payment_attempt::PaymentAttempt, PaymentIntent, VaultData, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::{ payment_method_data, payment_methods as domain_payment_methods, router_data_v2::flow_common_types::VaultConnectorFlowData, router_flow_types::ExternalVaultInsertFlow, types::VaultRouterData, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use masking::ExposeOptionInterface; use masking::{PeekInterface, Secret}; use router_env::{instrument, tracing}; @@ -68,7 +61,7 @@ use super::{ errors::{RouterResponse, StorageErrorExt}, pm_auth, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{ configs::settings, core::{ @@ -283,7 +276,7 @@ pub async fn create_pm_collect_db_entry( }) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn render_pm_collect_link( _state: SessionState, _merchant_context: domain::MerchantContext, @@ -292,7 +285,7 @@ pub async fn render_pm_collect_link( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn render_pm_collect_link( state: SessionState, merchant_context: domain::MerchantContext, @@ -469,10 +462,7 @@ fn generate_task_id_for_payment_method_status_update_workflow( format!("{runner}_{task}_{key_id}") } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn add_payment_method_status_update_task( db: &dyn StorageInterface, payment_method: &domain::PaymentMethod, @@ -545,10 +535,7 @@ pub async fn retrieve_payment_method_with_token( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn retrieve_payment_method_with_token( @@ -715,7 +702,7 @@ pub async fn retrieve_payment_method_with_token( Ok(token) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub(crate) fn get_payment_method_create_request( payment_method_data: &api_models::payments::PaymentMethodData, @@ -772,10 +759,7 @@ pub(crate) fn get_payment_method_create_request( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub(crate) async fn get_payment_method_create_request( payment_method_data: Option<&domain::PaymentMethodData>, @@ -892,7 +876,7 @@ fn get_card_network_with_us_local_debit_network_override( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn create_payment_method( state: &SessionState, @@ -908,7 +892,7 @@ pub async fn create_payment_method( Ok(services::ApplicationResponse::Json(response)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn create_payment_method_core( state: &SessionState, @@ -1061,7 +1045,7 @@ pub async fn create_payment_method_core( Ok((response, payment_method)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Clone, Debug)] pub struct NetworkTokenPaymentMethodDetails { network_token_requestor_reference_id: String, @@ -1069,7 +1053,7 @@ pub struct NetworkTokenPaymentMethodDetails { network_token_pmd: Encryptable>, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn network_tokenize_and_vault_the_pmd( state: &SessionState, payment_method_data: &domain::PaymentMethodVaultingData, @@ -1141,7 +1125,7 @@ pub async fn network_tokenize_and_vault_the_pmd( network_token_pm_details_result.ok() } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn populate_bin_details_for_payment_method( state: &SessionState, payment_method_data: &domain::PaymentMethodVaultingData, @@ -1196,13 +1180,13 @@ pub async fn populate_bin_details_for_payment_method( _ => payment_method_data.clone(), } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] pub trait PaymentMethodExt { async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self; } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl PaymentMethodExt for domain::PaymentMethodVaultingData { async fn populate_bin_details_for_payment_method(&self, state: &SessionState) -> Self { @@ -1258,7 +1242,7 @@ impl PaymentMethodExt for domain::PaymentMethodVaultingData { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn payment_method_intent_create( state: &SessionState, @@ -1341,7 +1325,7 @@ impl PerformFilteringOnEnabledPaymentMethods } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn list_payment_methods_for_session( state: SessionState, @@ -1655,7 +1639,7 @@ impl RequiredFieldsForEnabledPaymentMethodTypes { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn create_payment_method_for_intent( @@ -1750,7 +1734,7 @@ fn create_connector_token_details_update( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] pub async fn create_pm_additional_data_update( pmd: Option<&domain::PaymentMethodVaultingData>, @@ -1821,7 +1805,7 @@ pub async fn create_pm_additional_data_update( Ok(pm_update) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn vault_payment_method_internal( state: &SessionState, @@ -1869,7 +1853,7 @@ pub async fn vault_payment_method_internal( Ok(resp_from_vault) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn vault_payment_method_external( state: &SessionState, @@ -1927,7 +1911,7 @@ pub async fn vault_payment_method_external( get_vault_response_for_insert_payment_method_data(router_data_resp) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn get_vault_response_for_insert_payment_method_data( router_data: VaultRouterData, ) -> RouterResult { @@ -1956,7 +1940,7 @@ pub fn get_vault_response_for_insert_payment_method_data( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn vault_payment_method( state: &SessionState, @@ -2013,11 +1997,7 @@ pub async fn vault_payment_method( } } -#[cfg(all( - feature = "v2", - feature = "payment_methods_v2", - feature = "customer_v2" -))] +#[cfg(feature = "v2")] fn get_pm_list_context( payment_method_type: enums::PaymentMethod, payment_method: &domain::PaymentMethod, @@ -2100,11 +2080,7 @@ fn get_pm_list_context( Ok(payment_method_retrieval_context) } -#[cfg(all( - feature = "v2", - feature = "payment_methods_v2", - feature = "customer_v2" -))] +#[cfg(feature = "v2")] fn get_pm_list_token_data( payment_method_type: enums::PaymentMethod, payment_method: &domain::PaymentMethod, @@ -2250,7 +2226,7 @@ pub async fn get_total_payment_method_count_core( Ok(response) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn retrieve_payment_method( state: SessionState, @@ -2284,7 +2260,7 @@ pub async fn retrieve_payment_method( } // TODO: When we separate out microservices, this function will be an endpoint in payment_methods -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn update_payment_method_status_internal( state: &SessionState, @@ -2325,7 +2301,7 @@ pub async fn update_payment_method_status_internal( Ok(updated_pm) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn update_payment_method( state: SessionState, @@ -2341,7 +2317,7 @@ pub async fn update_payment_method( Ok(services::ApplicationResponse::Json(response)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn update_payment_method_core( state: &SessionState, @@ -2453,7 +2429,7 @@ pub async fn update_payment_method_core( Ok(response) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn delete_payment_method( state: SessionState, @@ -2469,7 +2445,7 @@ pub async fn delete_payment_method( Ok(services::ApplicationResponse::Json(response)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn delete_payment_method_core( state: &SessionState, @@ -3122,7 +3098,7 @@ pub async fn payment_methods_session_confirm( )) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl pm_types::SavedPMLPaymentsInfo { pub async fn form_payments_info( payment_intent: PaymentIntent, @@ -3177,7 +3153,7 @@ impl pm_types::SavedPMLPaymentsInfo { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] async fn create_single_use_tokenization_flow( state: SessionState, @@ -3330,7 +3306,7 @@ async fn create_single_use_tokenization_flow( Ok(()) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn add_single_use_token_to_store( state: &SessionState, key: payment_method_data::SingleUseTokenKey, @@ -3353,7 +3329,7 @@ async fn add_single_use_token_to_store( Ok(()) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn get_single_use_token_from_store( state: &SessionState, key: payment_method_data::SingleUseTokenKey, diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs index 567f167d1f..11b1489b5c 100644 --- a/crates/router/src/core/payment_methods/cards.rs +++ b/crates/router/src/core/payment_methods/cards.rs @@ -10,10 +10,7 @@ use ::payment_methods::{ }, controller::PaymentMethodsController, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use api_models::admin::PaymentMethodsEnabled; use api_models::{ enums as api_enums, @@ -44,21 +41,15 @@ use common_utils::{ }; use diesel_models::payment_method; use error_stack::{report, ResultExt}; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use euclid::dssa::graph::{AnalysisContext, CgraphExt}; use euclid::frontend::dir; use hyperswitch_constraint_graph as cgraph; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use hyperswitch_domain_models::customer::CustomerUpdate; use hyperswitch_domain_models::mandates::CommonMandateReference; use hyperswitch_interfaces::secrets_interface::secret_state::RawSecret; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use kgraph_utils::transformers::IntoDirValue; use masking::Secret; use router_env::{instrument, tracing}; @@ -70,24 +61,14 @@ use super::surcharge_decision_configs::{ perform_surcharge_decision_management_for_payment_method_list, perform_surcharge_decision_management_for_saved_cards, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use super::tokenize::NetworkTokenizationProcess; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use crate::core::payment_methods::{ add_payment_method_status_update_task, tokenize, utils::{get_merchant_pm_filter_graph, make_pm_graph, refresh_pm_filters_cache}, }; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] use crate::routes::app::SessionStateInfo; #[cfg(feature = "payouts")] use crate::types::domain::types::AsyncLift; @@ -116,7 +97,7 @@ use crate::{ utils, utils::OptionExt, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{ core::payment_methods as pm_core, headers, types::payment_methods as pm_types, utils::ConnectorResponseExt, @@ -128,11 +109,7 @@ pub struct PmCards<'a> { #[async_trait::async_trait] impl PaymentMethodsController for PmCards<'_> { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") - ))] + #[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] async fn create_payment_method( @@ -229,10 +206,7 @@ impl PaymentMethodsController for PmCards<'_> { } Ok(response) } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] fn store_default_payment_method( &self, req: &api::PaymentMethodCreate, @@ -264,7 +238,7 @@ impl PaymentMethodsController for PmCards<'_> { (payment_method_response, None) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] fn store_default_payment_method( &self, _req: &api::PaymentMethodCreate, @@ -277,10 +251,7 @@ impl PaymentMethodsController for PmCards<'_> { todo!() } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn get_or_insert_payment_method( &self, @@ -359,7 +330,7 @@ impl PaymentMethodsController for PmCards<'_> { } } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn get_or_insert_payment_method( &self, _req: api::PaymentMethodCreate, @@ -370,11 +341,7 @@ impl PaymentMethodsController for PmCards<'_> { todo!() } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn save_network_token_and_update_payment_method( &self, @@ -480,10 +447,7 @@ impl PaymentMethodsController for PmCards<'_> { } } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn insert_payment_method( &self, @@ -538,7 +502,7 @@ impl PaymentMethodsController for PmCards<'_> { .await } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] async fn insert_payment_method( &self, @@ -754,10 +718,7 @@ impl PaymentMethodsController for PmCards<'_> { Ok((payment_method_resp, store_card_payload.duplication_check)) } - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn get_card_details_with_locker_fallback( &self, pm: &domain::PaymentMethod, @@ -783,10 +744,7 @@ impl PaymentMethodsController for PmCards<'_> { }) } - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn get_card_details_without_locker_fallback( &self, pm: &domain::PaymentMethod, @@ -812,7 +770,7 @@ impl PaymentMethodsController for PmCards<'_> { }) } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] async fn set_default_payment_method( &self, merchant_id: &id_type::MerchantId, @@ -898,10 +856,7 @@ impl PaymentMethodsController for PmCards<'_> { Ok(services::ApplicationResponse::Json(resp)) } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn add_payment_method_status_update_task( &self, payment_method: &domain::PaymentMethod, @@ -937,10 +892,7 @@ impl PaymentMethodsController for PmCards<'_> { .await } - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn retrieve_payment_method( &self, @@ -999,7 +951,7 @@ impl PaymentMethodsController for PmCards<'_> { )) } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn delete_payment_method( &self, @@ -1101,10 +1053,7 @@ impl PaymentMethodsController for PmCards<'_> { )) } - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn add_payment_method( &self, @@ -1353,10 +1302,7 @@ impl PaymentMethodsController for PmCards<'_> { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn get_client_secret_or_add_payment_method( state: &routes::SessionState, @@ -1471,11 +1417,7 @@ pub fn authenticate_pm_client_secret_and_check_expiry( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn add_payment_method_data( state: routes::SessionState, @@ -1672,10 +1614,7 @@ pub async fn add_payment_method_data( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn update_customer_payment_method( state: routes::SessionState, @@ -1905,10 +1844,7 @@ pub async fn update_customer_payment_method( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub fn validate_payment_method_update( card_updation_obj: CardDetailUpdate, existing_card_data: api::CardDetailFromLocker, @@ -1957,7 +1893,7 @@ pub fn validate_payment_method_update( }) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn validate_payment_method_update( _card_updation_obj: CardDetailUpdate, _existing_card_data: api::CardDetailFromLocker, @@ -2003,7 +1939,7 @@ pub async fn get_card_from_locker( Ok(get_card_from_rs_locker_resp) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn delete_card_by_locker_id( state: &routes::SessionState, id: &id_type::GlobalCustomerId, @@ -2194,10 +2130,7 @@ where } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn update_payment_method_metadata_and_last_used( state: &routes::SessionState, key_store: &domain::MerchantKeyStore, @@ -2236,7 +2169,7 @@ pub async fn update_payment_method_and_last_used( Ok(()) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn update_payment_method_connector_mandate_details( state: &routes::SessionState, key_store: &domain::MerchantKeyStore, @@ -2255,10 +2188,7 @@ pub async fn update_payment_method_connector_mandate_details( Ok(()) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn update_payment_method_connector_mandate_details( state: &routes::SessionState, key_store: &domain::MerchantKeyStore, @@ -2374,7 +2304,7 @@ pub async fn delete_card_from_hs_locker<'a>( } // Need to fix this function while completing v2 -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn delete_card_from_hs_locker_by_global_id<'a>( state: &routes::SessionState, @@ -2627,11 +2557,7 @@ fn get_val(str: String, val: &serde_json::Value) -> Option { .map(|s| s.to_string()) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn list_payment_methods( state: routes::SessionState, merchant_context: domain::MerchantContext, @@ -3607,11 +3533,7 @@ pub async fn list_payment_methods( )) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] fn should_collect_shipping_or_billing_details_from_wallet_connector( payment_method: api_enums::PaymentMethod, payment_experience_optional: Option<&api_enums::PaymentExperience>, @@ -3645,10 +3567,7 @@ fn should_collect_shipping_or_billing_details_from_wallet_connector( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), -))] +#[cfg(feature = "v1")] async fn validate_payment_method_and_client_secret( state: &routes::SessionState, cs: &String, @@ -3806,10 +3725,7 @@ pub async fn call_surcharge_decision_management_for_saved_card( Ok(()) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn filter_payment_methods( graph: &cgraph::ConstraintGraph, @@ -4049,7 +3965,7 @@ pub async fn filter_payment_methods( // v2 type for PaymentMethodListRequest will not have the installment_payment_enabled field, // need to re-evaluate filter logic -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] pub async fn filter_payment_methods( _graph: &cgraph::ConstraintGraph, @@ -4123,11 +4039,7 @@ fn filter_recurring_based( }) } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] pub async fn do_list_customer_pm_fetch_customer_if_not_passed( state: routes::SessionState, merchant_context: domain::MerchantContext, @@ -4195,11 +4107,7 @@ pub async fn do_list_customer_pm_fetch_customer_if_not_passed( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] pub async fn list_customer_payment_method( state: &routes::SessionState, merchant_context: domain::MerchantContext, @@ -4441,11 +4349,7 @@ pub async fn list_customer_payment_method( Ok(services::ApplicationResponse::Json(response)) } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] pub async fn get_pm_list_context( state: &routes::SessionState, payment_method: &enums::PaymentMethod, @@ -4633,7 +4537,7 @@ pub async fn get_mca_status( Ok(Some(false)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] pub async fn get_mca_status( state: &routes::SessionState, @@ -4689,10 +4593,7 @@ where .attach_printable("unable to parse generic data value") } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn get_card_details_from_locker( state: &routes::SessionState, pm: &domain::PaymentMethod, @@ -4712,10 +4613,7 @@ pub async fn get_card_details_from_locker( .attach_printable("Get Card Details Failed") } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn get_lookup_key_from_locker( state: &routes::SessionState, payment_token: &str, @@ -4739,10 +4637,7 @@ pub async fn get_lookup_key_from_locker( pub async fn get_masked_bank_details( pm: &domain::PaymentMethod, ) -> errors::RouterResult> { - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] let payment_method_data = pm .payment_method_data .clone() @@ -4757,7 +4652,7 @@ pub async fn get_masked_bank_details( ) .transpose()?; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] let payment_method_data = pm.payment_method_data.clone().map(|x| x.into_inner()); match payment_method_data { @@ -4773,10 +4668,7 @@ pub async fn get_masked_bank_details( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn get_bank_account_connector_details( pm: &domain::PaymentMethod, ) -> errors::RouterResult> { @@ -4912,16 +4804,10 @@ pub async fn get_bank_from_hs_locker( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub struct TempLockerCardSupport; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl TempLockerCardSupport { #[instrument(skip_all)] async fn create_payment_method_data_in_temp_locker( @@ -5093,10 +4979,7 @@ pub async fn list_countries_currencies_for_connector_payment_method_util( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn tokenize_card_flow( state: &routes::SessionState, req: domain::CardNetworkTokenizeRequest, @@ -5133,10 +5016,7 @@ pub async fn tokenize_card_flow( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn execute_card_tokenization( executor: tokenize::CardNetworkTokenizeExecutor<'_, domain::TokenizeCardRequest>, builder: tokenize::NetworkTokenizationBuilder<'_, tokenize::TokenizeWithCard>, @@ -5198,10 +5078,7 @@ pub async fn execute_card_tokenization( Ok(builder.build()) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn execute_payment_method_tokenization( executor: tokenize::CardNetworkTokenizeExecutor<'_, domain::TokenizePaymentMethodRequest>, builder: tokenize::NetworkTokenizationBuilder<'_, tokenize::TokenizeWithPmId>, diff --git a/crates/router/src/core/payment_methods/network_tokenization.rs b/crates/router/src/core/payment_methods/network_tokenization.rs index 0a259d6c51..1a5d328303 100644 --- a/crates/router/src/core/payment_methods/network_tokenization.rs +++ b/crates/router/src/core/payment_methods/network_tokenization.rs @@ -1,11 +1,11 @@ -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use std::fmt::Debug; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use std::str::FromStr; use ::payment_methods::controller::PaymentMethodsController; use api_models::payment_methods as api_payment_methods; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use cards::{CardNumber, NetworkToken}; use common_utils::{ errors::CustomResult, @@ -14,14 +14,11 @@ use common_utils::{ metrics::utils::record_operation_time, request::RequestContent, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use error_stack::ResultExt; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use error_stack::{report, ResultExt}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::payment_method_data::{ NetworkTokenDetails, NetworkTokenDetailsPaymentMethod, }; @@ -40,10 +37,7 @@ use crate::{ pub const NETWORK_TOKEN_SERVICE: &str = "NETWORK_TOKEN"; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn mk_tokenization_req( state: &routes::SessionState, payload_bytes: &[u8], @@ -154,7 +148,7 @@ pub async fn mk_tokenization_req( Ok((cn_response.clone(), Some(cn_response.card_reference))) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn generate_network_token( state: &routes::SessionState, payload_bytes: &[u8], @@ -266,10 +260,7 @@ pub async fn generate_network_token( Ok((cn_response.clone(), cn_response.card_reference)) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn make_card_network_tokenization_request( state: &routes::SessionState, card: &domain::CardDetail, @@ -319,7 +310,7 @@ pub async fn make_card_network_tokenization_request( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn make_card_network_tokenization_request( state: &routes::SessionState, card: &api_payment_methods::CardDetail, @@ -443,7 +434,7 @@ pub async fn get_network_token( Ok(token_response) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn get_network_token( state: &routes::SessionState, customer_id: &id_type::GlobalCustomerId, @@ -580,7 +571,7 @@ pub async fn get_token_from_tokenization_service( Ok(network_token_data) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn get_token_from_tokenization_service( state: &routes::SessionState, network_token_requestor_ref_id: String, @@ -722,10 +713,7 @@ pub async fn do_status_check_for_network_token( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn check_token_status_with_tokenization_service( state: &routes::SessionState, customer_id: &id_type::CustomerId, @@ -799,7 +787,7 @@ pub async fn check_token_status_with_tokenization_service( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn check_token_status_with_tokenization_service( _state: &routes::SessionState, _customer_id: &id_type::GlobalCustomerId, @@ -810,10 +798,7 @@ pub async fn check_token_status_with_tokenization_service( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn delete_network_token_from_locker_and_token_service( state: &routes::SessionState, customer_id: &id_type::CustomerId, @@ -862,10 +847,7 @@ pub async fn delete_network_token_from_locker_and_token_service( Ok(resp) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn delete_network_token_from_tokenization_service( state: &routes::SessionState, network_token_requestor_reference_id: String, @@ -941,7 +923,7 @@ pub async fn delete_network_token_from_tokenization_service( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn delete_network_token_from_locker_and_token_service( _state: &routes::SessionState, _customer_id: &id_type::GlobalCustomerId, diff --git a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs index 7c8558ff8c..6c448dfa62 100644 --- a/crates/router/src/core/payment_methods/surcharge_decision_configs.rs +++ b/crates/router/src/core/payment_methods/surcharge_decision_configs.rs @@ -3,12 +3,9 @@ use api_models::{ payments, routing, surcharge_decision_configs::{self, SurchargeDecisionConfigs, SurchargeDecisionManagerRecord}, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use common_utils::{ext_traits::StringExt, types as common_utils_types}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::{ ext_traits::{OptionExt, StringExt}, types as common_utils_types, @@ -288,10 +285,7 @@ pub async fn perform_surcharge_decision_management_for_session_flow( Ok(surcharge_metadata) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn perform_surcharge_decision_management_for_saved_cards( state: &SessionState, algorithm_ref: routing::RoutingAlgorithmRef, @@ -368,7 +362,7 @@ pub async fn perform_surcharge_decision_management_for_saved_cards( } // TODO: uncomment and resolve compiler error when required -// #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +// #[cfg(feature = "v2")] // pub async fn perform_surcharge_decision_management_for_saved_cards( // state: &SessionState, // algorithm_ref: routing::RoutingAlgorithmRef, diff --git a/crates/router/src/core/payment_methods/transformers.rs b/crates/router/src/core/payment_methods/transformers.rs index 9f61796f2e..53c0765050 100644 --- a/crates/router/src/core/payment_methods/transformers.rs +++ b/crates/router/src/core/payment_methods/transformers.rs @@ -9,13 +9,13 @@ use common_utils::{ request::RequestContent, }; use error_stack::ResultExt; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::payment_method_data; use josekit::jwe; use router_env::tracing_actix_web::RequestId; use serde::{Deserialize, Serialize}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::types::{payment_methods as pm_types, transformers}; use crate::{ configs::settings, @@ -83,7 +83,7 @@ pub struct CardReqBody { pub card_reference: String, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Deserialize, Serialize)] pub struct CardReqBodyV2 { pub merchant_id: id_type::MerchantId, @@ -274,7 +274,7 @@ pub async fn get_decrypted_vault_response_payload( .attach_printable("Jws Decryption failed for JwsBody for vault") } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn create_jwe_body_for_vault( jwekey: &settings::Jwekey, jws: &str, @@ -409,11 +409,7 @@ pub async fn mk_add_locker_request_hs( Ok(request) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2"), - feature = "payouts" -))] +#[cfg(all(feature = "v1", feature = "payouts"))] pub fn mk_add_bank_response_hs( bank: api::BankPayout, bank_reference: String, @@ -438,7 +434,7 @@ pub fn mk_add_bank_response_hs( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2", feature = "payouts"))] +#[cfg(all(feature = "v2", feature = "payouts"))] pub fn mk_add_bank_response_hs( _bank: api::BankPayout, _bank_reference: String, @@ -448,10 +444,7 @@ pub fn mk_add_bank_response_hs( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub fn mk_add_card_response_hs( card: api::CardDetail, card_reference: String, @@ -501,7 +494,7 @@ pub fn mk_add_card_response_hs( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn mk_add_card_response_hs( card: api::CardDetail, card_reference: String, @@ -511,7 +504,7 @@ pub fn mk_add_card_response_hs( todo!() } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn generate_pm_vaulting_req_from_update_request( pm_create: domain::PaymentMethodVaultingData, pm_update: api::PaymentMethodUpdateData, @@ -538,7 +531,7 @@ pub fn generate_pm_vaulting_req_from_update_request( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn generate_payment_method_response( payment_method: &domain::PaymentMethod, single_use_token: &Option, @@ -742,7 +735,7 @@ pub async fn mk_delete_card_request_hs( } // Need to fix this once we start moving to v2 completion -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn mk_delete_card_request_hs_by_id( jwekey: &settings::Jwekey, locker: &settings::Locker, @@ -800,10 +793,7 @@ pub fn mk_delete_card_response( }) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub fn get_card_detail( pm: &domain::PaymentMethod, response: Card, @@ -832,7 +822,7 @@ pub fn get_card_detail( Ok(card_detail) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn get_card_detail( _pm: &domain::PaymentMethod, response: Card, diff --git a/crates/router/src/core/payment_methods/utils.rs b/crates/router/src/core/payment_methods/utils.rs index 512c40fc8d..0bff9033ca 100644 --- a/crates/router/src/core/payment_methods/utils.rs +++ b/crates/router/src/core/payment_methods/utils.rs @@ -6,9 +6,9 @@ use api_models::{ payment_methods::RequestPaymentMethodTypes, }; use common_enums::enums; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::ext_traits::{OptionExt, StringExt}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use error_stack::ResultExt; use euclid::frontend::dir; use hyperswitch_constraint_graph as cgraph; @@ -17,7 +17,7 @@ use masking::ExposeInterface; use storage_impl::redis::cache::{CacheKey, PM_FILTERS_CGRAPH_CACHE}; use crate::{configs::settings, routes::SessionState}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{ db::{ errors, @@ -811,7 +811,7 @@ fn compile_accepted_currency_for_mca( )) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub(super) async fn retrieve_payment_token_data( state: &SessionState, token: String, @@ -850,7 +850,7 @@ pub(super) async fn retrieve_payment_token_data( .attach_printable("failed to deserialize hyperswitch token data") } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub(super) async fn delete_payment_token_data( state: &SessionState, key_for_token: &str, diff --git a/crates/router/src/core/payment_methods/validator.rs b/crates/router/src/core/payment_methods/validator.rs index a50cadc95b..760d60a6b2 100644 --- a/crates/router/src/core/payment_methods/validator.rs +++ b/crates/router/src/core/payment_methods/validator.rs @@ -15,7 +15,7 @@ use crate::{ utils, }; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn validate_request_and_initiate_payment_method_collect_link( _state: &SessionState, _merchant_context: &domain::MerchantContext, @@ -24,7 +24,7 @@ pub async fn validate_request_and_initiate_payment_method_collect_link( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn validate_request_and_initiate_payment_method_collect_link( state: &SessionState, merchant_context: &domain::MerchantContext, @@ -34,7 +34,7 @@ pub async fn validate_request_and_initiate_payment_method_collect_link( let db: &dyn StorageInterface = &*state.store; let customer_id = req.customer_id.clone(); let merchant_id = merchant_context.get_merchant_account().get_id().clone(); - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] match db .find_customer_by_customer_id_merchant_id( &state.into(), diff --git a/crates/router/src/core/payment_methods/vault.rs b/crates/router/src/core/payment_methods/vault.rs index 236072b0cf..4e4aa1b77f 100644 --- a/crates/router/src/core/payment_methods/vault.rs +++ b/crates/router/src/core/payment_methods/vault.rs @@ -1,5 +1,5 @@ use common_enums::PaymentMethodType; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::request; use common_utils::{ crypto::{DecodeMessage, EncodeMessage, GcmAes256}, @@ -8,7 +8,7 @@ use common_utils::{ pii::Email, }; use error_stack::{report, ResultExt}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::{ router_data_v2::flow_common_types::VaultConnectorFlowData, router_flow_types::{ExternalVaultDeleteFlow, ExternalVaultRetrieveFlow}, @@ -31,7 +31,7 @@ use crate::{ }, utils::StringExt, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{ core::{ errors::ConnectorErrorExt, @@ -1201,7 +1201,7 @@ pub async fn delete_tokenized_data( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn create_vault_request( jwekey: &settings::Jwekey, locker: &settings::Locker, @@ -1235,7 +1235,7 @@ async fn create_vault_request( Ok(request) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn call_to_vault( state: &routes::SessionState, @@ -1268,7 +1268,7 @@ pub async fn call_to_vault( Ok(decrypted_payload) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn get_fingerprint_id_from_vault( state: &routes::SessionState, @@ -1297,7 +1297,7 @@ pub async fn get_fingerprint_id_from_vault( router_data: VaultRouterData, ) -> RouterResult { @@ -1467,7 +1467,7 @@ pub fn get_vault_response_for_retrieve_payment_method_data( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn retrieve_payment_method_from_vault_using_payment_token( state: &routes::SessionState, @@ -1527,7 +1527,7 @@ pub async fn retrieve_payment_method_from_vault_using_payment_token( Ok((payment_method, vault_data)) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn delete_payment_token( state: &routes::SessionState, @@ -1548,7 +1548,7 @@ pub async fn delete_payment_token( Ok(()) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] pub async fn retrieve_payment_method_from_vault( state: &routes::SessionState, @@ -1602,7 +1602,7 @@ pub async fn retrieve_payment_method_from_vault( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn delete_payment_method_data_from_vault_internal( state: &routes::SessionState, merchant_context: &domain::MerchantContext, @@ -1629,7 +1629,7 @@ pub async fn delete_payment_method_data_from_vault_internal( Ok(stored_pm_resp) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn delete_payment_method_data_from_vault_external( state: &routes::SessionState, merchant_account: &domain::MerchantAccount, @@ -1691,7 +1691,7 @@ pub async fn delete_payment_method_data_from_vault_external( ) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub fn get_vault_response_for_delete_payment_method_data( router_data: VaultRouterData, merchant_id: id_type::MerchantId, @@ -1716,7 +1716,7 @@ pub fn get_vault_response_for_delete_payment_method_data( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn delete_payment_method_data_from_vault( state: &routes::SessionState, merchant_context: &domain::MerchantContext, diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs index d72ef0410b..d077a33e46 100644 --- a/crates/router/src/core/payments.rs +++ b/crates/router/src/core/payments.rs @@ -127,7 +127,7 @@ use crate::{ }, workflows::payment_sync, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ core::authentication as authentication_core, types::{api::authentication, BrowserInformation}, @@ -7300,10 +7300,7 @@ where } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn decide_connector_for_normal_or_recurring_payment( state: &SessionState, @@ -7966,7 +7963,7 @@ pub async fn route_connector_v1_for_payouts( Ok(ConnectorCallType::Retryable(connector_data)) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn payment_external_authentication( _state: SessionState, _merchant_context: domain::MerchantContext, @@ -7975,7 +7972,7 @@ pub async fn payment_external_authentication( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all)] pub async fn payment_external_authentication( state: SessionState, diff --git a/crates/router/src/core/payments/customers.rs b/crates/router/src/core/payments/customers.rs index c0767aaf20..c520926504 100644 --- a/crates/router/src/core/payments/customers.rs +++ b/crates/router/src/core/payments/customers.rs @@ -74,7 +74,7 @@ pub async fn create_connector_customer( Ok(connector_customer_id) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub fn should_call_connector_create_customer<'a>( state: &SessionState, connector: &api::ConnectorData, @@ -99,7 +99,7 @@ pub fn should_call_connector_create_customer<'a>( } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub fn should_call_connector_create_customer<'a>( state: &SessionState, connector: &api::ConnectorData, @@ -124,7 +124,7 @@ pub fn should_call_connector_create_customer<'a>( } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument] pub async fn update_connector_customer_in_customers( connector_label: &str, @@ -151,7 +151,7 @@ pub async fn update_connector_customer_in_customers( ) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument] pub async fn update_connector_customer_in_customers( merchant_connector_id: common_utils::id_type::MerchantConnectorAccountId, diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs index 0130cafca5..d2c490a4d4 100644 --- a/crates/router/src/core/payments/helpers.rs +++ b/crates/router/src/core/payments/helpers.rs @@ -30,7 +30,7 @@ use diesel_models::enums; // TODO : Evaluate all the helper functions () use error_stack::{report, ResultExt}; use futures::future::Either; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use hyperswitch_domain_models::payments::payment_intent::CustomerData; use hyperswitch_domain_models::{ mandates::MandateData, @@ -96,7 +96,7 @@ use crate::{ }; #[cfg(feature = "v2")] use crate::{core::admin as core_admin, headers}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ core::payment_methods::cards::create_encrypted_data, types::storage::CustomerUpdate::Update, }; @@ -425,10 +425,7 @@ pub async fn get_address_by_id( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn get_token_pm_type_mandate_details( state: &SessionState, request: &api::PaymentsRequest, @@ -1602,7 +1599,7 @@ pub async fn get_connector_default( )) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] #[allow(clippy::type_complexity)] pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>( @@ -1617,7 +1614,7 @@ pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::type_complexity)] pub async fn create_customer_if_not_exist<'a, F: Clone, R, D>( @@ -1969,7 +1966,7 @@ pub async fn retrieve_payment_method_with_temporary_token( }) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn retrieve_card_with_permanent_token( state: &SessionState, locker_id: &str, @@ -2068,10 +2065,7 @@ pub fn determine_standard_vault_action( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn retrieve_payment_method_data_with_permanent_token( state: &SessionState, @@ -2228,10 +2222,7 @@ pub async fn retrieve_payment_method_data_with_permanent_token( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn retrieve_card_with_permanent_token_for_external_authentication( state: &SessionState, @@ -2263,10 +2254,7 @@ pub async fn retrieve_card_with_permanent_token_for_external_authentication( )) } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn fetch_card_details_from_locker( state: &SessionState, customer_id: &id_type::CustomerId, @@ -2323,10 +2311,7 @@ pub async fn fetch_card_details_from_locker( Ok(domain::Card::from((api_card, co_badged_card_data))) } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn fetch_network_token_details_from_locker( state: &SessionState, customer_id: &id_type::CustomerId, @@ -2375,10 +2360,7 @@ pub async fn fetch_network_token_details_from_locker( Ok(network_token_data) } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn fetch_card_details_for_network_transaction_flow_from_locker( state: &SessionState, customer_id: &id_type::CustomerId, @@ -2422,7 +2404,7 @@ pub async fn fetch_card_details_for_network_transaction_flow_from_locker( ) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn retrieve_payment_method_from_db_with_token_data( state: &SessionState, merchant_key_store: &domain::MerchantKeyStore, @@ -2432,10 +2414,7 @@ pub async fn retrieve_payment_method_from_db_with_token_data( todo!() } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn retrieve_payment_method_from_db_with_token_data( state: &SessionState, merchant_key_store: &domain::MerchantKeyStore, @@ -2482,10 +2461,7 @@ pub async fn retrieve_payment_method_from_db_with_token_data( } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn retrieve_payment_token_data( state: &SessionState, token: String, @@ -2536,7 +2512,7 @@ pub async fn retrieve_payment_token_data( Ok(token_data) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn make_pm_data<'a, F: Clone, R, D>( _operation: BoxedOperation<'a, F, R, D>, _state: &'a SessionState, @@ -2553,10 +2529,7 @@ pub async fn make_pm_data<'a, F: Clone, R, D>( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn make_pm_data<'a, F: Clone, R, D>( operation: BoxedOperation<'a, F, R, D>, @@ -6475,7 +6448,7 @@ pub fn update_additional_payment_data_with_connector_response_pm_data( .attach_printable("Failed to encode additional pm data") } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn get_payment_method_details_from_payment_token( state: &SessionState, payment_attempt: &PaymentAttempt, @@ -6486,10 +6459,7 @@ pub async fn get_payment_method_details_from_payment_token( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn get_payment_method_details_from_payment_token( state: &SessionState, payment_attempt: &PaymentAttempt, diff --git a/crates/router/src/core/payments/operations/payment_confirm.rs b/crates/router/src/core/payments/operations/payment_confirm.rs index e59b961cec..944f2852b1 100644 --- a/crates/router/src/core/payments/operations/payment_confirm.rs +++ b/crates/router/src/core/payments/operations/payment_confirm.rs @@ -1,12 +1,10 @@ use std::marker::PhantomData; -// use api_models::{admin::ExtendedCardInfoConfig, enums::FrmSuggestion, payments::ExtendedCardInfo}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use api_models::payment_methods::PaymentMethodsData; use api_models::{ admin::ExtendedCardInfoConfig, enums::FrmSuggestion, - // payment_methods::PaymentMethodsData, payments::{ConnectorMandateReferenceId, ExtendedCardInfo, GetAddressFromPaymentMethodData}, }; use async_trait::async_trait; @@ -14,7 +12,7 @@ use common_utils::ext_traits::{AsyncExt, Encode, StringExt, ValueExt}; use diesel_models::payment_attempt::ConnectorMandateReferenceId as DieselConnectorMandateReferenceId; use error_stack::{report, ResultExt}; use futures::FutureExt; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use hyperswitch_domain_models::payments::payment_intent::PaymentIntentUpdateFields; use hyperswitch_domain_models::router_request_types::unified_authentication_service; use masking::{ExposeInterface, PeekInterface}; @@ -23,7 +21,7 @@ use router_env::{instrument, logger, tracing}; use tracing_futures::Instrument; use super::{BoxedOperation, Domain, GetTracker, Operation, UpdateTracker, ValidateRequest}; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use crate::{ consts, core::payment_methods::cards::create_encrypted_data, @@ -1501,7 +1499,7 @@ impl Domain> for } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[async_trait] impl UpdateTracker, api::PaymentsRequest> for PaymentConfirm { #[instrument(skip_all)] @@ -1527,7 +1525,7 @@ impl UpdateTracker, api::PaymentsRequest> for } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait] impl UpdateTracker, api::PaymentsRequest> for PaymentConfirm { #[instrument(skip_all)] diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs index 8ba549c59a..68f1b9d9c1 100644 --- a/crates/router/src/core/payments/operations/payment_create.rs +++ b/crates/router/src/core/payments/operations/payment_create.rs @@ -1073,7 +1073,7 @@ impl ValidateRequest PostUpdateTracker, types::PaymentsAuthor Ok(payment_data) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn save_pm_and_mandate<'b>( &self, state: &SessionState, @@ -134,10 +134,7 @@ impl PostUpdateTracker, types::PaymentsAuthor todo!() } - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn save_pm_and_mandate<'b>( &self, state: &SessionState, @@ -2275,7 +2272,7 @@ async fn payment_response_update_tracker( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn update_payment_method_status_and_ntid( state: &SessionState, key_store: &domain::MerchantKeyStore, @@ -2287,10 +2284,7 @@ async fn update_payment_method_status_and_ntid( todo!() } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] async fn update_payment_method_status_and_ntid( state: &SessionState, key_store: &domain::MerchantKeyStore, diff --git a/crates/router/src/core/payments/operations/payment_status.rs b/crates/router/src/core/payments/operations/payment_status.rs index c6cf1f96fe..830f2754e5 100644 --- a/crates/router/src/core/payments/operations/payment_status.rs +++ b/crates/router/src/core/payments/operations/payment_status.rs @@ -226,7 +226,7 @@ impl GetTracker, api::PaymentsRetrieve } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn get_tracker_for_sync< 'a, F: Send + Clone, @@ -243,10 +243,7 @@ async fn get_tracker_for_sync< todo!() } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] async fn get_tracker_for_sync< 'a, diff --git a/crates/router/src/core/payments/operations/payment_update.rs b/crates/router/src/core/payments/operations/payment_update.rs index 4a21296298..eaae951491 100644 --- a/crates/router/src/core/payments/operations/payment_update.rs +++ b/crates/router/src/core/payments/operations/payment_update.rs @@ -707,7 +707,7 @@ impl Domain> for #[async_trait] impl UpdateTracker, api::PaymentsRequest> for PaymentUpdate { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[instrument(skip_all)] async fn update_trackers<'b>( &'b self, @@ -727,7 +727,7 @@ impl UpdateTracker, api::PaymentsRequest> for todo!() } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] #[instrument(skip_all)] async fn update_trackers<'b>( &'b self, diff --git a/crates/router/src/core/payments/payment_methods.rs b/crates/router/src/core/payments/payment_methods.rs index c10cf05044..1cf17289a2 100644 --- a/crates/router/src/core/payments/payment_methods.rs +++ b/crates/router/src/core/payments/payment_methods.rs @@ -7,11 +7,7 @@ use error_stack::ResultExt; use super::errors; use crate::{core::payment_methods, db::errors::StorageErrorExt, routes, types::domain}; -#[cfg(all( - feature = "v2", - feature = "customer_v2", - feature = "payment_methods_v2" -))] +#[cfg(feature = "v2")] pub async fn list_payment_methods( state: routes::SessionState, merchant_context: domain::MerchantContext, diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs index 76bdfca1c5..f758066207 100644 --- a/crates/router/src/core/payments/tokenization.rs +++ b/crates/router/src/core/payments/tokenization.rs @@ -1,10 +1,7 @@ use std::collections::HashMap; use ::payment_methods::controller::PaymentMethodsController; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use api_models::payment_methods::PaymentMethodsData; use api_models::{ payment_methods::PaymentMethodDataWalletInfo, payments::ConnectorMandateReferenceId, @@ -77,10 +74,7 @@ pub struct SavePaymentMethodDataResponse { pub payment_method_status: Option, pub connector_mandate_reference_id: Option, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn save_payment_method( @@ -811,8 +805,7 @@ where } } -// check in review -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn save_payment_method( @@ -907,10 +900,7 @@ pub async fn pre_payment_tokenization( } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] async fn skip_saving_card_in_locker( merchant_context: &domain::MerchantContext, payment_method_request: api::PaymentMethodCreate, @@ -999,7 +989,7 @@ async fn skip_saving_card_in_locker( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] async fn skip_saving_card_in_locker( merchant_context: &domain::MerchantContext, payment_method_request: api::PaymentMethodCreate, @@ -1010,10 +1000,7 @@ async fn skip_saving_card_in_locker( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn save_in_locker( state: &SessionState, merchant_context: &domain::MerchantContext, @@ -1064,7 +1051,7 @@ pub async fn save_in_locker( } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn save_in_locker( _state: &SessionState, _merchant_context: &domain::MerchantContext, @@ -1076,7 +1063,7 @@ pub async fn save_in_locker( todo!() } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn save_network_token_in_locker( _state: &SessionState, _merchant_context: &domain::MerchantContext, @@ -1090,10 +1077,7 @@ pub async fn save_network_token_in_locker( todo!() } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn save_network_token_in_locker( state: &SessionState, merchant_context: &domain::MerchantContext, @@ -1470,7 +1454,7 @@ pub fn update_connector_mandate_details_status( })) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn add_token_for_payment_method( router_data: &mut types::RouterData< api::PaymentMethodToken, diff --git a/crates/router/src/core/payments/transformers.rs b/crates/router/src/core/payments/transformers.rs index 0cf6e85e42..042fb6ba94 100644 --- a/crates/router/src/core/payments/transformers.rs +++ b/crates/router/src/core/payments/transformers.rs @@ -1080,7 +1080,7 @@ pub async fn construct_payment_router_data_for_setup_mandate<'a>( Ok(router_data) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn construct_payment_router_data<'a, F, T>( @@ -1279,7 +1279,7 @@ where Ok(router_data) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all)] #[allow(clippy::too_many_arguments)] pub async fn construct_payment_router_data_for_update_metadata<'a>( @@ -2213,7 +2213,7 @@ where Op: Debug, D: OperationSessionGetters, { - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] fn generate_response( _data: D, @@ -2229,7 +2229,7 @@ where todo!() } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] fn generate_response( payment_data: D, @@ -2287,7 +2287,7 @@ where } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all)] // try to use router data here so that already validated things , we don't want to repeat the validations. // Add internal value not found and external value not found so that we can give 500 / Internal server error for internal value not found @@ -2311,7 +2311,7 @@ where todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all)] // try to use router data here so that already validated things , we don't want to repeat the validations. // Add internal value not found and external value not found so that we can give 500 / Internal server error for internal value not found @@ -3406,7 +3406,7 @@ where customer_data: &'a Option, } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl TryFrom> for types::PaymentsAuthorizeData { type Error = error_stack::Report; @@ -3426,7 +3426,7 @@ fn get_off_session( } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl TryFrom> for types::PaymentsAuthorizeData { type Error = error_stack::Report; diff --git a/crates/router/src/core/payout_link.rs b/crates/router/src/core/payout_link.rs index 06edca897d..8c23488963 100644 --- a/crates/router/src/core/payout_link.rs +++ b/crates/router/src/core/payout_link.rs @@ -24,7 +24,7 @@ use crate::{ types::{api, domain, transformers::ForeignFrom}, }; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn initiate_payout_link( _state: SessionState, _merchant_context: domain::MerchantContext, @@ -35,7 +35,7 @@ pub async fn initiate_payout_link( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn initiate_payout_link( state: SessionState, merchant_context: domain::MerchantContext, diff --git a/crates/router/src/core/payouts.rs b/crates/router/src/core/payouts.rs index 04b3e05d1e..64c5ced78b 100644 --- a/crates/router/src/core/payouts.rs +++ b/crates/router/src/core/payouts.rs @@ -725,7 +725,7 @@ pub async fn payouts_fulfill_core( response_handler(&state, &merchant_context, &payout_data).await } -#[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))] +#[cfg(all(feature = "olap", feature = "v2"))] pub async fn payouts_list_core( _state: SessionState, _merchant_context: domain::MerchantContext, @@ -735,11 +735,7 @@ pub async fn payouts_list_core( todo!() } -#[cfg(all( - feature = "olap", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "olap", feature = "v1"))] pub async fn payouts_list_core( state: SessionState, merchant_context: domain::MerchantContext, @@ -773,7 +769,7 @@ pub async fn payouts_list_core( { Ok(payout_attempt) => { let domain_customer = match payout.customer_id.clone() { - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] Some(customer_id) => db .find_customer_by_customer_id_merchant_id( &(&state).into(), @@ -1158,7 +1154,7 @@ pub async fn complete_create_recipient( Ok(()) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn create_recipient( state: &SessionState, merchant_context: &domain::MerchantContext, @@ -1222,10 +1218,7 @@ pub async fn create_recipient( ) .await { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") - ))] + #[cfg(feature = "v1")] { let customer_id = customer.customer_id.to_owned(); payout_data.customer_details = Some( @@ -1244,7 +1237,7 @@ pub async fn create_recipient( ); } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] { let customer_id = customer.get_id().clone(); payout_data.customer_details = Some( @@ -1358,7 +1351,7 @@ pub async fn create_recipient( Ok(()) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn create_recipient( state: &SessionState, merchant_context: &domain::MerchantContext, @@ -2103,13 +2096,10 @@ pub async fn create_recipient_disburse_account( if let Some(pm_method) = payout_data.payment_method.clone() { let pm_update = diesel_models::PaymentMethodUpdate::ConnectorMandateDetailsUpdate { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] connector_mandate_details: Some(connector_mandate_details_value), - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] connector_mandate_details: Some(common_connector_mandate), }; @@ -2126,10 +2116,10 @@ pub async fn create_recipient_disburse_account( .attach_printable("Unable to find payment method")?, ); } else { - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] let customer_id = Some(customer_details.customer_id); - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] let customer_id = customer_details.merchant_reference_id; if let Some(customer_id) = customer_id { @@ -2501,15 +2491,12 @@ pub async fn response_handler( let payouts = payout_data.payouts.to_owned(); let payout_method_id: Option = payout_data.payment_method.as_ref().map(|pm| { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] { pm.payment_method_id.clone() } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] { pm.id.clone().get_string_repr().to_string() } @@ -2591,7 +2578,7 @@ pub async fn response_handler( Ok(services::ApplicationResponse::Json(response)) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[allow(clippy::too_many_arguments)] pub async fn payout_create_db_entries( _state: &SessionState, @@ -2608,7 +2595,7 @@ pub async fn payout_create_db_entries( } // DB entries -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn payout_create_db_entries( state: &SessionState, @@ -2818,7 +2805,7 @@ pub async fn payout_create_db_entries( }) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn make_payout_data( _state: &SessionState, _merchant_context: &domain::MerchantContext, @@ -2829,7 +2816,7 @@ pub async fn make_payout_data( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn make_payout_data( state: &SessionState, merchant_context: &domain::MerchantContext, diff --git a/crates/router/src/core/payouts/helpers.rs b/crates/router/src/core/payouts/helpers.rs index 7810716176..743b5330fa 100644 --- a/crates/router/src/core/payouts/helpers.rs +++ b/crates/router/src/core/payouts/helpers.rs @@ -11,7 +11,7 @@ use common_utils::{ MinorUnit, UnifiedCode, UnifiedMessage, }, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use common_utils::{generate_customer_id_of_default_length, types::keymanager::ToEncryptable}; use error_stack::{report, ResultExt}; use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation}; @@ -222,10 +222,7 @@ pub fn should_create_connector_transfer_method( Ok(connector_transfer_method_id) } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub async fn save_payout_data_to_locker( state: &SessionState, payout_data: &mut PayoutData, @@ -694,7 +691,7 @@ pub async fn save_payout_data_to_locker( Ok(()) } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub async fn save_payout_data_to_locker( _state: &SessionState, _payout_data: &mut PayoutData, @@ -706,7 +703,7 @@ pub async fn save_payout_data_to_locker( todo!() } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub(super) async fn get_or_create_customer_details( _state: &SessionState, _customer_details: &CustomerDetails, @@ -715,7 +712,7 @@ pub(super) async fn get_or_create_customer_details( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub(super) async fn get_or_create_customer_details( state: &SessionState, customer_details: &CustomerDetails, @@ -998,7 +995,7 @@ pub async fn get_default_payout_connector( )) } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub fn should_call_payout_connector_create_customer<'a>( state: &'a SessionState, connector: &'a api::ConnectorData, @@ -1028,7 +1025,7 @@ pub fn should_call_payout_connector_create_customer<'a>( } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub fn should_call_payout_connector_create_customer<'a>( state: &'a SessionState, connector: &'a api::ConnectorData, @@ -1179,7 +1176,7 @@ pub(super) async fn filter_by_constraints( Ok(result) } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn update_payouts_and_payout_attempt( _payout_data: &mut PayoutData, _merchant_context: &domain::MerchantContext, @@ -1189,7 +1186,7 @@ pub async fn update_payouts_and_payout_attempt( todo!() } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn update_payouts_and_payout_attempt( payout_data: &mut PayoutData, merchant_context: &domain::MerchantContext, diff --git a/crates/router/src/core/payouts/transformers.rs b/crates/router/src/core/payouts/transformers.rs index cb55f4629d..a1c92ec3b2 100644 --- a/crates/router/src/core/payouts/transformers.rs +++ b/crates/router/src/core/payouts/transformers.rs @@ -2,11 +2,7 @@ use std::collections::HashMap; use common_utils::link_utils::EnabledPaymentMethod; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - feature = "olap" -))] +#[cfg(all(feature = "v1", feature = "olap"))] use crate::types::transformers::ForeignInto; #[cfg(feature = "olap")] use crate::types::{api::payments, domain, storage}; @@ -15,7 +11,7 @@ use crate::{ types::{api, transformers::ForeignFrom}, }; -#[cfg(all(feature = "v2", feature = "customer_v2", feature = "olap"))] +#[cfg(all(feature = "v2", feature = "olap"))] impl ForeignFrom<( storage::Payouts, @@ -36,11 +32,7 @@ impl } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - feature = "olap" -))] +#[cfg(all(feature = "v1", feature = "olap"))] impl ForeignFrom<( storage::Payouts, diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs index 9fbd50c3fc..35c4599dbc 100644 --- a/crates/router/src/core/payouts/validator.rs +++ b/crates/router/src/core/payouts/validator.rs @@ -11,11 +11,7 @@ use router_env::{instrument, tracing, which as router_env_which, Env}; use url::Url; use super::helpers; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] use crate::core::payment_methods::cards::get_pm_list_context; use crate::{ core::{ @@ -54,7 +50,7 @@ pub async fn validate_uniqueness_of_payout_id_against_merchant_id( } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub async fn validate_create_request( _state: &SessionState, _merchant_context: &domain::MerchantContext, @@ -73,7 +69,7 @@ pub async fn validate_create_request( /// - merchant_id passed is same as the one in merchant_account table /// - payout_id is unique against merchant_id /// - payout_token provided is legitimate -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] pub async fn validate_create_request( state: &SessionState, merchant_context: &domain::MerchantContext, diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs index 0d89e839c7..0ed160784c 100644 --- a/crates/router/src/core/pm_auth.rs +++ b/crates/router/src/core/pm_auth.rs @@ -339,10 +339,6 @@ async fn store_bank_details_in_payment_methods( .customer_id .ok_or(ApiErrorResponse::CustomerNotFound)?; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] let payment_methods = db .find_payment_method_by_customer_id_merchant_id_list( &((&state).into()), @@ -354,20 +350,6 @@ async fn store_bank_details_in_payment_methods( .await .change_context(ApiErrorResponse::InternalServerError)?; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] - let payment_methods = db - .find_payment_method_by_customer_id_merchant_id_status( - &((&state).into()), - merchant_context.get_merchant_key_store(), - &customer_id, - merchant_context.get_merchant_account().get_id(), - common_enums::enums::PaymentMethodStatus::Active, - None, - merchant_context.get_merchant_account().storage_scheme, - ) - .await - .change_context(ApiErrorResponse::InternalServerError)?; - let mut hash_to_payment_method: HashMap< String, ( @@ -508,22 +490,10 @@ async fn store_bank_details_in_payment_methods( .change_context(ApiErrorResponse::InternalServerError) .attach_printable("Unable to encrypt customer details")?; - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] let pm_id = generate_id(consts::ID_LENGTH, "pm"); - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] - let pm_id = common_utils::id_type::GlobalPaymentMethodId::generate("random_cell_id") - .change_context(errors::ApiErrorResponse::InternalServerError) - .attach_printable("Unable to generate GlobalPaymentMethodId")?; - let now = common_utils::date_time::now(); - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + let pm_new = domain::PaymentMethod { customer_id: customer_id.clone(), merchant_id: merchant_context.get_merchant_account().get_id().clone(), @@ -561,33 +531,6 @@ async fn store_bank_details_in_payment_methods( network_token_payment_method_data: None, }; - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] - let pm_new = domain::PaymentMethod { - customer_id: customer_id.clone(), - merchant_id: merchant_context.get_merchant_account().get_id().clone(), - id: pm_id, - payment_method_type: Some(enums::PaymentMethod::BankDebit), - payment_method_subtype: Some(creds.payment_method_type), - status: enums::PaymentMethodStatus::Active, - metadata: None, - payment_method_data: Some(encrypted_data.into()), - created_at: now, - last_modified: now, - locker_id: None, - last_used_at: now, - connector_mandate_details: None, - customer_acceptance: None, - network_transaction_id: None, - client_secret: None, - payment_method_billing_address: None, - updated_by: None, - locker_fingerprint_id: None, - version: common_types::consts::API_VERSION, - network_token_requestor_reference_id: None, - network_token_locker_id: None, - network_token_payment_method_data: None, - }; - new_entries.push(pm_new); }; } diff --git a/crates/router/src/core/unified_authentication_service.rs b/crates/router/src/core/unified_authentication_service.rs index 3820d8d7ed..ff94c56f7b 100644 --- a/crates/router/src/core/unified_authentication_service.rs +++ b/crates/router/src/core/unified_authentication_service.rs @@ -472,10 +472,7 @@ impl UnifiedAuthenticationService for ExternalAuthentication } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[allow(clippy::too_many_arguments)] pub async fn create_new_authentication( state: &SessionState, diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs index 246b9eed3e..d2713e0f18 100644 --- a/crates/router/src/core/utils.rs +++ b/crates/router/src/core/utils.rs @@ -21,7 +21,7 @@ use hyperswitch_domain_models::{ merchant_connector_account::MerchantConnectorAccount, payment_address::PaymentAddress, router_data::ErrorResponse, router_request_types, types::OrderDetailsWithAmount, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::{ router_data_v2::flow_common_types::VaultConnectorFlowData, types::VaultRouterDataV2, }; @@ -40,7 +40,7 @@ use super::payments::helpers; use super::payouts::{helpers as payout_helpers, PayoutData}; #[cfg(feature = "payouts")] use crate::core::payments; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::core::payments::helpers as payment_helpers; use crate::{ configs::Settings, @@ -66,7 +66,7 @@ pub const IRRELEVANT_CONNECTOR_REQUEST_REFERENCE_ID_IN_PAYOUTS_FLOW: &str = "irrelevant_connector_request_reference_id_in_payouts_flow"; const IRRELEVANT_ATTEMPT_ID_IN_DISPUTE_FLOW: &str = "irrelevant_attempt_id_in_dispute_flow"; -#[cfg(all(feature = "payouts", feature = "v2", feature = "customer_v2"))] +#[cfg(all(feature = "payouts", feature = "v2"))] #[instrument(skip_all)] pub async fn construct_payout_router_data<'a, F>( _state: &SessionState, @@ -77,11 +77,7 @@ pub async fn construct_payout_router_data<'a, F>( todo!() } -#[cfg(all( - feature = "payouts", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "payouts", feature = "v1"))] #[instrument(skip_all)] pub async fn construct_payout_router_data<'a, F>( state: &SessionState, @@ -2038,7 +2034,7 @@ pub(crate) fn validate_profile_id_from_auth_layer( state: &SessionState, merchant_account: &domain::MerchantAccount, diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs index e7136919ce..1d20c7b27c 100644 --- a/crates/router/src/db/kafka_store.rs +++ b/crates/router/src/db/kafka_store.rs @@ -373,7 +373,7 @@ impl ConfigInterface for KafkaStore { #[async_trait::async_trait] impl CustomerInterface for KafkaStore { type Error = errors::StorageError; - #[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, @@ -384,7 +384,7 @@ impl CustomerInterface for KafkaStore { .await } - #[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, @@ -404,7 +404,7 @@ impl CustomerInterface for KafkaStore { .await } - #[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, @@ -424,7 +424,7 @@ impl CustomerInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_optional_by_merchant_id_merchant_reference_id( &self, state: &KeyManagerState, @@ -444,7 +444,7 @@ impl CustomerInterface for KafkaStore { .await } - #[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] + #[cfg(feature = "v1")] async fn update_customer_by_customer_id_merchant_id( &self, state: &KeyManagerState, @@ -468,7 +468,7 @@ impl CustomerInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn update_customer_by_global_id( &self, state: &KeyManagerState, @@ -504,7 +504,7 @@ impl CustomerInterface for KafkaStore { .await } - #[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, @@ -524,7 +524,7 @@ impl CustomerInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_customer_by_merchant_reference_id_merchant_id( &self, state: &KeyManagerState, @@ -544,7 +544,7 @@ impl CustomerInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_customer_by_global_id( &self, state: &KeyManagerState, @@ -946,7 +946,7 @@ impl MandateInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_mandate_by_global_customer_id( &self, id: &id_type::GlobalCustomerId, @@ -2100,10 +2100,7 @@ impl PaymentIntentInterface for KafkaStore { #[async_trait::async_trait] impl PaymentMethodInterface for KafkaStore { type Error = errors::StorageError; - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn find_payment_method( &self, state: &KeyManagerState, @@ -2116,7 +2113,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method( &self, state: &KeyManagerState, @@ -2129,10 +2126,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[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, @@ -2152,7 +2146,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method_list_by_global_customer_id( &self, state: &KeyManagerState, @@ -2165,10 +2159,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[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, @@ -2192,7 +2183,7 @@ impl PaymentMethodInterface for KafkaStore { .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, @@ -2216,10 +2207,7 @@ impl PaymentMethodInterface for KafkaStore { .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, @@ -2245,10 +2233,7 @@ impl PaymentMethodInterface for KafkaStore { .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, @@ -2292,10 +2277,7 @@ impl PaymentMethodInterface for KafkaStore { .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, @@ -2313,7 +2295,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn delete_payment_method( &self, state: &KeyManagerState, @@ -2325,7 +2307,7 @@ impl PaymentMethodInterface for KafkaStore { .await } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] async fn find_payment_method_by_fingerprint_id( &self, state: &KeyManagerState, diff --git a/crates/router/src/db/mandate.rs b/crates/router/src/db/mandate.rs index 236c1d526a..1eb0357ab0 100644 --- a/crates/router/src/db/mandate.rs +++ b/crates/router/src/db/mandate.rs @@ -29,7 +29,7 @@ pub trait MandateInterface { ) -> CustomResult, errors::StorageError>; // Fix this function once we move to mandate v2 - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_mandate_by_global_customer_id( &self, id: &id_type::GlobalCustomerId, @@ -199,7 +199,7 @@ mod storage { .map_err(|error| report!(errors::StorageError::from(error))) } - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[instrument(skip_all)] async fn find_mandate_by_global_customer_id( &self, @@ -457,7 +457,7 @@ mod storage { } // Need to fix this once we start moving to mandate v2 - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] #[instrument(skip_all)] async fn find_mandate_by_global_customer_id( &self, @@ -571,7 +571,7 @@ impl MandateInterface for MockDb { } // Need to fix this once we move to v2 mandate - #[cfg(all(feature = "v2", feature = "customer_v2"))] + #[cfg(feature = "v2")] async fn find_mandate_by_global_customer_id( &self, id: &id_type::GlobalCustomerId, diff --git a/crates/router/src/lib.rs b/crates/router/src/lib.rs index 6a048c59b0..94e98cda24 100644 --- a/crates/router/src/lib.rs +++ b/crates/router/src/lib.rs @@ -176,11 +176,7 @@ pub fn mk_app( { server_app = server_app.service(routes::EphemeralKey::server(state.clone())) } - #[cfg(all( - feature = "oltp", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") - ))] + #[cfg(all(feature = "oltp", feature = "v1"))] { server_app = server_app.service(routes::Poll::server(state.clone())) } @@ -223,18 +219,14 @@ pub fn mk_app( .service(routes::PayoutLink::server(state.clone())); } - #[cfg(all( - feature = "stripe", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") - ))] + #[cfg(all(feature = "stripe", feature = "v1"))] { server_app = server_app .service(routes::StripeApis::server(state.clone())) .service(routes::Cards::server(state.clone())); } - #[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))] + #[cfg(all(feature = "oltp", feature = "v2"))] { server_app = server_app.service(routes::Proxy::server(state.clone())); } diff --git a/crates/router/src/routes.rs b/crates/router/src/routes.rs index 35221104ae..de32c7b01b 100644 --- a/crates/router/src/routes.rs +++ b/crates/router/src/routes.rs @@ -71,14 +71,14 @@ pub mod relay; #[cfg(feature = "olap")] pub mod process_tracker; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub mod proxy; #[cfg(feature = "dummy_connector")] pub use self::app::DummyConnector; #[cfg(feature = "v2")] pub use self::app::PaymentMethodSession; -#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))] +#[cfg(all(feature = "oltp", feature = "v2"))] pub use self::app::Proxy; #[cfg(all(feature = "olap", feature = "recon", feature = "v1"))] pub use self::app::Recon; @@ -95,11 +95,7 @@ pub use self::app::{ pub use self::app::{Blocklist, Organization, Routing, Verify, WebhookEvents}; #[cfg(feature = "payouts")] pub use self::app::{PayoutLink, Payouts}; -#[cfg(all( - feature = "stripe", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "stripe", feature = "v1"))] pub use super::compatibility::stripe::StripeApis; #[cfg(feature = "olap")] pub use crate::analytics::routes::{self as analytics, Analytics}; diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs index 0a6c39447f..a22d71a5d6 100644 --- a/crates/router/src/routes/app.rs +++ b/crates/router/src/routes/app.rs @@ -39,15 +39,11 @@ use super::payment_methods; use super::payout_link::*; #[cfg(feature = "payouts")] use super::payouts::*; -#[cfg(all( - feature = "oltp", - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "oltp", feature = "v1"))] use super::pm_auth; #[cfg(feature = "oltp")] use super::poll; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use super::proxy; #[cfg(all(feature = "v2", feature = "revenue_recovery", feature = "oltp"))] use super::recovery_webhooks::*; @@ -603,11 +599,7 @@ impl DummyConnector { pub struct Payments; -#[cfg(all( - any(feature = "olap", feature = "oltp"), - feature = "v2", - feature = "payment_methods_v2", -))] +#[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v2"))] impl Payments { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/v2/payments").app_data(web::Data::new(state)); @@ -696,10 +688,10 @@ impl Relay { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub struct Proxy; -#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2"))] +#[cfg(all(feature = "oltp", feature = "v2"))] impl Proxy { pub fn server(state: AppState) -> Scope { web::scope("/proxy") @@ -1076,15 +1068,11 @@ impl Routing { pub struct Customers; -#[cfg(all( - feature = "v2", - feature = "customer_v2", - any(feature = "olap", feature = "oltp") -))] +#[cfg(all(feature = "v2", any(feature = "olap", feature = "oltp")))] impl Customers { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/v2/customers").app_data(web::Data::new(state)); - #[cfg(all(feature = "olap", feature = "v2", feature = "customer_v2"))] + #[cfg(all(feature = "olap", feature = "v2"))] { route = route .service(web::resource("/list").route(web::get().to(customers::customers_list))) @@ -1093,7 +1081,7 @@ impl Customers { .route(web::get().to(payment_methods::get_total_payment_method_count)), ) } - #[cfg(all(feature = "oltp", feature = "v2", feature = "customer_v2"))] + #[cfg(all(feature = "oltp", feature = "v2"))] { route = route .service(web::resource("").route(web::post().to(customers::customers_create))) @@ -1112,12 +1100,7 @@ impl Customers { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - not(feature = "payment_methods_v2"), - any(feature = "olap", feature = "oltp") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] impl Customers { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/customers").app_data(web::Data::new(state)); @@ -1276,7 +1259,7 @@ impl Payouts { } } -#[cfg(all(feature = "oltp", feature = "v2", feature = "payment_methods_v2",))] +#[cfg(all(feature = "oltp", feature = "v2"))] impl PaymentMethods { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/v2/payment-methods").app_data(web::Data::new(state)); @@ -1314,11 +1297,7 @@ impl PaymentMethods { } pub struct PaymentMethods; -#[cfg(all( - any(feature = "v1", feature = "v2"), - any(feature = "olap", feature = "oltp"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] impl PaymentMethods { pub fn server(state: AppState) -> Scope { let mut route = web::scope("/payment_methods").app_data(web::Data::new(state)); @@ -1667,11 +1646,7 @@ impl MerchantConnectorAccount { pub struct EphemeralKey; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "customer_v2"), - feature = "oltp" -))] +#[cfg(all(feature = "v1", feature = "oltp"))] impl EphemeralKey { pub fn server(config: AppState) -> Scope { web::scope("/ephemeral_keys") diff --git a/crates/router/src/routes/cards_info.rs b/crates/router/src/routes/cards_info.rs index 6e878f27c0..d65b06e182 100644 --- a/crates/router/src/routes/cards_info.rs +++ b/crates/router/src/routes/cards_info.rs @@ -105,10 +105,7 @@ pub async fn update_cards_info( .await } -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] #[instrument(skip_all, fields(flow = ?Flow::CardsInfoMigrate))] pub async fn migrate_cards_info( state: web::Data, diff --git a/crates/router/src/routes/customers.rs b/crates/router/src/routes/customers.rs index e7284e283a..ce5d007fcd 100644 --- a/crates/router/src/routes/customers.rs +++ b/crates/router/src/routes/customers.rs @@ -8,7 +8,7 @@ use crate::{ services::{api, authentication as auth, authorization::permissions::Permission}, types::{api::customers, domain}, }; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::CustomersCreate))] pub async fn customers_create( state: web::Data, @@ -41,7 +41,7 @@ pub async fn customers_create( )) .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersCreate))] pub async fn customers_create( state: web::Data, @@ -75,7 +75,7 @@ pub async fn customers_create( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersRetrieve))] pub async fn customers_retrieve( state: web::Data, @@ -115,7 +115,7 @@ pub async fn customers_retrieve( .await } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::CustomersRetrieve))] pub async fn customers_retrieve( state: web::Data, @@ -162,7 +162,7 @@ pub async fn customers_retrieve( )) .await } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::CustomersList))] pub async fn customers_list( state: web::Data, @@ -200,7 +200,7 @@ pub async fn customers_list( )) .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersList))] pub async fn customers_list( state: web::Data, @@ -239,7 +239,7 @@ pub async fn customers_list( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersUpdate))] pub async fn customers_update( state: web::Data, @@ -281,7 +281,7 @@ pub async fn customers_update( .await } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::CustomersUpdate))] pub async fn customers_update( state: web::Data, @@ -320,7 +320,7 @@ pub async fn customers_update( .await } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::CustomersDelete))] pub async fn customers_delete( state: web::Data, @@ -356,7 +356,7 @@ pub async fn customers_delete( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersDelete))] pub async fn customers_delete( state: web::Data, @@ -392,7 +392,7 @@ pub async fn customers_delete( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::CustomersGetMandates))] pub async fn get_customer_mandates( state: web::Data, diff --git a/crates/router/src/routes/ephemeral_key.rs b/crates/router/src/routes/ephemeral_key.rs index 3ff3b4dde9..8c149f95f4 100644 --- a/crates/router/src/routes/ephemeral_key.rs +++ b/crates/router/src/routes/ephemeral_key.rs @@ -9,7 +9,7 @@ use crate::{ services::{api, authentication as auth}, }; -#[cfg(all(feature = "v1", not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::EphemeralKeyCreate))] pub async fn ephemeral_key_create( state: web::Data, diff --git a/crates/router/src/routes/payment_methods.rs b/crates/router/src/routes/payment_methods.rs index 1e8969d372..3288a912ad 100644 --- a/crates/router/src/routes/payment_methods.rs +++ b/crates/router/src/routes/payment_methods.rs @@ -2,10 +2,7 @@ use ::payment_methods::{ controller::PaymentMethodsController, core::{migration, migration::payment_methods::migrate_payment_method}, }; -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - all(not(feature = "customer_v2"), not(feature = "payment_methods_v2")) -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] use actix_multipart::form::MultipartForm; use actix_web::{web, HttpRequest, HttpResponse}; use common_utils::{errors::CustomResult, id_type, transformers::ForeignFrom}; @@ -30,19 +27,13 @@ use crate::{ storage::payment_method::PaymentTokenData, }, }; -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] use crate::{ core::{customers, payment_methods::tokenize}, types::api::customers::CustomerRequest, }; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsCreate))] pub async fn create_payment_method_api( state: web::Data, @@ -76,7 +67,7 @@ pub async fn create_payment_method_api( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsCreate))] pub async fn create_payment_method_api( state: web::Data, @@ -112,7 +103,7 @@ pub async fn create_payment_method_api( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsCreate))] pub async fn create_payment_method_intent_api( state: web::Data, @@ -147,21 +138,21 @@ pub async fn create_payment_method_intent_api( } /// This struct is used internally only -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize, Clone)] pub struct PaymentMethodIntentConfirmInternal { pub id: id_type::GlobalPaymentMethodId, pub request: payment_methods::PaymentMethodIntentConfirm, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for payment_methods::PaymentMethodIntentConfirm { fn from(item: PaymentMethodIntentConfirmInternal) -> Self { item.request } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl common_utils::events::ApiEventMetric for PaymentMethodIntentConfirmInternal { fn get_api_event_type(&self) -> Option { Some(common_utils::events::ApiEventsType::PaymentMethod { @@ -172,7 +163,7 @@ impl common_utils::events::ApiEventMetric for PaymentMethodIntentConfirmInternal } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsUpdate))] pub async fn payment_method_update_api( state: web::Data, @@ -210,7 +201,7 @@ pub async fn payment_method_update_api( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsRetrieve))] pub async fn payment_method_retrieve_api( state: web::Data, @@ -243,7 +234,7 @@ pub async fn payment_method_retrieve_api( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsDelete))] pub async fn payment_method_delete_api( state: web::Data, @@ -335,10 +326,7 @@ async fn get_merchant_account( Ok((key_store, merchant_account)) } -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "customer_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsMigrate))] pub async fn migrate_payment_methods( state: web::Data, @@ -399,10 +387,7 @@ pub async fn migrate_payment_methods( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSave))] pub async fn save_payment_method_api( state: web::Data, @@ -478,11 +463,7 @@ pub async fn list_payment_method_api( .await } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] /// List payment methods for a Customer /// /// To filter and list the applicable payment methods for a particular Customer ID @@ -545,11 +526,7 @@ pub async fn list_customer_payment_method_api( .await } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2"), - not(feature = "customer_v2") -))] +#[cfg(feature = "v1")] /// List payment methods for a Customer /// /// To filter and list the applicable payment methods for a particular Customer ID @@ -765,7 +742,7 @@ pub async fn get_total_payment_method_count( .await } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] /// Generate a form link for collecting payment methods for a customer #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodCollectLink))] pub async fn render_pm_collect_link( @@ -796,10 +773,7 @@ pub async fn render_pm_collect_link( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsRetrieve))] pub async fn payment_method_retrieve_api( state: web::Data, @@ -837,10 +811,7 @@ pub async fn payment_method_retrieve_api( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsUpdate))] pub async fn payment_method_update_api( state: web::Data, @@ -876,10 +847,7 @@ pub async fn payment_method_update_api( .await } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsDelete))] pub async fn payment_method_delete_api( state: web::Data, @@ -1110,10 +1078,7 @@ impl ParentPaymentMethodToken { } } -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "payment_methods_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] #[instrument(skip_all, fields(flow = ?Flow::TokenizeCard))] pub async fn tokenize_card_api( state: web::Data, @@ -1147,10 +1112,7 @@ pub async fn tokenize_card_api( .await } -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "payment_methods_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] #[instrument(skip_all, fields(flow = ?Flow::TokenizeCardUsingPaymentMethodId))] pub async fn tokenize_card_using_pm_api( state: web::Data, @@ -1196,10 +1158,7 @@ pub async fn tokenize_card_using_pm_api( .await } -#[cfg(all( - any(feature = "v1", feature = "v2", feature = "olap", feature = "oltp"), - not(feature = "payment_methods_v2") -))] +#[cfg(all(feature = "v1", any(feature = "olap", feature = "oltp")))] #[instrument(skip_all, fields(flow = ?Flow::TokenizeCardBatch))] pub async fn tokenize_card_batch_api( state: web::Data, @@ -1348,7 +1307,7 @@ pub async fn payment_methods_session_retrieve( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] pub async fn payment_method_session_list_payment_methods( state: web::Data, @@ -1403,7 +1362,7 @@ impl common_utils::events::ApiEventMetric } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSessionConfirm))] pub async fn payment_method_session_confirm( state: web::Data, @@ -1448,7 +1407,7 @@ pub async fn payment_method_session_confirm( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSessionUpdateSavedPaymentMethod))] pub async fn payment_method_session_update_saved_payment_method( state: web::Data, @@ -1494,7 +1453,7 @@ pub async fn payment_method_session_update_saved_payment_method( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodSessionUpdateSavedPaymentMethod))] pub async fn payment_method_session_delete_saved_payment_method( state: web::Data, diff --git a/crates/router/src/routes/payments.rs b/crates/router/src/routes/payments.rs index 25f916dc8a..90105032cc 100644 --- a/crates/router/src/routes/payments.rs +++ b/crates/router/src/routes/payments.rs @@ -3121,7 +3121,7 @@ pub async fn payments_capture( .await } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[instrument(skip_all, fields(flow = ?Flow::PaymentMethodsList))] pub async fn list_payment_methods( state: web::Data, diff --git a/crates/router/src/services/authentication.rs b/crates/router/src/services/authentication.rs index ad854405a9..41b7bd3d87 100644 --- a/crates/router/src/services/authentication.rs +++ b/crates/router/src/services/authentication.rs @@ -1,12 +1,9 @@ use std::str::FromStr; use actix_web::http::header::HeaderMap; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use api_models::payment_methods::PaymentMethodCreate; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use api_models::payment_methods::PaymentMethodIntentConfirm; #[cfg(feature = "payouts")] use api_models::payouts; @@ -4165,10 +4162,7 @@ impl ClientSecretFetch for payments::PaymentsPostSessionTokensRequest { } } -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl ClientSecretFetch for PaymentMethodCreate { fn get_client_secret(&self) -> Option<&String> { self.client_secret.as_ref() diff --git a/crates/router/src/types/api.rs b/crates/router/src/types/api.rs index dbb24e3cb0..ce12ba9844 100644 --- a/crates/router/src/types/api.rs +++ b/crates/router/src/types/api.rs @@ -298,7 +298,7 @@ impl ConnectorData { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn get_external_vault_connector_by_name( _connectors: &Connectors, connector: &api_enums::Connector, diff --git a/crates/router/src/types/api/customers.rs b/crates/router/src/types/api/customers.rs index 63ebfe4993..5e60acf160 100644 --- a/crates/router/src/types/api/customers.rs +++ b/crates/router/src/types/api/customers.rs @@ -3,11 +3,11 @@ pub use api_models::customers::{ CustomerDeleteResponse, CustomerListRequest, CustomerRequest, CustomerUpdateRequest, CustomerUpdateRequestInternal, }; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::customer; use serde::Serialize; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use super::payments; use crate::{ newtype, @@ -25,7 +25,7 @@ impl common_utils::events::ApiEventMetric for CustomerResponse { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ForeignFrom<(domain::Customer, Option)> for CustomerResponse { fn foreign_from((cust, address): (domain::Customer, Option)) -> Self { customers::CustomerResponse { @@ -44,7 +44,7 @@ impl ForeignFrom<(domain::Customer, Option)> for Custo } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ForeignFrom for CustomerResponse { fn foreign_from(cust: domain::Customer) -> Self { customers::CustomerResponse { diff --git a/crates/router/src/types/api/mandates.rs b/crates/router/src/types/api/mandates.rs index 1ad9731bc1..e3cb8cf535 100644 --- a/crates/router/src/types/api/mandates.rs +++ b/crates/router/src/types/api/mandates.rs @@ -33,10 +33,7 @@ pub(crate) trait MandateResponseExt: Sized { ) -> RouterResult; } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl MandateResponseExt for MandateResponse { async fn from_db_mandate( @@ -121,7 +118,7 @@ impl MandateResponseExt for MandateResponse { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[async_trait::async_trait] impl MandateResponseExt for MandateResponse { async fn from_db_mandate( @@ -134,10 +131,7 @@ impl MandateResponseExt for MandateResponse { } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl From for MandateCardDetails { fn from(card_details_from_locker: api::payment_methods::CardDetailFromLocker) -> Self { mandates::MandateCardDetails { @@ -159,7 +153,7 @@ impl From for MandateCardDetails { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl From for MandateCardDetails { fn from(card_details_from_locker: api::payment_methods::CardDetailFromLocker) -> Self { mandates::MandateCardDetails { diff --git a/crates/router/src/types/api/payment_methods.rs b/crates/router/src/types/api/payment_methods.rs index ecc3ec35ed..4c094af5ac 100644 --- a/crates/router/src/types/api/payment_methods.rs +++ b/crates/router/src/types/api/payment_methods.rs @@ -1,4 +1,4 @@ -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub use api_models::payment_methods::{ CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CardNetworkTokenizeRequest, CardNetworkTokenizeResponse, CardType, CustomerPaymentMethodResponseItem, @@ -14,10 +14,7 @@ pub use api_models::payment_methods::{ TokenizePayloadRequest, TokenizedCardValue1, TokenizedCardValue2, TokenizedWalletValue1, TokenizedWalletValue2, TotalPaymentMethodCountResponse, }; -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] pub use api_models::payment_methods::{ CardDetail, CardDetailFromLocker, CardDetailsPaymentMethod, CardNetworkTokenizeRequest, CardNetworkTokenizeResponse, CustomerPaymentMethod, CustomerPaymentMethodsListResponse, @@ -37,7 +34,7 @@ use crate::core::{ errors::{self, RouterResult}, payments::helpers::validate_payment_method_type_against_payment_method, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::utils; pub(crate) trait PaymentMethodCreateExt { @@ -45,10 +42,7 @@ pub(crate) trait PaymentMethodCreateExt { } // convert self.payment_method_type to payment_method and compare it against self.payment_method -#[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl PaymentMethodCreateExt for PaymentMethodCreate { fn validate(&self) -> RouterResult<()> { if let Some(pm) = self.payment_method { @@ -65,7 +59,7 @@ impl PaymentMethodCreateExt for PaymentMethodCreate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodCreateExt for PaymentMethodCreate { fn validate(&self) -> RouterResult<()> { utils::when( @@ -97,7 +91,7 @@ impl PaymentMethodCreateExt for PaymentMethodCreate { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodCreateExt for PaymentMethodIntentConfirm { fn validate(&self) -> RouterResult<()> { utils::when( diff --git a/crates/router/src/types/domain.rs b/crates/router/src/types/domain.rs index 1d1f0be637..3e94375b5e 100644 --- a/crates/router/src/types/domain.rs +++ b/crates/router/src/types/domain.rs @@ -51,7 +51,7 @@ pub mod authentication { pub use hyperswitch_domain_models::router_request_types::authentication::*; } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub mod vault { pub use hyperswitch_domain_models::vault::*; } @@ -81,5 +81,5 @@ pub use routing::*; #[cfg(feature = "olap")] pub use user::*; pub use user_key_store::*; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub use vault::*; diff --git a/crates/router/src/types/payment_methods.rs b/crates/router/src/types/payment_methods.rs index f05442ed45..29814ddcef 100644 --- a/crates/router/src/types/payment_methods.rs +++ b/crates/router/src/types/payment_methods.rs @@ -1,54 +1,47 @@ use std::fmt::Debug; use api_models::enums as api_enums; -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] use cards::CardNumber; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use cards::{CardNumber, NetworkToken}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_types::primitive_wrappers; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use common_utils::generate_id; use common_utils::id_type; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use hyperswitch_domain_models::payment_method_data::NetworkTokenDetails; use masking::Secret; use serde::{Deserialize, Serialize}; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] use crate::{ consts, types::{api, domain, storage}, }; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub trait VaultingInterface { fn get_vaulting_request_url() -> &'static str; fn get_vaulting_flow_name() -> &'static str; } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultFingerprintRequest { pub data: String, pub key: String, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultFingerprintResponse { pub fingerprint_id: String, } -#[cfg(any( - feature = "v2", - feature = "payment_methods_v2", - feature = "tokenization_v2" -))] +#[cfg(any(feature = "v2", feature = "tokenization_v2"))] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct AddVaultRequest { pub entity_id: id_type::MerchantId, @@ -57,7 +50,7 @@ pub struct AddVaultRequest { pub ttl: i64, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct AddVaultResponse { pub entity_id: Option, @@ -65,23 +58,23 @@ pub struct AddVaultResponse { pub fingerprint_id: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct AddVault; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct GetVaultFingerprint; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultRetrieve; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultDelete; -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl VaultingInterface for AddVault { fn get_vaulting_request_url() -> &'static str { consts::ADD_VAULT_REQUEST_URL @@ -92,7 +85,7 @@ impl VaultingInterface for AddVault { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl VaultingInterface for GetVaultFingerprint { fn get_vaulting_request_url() -> &'static str { consts::VAULT_FINGERPRINT_REQUEST_URL @@ -103,7 +96,7 @@ impl VaultingInterface for GetVaultFingerprint { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl VaultingInterface for VaultRetrieve { fn get_vaulting_request_url() -> &'static str { consts::VAULT_RETRIEVE_REQUEST_URL @@ -114,7 +107,7 @@ impl VaultingInterface for VaultRetrieve { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl VaultingInterface for VaultDelete { fn get_vaulting_request_url() -> &'static str { consts::VAULT_DELETE_REQUEST_URL @@ -125,7 +118,7 @@ impl VaultingInterface for VaultDelete { } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub struct SavedPMLPaymentsInfo { pub payment_intent: storage::PaymentIntent, pub profile: domain::Profile, @@ -134,37 +127,34 @@ pub struct SavedPMLPaymentsInfo { pub is_connector_agnostic_mit_enabled: bool, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultRetrieveRequest { pub entity_id: id_type::MerchantId, pub vault_id: domain::VaultId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultRetrieveResponse { pub data: domain::PaymentMethodVaultingData, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultDeleteRequest { pub entity_id: id_type::MerchantId, pub vault_id: domain::VaultId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, serde::Deserialize, serde::Serialize)] pub struct VaultDeleteResponse { pub entity_id: id_type::MerchantId, pub vault_id: domain::VaultId, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CardData { @@ -174,7 +164,7 @@ pub struct CardData { pub card_security_code: Option>, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CardData { @@ -185,10 +175,7 @@ pub struct CardData { pub card_security_code: Option>, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct OrderData { @@ -196,7 +183,7 @@ pub struct OrderData { pub customer_id: id_type::CustomerId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct OrderData { @@ -219,10 +206,7 @@ pub struct CardNetworkTokenResponse { pub payload: Secret, //encrypted payload } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct CardNetworkTokenResponsePayload { @@ -240,7 +224,7 @@ pub struct CardNetworkTokenResponsePayload { pub token_status: String, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GenerateNetworkTokenResponsePayload { @@ -258,17 +242,14 @@ pub struct GenerateNetworkTokenResponsePayload { pub token_status: String, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize)] pub struct GetCardToken { pub card_reference: String, pub customer_id: id_type::CustomerId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize)] pub struct GetCardToken { pub card_reference: String, @@ -306,17 +287,14 @@ pub struct TokenResponse { pub nickname: Option>, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize, Deserialize)] pub struct DeleteCardToken { pub card_reference: String, //network token requestor ref id pub customer_id: id_type::CustomerId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize, Deserialize)] pub struct DeleteCardToken { pub card_reference: String, //network token requestor ref id @@ -346,17 +324,14 @@ pub struct DeleteNetworkTokenResponse { pub status: DeleteNetworkTokenStatus, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Serialize, Deserialize)] pub struct CheckTokenStatus { pub card_reference: String, pub customer_id: id_type::CustomerId, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Serialize, Deserialize)] pub struct CheckTokenStatus { pub card_reference: String, diff --git a/crates/router/src/types/storage/customers.rs b/crates/router/src/types/storage/customers.rs index 507c219534..6533a658da 100644 --- a/crates/router/src/types/storage/customers.rs +++ b/crates/router/src/types/storage/customers.rs @@ -1,5 +1,5 @@ pub use diesel_models::customers::{Customer, CustomerNew, CustomerUpdateInternal}; -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] pub use crate::types::domain::CustomerGeneralUpdate; pub use crate::types::domain::CustomerUpdate; diff --git a/crates/router/src/types/storage/payment_method.rs b/crates/router/src/types/storage/payment_method.rs index ff12d890df..4f675c28c0 100644 --- a/crates/router/src/types/storage/payment_method.rs +++ b/crates/router/src/types/storage/payment_method.rs @@ -14,10 +14,7 @@ pub enum PaymentTokenKind { Permanent, } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct CardTokenData { pub payment_method_id: Option, @@ -26,7 +23,7 @@ pub struct CardTokenData { pub network_token_locker_id: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct CardTokenData { pub payment_method_id: common_utils::id_type::GlobalPaymentMethodId, @@ -67,7 +64,7 @@ pub enum PaymentTokenData { #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] #[serde(tag = "kind", rename_all = "snake_case")] -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] pub enum PaymentTokenData { TemporaryGeneric(GenericTokenData), PermanentCard(CardTokenData), @@ -75,10 +72,7 @@ pub enum PaymentTokenData { } impl PaymentTokenData { - #[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] pub fn permanent_card( payment_method_id: Option, locker_id: Option, @@ -93,7 +87,7 @@ impl PaymentTokenData { }) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn permanent_card( payment_method_id: common_utils::id_type::GlobalPaymentMethodId, locker_id: Option, @@ -120,16 +114,13 @@ impl PaymentTokenData { matches!(self, Self::PermanentCard(_) | Self::Permanent(_)) } - #[cfg(all(feature = "v2", feature = "payment_methods_v2"))] + #[cfg(feature = "v2")] pub fn is_permanent_card(&self) -> bool { matches!(self, Self::PermanentCard(_)) } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub struct PaymentMethodListContext { pub card_details: Option, @@ -138,7 +129,7 @@ pub struct PaymentMethodListContext { pub bank_transfer_details: Option, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)] pub enum PaymentMethodListContext { Card { @@ -159,7 +150,7 @@ pub enum PaymentMethodListContext { }, } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl PaymentMethodListContext { pub(crate) fn get_token_data(&self) -> Option { match self { diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs index 66dc405fdf..1f73db2c06 100644 --- a/crates/router/src/types/transformers.rs +++ b/crates/router/src/types/transformers.rs @@ -80,10 +80,7 @@ impl ForeignFrom for storage_enums::RefundType } } -#[cfg(all( - any(feature = "v1", feature = "v2"), - not(feature = "payment_methods_v2") -))] +#[cfg(feature = "v1")] impl ForeignFrom<( Option, @@ -116,7 +113,7 @@ impl } } -#[cfg(all(feature = "v2", feature = "payment_methods_v2"))] +#[cfg(feature = "v2")] impl ForeignFrom<( Option, @@ -1905,14 +1902,14 @@ impl ForeignFrom for gsm_api_types::GsmResponse { } } -#[cfg(all(feature = "v2", feature = "customer_v2"))] +#[cfg(feature = "v2")] impl ForeignFrom<&domain::Customer> for payments::CustomerDetailsResponse { fn foreign_from(_customer: &domain::Customer) -> Self { todo!() } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] impl ForeignFrom<&domain::Customer> for payments::CustomerDetailsResponse { fn foreign_from(customer: &domain::Customer) -> Self { Self { diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs index 7c1b4db71d..6861e4d1df 100644 --- a/crates/router/src/utils.rs +++ b/crates/router/src/utils.rs @@ -26,7 +26,7 @@ pub use common_utils::{ id_type, pii, validation::validate_email, }; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use common_utils::{ type_name, types::keymanager::{Identifier, ToEncryptable}, @@ -34,7 +34,7 @@ use common_utils::{ use error_stack::ResultExt; pub use hyperswitch_connectors::utils::QrImage; use hyperswitch_domain_models::payments::PaymentIntent; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] use hyperswitch_domain_models::type_encryption::{crypto_operation, CryptoOperation}; use masking::{ExposeInterface, SwitchStrategy}; use nanoid::nanoid; @@ -44,10 +44,6 @@ use tracing_futures::Instrument; use uuid::Uuid; pub use self::ext_traits::{OptionExt, ValidateCall}; -#[cfg(feature = "v1")] -use crate::core::webhooks as webhooks_core; -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] -use crate::types::storage; use crate::{ consts, core::{ @@ -64,6 +60,8 @@ use crate::{ transformers::{ForeignFrom, ForeignInto}, }, }; +#[cfg(feature = "v1")] +use crate::{core::webhooks as webhooks_core, types::storage}; pub mod error_parser { use std::fmt::Display; @@ -721,7 +719,7 @@ pub fn add_connector_http_status_code_metrics(option_status_code: Option) { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] pub trait CustomerAddress { async fn get_address_update( @@ -744,7 +742,7 @@ pub trait CustomerAddress { ) -> CustomResult; } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl CustomerAddress for api_models::customers::CustomerRequest { async fn get_address_update( @@ -880,7 +878,7 @@ impl CustomerAddress for api_models::customers::CustomerRequest { } } -#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))] +#[cfg(feature = "v1")] #[async_trait::async_trait] impl CustomerAddress for api_models::customers::CustomerUpdateRequest { async fn get_address_update( diff --git a/crates/router/src/workflows/payment_method_status_update.rs b/crates/router/src/workflows/payment_method_status_update.rs index 1e568c04c7..24f3205324 100644 --- a/crates/router/src/workflows/payment_method_status_update.rs +++ b/crates/router/src/workflows/payment_method_status_update.rs @@ -14,10 +14,7 @@ pub struct PaymentMethodStatusUpdateWorkflow; #[async_trait::async_trait] impl ProcessTrackerWorkflow for PaymentMethodStatusUpdateWorkflow { - #[cfg(all( - any(feature = "v2", feature = "v1"), - not(feature = "payment_methods_v2") - ))] + #[cfg(feature = "v1")] async fn execute_workflow<'a>( &'a self, state: &'a SessionState, diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.toml index 47ddd04a09..c42f96643f 100644 --- a/crates/storage_impl/Cargo.toml +++ b/crates/storage_impl/Cargo.toml @@ -15,8 +15,6 @@ olap = ["hyperswitch_domain_models/olap"] payouts = ["hyperswitch_domain_models/payouts"] v1 = ["api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "common_utils/v1"] v2 = ["api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "common_utils/v2"] -customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2"] -payment_methods_v2 = ["diesel_models/payment_methods_v2", "api_models/payment_methods_v2", "hyperswitch_domain_models/payment_methods_v2"] refunds_v2 = ["diesel_models/refunds_v2"] tokenization_v2 = ["diesel_models/tokenization_v2", "api_models/tokenization_v2", "hyperswitch_domain_models/tokenization_v2"] diff --git a/crates/storage_impl/src/customers.rs b/crates/storage_impl/src/customers.rs index 3c30f0730e..8df20a298e 100644 --- a/crates/storage_impl/src/customers.rs +++ b/crates/storage_impl/src/customers.rs @@ -27,7 +27,7 @@ impl 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 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 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 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 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 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 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 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 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 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 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 domain::CustomerInterface for kv_router_store::KVRouterSt impl domain::CustomerInterface for RouterStore { 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 domain::CustomerInterface for RouterStore { } #[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 domain::CustomerInterface for RouterStore { } #[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 domain::CustomerInterface for RouterStore { }) } - #[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 domain::CustomerInterface for RouterStore { .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 domain::CustomerInterface for RouterStore { } } - #[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 domain::CustomerInterface for RouterStore { .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 domain::CustomerInterface for RouterStore { }) } - #[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 domain::CustomerInterface for RouterStore { .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 domain::CustomerInterface for RouterStore { #[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, diff --git a/crates/storage_impl/src/lib.rs b/crates/storage_impl/src/lib.rs index 05fc865860..27b5905205 100644 --- a/crates/storage_impl/src/lib.rs +++ b/crates/storage_impl/src/lib.rs @@ -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 { 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 { 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 { 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 { vec![format!("customer_{}", self.id.get_string_repr())] diff --git a/crates/storage_impl/src/payment_method.rs b/crates/storage_impl/src/payment_method.rs index afb08146aa..020adf6a27 100644 --- a/crates/storage_impl/src/payment_method.rs +++ b/crates/storage_impl/src/payment_method.rs @@ -33,10 +33,7 @@ use crate::{ #[async_trait::async_trait] impl PaymentMethodInterface for KVRouterStore { 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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { } // 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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { .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 PaymentMethodInterface for KVRouterStore { } // 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 PaymentMethodInterface for KVRouterStore { } // 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 PaymentMethodInterface for KVRouterStore { impl PaymentMethodInterface for RouterStore { 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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { } // 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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { .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 PaymentMethodInterface for RouterStore { #[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, diff --git a/crates/storage_impl/src/payouts/payouts.rs b/crates/storage_impl/src/payouts/payouts.rs index 2beead240e..482b77e300 100644 --- a/crates/storage_impl/src/payouts/payouts.rs +++ b/crates/storage_impl/src/payouts/payouts.rs @@ -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 PayoutsInterface for crate::RouterStore { }) } - #[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 PayoutsInterface for crate::RouterStore { }) } - #[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 PayoutsInterface for crate::RouterStore { }) } - #[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 PayoutsInterface for crate::RouterStore { }) } - #[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, diff --git a/crates/storage_impl/src/redis/kv_store.rs b/crates/storage_impl/src/redis/kv_store.rs index 724a4b1b3c..f09506bc76 100644 --- a/crates/storage_impl/src/redis/kv_store.rs +++ b/crates/storage_impl/src/redis/kv_store.rs @@ -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}",)), } }