Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor(router): remove admin v2 intermediate features (#5780)

Sai Harsha Vardhanb85322612078
diff --git a/.github/workflows/CI-pr.yml b/.github/workflows/CI-pr.yml
index 17e3105334..722e0d22b1 100644
--- a/.github/workflows/CI-pr.yml
+++ b/.github/workflows/CI-pr.yml
@@ -302,11 +302,6 @@ jobs:
- name: Install rust cache
uses: Swatinem/[email protected]
- - name: Install cargo-hack
- uses: taiki-e/[email protected]
- with:
- tool: cargo-hack
- checksum: true
- name: Install just
uses: taiki-e/[email protected]
@@ -314,13 +309,6 @@ jobs:
tool: just
checksum: true
- - name: Run cargo-hack on v2 features in select crates
- shell: bash
- env:
- GH_TOKEN: ${{ github.token }}
- RUSTFLAGS: "-D warnings -A clippy::todo"
- run: just hack_v2
-
- name: Run cargo check with v2 features enabled
shell: bash
# env:
diff --git a/Dockerfile b/Dockerfile
index a869717771..29c1003c11 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,6 +1,7 @@
FROM rust:bookworm as builder
ARG EXTRA_FEATURES=""
+ARG VERSION_FEATURE_SET="v1"
RUN apt-get update \
&& apt-get install -y libpq-dev libssl-dev pkg-config
@@ -32,7 +33,12 @@ ENV RUST_BACKTRACE="short"
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL="sparse"
COPY . .
-RUN cargo build --release --features release ${EXTRA_FEATURES}
+RUN cargo build \
+ --release \
+ --no-default-features \
+ --features release \
+ --features ${VERSION_FEATURE_SET} \
+ ${EXTRA_FEATURES}
diff --git a/Makefile b/Makefile
index 3f8dc2e601..e64f0c5bcb 100644
--- a/Makefile
+++ b/Makefile
@@ -112,4 +112,4 @@ precommit : fmt clippy test
hack:
- cargo hack check --workspace --each-feature --all-targets --exclude-features 'v2 merchant_account_v2 payment_v2'
+ cargo hack check --workspace --each-feature --all-targets --exclude-features 'v2 payment_v2'
diff --git a/crates/analytics/Cargo.toml b/crates/analytics/Cargo.toml
index 4fe0ff90ce..68893bf829 100644
--- a/crates/analytics/Cargo.toml
+++ b/crates/analytics/Cargo.toml
@@ -7,7 +7,6 @@ rust-version.workspace = true
license.workspace = true
[features]
-default = ["v1"]
v1 = ["api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1"]
v2 = ["api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2"]
diff --git a/crates/api_models/Cargo.toml b/crates/api_models/Cargo.toml
index 57b797fa61..00c12b9255 100644
--- a/crates/api_models/Cargo.toml
+++ b/crates/api_models/Cargo.toml
@@ -8,7 +8,6 @@ readme = "README.md"
license.workspace = true
[features]
-default = ["v1"]
errors = ["dep:actix-web", "dep:reqwest"]
dummy_connector = ["euclid/dummy_connector", "common_enums/dummy_connector"]
detailed_errors = []
@@ -18,14 +17,10 @@ olap = []
openapi = ["common_enums/openapi", "olap", "recon", "dummy_connector", "olap"]
recon = []
v1 = ["common_utils/v1"]
-v2 = ["common_utils/v2"]
-business_profile_v2 = []
+v2 = ["common_utils/v2", "customer_v2"]
customer_v2 = ["common_utils/customer_v2"]
-merchant_account_v2 = []
-merchant_connector_account_v2 = []
payment_v2 = []
payment_methods_v2 = []
-routing_v2 = []
[dependencies]
actix-web = { version = "4.5.1", optional = true }
diff --git a/crates/api_models/src/admin.rs b/crates/api_models/src/admin.rs
index 56924c541d..aef5f106be 100644
--- a/crates/api_models/src/admin.rs
+++ b/crates/api_models/src/admin.rs
@@ -7,13 +7,10 @@ use common_utils::{
ext_traits::Encode,
id_type, link_utils, pii,
};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
use common_utils::{crypto::OptionalEncryptableName, ext_traits::ValueExt};
use indexmap::IndexMap;
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
use masking::ExposeInterface;
use masking::Secret;
use serde::{Deserialize, Serialize};
@@ -21,10 +18,7 @@ use url;
use utoipa::ToSchema;
use super::payments::AddressDetails;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::routing;
use crate::{
consts::{MAX_ORDER_FULFILLMENT_EXPIRY, MIN_ORDER_FULFILLMENT_EXPIRY},
@@ -36,10 +30,7 @@ pub struct MerchantAccountListRequest {
pub organization_id: String,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MerchantAccountCreate {
@@ -120,10 +111,7 @@ pub struct MerchantAccountCreate {
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantAccountCreate {
pub fn get_merchant_reference_id(&self) -> id_type::MerchantId {
self.merchant_id.clone()
@@ -188,7 +176,7 @@ impl MerchantAccountCreate {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MerchantAccountCreate {
@@ -208,7 +196,7 @@ pub struct MerchantAccountCreate {
pub organization_id: id_type::OrganizationId,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantAccountCreate {
pub fn get_merchant_reference_id(&self) -> id_type::MerchantId {
id_type::MerchantId::from_merchant_name(self.merchant_name.clone().expose())
@@ -256,10 +244,7 @@ pub struct MerchantAccountMetadata {
pub data: Option<pii::SecretSerdeValue>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MerchantAccountUpdate {
@@ -338,10 +323,7 @@ pub struct MerchantAccountUpdate {
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantAccountUpdate {
pub fn get_primary_details_as_value(
&self,
@@ -405,7 +387,7 @@ impl MerchantAccountUpdate {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MerchantAccountUpdate {
@@ -421,7 +403,7 @@ pub struct MerchantAccountUpdate {
pub metadata: Option<pii::SecretSerdeValue>,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantAccountUpdate {
pub fn get_merchant_details_as_secret(
&self,
@@ -442,10 +424,7 @@ impl MerchantAccountUpdate {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct MerchantAccountResponse {
/// The identifier for the Merchant Account
@@ -537,7 +516,7 @@ pub struct MerchantAccountResponse {
pub pm_collect_link_config: Option<BusinessCollectLinkConfig>,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct MerchantAccountResponse {
/// The identifier for the Merchant Account
@@ -666,10 +645,7 @@ pub struct MerchantId {
pub merchant_id: id_type::MerchantId,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, Deserialize, ToSchema, Serialize)]
pub struct MerchantConnectorId {
#[schema(value_type = String)]
@@ -677,14 +653,14 @@ pub struct MerchantConnectorId {
#[schema(value_type = String)]
pub merchant_connector_id: id_type::MerchantConnectorAccountId,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Deserialize, ToSchema, Serialize)]
pub struct MerchantConnectorId {
#[schema(value_type = String)]
pub id: id_type::MerchantConnectorAccountId,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
@@ -772,7 +748,7 @@ pub struct MerchantConnectorCreate {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorCreate {
pub fn get_transaction_type(&self) -> api_enums::TransactionType {
match self.connector_type {
@@ -804,10 +780,7 @@ impl MerchantConnectorCreate {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
@@ -912,10 +885,7 @@ pub struct MerchantConnectorCreate {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorCreate {
pub fn get_transaction_type(&self) -> api_enums::TransactionType {
match self.connector_type {
@@ -1042,7 +1012,7 @@ impl MerchantConnectorInfo {
}
/// Response of creating a new Merchant Connector for the merchant account."
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorResponse {
@@ -1135,7 +1105,7 @@ pub struct MerchantConnectorResponse {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorResponse {
pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo {
MerchantConnectorInfo {
@@ -1146,10 +1116,7 @@ impl MerchantConnectorResponse {
}
/// Response of creating a new Merchant Connector for the merchant account."
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorResponse {
@@ -1257,10 +1224,7 @@ pub struct MerchantConnectorResponse {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorResponse {
pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo {
MerchantConnectorInfo {
@@ -1270,10 +1234,7 @@ impl MerchantConnectorResponse {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorListResponse {
@@ -1369,10 +1330,7 @@ pub struct MerchantConnectorListResponse {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorListResponse {
pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo {
MerchantConnectorInfo {
@@ -1382,7 +1340,7 @@ impl MerchantConnectorListResponse {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorListResponse {
@@ -1462,7 +1420,7 @@ pub struct MerchantConnectorListResponse {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorListResponse {
pub fn to_merchant_connector_info(&self, connector_label: &String) -> MerchantConnectorInfo {
MerchantConnectorInfo {
@@ -1473,10 +1431,7 @@ impl MerchantConnectorListResponse {
}
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorUpdate {
@@ -1561,7 +1516,7 @@ pub struct MerchantConnectorUpdate {
}
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
#[serde(deny_unknown_fields)]
pub struct MerchantConnectorUpdate {
@@ -1645,7 +1600,7 @@ pub struct MerchantConnectorUpdate {
pub additional_merchant_data: Option<AdditionalMerchantData>,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorUpdate {
pub fn get_frm_config_as_secret(&self) -> Option<Vec<Secret<serde_json::Value>>> {
match self.frm_configs.as_ref() {
@@ -1748,10 +1703,7 @@ pub enum AcceptedCountries {
AllAccepted,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct MerchantConnectorDeleteResponse {
/// The identifier for the Merchant Account
@@ -1765,7 +1717,7 @@ pub struct MerchantConnectorDeleteResponse {
pub deleted: bool,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
pub struct MerchantConnectorDeleteResponse {
/// The identifier for the Merchant Account
@@ -1861,10 +1813,7 @@ pub struct MerchantConnectorDetails {
pub metadata: Option<pii::SecretSerdeValue>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileCreate {
@@ -1976,7 +1925,7 @@ pub struct BusinessProfileCreate {
)]
pub struct OrderFulfillmentTime(i64);
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Default, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileCreate {
@@ -2073,10 +2022,7 @@ pub struct BusinessProfileCreate {
pub is_tax_connector_enabled: bool,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct BusinessProfileResponse {
/// The identifier for Merchant Account
@@ -2192,7 +2138,7 @@ pub struct BusinessProfileResponse {
pub is_tax_connector_enabled: bool,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, ToSchema, Serialize)]
pub struct BusinessProfileResponse {
/// The identifier for Merchant Account
@@ -2299,10 +2245,7 @@ pub struct BusinessProfileResponse {
pub is_tax_connector_enabled: bool,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileUpdate {
@@ -2410,7 +2353,7 @@ pub struct BusinessProfileUpdate {
pub is_tax_connector_enabled: Option<bool>,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Deserialize, ToSchema, Serialize)]
#[serde(deny_unknown_fields)]
pub struct BusinessProfileUpdate {
diff --git a/crates/api_models/src/routing.rs b/crates/api_models/src/routing.rs
index 7b7a59bc86..bec917b06c 100644
--- a/crates/api_models/src/routing.rs
+++ b/crates/api_models/src/routing.rs
@@ -30,7 +30,7 @@ impl ConnectorSelection {
}
}
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct RoutingConfigRequest {
pub name: String,
@@ -40,7 +40,7 @@ pub struct RoutingConfigRequest {
pub profile_id: common_utils::id_type::ProfileId,
}
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, ToSchema)]
pub struct RoutingConfigRequest {
pub name: Option<String>,
diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml
index 1809d75583..0c460a9f2b 100644
--- a/crates/connector_configs/Cargo.toml
+++ b/crates/connector_configs/Cargo.toml
@@ -13,10 +13,11 @@ development = []
sandbox = []
dummy_connector = ["api_models/dummy_connector", "development"]
payouts = ["api_models/payouts"]
+v1 = ["api_models/v1"]
[dependencies]
# First party crates
-api_models = { version = "0.1.0", path = "../api_models", package = "api_models" }
+api_models = { version = "0.1.0", path = "../api_models", package = "api_models"}
common_utils = { version = "0.1.0", path = "../common_utils" }
# Third party crates
diff --git a/crates/diesel_models/Cargo.toml b/crates/diesel_models/Cargo.toml
index e95a39e008..45582cc0ad 100644
--- a/crates/diesel_models/Cargo.toml
+++ b/crates/diesel_models/Cargo.toml
@@ -8,14 +8,11 @@ readme = "README.md"
license.workspace = true
[features]
-default = ["kv_store", "v1"]
+default = ["kv_store"]
kv_store = []
v1 = []
v2 = []
-business_profile_v2 = []
customer_v2 = []
-merchant_account_v2 = []
-merchant_connector_account_v2 = []
payment_v2 = []
[dependencies]
diff --git a/crates/diesel_models/src/business_profile.rs b/crates/diesel_models/src/business_profile.rs
index 671b35a846..7883e3b29b 100644
--- a/crates/diesel_models/src/business_profile.rs
+++ b/crates/diesel_models/src/business_profile.rs
@@ -5,12 +5,9 @@ use common_utils::{encryption::Encryption, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use masking::Secret;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::business_profile;
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::business_profile;
/// Note: The order of fields in the struct is important.
@@ -18,10 +15,7 @@ use crate::schema_v2::business_profile;
/// not compile
/// If two adjacent columns have the same type, then the compiler will not throw any error, but the
/// fields read / written will be interchanged
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id), check_for_backend(diesel::pg::Pg))]
pub struct BusinessProfile {
@@ -61,10 +55,7 @@ pub struct BusinessProfile {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id))]
pub struct BusinessProfileNew {
@@ -104,10 +95,7 @@ pub struct BusinessProfileNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile)]
pub struct BusinessProfileUpdateInternal {
@@ -143,10 +131,7 @@ pub struct BusinessProfileUpdateInternal {
pub is_tax_connector_enabled: Option<bool>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
impl BusinessProfileUpdateInternal {
pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile {
let Self {
@@ -241,7 +226,7 @@ impl BusinessProfileUpdateInternal {
/// not compile
/// If two adjacent columns have the same type, then the compiler will not throw any error, but the
/// fields read / written will be interchanged
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Identifiable, Queryable, Selectable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(id), check_for_backend(diesel::pg::Pg))]
pub struct BusinessProfile {
@@ -284,21 +269,18 @@ pub struct BusinessProfile {
}
impl BusinessProfile {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.profile_id
}
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.id
}
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile, primary_key(profile_id))]
pub struct BusinessProfileNew {
@@ -340,7 +322,7 @@ pub struct BusinessProfileNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = business_profile)]
pub struct BusinessProfileUpdateInternal {
@@ -378,7 +360,7 @@ pub struct BusinessProfileUpdateInternal {
pub default_fallback_routing: Option<pii::SecretSerdeValue>,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
impl BusinessProfileUpdateInternal {
pub fn apply_changeset(self, source: BusinessProfile) -> BusinessProfile {
let Self {
@@ -477,7 +459,7 @@ impl BusinessProfileUpdateInternal {
// This is being used only in the `BusinessProfileInterface` implementation for `MockDb`.
// This can be removed once the `BusinessProfileInterface` trait has been updated to use the domain
// model instead.
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
impl From<BusinessProfileNew> for BusinessProfile {
fn from(new: BusinessProfileNew) -> Self {
Self {
diff --git a/crates/diesel_models/src/merchant_account.rs b/crates/diesel_models/src/merchant_account.rs
index d5566a72e2..b1dcc1d347 100644
--- a/crates/diesel_models/src/merchant_account.rs
+++ b/crates/diesel_models/src/merchant_account.rs
@@ -2,21 +2,15 @@ use common_utils::{encryption::Encryption, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use crate::enums as storage_enums;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::merchant_account;
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::merchant_account;
/// Note: The order of fields in the struct is important.
/// This should be in the same order as the fields in the schema.rs file, otherwise the code will not compile
/// If two adjacent columns have the same type, then the compiler will not throw any error, but the fields read / written will be interchanged
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(
Clone,
Debug,
@@ -59,10 +53,7 @@ pub struct MerchantAccount {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub struct MerchantAccountSetter {
pub merchant_id: common_utils::id_type::MerchantId,
pub return_url: Option<String>,
@@ -94,10 +85,7 @@ pub struct MerchantAccountSetter {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl From<MerchantAccountSetter> for MerchantAccount {
fn from(item: MerchantAccountSetter) -> Self {
Self {
@@ -136,7 +124,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
/// Note: The order of fields in the struct is important.
/// This should be in the same order as the fields in the schema.rs file, otherwise the code will not compile
/// If two adjacent columns have the same type, then the compiler will not throw any error, but the fields read / written will be interchanged
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(
Clone,
Debug,
@@ -162,7 +150,7 @@ pub struct MerchantAccount {
pub id: common_utils::id_type::MerchantId,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl From<MerchantAccountSetter> for MerchantAccount {
fn from(item: MerchantAccountSetter) -> Self {
Self {
@@ -181,7 +169,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub struct MerchantAccountSetter {
pub id: common_utils::id_type::MerchantId,
pub merchant_name: Option<Encryption>,
@@ -197,25 +185,19 @@ pub struct MerchantAccountSetter {
}
impl MerchantAccount {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
/// Get the unique identifier of MerchantAccount
pub fn get_id(&self) -> &common_utils::id_type::MerchantId {
&self.merchant_id
}
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
pub fn get_id(&self) -> &common_utils::id_type::MerchantId {
&self.id
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_account)]
pub struct MerchantAccountNew {
@@ -248,7 +230,7 @@ pub struct MerchantAccountNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_account)]
pub struct MerchantAccountNew {
@@ -264,7 +246,7 @@ pub struct MerchantAccountNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_account)]
pub struct MerchantAccountUpdateInternal {
@@ -278,10 +260,7 @@ pub struct MerchantAccountUpdateInternal {
pub recon_status: Option<storage_enums::ReconStatus>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_account)]
pub struct MerchantAccountUpdateInternal {
diff --git a/crates/diesel_models/src/merchant_connector_account.rs b/crates/diesel_models/src/merchant_connector_account.rs
index ab2672026b..f78886b8c9 100644
--- a/crates/diesel_models/src/merchant_connector_account.rs
+++ b/crates/diesel_models/src/merchant_connector_account.rs
@@ -4,18 +4,12 @@ use common_utils::{encryption::Encryption, id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
use crate::enums as storage_enums;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::merchant_connector_account;
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::merchant_connector_account;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(
Clone,
Debug,
@@ -58,17 +52,14 @@ pub struct MerchantConnectorAccount {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorAccount {
pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.merchant_connector_id.clone()
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(
Clone,
Debug,
@@ -106,17 +97,14 @@ pub struct MerchantConnectorAccount {
pub id: id_type::MerchantConnectorAccountId,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorAccount {
pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.id.clone()
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_connector_account)]
pub struct MerchantConnectorAccountNew {
@@ -149,7 +137,7 @@ pub struct MerchantConnectorAccountNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Insertable, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_connector_account)]
pub struct MerchantConnectorAccountNew {
@@ -177,10 +165,7 @@ pub struct MerchantConnectorAccountNew {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_connector_account)]
pub struct MerchantConnectorAccountUpdateInternal {
@@ -206,7 +191,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
pub additional_merchant_data: Option<Encryption>,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, AsChangeset, router_derive::DebugAsDisplay)]
#[diesel(table_name = merchant_connector_account)]
pub struct MerchantConnectorAccountUpdateInternal {
@@ -228,10 +213,7 @@ pub struct MerchantConnectorAccountUpdateInternal {
pub additional_merchant_data: Option<Encryption>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorAccountUpdateInternal {
pub fn create_merchant_connector_account(
self,
@@ -259,7 +241,7 @@ impl MerchantConnectorAccountUpdateInternal {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorAccountUpdateInternal {
pub fn create_merchant_connector_account(
self,
diff --git a/crates/diesel_models/src/organization.rs b/crates/diesel_models/src/organization.rs
index ed90e641f3..bd4fd11920 100644
--- a/crates/diesel_models/src/organization.rs
+++ b/crates/diesel_models/src/organization.rs
@@ -1,22 +1,16 @@
use common_utils::{id_type, pii};
use diesel::{AsChangeset, Identifiable, Insertable, Queryable, Selectable};
-#[cfg(all(
- any(any(feature = "v1", feature = "v2"), feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::organization;
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::organization;
pub trait OrganizationBridge {
fn get_organization_id(&self) -> id_type::OrganizationId;
fn get_organization_name(&self) -> Option<String>;
fn set_organization_name(&mut self, organization_name: String);
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
#[diesel(
table_name = organization,
@@ -36,7 +30,7 @@ pub struct Organization {
organization_name: Option<String>,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Identifiable, Queryable, Selectable)]
#[diesel(
table_name = organization,
@@ -52,10 +46,7 @@ pub struct Organization {
organization_name: Option<String>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl Organization {
pub fn new(org_new: OrganizationNew) -> Self {
let OrganizationNew {
@@ -81,7 +72,7 @@ impl Organization {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl Organization {
pub fn new(org_new: OrganizationNew) -> Self {
let OrganizationNew {
@@ -103,10 +94,7 @@ impl Organization {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, Insertable)]
#[diesel(table_name = organization, primary_key(org_id))]
pub struct OrganizationNew {
@@ -120,7 +108,7 @@ pub struct OrganizationNew {
pub modified_at: time::PrimitiveDateTime,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, Insertable)]
#[diesel(table_name = organization, primary_key(id))]
pub struct OrganizationNew {
@@ -132,10 +120,7 @@ pub struct OrganizationNew {
pub modified_at: time::PrimitiveDateTime,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl OrganizationNew {
pub fn new(id: id_type::OrganizationId, organization_name: Option<String>) -> Self {
Self {
@@ -151,7 +136,7 @@ impl OrganizationNew {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl OrganizationNew {
pub fn new(id: id_type::OrganizationId, organization_name: Option<String>) -> Self {
Self {
@@ -165,10 +150,7 @@ impl OrganizationNew {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, AsChangeset)]
#[diesel(table_name = organization)]
pub struct OrganizationUpdateInternal {
@@ -179,7 +161,7 @@ pub struct OrganizationUpdateInternal {
modified_at: time::PrimitiveDateTime,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, AsChangeset)]
#[diesel(table_name = organization)]
pub struct OrganizationUpdateInternal {
@@ -197,10 +179,7 @@ pub enum OrganizationUpdate {
},
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl From<OrganizationUpdate> for OrganizationUpdateInternal {
fn from(value: OrganizationUpdate) -> Self {
match value {
@@ -218,7 +197,7 @@ impl From<OrganizationUpdate> for OrganizationUpdateInternal {
}
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl From<OrganizationUpdate> for OrganizationUpdateInternal {
fn from(value: OrganizationUpdate) -> Self {
@@ -237,10 +216,7 @@ impl From<OrganizationUpdate> for OrganizationUpdateInternal {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl OrganizationBridge for Organization {
fn get_organization_id(&self) -> id_type::OrganizationId {
self.org_id.clone()
@@ -253,10 +229,7 @@ impl OrganizationBridge for Organization {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl OrganizationBridge for OrganizationNew {
fn get_organization_id(&self) -> id_type::OrganizationId {
self.org_id.clone()
@@ -269,7 +242,7 @@ impl OrganizationBridge for OrganizationNew {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl OrganizationBridge for Organization {
fn get_organization_id(&self) -> id_type::OrganizationId {
self.id.clone()
@@ -282,7 +255,7 @@ impl OrganizationBridge for Organization {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl OrganizationBridge for OrganizationNew {
fn get_organization_id(&self) -> id_type::OrganizationId {
self.id.clone()
diff --git a/crates/diesel_models/src/query/business_profile.rs b/crates/diesel_models/src/query/business_profile.rs
index eaf50c8a8c..da95626935 100644
--- a/crates/diesel_models/src/query/business_profile.rs
+++ b/crates/diesel_models/src/query/business_profile.rs
@@ -1,12 +1,9 @@
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use super::generics;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::business_profile::dsl::{self, profile_id as dsl_identifier};
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::business_profile::dsl::{self, id as dsl_identifier};
use crate::{
business_profile::{BusinessProfile, BusinessProfileNew, BusinessProfileUpdateInternal},
diff --git a/crates/diesel_models/src/query/merchant_account.rs b/crates/diesel_models/src/query/merchant_account.rs
index 564a37d79e..e6aa5c25c2 100644
--- a/crates/diesel_models/src/query/merchant_account.rs
+++ b/crates/diesel_models/src/query/merchant_account.rs
@@ -1,12 +1,9 @@
use diesel::{associations::HasTable, ExpressionMethods, Table};
use super::generics;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::merchant_account::dsl::{self, merchant_id as dsl_identifier};
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::merchant_account::dsl::{self, id as dsl_identifier};
use crate::{
errors,
diff --git a/crates/diesel_models/src/query/merchant_connector_account.rs b/crates/diesel_models/src/query/merchant_connector_account.rs
index ed3f1562f7..0ebf0ab9c0 100644
--- a/crates/diesel_models/src/query/merchant_connector_account.rs
+++ b/crates/diesel_models/src/query/merchant_connector_account.rs
@@ -1,12 +1,9 @@
use diesel::{associations::HasTable, BoolExpressionMethods, ExpressionMethods, Table};
use super::generics;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
use crate::schema::merchant_connector_account::dsl;
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
use crate::schema_v2::merchant_connector_account::dsl;
use crate::{
errors,
@@ -23,10 +20,7 @@ impl MerchantConnectorAccountNew {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorAccount {
pub async fn update(
self,
@@ -160,7 +154,7 @@ impl MerchantConnectorAccount {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorAccount {
pub async fn update(
self,
diff --git a/crates/diesel_models/src/query/organization.rs b/crates/diesel_models/src/query/organization.rs
index c05445191b..f8f6cf8cbf 100644
--- a/crates/diesel_models/src/query/organization.rs
+++ b/crates/diesel_models/src/query/organization.rs
@@ -1,13 +1,10 @@
use common_utils::id_type;
use diesel::{associations::HasTable, ExpressionMethods};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
-use crate::schema::organization::dsl;
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
-use crate::schema_v2::organization::dsl;
+#[cfg(feature = "v1")]
+use crate::schema::organization::dsl::org_id as dsl_identifier;
+#[cfg(feature = "v2")]
+use crate::schema_v2::organization::dsl::id as dsl_identifier;
use crate::{organization::*, query::generics, PgPooledConn, StorageResult};
impl OrganizationNew {
@@ -23,13 +20,7 @@ impl Organization {
) -> StorageResult<Self> {
generics::generic_find_one::<<Self as HasTable>::Table, _, _>(
conn,
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
- dsl::org_id.eq(org_id),
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
- dsl::id.eq(org_id),
+ dsl_identifier.eq(org_id),
)
.await
}
@@ -46,13 +37,7 @@ impl Organization {
_,
>(
conn,
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
- dsl::org_id.eq(org_id),
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
- dsl::id.eq(org_id),
+ dsl_identifier.eq(org_id),
OrganizationUpdateInternal::from(update),
)
.await
diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml
index 55b2c8b84b..f8c97699d0 100644
--- a/crates/euclid_wasm/Cargo.toml
+++ b/crates/euclid_wasm/Cargo.toml
@@ -17,6 +17,7 @@ production = ["connector_configs/production"]
development = ["connector_configs/development"]
sandbox = ["connector_configs/sandbox"]
payouts = ["api_models/payouts", "euclid/payouts"]
+v1 = ["api_models/v1"]
[dependencies]
api_models = { version = "0.1.0", path = "../api_models", package = "api_models" }
diff --git a/crates/external_services/Cargo.toml b/crates/external_services/Cargo.toml
index 2e33e0fafd..9051c58ea5 100644
--- a/crates/external_services/Cargo.toml
+++ b/crates/external_services/Cargo.toml
@@ -12,6 +12,7 @@ aws_kms = ["dep:aws-config", "dep:aws-sdk-kms"]
email = ["dep:aws-config"]
aws_s3 = ["dep:aws-config", "dep:aws-sdk-s3"]
hashicorp-vault = ["dep:vaultrs"]
+v1 = ["hyperswitch_interfaces/v1"]
[dependencies]
async-trait = "0.1.79"
diff --git a/crates/hyperswitch_connectors/Cargo.toml b/crates/hyperswitch_connectors/Cargo.toml
index 2009f60e2e..8ae48a0122 100644
--- a/crates/hyperswitch_connectors/Cargo.toml
+++ b/crates/hyperswitch_connectors/Cargo.toml
@@ -8,6 +8,7 @@ license.workspace = true
[features]
frm = ["hyperswitch_domain_models/frm", "hyperswitch_interfaces/frm"]
payouts = ["hyperswitch_domain_models/payouts", "api_models/payouts", "hyperswitch_interfaces/payouts"]
+v1 = ["api_models/v1", "hyperswitch_domain_models/v1"]
[dependencies]
actix-http = "3.6.0"
diff --git a/crates/hyperswitch_domain_models/Cargo.toml b/crates/hyperswitch_domain_models/Cargo.toml
index 4e00081961..f84d065fd9 100644
--- a/crates/hyperswitch_domain_models/Cargo.toml
+++ b/crates/hyperswitch_domain_models/Cargo.toml
@@ -8,17 +8,14 @@ readme = "README.md"
license.workspace = true
[features]
-default = ["olap", "frm", "v1"]
+default = ["olap", "frm"]
encryption_service = []
olap = []
payouts = ["api_models/payouts"]
frm = ["api_models/frm"]
v2 = ["api_models/v2", "diesel_models/v2"]
v1 = ["api_models/v1", "diesel_models/v1"]
-business_profile_v2 = ["api_models/business_profile_v2", "diesel_models/business_profile_v2"]
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2"]
-merchant_account_v2 = ["api_models/merchant_account_v2", "diesel_models/merchant_account_v2"]
-merchant_connector_account_v2 = ["api_models/merchant_connector_account_v2", "diesel_models/merchant_connector_account_v2"]
payment_v2 = ["api_models/payment_v2", "diesel_models/payment_v2"]
[dependencies]
diff --git a/crates/hyperswitch_domain_models/src/business_profile.rs b/crates/hyperswitch_domain_models/src/business_profile.rs
index 0910a2b0e9..ff98475e62 100644
--- a/crates/hyperswitch_domain_models/src/business_profile.rs
+++ b/crates/hyperswitch_domain_models/src/business_profile.rs
@@ -18,10 +18,7 @@ use crate::{
type_encryption::{crypto_operation, AsyncLift, CryptoOperation},
};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug)]
pub struct BusinessProfile {
profile_id: common_utils::id_type::ProfileId,
@@ -59,10 +56,7 @@ pub struct BusinessProfile {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
pub struct BusinessProfileSetter {
pub profile_id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
@@ -98,10 +92,7 @@ pub struct BusinessProfileSetter {
pub is_tax_connector_enabled: bool,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
impl From<BusinessProfileSetter> for BusinessProfile {
fn from(value: BusinessProfileSetter) -> Self {
Self {
@@ -147,24 +138,18 @@ impl From<BusinessProfileSetter> for BusinessProfile {
}
impl BusinessProfile {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.profile_id
}
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
pub fn get_id(&self) -> &common_utils::id_type::ProfileId {
&self.id
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug)]
pub struct BusinessProfileGeneralUpdate {
pub profile_name: Option<String>,
@@ -195,10 +180,7 @@ pub struct BusinessProfileGeneralUpdate {
pub is_tax_connector_enabled: Option<bool>,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug)]
pub enum BusinessProfileUpdate {
Update(Box<BusinessProfileGeneralUpdate>),
@@ -214,10 +196,7 @@ pub enum BusinessProfileUpdate {
},
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
fn from(business_profile_update: BusinessProfileUpdate) -> Self {
let now = date_time::now();
@@ -390,10 +369,7 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[async_trait::async_trait]
impl super::behaviour::Conversion for BusinessProfile {
type DstType = diesel_models::business_profile::BusinessProfile;
@@ -557,7 +533,7 @@ impl super::behaviour::Conversion for BusinessProfile {
}
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
pub struct BusinessProfile {
id: common_utils::id_type::ProfileId,
@@ -597,7 +573,7 @@ pub struct BusinessProfile {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
pub struct BusinessProfileSetter {
pub id: common_utils::id_type::ProfileId,
pub merchant_id: common_utils::id_type::MerchantId,
@@ -635,7 +611,7 @@ pub struct BusinessProfileSetter {
pub is_tax_connector_enabled: bool,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
impl From<BusinessProfileSetter> for BusinessProfile {
fn from(value: BusinessProfileSetter) -> Self {
Self {
@@ -683,21 +659,18 @@ impl From<BusinessProfileSetter> for BusinessProfile {
}
impl BusinessProfile {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
pub fn get_order_fulfillment_time(&self) -> Option<i64> {
self.intent_fulfillment_time
}
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
pub fn get_order_fulfillment_time(&self) -> Option<i64> {
self.order_fulfillment_time
}
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug)]
pub struct BusinessProfileGeneralUpdate {
pub profile_name: Option<String>,
@@ -724,7 +697,7 @@ pub struct BusinessProfileGeneralUpdate {
pub order_fulfillment_time_origin: Option<common_enums::OrderFulfillmentTimeOrigin>,
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug)]
pub enum BusinessProfileUpdate {
Update(Box<BusinessProfileGeneralUpdate>),
@@ -743,7 +716,7 @@ pub enum BusinessProfileUpdate {
},
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
fn from(business_profile_update: BusinessProfileUpdate) -> Self {
let now = date_time::now();
@@ -954,7 +927,7 @@ impl From<BusinessProfileUpdate> for BusinessProfileUpdateInternal {
}
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[async_trait::async_trait]
impl super::behaviour::Conversion for BusinessProfile {
type DstType = diesel_models::business_profile::BusinessProfile;
diff --git a/crates/hyperswitch_domain_models/src/consts.rs b/crates/hyperswitch_domain_models/src/consts.rs
index c19d813cfe..3808e615c0 100644
--- a/crates/hyperswitch_domain_models/src/consts.rs
+++ b/crates/hyperswitch_domain_models/src/consts.rs
@@ -1,19 +1,7 @@
//! Constants that are used in the domain models.
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "customer_v2"),
- not(feature = "merchant_account_v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "customer_v2")))]
pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V1;
-#[cfg(all(
- feature = "v2",
- any(
- feature = "customer_v2",
- feature = "merchant_account_v2",
- feature = "merchant_connector_account_v2"
- )
-))]
+#[cfg(all(feature = "v2", feature = "customer_v2"))]
pub const API_VERSION: common_enums::ApiVersion = common_enums::ApiVersion::V2;
diff --git a/crates/hyperswitch_domain_models/src/merchant_account.rs b/crates/hyperswitch_domain_models/src/merchant_account.rs
index 666b6bfeea..3e860d3628 100644
--- a/crates/hyperswitch_domain_models/src/merchant_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_account.rs
@@ -16,10 +16,7 @@ use router_env::logger;
use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug, serde::Serialize)]
pub struct MerchantAccount {
merchant_id: common_utils::id_type::MerchantId,
@@ -52,10 +49,7 @@ pub struct MerchantAccount {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone)]
/// Set the private fields of merchant account
pub struct MerchantAccountSetter {
@@ -89,10 +83,7 @@ pub struct MerchantAccountSetter {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl From<MerchantAccountSetter> for MerchantAccount {
fn from(item: MerchantAccountSetter) -> Self {
Self {
@@ -128,7 +119,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone)]
/// Set the private fields of merchant account
pub struct MerchantAccountSetter {
@@ -144,7 +135,7 @@ pub struct MerchantAccountSetter {
pub recon_status: diesel_models::enums::ReconStatus,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl From<MerchantAccountSetter> for MerchantAccount {
fn from(item: MerchantAccountSetter) -> Self {
let MerchantAccountSetter {
@@ -174,7 +165,7 @@ impl From<MerchantAccountSetter> for MerchantAccount {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug, serde::Serialize)]
pub struct MerchantAccount {
id: common_utils::id_type::MerchantId,
@@ -190,16 +181,13 @@ pub struct MerchantAccount {
}
impl MerchantAccount {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
/// Get the unique identifier of MerchantAccount
pub fn get_id(&self) -> &common_utils::id_type::MerchantId {
&self.merchant_id
}
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
/// Get the unique identifier of MerchantAccount
pub fn get_id(&self) -> &common_utils::id_type::MerchantId {
&self.id
@@ -211,10 +199,7 @@ impl MerchantAccount {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
pub enum MerchantAccountUpdate {
@@ -250,7 +235,7 @@ pub enum MerchantAccountUpdate {
ModifiedAtUpdate,
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[allow(clippy::large_enum_variant)]
#[derive(Debug)]
pub enum MerchantAccountUpdate {
@@ -269,10 +254,7 @@ pub enum MerchantAccountUpdate {
ModifiedAtUpdate,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
fn from(merchant_account_update: MerchantAccountUpdate) -> Self {
@@ -439,7 +421,7 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
fn from(merchant_account_update: MerchantAccountUpdate) -> Self {
let now = date_time::now();
@@ -494,7 +476,7 @@ impl From<MerchantAccountUpdate> for MerchantAccountUpdateInternal {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[async_trait::async_trait]
impl super::behaviour::Conversion for MerchantAccount {
type DstType = diesel_models::merchant_account::MerchantAccount;
@@ -598,10 +580,7 @@ impl super::behaviour::Conversion for MerchantAccount {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[async_trait::async_trait]
impl super::behaviour::Conversion for MerchantAccount {
type DstType = diesel_models::merchant_account::MerchantAccount;
diff --git a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
index c97fcbdfe8..a281c553a1 100644
--- a/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
+++ b/crates/hyperswitch_domain_models/src/merchant_connector_account.rs
@@ -13,10 +13,7 @@ use masking::{PeekInterface, Secret};
use super::behaviour;
use crate::type_encryption::{crypto_operation, AsyncLift, CryptoOperation};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Clone, Debug)]
pub struct MerchantConnectorAccount {
pub merchant_id: id_type::MerchantId,
@@ -45,17 +42,14 @@ pub struct MerchantConnectorAccount {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl MerchantConnectorAccount {
pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.merchant_connector_id.clone()
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
pub struct MerchantConnectorAccount {
pub id: id_type::MerchantConnectorAccountId,
@@ -80,17 +74,14 @@ pub struct MerchantConnectorAccount {
pub version: common_enums::ApiVersion,
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorAccount {
pub fn get_id(&self) -> id_type::MerchantConnectorAccountId {
self.id.clone()
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[derive(Debug)]
pub enum MerchantConnectorAccountUpdate {
Update {
@@ -116,7 +107,7 @@ pub enum MerchantConnectorAccountUpdate {
},
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[derive(Debug)]
pub enum MerchantConnectorAccountUpdate {
Update {
@@ -139,10 +130,7 @@ pub enum MerchantConnectorAccountUpdate {
},
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[async_trait::async_trait]
impl behaviour::Conversion for MerchantConnectorAccount {
type DstType = diesel_models::merchant_connector_account::MerchantConnectorAccount;
@@ -296,7 +284,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[async_trait::async_trait]
impl behaviour::Conversion for MerchantConnectorAccount {
type DstType = diesel_models::merchant_connector_account::MerchantConnectorAccount;
@@ -432,10 +420,7 @@ impl behaviour::Conversion for MerchantConnectorAccount {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInternal {
fn from(merchant_connector_account_update: MerchantConnectorAccountUpdate) -> Self {
match merchant_connector_account_update {
@@ -502,7 +487,7 @@ impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInte
}
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
impl From<MerchantConnectorAccountUpdate> for MerchantConnectorAccountUpdateInternal {
fn from(merchant_connector_account_update: MerchantConnectorAccountUpdate) -> Self {
match merchant_connector_account_update {
diff --git a/crates/hyperswitch_interfaces/Cargo.toml b/crates/hyperswitch_interfaces/Cargo.toml
index 829db1f8d9..b225f89787 100644
--- a/crates/hyperswitch_interfaces/Cargo.toml
+++ b/crates/hyperswitch_interfaces/Cargo.toml
@@ -9,7 +9,7 @@ license.workspace = true
[features]
default = ["dummy_connector", "frm", "payouts"]
dummy_connector = []
-v1 = ["hyperswitch_domain_models/v1"]
+v1 = ["hyperswitch_domain_models/v1", "api_models/v1"]
payouts = ["hyperswitch_domain_models/payouts"]
frm = ["hyperswitch_domain_models/frm"]
@@ -30,9 +30,9 @@ thiserror = "1.0.58"
time = "0.3.35"
# First party crates
+hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false }
masking = { version = "0.1.0", path = "../masking" }
api_models = { version = "0.1.0", path = "../api_models" }
-hyperswitch_domain_models = { version = "0.1.0", path = "../hyperswitch_domain_models", default-features = false, features = ["v1"] }
common_enums = { version = "0.1.0", path = "../common_enums" }
common_utils = { version = "0.1.0", path = "../common_utils" }
router_derive = { version = "0.1.0", path = "../router_derive" }
diff --git a/crates/kgraph_utils/Cargo.toml b/crates/kgraph_utils/Cargo.toml
index 3e463441c2..0b7b580e64 100644
--- a/crates/kgraph_utils/Cargo.toml
+++ b/crates/kgraph_utils/Cargo.toml
@@ -7,11 +7,9 @@ rust-version.workspace = true
license.workspace = true
[features]
-default = []
dummy_connector = ["api_models/dummy_connector", "euclid/dummy_connector"]
-v1 = []
-v2 = []
-merchant_connector_account_v2 = ["api_models/merchant_connector_account_v2"]
+v1 = ["api_models/v1"]
+v2 = ["api_models/v2"]
[dependencies]
api_models = { version = "0.1.0", path = "../api_models", package = "api_models" }
diff --git a/crates/kgraph_utils/benches/evaluation.rs b/crates/kgraph_utils/benches/evaluation.rs
index 8e3bec16b2..b98b854fba 100644
--- a/crates/kgraph_utils/benches/evaluation.rs
+++ b/crates/kgraph_utils/benches/evaluation.rs
@@ -54,7 +54,7 @@ fn build_test_data(
let profile_id = common_utils::generate_profile_id_of_default_length();
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
@@ -73,10 +73,7 @@ fn build_test_data(
additional_merchant_data: None,
};
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
diff --git a/crates/kgraph_utils/src/mca.rs b/crates/kgraph_utils/src/mca.rs
index fa98ae915e..7d04f5d423 100644
--- a/crates/kgraph_utils/src/mca.rs
+++ b/crates/kgraph_utils/src/mca.rs
@@ -706,7 +706,7 @@ mod tests {
use api_models::{admin::*, payment_methods::*};
let profile_id = common_utils::generate_profile_id_of_default_length();
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
@@ -760,10 +760,7 @@ mod tests {
status: api_enums::ConnectorStatus::Inactive,
additional_merchant_data: None,
};
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let stripe_account = MerchantConnectorResponse {
connector_type: api_enums::ConnectorType::FizOperations,
connector_name: "stripe".to_string(),
diff --git a/crates/openapi/Cargo.toml b/crates/openapi/Cargo.toml
index 469e1a0dc9..6aae926011 100644
--- a/crates/openapi/Cargo.toml
+++ b/crates/openapi/Cargo.toml
@@ -16,7 +16,7 @@ common_utils = { version = "0.1.0", path = "../common_utils" }
router_env = { version = "0.1.0", path = "../router_env" }
[features]
-v2 = ["api_models/v2", "api_models/customer_v2", "api_models/merchant_account_v2", "api_models/routing_v2", "api_models/merchant_connector_account_v2", "api_models/business_profile_v2"]
+v2 = ["api_models/v2", "api_models/customer_v2"]
v1 = ["api_models/v1"]
[lints]
diff --git a/crates/pm_auth/Cargo.toml b/crates/pm_auth/Cargo.toml
index 9766d7f19c..df8136ba83 100644
--- a/crates/pm_auth/Cargo.toml
+++ b/crates/pm_auth/Cargo.toml
@@ -7,6 +7,9 @@ rust-version.workspace = true
readme = "README.md"
license.workspace = true
+[features]
+v1 = ["api_models/v1"]
+
[dependencies]
# First party crates
api_models = { version = "0.1.0", path = "../api_models" }
diff --git a/crates/router/Cargo.toml b/crates/router/Cargo.toml
index 18476ffe48..e9c9d504b4 100644
--- a/crates/router/Cargo.toml
+++ b/crates/router/Cargo.toml
@@ -9,7 +9,8 @@ readme = "README.md"
license.workspace = true
[features]
-default = ["kv_store", "stripe", "oltp", "olap", "accounts_cache", "dummy_connector", "payouts", "payout_retry", "retry", "frm", "tls", "v1", "partial-auth"]
+default = ["common_default", "v1"]
+common_default = ["kv_store", "stripe", "oltp", "olap", "accounts_cache", "dummy_connector", "payouts", "payout_retry", "retry", "frm", "tls", "partial-auth"]
olap = ["hyperswitch_domain_models/olap", "storage_impl/olap", "scheduler/olap", "api_models/olap", "dep:analytics"]
tls = ["actix-web/rustls-0_22"]
email = ["external_services/email", "scheduler/email", "olap"]
@@ -31,15 +32,11 @@ payouts = ["api_models/payouts", "common_enums/payouts", "hyperswitch_connectors
payout_retry = ["payouts"]
recon = ["email", "api_models/recon"]
retry = []
-v2 = ["api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2"]
-v1 = ["api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1"]
-business_profile_v2 = ["api_models/business_profile_v2", "diesel_models/business_profile_v2", "hyperswitch_domain_models/business_profile_v2"]
+v2 = ["customer_v2", "payment_methods_v2", "payment_v2", "common_default", "api_models/v2", "diesel_models/v2", "hyperswitch_domain_models/v2", "storage_impl/v2", "kgraph_utils/v2"]
+v1 = ["common_default", "api_models/v1", "diesel_models/v1", "hyperswitch_domain_models/v1", "storage_impl/v1", "hyperswitch_interfaces/v1", "kgraph_utils/v1"]
customer_v2 = ["api_models/customer_v2", "diesel_models/customer_v2", "hyperswitch_domain_models/customer_v2", "storage_impl/customer_v2"]
-merchant_account_v2 = ["api_models/merchant_account_v2", "diesel_models/merchant_account_v2", "hyperswitch_domain_models/merchant_account_v2"]
payment_v2 = ["api_models/payment_v2", "diesel_models/payment_v2", "hyperswitch_domain_models/payment_v2", "storage_impl/payment_v2"]
payment_methods_v2 = ["api_models/payment_methods_v2"]
-routing_v2 = ["api_models/routing_v2"]
-merchant_connector_account_v2 = ["api_models/merchant_connector_account_v2", "kgraph_utils/merchant_connector_account_v2", "hyperswitch_domain_models/merchant_connector_account_v2", "diesel_models/merchant_connector_account_v2"]
# Partial Auth
# The feature reduces the overhead of the router authenticating the merchant for every request, and trusts on `x-merchant-id` header to be present in the request.
@@ -127,7 +124,7 @@ x509-parser = "0.16.0"
# First party crates
analytics = { version = "0.1.0", path = "../analytics", optional = true, default-features = false }
-api_models = { version = "0.1.0", path = "../api_models", features = ["errors"] }
+api_models = { version = "0.1.0", path = "../api_models", features = ["errors"]}
cards = { version = "0.1.0", path = "../cards" }
common_enums = { version = "0.1.0", path = "../common_enums" }
common_utils = { version = "0.1.0", path = "../common_utils", features = ["signals", "async_ext", "logs", "metrics", "keymanager", "encryption_service"] }
diff --git a/crates/router/src/core/admin.rs b/crates/router/src/core/admin.rs
index a69a46000f..85c8d90c8b 100644
--- a/crates/router/src/core/admin.rs
+++ b/crates/router/src/core/admin.rs
@@ -158,11 +158,7 @@ pub async fn get_organization(
state: SessionState,
org_id: api::OrganizationId,
) -> RouterResponse<api::OrganizationResponse> {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2"),
- feature = "olap"
- ))]
+ #[cfg(all(feature = "v1", feature = "olap"))]
{
CreateOrValidateOrganization::new(Some(org_id.organization_id))
.create_or_validate(state.store.as_ref())
@@ -170,7 +166,7 @@ pub async fn get_organization(
.map(ForeignFrom::foreign_from)
.map(service_api::ApplicationResponse::Json)
}
- #[cfg(all(feature = "v2", feature = "merchant_account_v2", feature = "olap"))]
+ #[cfg(all(feature = "v2", feature = "olap"))]
{
CreateOrValidateOrganization::new(org_id.organization_id)
.create_or_validate(state.store.as_ref())
@@ -272,11 +268,7 @@ trait MerchantAccountCreateBridge {
) -> RouterResult<domain::MerchantAccount>;
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- feature = "olap",
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "v1", feature = "olap"))]
#[async_trait::async_trait]
impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
async fn create_domain_model_from_request(
@@ -423,10 +415,7 @@ impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
#[cfg(feature = "olap")]
enum CreateOrValidateOrganization {
/// Creates a new organization
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
Create,
/// Validates if this organization exists in the records
Validate {
@@ -436,11 +425,7 @@ enum CreateOrValidateOrganization {
#[cfg(feature = "olap")]
impl CreateOrValidateOrganization {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2"),
- feature = "olap"
- ))]
+ #[cfg(all(feature = "v1", feature = "olap"))]
/// Create an action to either create or validate the given organization_id
/// If organization_id is passed, then validate if this organization exists
/// If not passed, create a new organization
@@ -452,7 +437,7 @@ impl CreateOrValidateOrganization {
}
}
- #[cfg(all(feature = "v2", feature = "merchant_account_v2", feature = "olap"))]
+ #[cfg(all(feature = "v2", feature = "olap"))]
/// Create an action to validate the provided organization_id
fn new(organization_id: id_type::OrganizationId) -> Self {
Self::Validate { organization_id }
@@ -465,10 +450,7 @@ impl CreateOrValidateOrganization {
db: &dyn StorageInterface,
) -> RouterResult<diesel_models::organization::Organization> {
match self {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
Self::Create => {
let new_organization = api_models::organization::OrganizationNew::new(None);
let db_organization = ForeignFrom::foreign_from(new_organization);
@@ -487,11 +469,7 @@ impl CreateOrValidateOrganization {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- feature = "olap",
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "v1", feature = "olap"))]
enum CreateBusinessProfile {
/// Create business profiles from primary business details
/// If there is only one business profile created, then set this profile as default
@@ -502,11 +480,7 @@ enum CreateBusinessProfile {
CreateDefaultBusinessProfile,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- feature = "olap",
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "v1", feature = "olap"))]
impl CreateBusinessProfile {
/// Create a new business profile action from the given information
/// If primary business details exist, then create business profiles from them
@@ -620,7 +594,7 @@ impl CreateBusinessProfile {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2", feature = "olap"))]
+#[cfg(all(feature = "v2", feature = "olap"))]
#[async_trait::async_trait]
impl MerchantAccountCreateBridge for api::MerchantAccountCreate {
async fn create_domain_model_from_request(
@@ -753,10 +727,7 @@ pub async fn get_merchant_account(
))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// For backwards compatibility, whenever new business labels are passed in
/// primary_business_details, create a business profile
pub async fn create_business_profile_from_business_labels(
@@ -837,10 +808,7 @@ trait MerchantAccountUpdateBridge {
) -> RouterResult<storage::MerchantAccountUpdate>;
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[async_trait::async_trait]
impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
async fn get_update_merchant_object(
@@ -980,7 +948,7 @@ impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
}
}
-#[cfg(all(any(feature = "v1", feature = "v2"), feature = "merchant_account_v2",))]
+#[cfg(feature = "v2")]
#[async_trait::async_trait]
impl MerchantAccountUpdateBridge for api::MerchantAccountUpdate {
async fn get_update_merchant_object(
@@ -1153,10 +1121,7 @@ pub async fn merchant_account_delete(
Ok(service_api::ApplicationResponse::Json(response))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
async fn get_parent_merchant(
state: &SessionState,
sub_merchants_enabled: Option<bool>,
@@ -1185,10 +1150,7 @@ async fn get_parent_merchant(
})
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
async fn validate_merchant_id(
state: &SessionState,
merchant_id: &id_type::MerchantId,
@@ -1840,10 +1802,7 @@ impl<'a> ConnectorTypeAndConnectorName<'a> {
Ok(routable_connector)
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2",))
-))]
+#[cfg(feature = "v1")]
struct MerchantDefaultConfigUpdate<'a> {
routable_connector: &'a Option<api_enums::RoutableConnectors>,
merchant_connector_id: &'a id_type::MerchantConnectorAccountId,
@@ -1852,10 +1811,7 @@ struct MerchantDefaultConfigUpdate<'a> {
profile_id: &'a id_type::ProfileId,
transaction_type: &'a api_enums::TransactionType,
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2",))
-))]
+#[cfg(feature = "v1")]
impl<'a> MerchantDefaultConfigUpdate<'a> {
async fn retrieve_and_update_default_fallback_routing_algorithm_if_routable_connector_exists(
&self,
@@ -1904,11 +1860,7 @@ impl<'a> MerchantDefaultConfigUpdate<'a> {
Ok(())
}
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2",
-))]
+#[cfg(feature = "v2")]
struct DefaultFallbackRoutingConfigUpdate<'a> {
routable_connector: &'a Option<api_enums::RoutableConnectors>,
merchant_connector_id: &'a id_type::MerchantConnectorAccountId,
@@ -1917,11 +1869,7 @@ struct DefaultFallbackRoutingConfigUpdate<'a> {
key_store: hyperswitch_domain_models::merchant_key_store::MerchantKeyStore,
key_manager_state: &'a KeyManagerState,
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
impl<'a> DefaultFallbackRoutingConfigUpdate<'a> {
async fn retrieve_and_update_default_fallback_routing_algorithm_if_routable_connector_exists(
&self,
@@ -1973,11 +1921,7 @@ trait MerchantConnectorAccountUpdateBridge {
) -> RouterResult<domain::MerchantConnectorAccountUpdate>;
}
-#[cfg(all(
- feature = "v2",
- feature = "merchant_connector_account_v2",
- feature = "olap"
-))]
+#[cfg(all(feature = "v2", feature = "olap"))]
#[async_trait::async_trait]
impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnectorUpdate {
async fn get_merchant_connector_account_from_id(
@@ -2142,10 +2086,7 @@ impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnect
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2", feature = "olap"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(all(feature = "v1", feature = "olap"))]
#[async_trait::async_trait]
impl MerchantConnectorAccountUpdateBridge for api_models::admin::MerchantConnectorUpdate {
async fn get_merchant_connector_account_from_id(
@@ -2342,12 +2283,7 @@ trait MerchantConnectorAccountCreateBridge {
) -> RouterResult<domain::BusinessProfile>;
}
-#[cfg(all(
- feature = "v2",
- feature = "merchant_connector_account_v2",
- feature = "olap",
- feature = "merchant_account_v2"
-))]
+#[cfg(all(feature = "v2", feature = "olap",))]
#[async_trait::async_trait]
impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
async fn create_domain_model_from_request(
@@ -2500,11 +2436,7 @@ impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2", feature = "olap"),
- not(feature = "merchant_connector_account_v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "v1", feature = "olap"))]
#[async_trait::async_trait]
impl MerchantConnectorAccountCreateBridge for api::MerchantConnectorCreate {
async fn create_domain_model_from_request(
@@ -2725,10 +2657,7 @@ pub async fn create_connector(
connector_metadata.validate_apple_pay_certificates_in_mca_metadata()?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
helpers::validate_business_details(
req.business_country,
req.business_label.as_ref(),
@@ -2798,10 +2727,7 @@ pub async fn create_connector(
},
)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2",))
- ))]
+ #[cfg(feature = "v1")]
//update merchant default config
let merchant_default_config_update = MerchantDefaultConfigUpdate {
routable_connector: &routable_connector,
@@ -2812,11 +2738,7 @@ pub async fn create_connector(
transaction_type: &req.get_transaction_type(),
};
- #[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2",
- ))]
+ #[cfg(feature = "v2")]
//update merchant default config
let merchant_default_config_update = DefaultFallbackRoutingConfigUpdate {
routable_connector: &routable_connector,
@@ -2844,10 +2766,7 @@ pub async fn create_connector(
Ok(service_api::ApplicationResponse::Json(mca_response))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
async fn validate_pm_auth(
val: pii::SecretSerdeValue,
state: &SessionState,
@@ -2896,10 +2815,7 @@ async fn validate_pm_auth(
Ok(services::ApplicationResponse::StatusOk)
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn retrieve_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
@@ -2940,7 +2856,7 @@ pub async fn retrieve_connector(
))
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn retrieve_connector(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -3098,10 +3014,7 @@ pub async fn update_connector(
Ok(service_api::ApplicationResponse::Json(response))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn delete_connector(
state: SessionState,
merchant_id: id_type::MerchantId,
@@ -3153,7 +3066,7 @@ pub async fn delete_connector(
Ok(service_api::ApplicationResponse::Json(response))
}
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn delete_connector(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -3358,10 +3271,7 @@ pub fn get_frm_config_as_secret(
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn create_and_insert_business_profile(
state: &SessionState,
request: api::BusinessProfileCreate,
@@ -3393,10 +3303,7 @@ pub async fn create_and_insert_business_profile(
#[cfg(feature = "olap")]
#[async_trait::async_trait]
trait BusinessProfileCreateBridge {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn create_domain_model_from_request(
self,
state: &SessionState,
@@ -3404,7 +3311,7 @@ trait BusinessProfileCreateBridge {
key: &domain::MerchantKeyStore,
) -> RouterResult<domain::BusinessProfile>;
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
async fn create_domain_model_from_request(
self,
state: &SessionState,
@@ -3416,10 +3323,7 @@ trait BusinessProfileCreateBridge {
#[cfg(feature = "olap")]
#[async_trait::async_trait]
impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn create_domain_model_from_request(
self,
state: &SessionState,
@@ -3550,7 +3454,7 @@ impl BusinessProfileCreateBridge for api::BusinessProfileCreate {
))
}
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
async fn create_domain_model_from_request(
self,
state: &SessionState,
@@ -3665,15 +3569,12 @@ pub async fn create_business_profile(
let db = state.store.as_ref();
let key_manager_state = &(&state).into();
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
let business_profile = request
.create_domain_model_from_request(&state, &merchant_account, &key_store)
.await?;
- #[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+ #[cfg(feature = "v2")]
let business_profile = request
.create_domain_model_from_request(&state, &key_store, merchant_account.get_id())
.await?;
@@ -3691,10 +3592,7 @@ pub async fn create_business_profile(
})
.attach_printable("Failed to insert Business profile because of duplication error")?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
- ))]
+ #[cfg(feature = "v1")]
if merchant_account.default_profile.is_some() {
let unset_default_profile = domain::MerchantAccountUpdate::UnsetDefaultProfile;
db.update_merchant(
@@ -3793,11 +3691,7 @@ trait BusinessProfileUpdateBridge {
) -> RouterResult<domain::BusinessProfileUpdate>;
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[async_trait::async_trait]
impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
async fn get_update_business_profile_object(
@@ -3908,7 +3802,7 @@ impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
}
}
-#[cfg(all(feature = "olap", feature = "v2", feature = "business_profile_v2"))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[async_trait::async_trait]
impl BusinessProfileUpdateBridge for api::BusinessProfileUpdate {
async fn get_update_business_profile_object(
@@ -4040,21 +3934,13 @@ pub async fn update_business_profile(
))
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
pub struct BusinessProfileWrapper {
pub profile: domain::BusinessProfile,
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
impl BusinessProfileWrapper {
pub fn new(profile: domain::BusinessProfile) -> Self {
Self { profile }
diff --git a/crates/router/src/core/conditional_config.rs b/crates/router/src/core/conditional_config.rs
index 4c96ebc7d2..9ef409268f 100644
--- a/crates/router/src/core/conditional_config.rs
+++ b/crates/router/src/core/conditional_config.rs
@@ -11,7 +11,7 @@ use crate::{
types::domain,
};
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn upsert_conditional_config(
_state: SessionState,
_key_store: domain::MerchantKeyStore,
@@ -21,10 +21,7 @@ pub async fn upsert_conditional_config(
todo!()
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn upsert_conditional_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
@@ -163,7 +160,7 @@ pub async fn upsert_conditional_config(
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn delete_conditional_config(
_state: SessionState,
_key_store: domain::MerchantKeyStore,
@@ -172,10 +169,7 @@ pub async fn delete_conditional_config(
todo!()
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn delete_conditional_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
diff --git a/crates/router/src/core/connector_onboarding/paypal.rs b/crates/router/src/core/connector_onboarding/paypal.rs
index a61fab395f..0dca02bf79 100644
--- a/crates/router/src/core/connector_onboarding/paypal.rs
+++ b/crates/router/src/core/connector_onboarding/paypal.rs
@@ -148,10 +148,7 @@ pub async fn update_mca(
.encode_to_value()
.change_context(ApiErrorResponse::InternalServerError)
.attach_printable("Error while deserializing connector_account_details")?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let request = MerchantConnectorUpdate {
connector_type: common_enums::ConnectorType::PaymentProcessor,
connector_account_details: Some(Secret::new(connector_auth_json)),
@@ -166,7 +163,7 @@ pub async fn update_mca(
test_mode: None,
additional_merchant_data: None,
};
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let request = MerchantConnectorUpdate {
connector_type: common_enums::ConnectorType::PaymentProcessor,
connector_account_details: Some(Secret::new(connector_auth_json)),
diff --git a/crates/router/src/core/fraud_check.rs b/crates/router/src/core/fraud_check.rs
index d185e3545b..f0d3f79f66 100644
--- a/crates/router/src/core/fraud_check.rs
+++ b/crates/router/src/core/fraud_check.rs
@@ -119,7 +119,7 @@ where
Ok(router_data_res)
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn should_call_frm<F: Send + Clone>(
_merchant_account: &domain::MerchantAccount,
_payment_data: &payments::PaymentData<F>,
@@ -136,7 +136,7 @@ pub async fn should_call_frm<F: Send + Clone>(
todo!()
}
-#[cfg(all(feature = "v1", not(feature = "merchant_account_v2")))]
+#[cfg(feature = "v1")]
pub async fn should_call_frm<F: Send + Clone>(
merchant_account: &domain::MerchantAccount,
payment_data: &payments::PaymentData<F>,
@@ -171,10 +171,7 @@ pub async fn should_call_frm<F: Send + Clone>(
.attach_printable("profile_id is not set in payment_intent")?
.clone();
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let merchant_connector_account_from_db_option = db
.find_merchant_connector_account_by_profile_id_connector_name(
&state.into(),
@@ -204,7 +201,7 @@ pub async fn should_call_frm<F: Send + Clone>(
}
});
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let merchant_connector_account_from_db_option: Option<
domain::MerchantConnectorAccount,
> = {
diff --git a/crates/router/src/core/payment_methods/cards.rs b/crates/router/src/core/payment_methods/cards.rs
index 0e9244f1b5..f459210be7 100644
--- a/crates/router/src/core/payment_methods/cards.rs
+++ b/crates/router/src/core/payment_methods/cards.rs
@@ -3664,10 +3664,7 @@ pub async fn call_surcharge_decision_management(
billing_address: Option<domain::Address>,
response_payment_method_types: &mut [ResponsePaymentMethodsEnabled],
) -> errors::RouterResult<api_surcharge_decision_configs::MerchantSurchargeConfigs> {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let algorithm_ref: routing_types::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -3678,7 +3675,7 @@ pub async fn call_surcharge_decision_management(
.unwrap_or_default();
// TODO: Move to business profile surcharge decision column
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let algorithm_ref: routing_types::RoutingAlgorithmRef = todo!();
let (surcharge_results, merchant_sucharge_configs) =
@@ -3725,10 +3722,7 @@ pub async fn call_surcharge_decision_management_for_saved_card(
payment_intent: storage::PaymentIntent,
customer_payment_method_response: &mut api::CustomerPaymentMethodsListResponse,
) -> errors::RouterResult<()> {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let algorithm_ref: routing_types::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -3737,10 +3731,10 @@ pub async fn call_surcharge_decision_management_for_saved_card(
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Could not decode the routing algorithm")?
.unwrap_or_default();
- // TODO: Move to business profile surcharge column
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let algorithm_ref: routing_types::RoutingAlgorithmRef = todo!();
+ // TODO: Move to business profile surcharge column
let surcharge_results = perform_surcharge_decision_management_for_saved_cards(
state,
algorithm_ref,
diff --git a/crates/router/src/core/payment_methods/validator.rs b/crates/router/src/core/payment_methods/validator.rs
index f32e337a8c..f7c7c89796 100644
--- a/crates/router/src/core/payment_methods/validator.rs
+++ b/crates/router/src/core/payment_methods/validator.rs
@@ -75,10 +75,7 @@ pub async fn validate_request_and_initiate_payment_method_collect_link(
// Fetch all configs
let default_config = &state.conf.generic_link.payment_method_collect;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let merchant_config = merchant_account
.pm_collect_link_config
.as_ref()
@@ -93,7 +90,7 @@ pub async fn validate_request_and_initiate_payment_method_collect_link(
field_name: "pm_collect_link_config in merchant_account",
})?;
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let merchant_config = Option::<admin::BusinessCollectLinkConfig>::None;
let merchant_ui_config = merchant_config.as_ref().map(|c| c.config.ui_config.clone());
diff --git a/crates/router/src/core/payments.rs b/crates/router/src/core/payments.rs
index 1f9eab87e1..678c9522a9 100644
--- a/crates/router/src/core/payments.rs
+++ b/crates/router/src/core/payments.rs
@@ -642,10 +642,7 @@ pub async fn call_decision_manager<O>(
where
O: Send + Clone,
{
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = merchant_account
.routing_algorithm
.clone()
@@ -656,7 +653,7 @@ where
.unwrap_or_default();
// TODO: Move to business profile surcharge column
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = todo!();
let output = perform_decision_management(
@@ -789,10 +786,7 @@ where
.map(|session_connector_data| session_connector_data.payment_method_type)
.collect();
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = _merchant_account
.routing_algorithm
.clone()
@@ -803,7 +797,7 @@ where
.unwrap_or_default();
// TODO: Move to business profile surcharge column
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let algorithm_ref: api::routing::RoutingAlgorithmRef = todo!();
let surcharge_results =
@@ -3996,11 +3990,7 @@ where
Ok(final_list)
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
#[allow(clippy::too_many_arguments)]
pub async fn route_connector_v1<F>(
state: &SessionState,
@@ -4085,10 +4075,7 @@ where
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
#[allow(clippy::too_many_arguments)]
pub async fn route_connector_v1<F>(
state: &SessionState,
diff --git a/crates/router/src/core/payments/helpers.rs b/crates/router/src/core/payments/helpers.rs
index 5d93170eb9..38f0fd127f 100644
--- a/crates/router/src/core/payments/helpers.rs
+++ b/crates/router/src/core/payments/helpers.rs
@@ -45,11 +45,7 @@ use super::{
operations::{BoxedOperation, Operation, PaymentResponse},
CustomerDetails, PaymentData,
};
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
use crate::core::admin as core_admin;
use crate::{
configs::settings::{ConnectorRequestReferenceIdConfig, TempLockerEnableConfig},
@@ -421,10 +417,7 @@ pub async fn get_token_pm_type_mandate_details(
let db = &*state.store;
let key_manager_state = &state.into();
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let connector_name = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -437,7 +430,7 @@ pub async fn get_token_pm_type_mandate_details(
id: mca_id.clone().get_string_repr().to_string(),
})?.connector_name;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let connector_name = db
.find_merchant_connector_account_by_id(key_manager_state, mca_id, merchant_key_store)
.await
@@ -2960,10 +2953,7 @@ pub async fn verify_payment_intent_time_and_client_secret(
.transpose()
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// Check whether the business details are configured in the merchant account
pub fn validate_business_details(
business_country: Option<api_enums::CountryAlpha2>,
@@ -3278,10 +3268,7 @@ impl MerchantConnectorAccountType {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
pub fn is_test_mode_on(&self) -> Option<bool> {
match self {
Self::DbVal(val) => val.test_mode,
@@ -3289,7 +3276,7 @@ impl MerchantConnectorAccountType {
}
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
pub fn is_test_mode_on(&self) -> Option<bool> {
None
}
@@ -3407,10 +3394,7 @@ pub async fn get_merchant_connector_account(
None => {
let mca: RouterResult<domain::MerchantConnectorAccount> =
if let Some(merchant_connector_id) = merchant_connector_id {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -3425,7 +3409,7 @@ pub async fn get_merchant_connector_account(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
// get mca using id
{
let _id = merchant_connector_id;
@@ -3436,10 +3420,7 @@ pub async fn get_merchant_connector_account(
todo!()
}
} else {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
@@ -3457,7 +3438,7 @@ pub async fn get_merchant_connector_account(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
todo!()
}
@@ -4338,10 +4319,7 @@ where
}
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
- ))]
+ #[cfg(feature = "v1")]
let fallback_connetors_list = crate::core::routing::helpers::get_merchant_default_config(
&*state.clone().store,
profile_id.get_string_repr(),
@@ -4351,11 +4329,7 @@ where
.change_context(errors::ApiErrorResponse::InternalServerError)
.attach_printable("Failed to get merchant default fallback connectors config")?;
- #[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
- ))]
+ #[cfg(feature = "v2")]
let fallback_connetors_list = core_admin::BusinessProfileWrapper::new(business_profile)
.get_default_fallback_list_of_connector_under_profile()
.change_context(errors::ApiErrorResponse::InternalServerError)
diff --git a/crates/router/src/core/payments/operations/payment_create.rs b/crates/router/src/core/payments/operations/payment_create.rs
index 200d549097..a947d66bae 100644
--- a/crates/router/src/core/payments/operations/payment_create.rs
+++ b/crates/router/src/core/payments/operations/payment_create.rs
@@ -83,10 +83,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.get_payment_intent_id()
.change_context(errors::ApiErrorResponse::PaymentNotFound)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
helpers::validate_business_details(
request.business_country,
request.business_label.as_ref(),
@@ -94,10 +91,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
)?;
// If profile id is not passed, get it from the business_country and business_label
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let profile_id = core_utils::get_profile_id_from_business_details(
key_manager_state,
merchant_key_store,
@@ -111,7 +105,7 @@ impl<F: Send + Clone> GetTracker<F, PaymentData<F>, api::PaymentsRequest> for Pa
.await?;
// Profile id will be mandatory in v2 in the request / headers
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let profile_id = request
.profile_id
.clone()
diff --git a/crates/router/src/core/payments/operations/payment_session.rs b/crates/router/src/core/payments/operations/payment_session.rs
index 4bf740f146..a5c27b2042 100644
--- a/crates/router/src/core/payments/operations/payment_session.rs
+++ b/crates/router/src/core/payments/operations/payment_session.rs
@@ -449,10 +449,7 @@ where
.inspect_err(|err| {
logger::error!(session_token_error=?err);
}) {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
let new_session_connector_data = api::SessionConnectorData::new(
payment_method_type,
@@ -461,7 +458,7 @@ where
);
session_connector_data.push(new_session_connector_data)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
let new_session_connector_data =
api::SessionConnectorData::new(payment_method_type, connector_data, None);
diff --git a/crates/router/src/core/payments/routing.rs b/crates/router/src/core/payments/routing.rs
index ddcc1cb8e8..5303366dbe 100644
--- a/crates/router/src/core/payments/routing.rs
+++ b/crates/router/src/core/payments/routing.rs
@@ -34,11 +34,7 @@ use rand::{
use rustc_hash::FxHashMap;
use storage_impl::redis::cache::{CacheKey, CGRAPH_CACHE, ROUTING_CACHE};
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
use crate::core::admin;
#[cfg(feature = "payouts")]
use crate::core::payouts;
@@ -86,31 +82,21 @@ pub struct SessionRoutingPmTypeInput<'a> {
type RoutingResult<O> = oss_errors::CustomResult<O, errors::RoutingError>;
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
enum MerchantAccountRoutingAlgorithm {
V1(routing_types::RoutingAlgorithmRef),
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
impl Default for MerchantAccountRoutingAlgorithm {
fn default() -> Self {
Self::V1(routing_types::RoutingAlgorithmRef::default())
}
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
#[derive(Debug, serde::Serialize, serde::Deserialize)]
#[serde(untagged)]
enum MerchantAccountRoutingAlgorithm {
@@ -296,10 +282,7 @@ pub async fn perform_static_routing_v1<F: Clone>(
let algorithm_id = if let Some(id) = algorithm_id {
id
} else {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
- ))]
+ #[cfg(feature = "v1")]
let fallback_config = routing::helpers::get_merchant_default_config(
&*state.clone().store,
business_profile.get_id().get_string_repr(),
@@ -307,11 +290,7 @@ pub async fn perform_static_routing_v1<F: Clone>(
)
.await
.change_context(errors::RoutingError::FallbackConfigFetchFailed)?;
- #[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
- ))]
+ #[cfg(feature = "v2")]
let fallback_config = admin::BusinessProfileWrapper::new(business_profile.clone())
.get_default_fallback_list_of_connector_under_profile()
.change_context(errors::RoutingError::FallbackConfigFetchFailed)?;
@@ -737,10 +716,7 @@ pub async fn perform_fallback_routing<F: Clone>(
eligible_connectors: Option<&Vec<api_enums::RoutableConnectors>>,
business_profile: &domain::BusinessProfile,
) -> RoutingResult<Vec<routing_types::RoutableConnectorChoice>> {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
- ))]
+ #[cfg(feature = "v1")]
let fallback_config = routing::helpers::get_merchant_default_config(
&*state.store,
match transaction_data {
@@ -760,11 +736,7 @@ pub async fn perform_fallback_routing<F: Clone>(
)
.await
.change_context(errors::RoutingError::FallbackConfigFetchFailed)?;
- #[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
- ))]
+ #[cfg(feature = "v2")]
let fallback_config = admin::BusinessProfileWrapper::new(business_profile.clone())
.get_default_fallback_list_of_connector_under_profile()
.change_context(errors::RoutingError::FallbackConfigFetchFailed)?;
@@ -857,18 +829,11 @@ pub async fn perform_session_flow_routing(
)
.await
.change_context(errors::RoutingError::ProfileNotFound)?;
- #[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
- ))]
+ #[cfg(feature = "v2")]
let routing_algorithm =
MerchantAccountRoutingAlgorithm::V1(business_profile.routing_algorithm_id.clone());
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
- ))]
+ #[cfg(feature = "v1")]
let routing_algorithm: MerchantAccountRoutingAlgorithm = {
business_profile
.routing_algorithm
@@ -999,10 +964,7 @@ pub async fn perform_session_flow_routing(
Ok(result)
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
async fn perform_session_routing_for_pm_type(
session_pm_input: &SessionRoutingPmTypeInput<'_>,
transaction_type: &api_enums::TransactionType,
@@ -1085,11 +1047,7 @@ async fn perform_session_routing_for_pm_type(
}
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
async fn perform_session_routing_for_pm_type(
session_pm_input: &SessionRoutingPmTypeInput<'_>,
transaction_type: &api_enums::TransactionType,
diff --git a/crates/router/src/core/payouts/validator.rs b/crates/router/src/core/payouts/validator.rs
index 51ddf64f8d..c647d6eaf1 100644
--- a/crates/router/src/core/payouts/validator.rs
+++ b/crates/router/src/core/payouts/validator.rs
@@ -159,10 +159,7 @@ pub async fn validate_create_request(
_ => Ok(None),
}?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let profile_id = core_utils::get_profile_id_from_business_details(
&state.into(),
merchant_key_store,
@@ -175,7 +172,7 @@ pub async fn validate_create_request(
)
.await?;
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
// Profile id will be mandatory in v2 in the request / headers
let profile_id = req
.profile_id
diff --git a/crates/router/src/core/pm_auth.rs b/crates/router/src/core/pm_auth.rs
index 6710a7c86d..ba464d27f0 100644
--- a/crates/router/src/core/pm_auth.rs
+++ b/crates/router/src/core/pm_auth.rs
@@ -134,10 +134,7 @@ pub async fn create_link_token(
.and_then(|address| address.country)
.map(|country| country.to_string());
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@@ -151,7 +148,7 @@ pub async fn create_link_token(
id: merchant_account.get_id().get_string_repr().to_owned(),
})?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let merchant_connector_account = {
let _ = billing_country;
todo!()
@@ -239,10 +236,7 @@ pub async fn exchange_token_core(
let connector = PaymentAuthConnectorData::get_connector_by_name(connector_name)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@@ -256,7 +250,7 @@ pub async fn exchange_token_core(
id: merchant_account.get_id().get_string_repr().to_owned(),
})?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let merchant_connector_account: domain::MerchantConnectorAccount = {
let _ = merchant_account;
let _ = connector;
@@ -740,10 +734,7 @@ pub async fn retrieve_payment_method_from_auth_service(
.await
.to_not_found_response(ApiErrorResponse::MerchantAccountNotFound)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let mca = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -764,7 +755,7 @@ pub async fn retrieve_payment_method_from_auth_service(
"error while fetching merchant_connector_account from merchant_id and connector name",
)?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let mca = {
let _ = merchant_account;
let _ = connector;
diff --git a/crates/router/src/core/routing.rs b/crates/router/src/core/routing.rs
index 9efe2cd6ab..e431ae7b51 100644
--- a/crates/router/src/core/routing.rs
+++ b/crates/router/src/core/routing.rs
@@ -12,9 +12,9 @@ use rustc_hash::FxHashSet;
use super::payments;
#[cfg(feature = "payouts")]
use super::payouts;
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
use crate::utils::ValueExt;
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
use crate::{
core::{admin, errors::RouterResult},
db::StorageInterface,
@@ -41,10 +41,10 @@ where
Payout(&'a payouts::PayoutData),
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
struct RoutingAlgorithmUpdate(RoutingAlgorithm);
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
impl RoutingAlgorithmUpdate {
pub fn create_new_routing_algorithm(
request: &routing_types::RoutingConfigRequest,
@@ -114,7 +114,7 @@ pub async fn retrieve_merchant_routing_dictionary(
))
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
pub async fn create_routing_algorithm_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -184,7 +184,7 @@ pub async fn create_routing_algorithm_under_profile(
Ok(service_api::ApplicationResponse::Json(new_record))
}
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
pub async fn create_routing_algorithm_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -274,11 +274,7 @@ pub async fn create_routing_algorithm_under_profile(
Ok(service_api::ApplicationResponse::Json(new_record))
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
pub async fn link_routing_config_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -348,10 +344,7 @@ pub async fn link_routing_config_under_profile(
))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn link_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -430,7 +423,7 @@ pub async fn link_routing_config(
))
}
-#[cfg(all(feature = "v2", feature = "routing_v2",))]
+#[cfg(feature = "v2")]
pub async fn retrieve_routing_algorithm_from_algorithm_id(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -466,7 +459,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
Ok(service_api::ApplicationResponse::Json(response))
}
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
pub async fn retrieve_routing_algorithm_from_algorithm_id(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -507,11 +500,7 @@ pub async fn retrieve_routing_algorithm_from_algorithm_id(
Ok(service_api::ApplicationResponse::Json(response))
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
pub async fn unlink_routing_config_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -565,10 +554,7 @@ pub async fn unlink_routing_config_under_profile(
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn unlink_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -661,11 +647,7 @@ pub async fn unlink_routing_config(
}
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
pub async fn update_default_fallback_routing(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -741,10 +723,7 @@ pub async fn update_default_fallback_routing(
))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn update_default_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -797,11 +776,7 @@ pub async fn update_default_routing_config(
Ok(service_api::ApplicationResponse::Json(updated_config))
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
pub async fn retrieve_default_fallback_algorithm_for_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -828,10 +803,7 @@ pub async fn retrieve_default_fallback_algorithm_for_profile(
Ok(service_api::ApplicationResponse::Json(connectors_choice))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn retrieve_default_routing_config(
state: SessionState,
@@ -852,11 +824,7 @@ pub async fn retrieve_default_routing_config(
service_api::ApplicationResponse::Json(conn_choice)
})
}
-#[cfg(all(
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(feature = "v2")]
pub async fn retrieve_routing_config_under_profile(
state: SessionState,
merchant_account: domain::MerchantAccount,
@@ -900,10 +868,7 @@ pub async fn retrieve_routing_config_under_profile(
))
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn retrieve_linked_routing_config(
state: SessionState,
merchant_account: domain::MerchantAccount,
diff --git a/crates/router/src/core/routing/helpers.rs b/crates/router/src/core/routing/helpers.rs
index f0dbf8dfa8..bd4107a48d 100644
--- a/crates/router/src/core/routing/helpers.rs
+++ b/crates/router/src/core/routing/helpers.rs
@@ -9,7 +9,7 @@ use error_stack::ResultExt;
use rustc_hash::FxHashSet;
use storage_impl::redis::cache;
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
use crate::types::domain::MerchantConnectorAccount;
use crate::{
core::errors::{self, RouterResult},
@@ -116,10 +116,7 @@ pub async fn update_merchant_routing_dictionary(
/// This will help make one of all configured algorithms to be in active state for a particular
/// merchant
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn update_merchant_active_algorithm_ref(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
@@ -173,7 +170,7 @@ pub async fn update_merchant_active_algorithm_ref(
Ok(())
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn update_merchant_active_algorithm_ref(
_state: &SessionState,
_key_store: &domain::MerchantKeyStore,
@@ -184,10 +181,7 @@ pub async fn update_merchant_active_algorithm_ref(
todo!()
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn update_business_profile_active_algorithm_ref(
db: &dyn StorageInterface,
key_manager_state: &KeyManagerState,
@@ -242,7 +236,7 @@ pub async fn update_business_profile_active_algorithm_ref(
Ok(())
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
pub struct RoutingAlgorithmHelpers<'h> {
pub name_mca_id_set: ConnectNameAndMCAIdForProfile<'h>,
@@ -260,11 +254,11 @@ pub struct ConnectNameAndMCAIdForProfile<'a>(
#[derive(Clone, Debug)]
pub struct ConnectNameForProfile<'a>(pub FxHashSet<&'a String>);
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
#[derive(Clone, Debug)]
pub struct MerchantConnectorAccounts(pub Vec<MerchantConnectorAccount>);
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
impl MerchantConnectorAccounts {
pub async fn get_all_mcas(
merchant_id: &common_utils::id_type::MerchantId,
@@ -316,7 +310,7 @@ impl MerchantConnectorAccounts {
}
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
impl<'h> RoutingAlgorithmHelpers<'h> {
fn connector_choice(
&self,
@@ -397,7 +391,7 @@ impl<'h> RoutingAlgorithmHelpers<'h> {
}
}
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
pub async fn validate_connectors_in_routing_config(
state: &SessionState,
key_store: &domain::MerchantKeyStore,
diff --git a/crates/router/src/core/surcharge_decision_config.rs b/crates/router/src/core/surcharge_decision_config.rs
index 461764ca42..0ff5f3fb37 100644
--- a/crates/router/src/core/surcharge_decision_config.rs
+++ b/crates/router/src/core/surcharge_decision_config.rs
@@ -11,10 +11,7 @@ use crate::{
types::domain,
};
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn upsert_surcharge_decision_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
@@ -142,7 +139,7 @@ pub async fn upsert_surcharge_decision_config(
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn upsert_surcharge_decision_config(
_state: SessionState,
_key_store: domain::MerchantKeyStore,
@@ -152,10 +149,7 @@ pub async fn upsert_surcharge_decision_config(
todo!();
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
pub async fn delete_surcharge_decision_config(
state: SessionState,
key_store: domain::MerchantKeyStore,
@@ -192,7 +186,7 @@ pub async fn delete_surcharge_decision_config(
Ok(service_api::ApplicationResponse::StatusOk)
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn delete_surcharge_decision_config(
_state: SessionState,
_key_store: domain::MerchantKeyStore,
diff --git a/crates/router/src/core/user/dashboard_metadata.rs b/crates/router/src/core/user/dashboard_metadata.rs
index ee11a38136..47639fed71 100644
--- a/crates/router/src/core/user/dashboard_metadata.rs
+++ b/crates/router/src/core/user/dashboard_metadata.rs
@@ -711,10 +711,7 @@ pub async fn get_merchant_connector_account_by_name(
connector_name: &str,
key_store: &MerchantKeyStore,
) -> UserResult<Option<domain::MerchantConnectorAccount>> {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
state
.store
@@ -731,7 +728,7 @@ pub async fn get_merchant_connector_account_by_name(
})
.map(|data| data.first().cloned())
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
let _ = state;
let _ = merchant_id;
diff --git a/crates/router/src/core/user_role.rs b/crates/router/src/core/user_role.rs
index 5ee71d0e50..5125147fde 100644
--- a/crates/router/src/core/user_role.rs
+++ b/crates/router/src/core/user_role.rs
@@ -36,7 +36,6 @@ pub async fn get_authorization_info_with_groups(
),
))
}
-
pub async fn get_authorization_info_with_group_tag(
) -> UserResponse<user_role_api::AuthorizationInfoResponse> {
static GROUPS_WITH_PARENT_TAGS: Lazy<Vec<user_role_api::ParentInfo>> = Lazy::new(|| {
@@ -262,7 +261,6 @@ pub async fn accept_invitation(
.list_multiple_merchant_accounts(&(&state).into(), req.merchant_ids)
.await
.change_context(UserErrors::InternalServerError)?;
-
let update_result =
futures::future::join_all(merchant_accounts.iter().map(|merchant_account| async {
let (update_v1_result, update_v2_result) =
diff --git a/crates/router/src/core/utils.rs b/crates/router/src/core/utils.rs
index 0c4015d321..a6cf890dc1 100644
--- a/crates/router/src/core/utils.rs
+++ b/crates/router/src/core/utils.rs
@@ -1145,10 +1145,7 @@ pub fn get_connector_label(
})
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// If profile_id is not passed, use default profile if available, or
/// If business_details (business_country and business_label) are passed, get the business_profile
/// or return a `MissingRequiredField` error
@@ -1368,14 +1365,14 @@ impl GetProfileId for diesel_models::Refund {
}
}
-#[cfg(all(any(feature = "v1", feature = "v2"), not(feature = "routing_v2")))]
+#[cfg(feature = "v1")]
impl GetProfileId for api_models::routing::RoutingConfigRequest {
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
self.profile_id.as_ref()
}
}
-#[cfg(all(feature = "v2", feature = "routing_v2"))]
+#[cfg(feature = "v2")]
impl GetProfileId for api_models::routing::RoutingConfigRequest {
fn get_profile_id(&self) -> Option<&common_utils::id_type::ProfileId> {
Some(&self.profile_id)
diff --git a/crates/router/src/core/verification.rs b/crates/router/src/core/verification.rs
index 8dc312b7f5..3c1b95dd98 100644
--- a/crates/router/src/core/verification.rs
+++ b/crates/router/src/core/verification.rs
@@ -103,10 +103,7 @@ pub async fn get_verified_apple_domains_with_mid_mca_id(
.await
.change_context(errors::ApiErrorResponse::MerchantAccountNotFound)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let verified_domains = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -119,7 +116,7 @@ pub async fn get_verified_apple_domains_with_mid_mca_id(
.applepay_verified_domains
.unwrap_or_default();
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let verified_domains = {
let _ = merchant_connector_id;
let _ = key_store;
diff --git a/crates/router/src/core/verification/utils.rs b/crates/router/src/core/verification/utils.rs
index 5323c6d744..404019e809 100644
--- a/crates/router/src/core/verification/utils.rs
+++ b/crates/router/src/core/verification/utils.rs
@@ -32,10 +32,7 @@ pub async fn check_existence_and_add_domain_to_db(
.await
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let merchant_connector_account = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@@ -47,7 +44,7 @@ pub async fn check_existence_and_add_domain_to_db(
.await
.change_context(errors::ApiErrorResponse::InternalServerError)?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let merchant_connector_account: hyperswitch_domain_models::merchant_connector_account::MerchantConnectorAccount = {
let _ = merchant_connector_id;
let _ = key_store;
@@ -69,10 +66,7 @@ pub async fn check_existence_and_add_domain_to_db(
.collect();
already_verified_domains.append(&mut new_verified_domains);
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let updated_mca = storage::MerchantConnectorAccountUpdate::Update {
connector_type: None,
connector_name: None,
@@ -91,7 +85,7 @@ pub async fn check_existence_and_add_domain_to_db(
connector_wallets_details: None,
additional_merchant_data: None,
};
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let updated_mca = storage::MerchantConnectorAccountUpdate::Update {
connector_type: None,
connector_account_details: None,
diff --git a/crates/router/src/core/webhooks/incoming.rs b/crates/router/src/core/webhooks/incoming.rs
index bc1b4b6f27..056a85d9c8 100644
--- a/crates/router/src/core/webhooks/incoming.rs
+++ b/crates/router/src/core/webhooks/incoming.rs
@@ -1660,10 +1660,7 @@ async fn fetch_optional_mca_and_connector(
> {
let db = &state.store;
if connector_name_or_mca_id.starts_with("mca_") {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let mca = db
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&state.into(),
@@ -1685,7 +1682,7 @@ async fn fetch_optional_mca_and_connector(
.attach_printable(
"error while fetching merchant_connector_account from connector_id",
)?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let mca: domain::MerchantConnectorAccount = {
let _ = merchant_account;
let _ = key_store;
diff --git a/crates/router/src/db/kafka_store.rs b/crates/router/src/db/kafka_store.rs
index 341684ab8d..0293dd2b32 100644
--- a/crates/router/src/db/kafka_store.rs
+++ b/crates/router/src/db/kafka_store.rs
@@ -1104,10 +1104,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.update_multiple_merchant_connector_accounts(merchant_connector_accounts)
.await
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_label(
&self,
state: &KeyManagerState,
@@ -1125,10 +1122,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
state: &KeyManagerState,
@@ -1146,10 +1140,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
@@ -1178,10 +1169,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&self,
state: &KeyManagerState,
@@ -1199,7 +1187,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
@@ -1240,10 +1228,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &id_type::MerchantId,
@@ -1257,7 +1242,7 @@ impl MerchantConnectorAccountInterface for KafkaStore {
.await
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn delete_merchant_connector_account_by_id(
&self,
id: &id_type::MerchantConnectorAccountId,
diff --git a/crates/router/src/db/merchant_account.rs b/crates/router/src/db/merchant_account.rs
index 8aa013ab08..c3b2c45f33 100644
--- a/crates/router/src/db/merchant_account.rs
+++ b/crates/router/src/db/merchant_account.rs
@@ -580,10 +580,7 @@ async fn publish_and_redact_merchant_account_cache(
.as_ref()
.map(|publishable_key| CacheKind::Accounts(publishable_key.into()));
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let cgraph_key = merchant_account.default_profile.as_ref().map(|profile_id| {
CacheKind::CGraph(
format!(
@@ -596,7 +593,7 @@ async fn publish_and_redact_merchant_account_cache(
});
// TODO: we will not have default profile in v2
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let cgraph_key = None;
let mut cache_keys = vec![CacheKind::Accounts(
diff --git a/crates/router/src/db/merchant_connector_account.rs b/crates/router/src/db/merchant_connector_account.rs
index 831804b0c6..c13fd3fe9b 100644
--- a/crates/router/src/db/merchant_connector_account.rs
+++ b/crates/router/src/db/merchant_connector_account.rs
@@ -122,10 +122,7 @@ where
NewDstType = storage::MerchantConnectorAccountNew,
>,
{
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_label(
&self,
state: &KeyManagerState,
@@ -134,10 +131,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
@@ -146,10 +140,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
state: &KeyManagerState,
@@ -165,10 +156,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&self,
state: &KeyManagerState,
@@ -177,7 +165,7 @@ where
key_store: &domain::MerchantKeyStore,
) -> CustomResult<domain::MerchantConnectorAccount, errors::StorageError>;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
@@ -209,17 +197,14 @@ where
)>,
) -> CustomResult<(), errors::StorageError>;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
merchant_connector_id: &common_utils::id_type::MerchantConnectorAccountId,
) -> CustomResult<bool, errors::StorageError>;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn delete_merchant_connector_account_by_id(
&self,
id: &common_utils::id_type::MerchantConnectorAccountId,
@@ -228,10 +213,7 @@ where
#[async_trait::async_trait]
impl MerchantConnectorAccountInterface for Store {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_merchant_connector_account_by_merchant_id_connector_label(
&self,
@@ -282,10 +264,7 @@ impl MerchantConnectorAccountInterface for Store {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
@@ -340,10 +319,7 @@ impl MerchantConnectorAccountInterface for Store {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
#[instrument(skip_all)]
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
@@ -379,10 +355,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&self,
state: &KeyManagerState,
@@ -438,7 +411,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
@@ -648,10 +621,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn update_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -731,7 +701,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn update_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -813,10 +783,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
@@ -892,7 +859,7 @@ impl MerchantConnectorAccountInterface for Store {
}
#[instrument(skip_all)]
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn delete_merchant_connector_account_by_id(
&self,
id: &common_utils::id_type::MerchantConnectorAccountId,
@@ -970,10 +937,7 @@ impl MerchantConnectorAccountInterface for MockDb {
// apple pay certificate migration
Err(errors::StorageError::MockDbError)?
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_label(
&self,
state: &KeyManagerState,
@@ -1013,10 +977,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_merchant_id_connector_name(
&self,
state: &KeyManagerState,
@@ -1050,10 +1011,7 @@ impl MerchantConnectorAccountInterface for MockDb {
Ok(output)
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_merchant_connector_account_by_profile_id_connector_name(
&self,
state: &KeyManagerState,
@@ -1089,10 +1047,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&self,
state: &KeyManagerState,
@@ -1132,7 +1087,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn find_merchant_connector_account_by_id(
&self,
state: &KeyManagerState,
@@ -1170,10 +1125,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn insert_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -1219,7 +1171,7 @@ impl MerchantConnectorAccountInterface for MockDb {
.change_context(errors::StorageError::DecryptionError)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn insert_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -1300,10 +1252,7 @@ impl MerchantConnectorAccountInterface for MockDb {
Ok(output)
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn update_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -1346,7 +1295,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn update_merchant_connector_account(
&self,
state: &KeyManagerState,
@@ -1391,10 +1340,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn delete_merchant_connector_account_by_merchant_id_merchant_connector_id(
&self,
merchant_id: &common_utils::id_type::MerchantId,
@@ -1418,7 +1364,7 @@ impl MerchantConnectorAccountInterface for MockDb {
}
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn delete_merchant_connector_account_by_id(
&self,
id: &common_utils::id_type::MerchantConnectorAccountId,
@@ -1444,10 +1390,7 @@ impl MerchantConnectorAccountInterface for MockDb {
mod merchant_connector_account_cache_tests {
use std::sync::Arc;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
use api_models::enums::CountryAlpha2;
use common_utils::{date_time, type_name, types::keymanager::Identifier};
use diesel_models::enums::ConnectorType;
@@ -1480,10 +1423,7 @@ mod merchant_connector_account_cache_tests {
#[allow(clippy::unwrap_used)]
#[tokio::test]
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
async fn test_connector_profile_id_cache() {
let conf = Settings::new().unwrap();
let tx: oneshot::Sender<()> = oneshot::channel().0;
@@ -1665,7 +1605,7 @@ mod merchant_connector_account_cache_tests {
#[allow(clippy::unwrap_used)]
#[tokio::test]
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
async fn test_connector_profile_id_cache() {
let conf = Settings::new().unwrap();
let tx: oneshot::Sender<()> = oneshot::channel().0;
@@ -1781,10 +1721,7 @@ mod merchant_connector_account_cache_tests {
.unwrap();
let find_call = || async {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let mca = db
.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
@@ -1794,7 +1731,7 @@ mod merchant_connector_account_cache_tests {
)
.await
.unwrap();
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let mca: domain::MerchantConnectorAccount = { todo!() };
Conversion::convert(mca)
.await
diff --git a/crates/router/src/routes/admin.rs b/crates/router/src/routes/admin.rs
index 6c7f30de1c..ae97bfe604 100644
--- a/crates/router/src/routes/admin.rs
+++ b/crates/router/src/routes/admin.rs
@@ -206,10 +206,7 @@ pub async fn delete_merchant_account(
/// Merchant Connector - Create
///
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsCreate))]
pub async fn connector_create(
state: web::Data<AppState>,
@@ -243,7 +240,7 @@ pub async fn connector_create(
/// Merchant Connector - Create
///
/// Create a new Merchant Connector for the merchant account. The connector could be a payment processor / facilitator / acquirer or specialized services like Fraud / Accounting etc."
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsCreate))]
pub async fn connector_create(
state: web::Data<AppState>,
@@ -274,10 +271,7 @@ pub async fn connector_create(
/// Merchant Connector - Retrieve
///
/// Retrieve Merchant Connector Details
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[utoipa::path(
get,
path = "/accounts/{account_id}/connectors/{connector_id}",
@@ -339,7 +333,7 @@ pub async fn connector_retrieve(
/// Merchant Connector - Retrieve
///
/// Retrieve Merchant Connector Details
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsRetrieve))]
pub async fn connector_retrieve(
state: web::Data<AppState>,
@@ -473,10 +467,7 @@ pub async fn payment_connector_list_profile(
/// Merchant Connector - Update
///
/// To update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc.
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[utoipa::path(
post,
path = "/accounts/{account_id}/connectors/{connector_id}",
@@ -537,7 +528,7 @@ pub async fn connector_update(
/// Merchant Connector - Update
///
/// To update an existing Merchant Connector. Helpful in enabling / disabling different payment methods and other settings for the connector etc.
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[utoipa::path(
post,
path = "/connector_accounts/{id}",
@@ -587,10 +578,7 @@ pub async fn connector_update(
/// Merchant Connector - Delete
///
/// Delete or Detach a Merchant Connector from Merchant Account
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(feature = "v1")]
#[utoipa::path(
delete,
path = "/accounts/{account_id}/connectors/{connector_id}",
@@ -645,7 +633,7 @@ pub async fn connector_delete(
/// Merchant Connector - Delete
///
/// Delete or Detach a Merchant Connector from Merchant Account
-#[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::MerchantConnectorsDelete))]
pub async fn connector_delete(
state: web::Data<AppState>,
@@ -730,11 +718,7 @@ pub async fn merchant_account_toggle_all_kv(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileCreate))]
pub async fn business_profile_create(
state: web::Data<AppState>,
@@ -767,7 +751,7 @@ pub async fn business_profile_create(
.await
}
-#[cfg(all(feature = "olap", feature = "v2", feature = "business_profile_v2"))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileCreate))]
pub async fn business_profile_create(
state: web::Data<AppState>,
@@ -797,10 +781,7 @@ pub async fn business_profile_create(
.await
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileRetrieve))]
pub async fn business_profile_retrieve(
state: web::Data<AppState>,
@@ -834,7 +815,7 @@ pub async fn business_profile_retrieve(
.await
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileRetrieve))]
pub async fn business_profile_retrieve(
state: web::Data<AppState>,
@@ -864,11 +845,7 @@ pub async fn business_profile_retrieve(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileUpdate))]
pub async fn business_profile_update(
state: web::Data<AppState>,
@@ -904,7 +881,7 @@ pub async fn business_profile_update(
.await
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::BusinessProfileUpdate))]
pub async fn business_profile_update(
state: web::Data<AppState>,
diff --git a/crates/router/src/routes/api_keys.rs b/crates/router/src/routes/api_keys.rs
index 78bccad4a0..68e5687e24 100644
--- a/crates/router/src/routes/api_keys.rs
+++ b/crates/router/src/routes/api_keys.rs
@@ -12,10 +12,7 @@ use crate::{
///
/// Create a new API Key for accessing our APIs from your servers. The plaintext API Key will be
/// displayed only once on creation, so ensure you store it securely.
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyCreate))]
pub async fn api_key_create(
state: web::Data<AppState>,
@@ -48,7 +45,7 @@ pub async fn api_key_create(
.await
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyCreate))]
pub async fn api_key_create(
state: web::Data<AppState>,
@@ -81,7 +78,7 @@ pub async fn api_key_create(
/// API Key - Retrieve
///
/// Retrieve information about the specified API Key.
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyRetrieve))]
pub async fn api_key_retrieve(
state: web::Data<AppState>,
@@ -115,10 +112,7 @@ pub async fn api_key_retrieve(
.await
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// API Key - Retrieve
///
/// Retrieve information about the specified API Key.
@@ -150,10 +144,7 @@ pub async fn api_key_retrieve(
.await
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// API Key - Update
///
/// Update information for the specified API Key.
@@ -189,7 +180,7 @@ pub async fn api_key_update(
.await
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
pub async fn api_key_update(
state: web::Data<AppState>,
req: HttpRequest,
@@ -221,10 +212,7 @@ pub async fn api_key_update(
.await
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
/// API Key - Revoke
///
/// Revoke the specified API Key. Once revoked, the API Key can no longer be used for
@@ -257,7 +245,7 @@ pub async fn api_key_revoke(
.await
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
#[instrument(skip_all, fields(flow = ?Flow::ApiKeyRevoke))]
pub async fn api_key_revoke(
state: web::Data<AppState>,
diff --git a/crates/router/src/routes/app.rs b/crates/router/src/routes/app.rs
index bd05740aca..5e69f42cfe 100644
--- a/crates/router/src/routes/app.rs
+++ b/crates/router/src/routes/app.rs
@@ -1,11 +1,7 @@
use std::{collections::HashMap, sync::Arc};
use actix_web::{web, Scope};
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "routing_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
use api_models::routing::RoutingRetrieveQuery;
#[cfg(feature = "olap")]
use common_enums::TransactionType;
@@ -654,7 +650,7 @@ impl Forex {
#[cfg(feature = "olap")]
pub struct Routing;
-#[cfg(all(feature = "olap", feature = "v2", feature = "routing_v2"))]
+#[cfg(all(feature = "olap", feature = "v2"))]
impl Routing {
pub fn server(state: AppState) -> Scope {
web::scope("/v2/routing_algorithm")
@@ -670,11 +666,7 @@ impl Routing {
)
}
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "routing_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
impl Routing {
pub fn server(state: AppState) -> Scope {
#[allow(unused_mut)]
@@ -1153,11 +1145,7 @@ impl Blocklist {
#[cfg(feature = "olap")]
pub struct Organization;
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
impl Organization {
pub fn server(state: AppState) -> Scope {
web::scope("/organization")
@@ -1171,7 +1159,7 @@ impl Organization {
}
}
-#[cfg(all(feature = "v2", feature = "olap", feature = "merchant_account_v2"))]
+#[cfg(all(feature = "v2", feature = "olap"))]
impl Organization {
pub fn server(state: AppState) -> Scope {
web::scope("/v2/organization")
@@ -1187,7 +1175,7 @@ impl Organization {
pub struct MerchantAccount;
-#[cfg(all(feature = "v2", feature = "olap", feature = "merchant_account_v2"))]
+#[cfg(all(feature = "v2", feature = "olap"))]
impl MerchantAccount {
pub fn server(state: AppState) -> Scope {
web::scope("/v2/accounts")
@@ -1201,11 +1189,7 @@ impl MerchantAccount {
}
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
impl MerchantAccount {
pub fn server(state: AppState) -> Scope {
web::scope("/accounts")
@@ -1232,11 +1216,7 @@ impl MerchantAccount {
pub struct MerchantConnectorAccount;
-#[cfg(all(
- any(feature = "olap", feature = "oltp"),
- feature = "v2",
- feature = "merchant_connector_account_v2"
-))]
+#[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v2"))]
impl MerchantConnectorAccount {
pub fn server(state: AppState) -> Scope {
let mut route = web::scope("/v2/connector_accounts").app_data(web::Data::new(state));
@@ -1258,11 +1238,7 @@ impl MerchantConnectorAccount {
}
}
-#[cfg(all(
- any(feature = "olap", feature = "oltp"),
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
-))]
+#[cfg(all(any(feature = "olap", feature = "oltp"), feature = "v1"))]
impl MerchantConnectorAccount {
pub fn server(state: AppState) -> Scope {
let mut route = web::scope("/account").app_data(web::Data::new(state));
@@ -1416,7 +1392,7 @@ impl Poll {
pub struct ApiKeys;
-#[cfg(all(feature = "v2", feature = "olap", feature = "merchant_account_v2"))]
+#[cfg(all(feature = "v2", feature = "olap"))]
impl ApiKeys {
pub fn server(state: AppState) -> Scope {
web::scope("/v2/api_keys")
@@ -1432,11 +1408,7 @@ impl ApiKeys {
}
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
impl ApiKeys {
pub fn server(state: AppState) -> Scope {
web::scope("/api_keys/{merchant_id}")
@@ -1554,12 +1526,7 @@ impl PayoutLink {
}
pub struct BusinessProfile;
-#[cfg(all(
- feature = "olap",
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(all(feature = "olap", feature = "v2"))]
impl BusinessProfile {
pub fn server(state: AppState) -> Scope {
web::scope("/v2/profiles")
@@ -1616,11 +1583,7 @@ impl BusinessProfile {
)
}
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
impl BusinessProfile {
pub fn server(state: AppState) -> Scope {
web::scope("/account/{account_id}/business_profile")
diff --git a/crates/router/src/routes/routing.rs b/crates/router/src/routes/routing.rs
index b68d09deeb..8527aa8628 100644
--- a/crates/router/src/routes/routing.rs
+++ b/crates/router/src/routes/routing.rs
@@ -52,11 +52,7 @@ pub async fn routing_create_config(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "routing_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all)]
pub async fn routing_link_config(
state: web::Data<AppState>,
@@ -93,7 +89,7 @@ pub async fn routing_link_config(
.await
}
-#[cfg(all(feature = "olap", feature = "v2", feature = "routing_v2"))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all)]
pub async fn routing_link_config(
state: web::Data<AppState>,
@@ -258,7 +254,7 @@ pub async fn list_routing_configs_for_profile(
.await
}
-#[cfg(all(feature = "olap", feature = "v2", feature = "routing_v2"))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all)]
pub async fn routing_unlink_config(
state: web::Data<AppState>,
@@ -301,11 +297,7 @@ pub async fn routing_unlink_config(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(feature = "routing_v2")
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all)]
pub async fn routing_unlink_config(
state: web::Data<AppState>,
@@ -342,12 +334,7 @@ pub async fn routing_unlink_config(
.await
}
-#[cfg(all(
- feature = "olap",
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all)]
pub async fn routing_update_default_config(
state: web::Data<AppState>,
@@ -386,11 +373,7 @@ pub async fn routing_update_default_config(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all)]
pub async fn routing_update_default_config(
state: web::Data<AppState>,
@@ -424,12 +407,7 @@ pub async fn routing_update_default_config(
.await
}
-#[cfg(all(
- feature = "olap",
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all)]
pub async fn routing_retrieve_default_config(
state: web::Data<AppState>,
@@ -469,11 +447,7 @@ pub async fn routing_retrieve_default_config(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all)]
pub async fn routing_retrieve_default_config(
state: web::Data<AppState>,
@@ -691,11 +665,7 @@ pub async fn retrieve_decision_manager_config(
.await
}
-#[cfg(all(
- feature = "olap",
- any(feature = "v1", feature = "v2"),
- not(any(feature = "routing_v2", feature = "business_profile_v2"))
-))]
+#[cfg(all(feature = "olap", feature = "v1"))]
#[instrument(skip_all)]
pub async fn routing_retrieve_linked_config(
state: web::Data<AppState>,
@@ -769,12 +739,7 @@ pub async fn routing_retrieve_linked_config(
}
}
-#[cfg(all(
- feature = "olap",
- feature = "v2",
- feature = "routing_v2",
- feature = "business_profile_v2"
-))]
+#[cfg(all(feature = "olap", feature = "v2"))]
#[instrument(skip_all)]
pub async fn routing_retrieve_linked_config(
state: web::Data<AppState>,
diff --git a/crates/router/src/types/api/admin.rs b/crates/router/src/types/api/admin.rs
index e67ff62a2f..3d915f838e 100644
--- a/crates/router/src/types/api/admin.rs
+++ b/crates/router/src/types/api/admin.rs
@@ -40,10 +40,7 @@ impl ForeignFrom<diesel_models::organization::Organization> for OrganizationResp
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
-))]
+#[cfg(feature = "v1")]
impl ForeignTryFrom<domain::MerchantAccount> for MerchantAccountResponse {
type Error = error_stack::Report<errors::ParsingError>;
fn foreign_try_from(item: domain::MerchantAccount) -> Result<Self, Self::Error> {
@@ -85,7 +82,7 @@ impl ForeignTryFrom<domain::MerchantAccount> for MerchantAccountResponse {
}
}
-#[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+#[cfg(feature = "v2")]
impl ForeignTryFrom<domain::MerchantAccount> for MerchantAccountResponse {
type Error = error_stack::Report<errors::ValidationError>;
fn foreign_try_from(item: domain::MerchantAccount) -> Result<Self, Self::Error> {
@@ -109,10 +106,7 @@ impl ForeignTryFrom<domain::MerchantAccount> for MerchantAccountResponse {
})
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "business_profile_v2")
-))]
+#[cfg(feature = "v1")]
impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
type Error = error_stack::Report<errors::ParsingError>;
@@ -173,7 +167,7 @@ impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
}
}
-#[cfg(all(feature = "v2", feature = "business_profile_v2"))]
+#[cfg(feature = "v2")]
impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
type Error = error_stack::Report<errors::ParsingError>;
@@ -238,10 +232,7 @@ impl ForeignTryFrom<domain::BusinessProfile> for BusinessProfileResponse {
}
}
-#[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(any(feature = "merchant_account_v2", feature = "business_profile_v2"))
-))]
+#[cfg(feature = "v1")]
pub async fn create_business_profile_from_merchant_account(
state: &SessionState,
merchant_account: domain::MerchantAccount,
diff --git a/crates/router/src/types/domain/user.rs b/crates/router/src/types/domain/user.rs
index f41d7157ee..674ea8b5c0 100644
--- a/crates/router/src/types/domain/user.rs
+++ b/crates/router/src/types/domain/user.rs
@@ -396,7 +396,7 @@ impl NewUserMerchant {
Ok(())
}
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
fn create_merchant_account_request(&self) -> UserResult<admin_api::MerchantAccountCreate> {
let merchant_name = if let Some(company_name) = self.company_name.clone() {
MerchantName::try_from(company_name)
@@ -415,10 +415,7 @@ impl NewUserMerchant {
})
}
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
fn create_merchant_account_request(&self) -> UserResult<admin_api::MerchantAccountCreate> {
Ok(admin_api::MerchantAccountCreate {
merchant_id: self.get_merchant_id(),
diff --git a/crates/router/src/types/transformers.rs b/crates/router/src/types/transformers.rs
index 964d653647..ca4ba575d7 100644
--- a/crates/router/src/types/transformers.rs
+++ b/crates/router/src/types/transformers.rs
@@ -999,10 +999,7 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
}
None => None,
};
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let response = Self {
connector_type: item.connector_type,
connector_name: item.connector_name,
@@ -1034,7 +1031,7 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
.transpose()?
.map(api_models::admin::AdditionalMerchantData::foreign_from),
};
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let response = Self {
id: item.id,
connector_type: item.connector_type,
@@ -1101,7 +1098,7 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
}
None => None,
};
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
let response = Self {
id: item.get_id(),
connector_type: item.connector_type,
@@ -1141,10 +1138,7 @@ impl ForeignTryFrom<domain::MerchantConnectorAccount>
.transpose()?
.map(api_models::admin::AdditionalMerchantData::foreign_from),
};
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let response = Self {
connector_type: item.connector_type,
connector_name: item.connector_name,
diff --git a/crates/router/src/utils.rs b/crates/router/src/utils.rs
index abdfb680a7..ea687af796 100644
--- a/crates/router/src/utils.rs
+++ b/crates/router/src/utils.rs
@@ -370,10 +370,7 @@ pub async fn find_mca_from_authentication_id_type(
.to_not_found_response(errors::ApiErrorResponse::InternalServerError)?
}
};
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
&state.into(),
@@ -391,7 +388,7 @@ pub async fn find_mca_from_authentication_id_type(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
//get mca using id
{
let _ = key_store;
@@ -419,10 +416,7 @@ pub async fn get_mca_from_payment_intent(
let key_manager_state: &KeyManagerState = &state.into();
match payment_attempt.merchant_connector_id {
Some(merchant_connector_id) => {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -437,7 +431,7 @@ pub async fn get_mca_from_payment_intent(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
//get mca using id
let _id = merchant_connector_id;
@@ -456,10 +450,7 @@ pub async fn get_mca_from_payment_intent(
.attach_printable("profile_id is not set in payment_intent")?
.clone();
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
@@ -477,7 +468,7 @@ pub async fn get_mca_from_payment_intent(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
//get mca using id
let _ = profile_id;
@@ -517,10 +508,7 @@ pub async fn get_mca_from_payout_attempt(
let key_manager_state: &KeyManagerState = &state.into();
match payout.merchant_connector_id {
Some(merchant_connector_id) => {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
key_manager_state,
@@ -535,7 +523,7 @@ pub async fn get_mca_from_payout_attempt(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
//get mca using id
let _id = merchant_connector_id;
@@ -546,10 +534,7 @@ pub async fn get_mca_from_payout_attempt(
}
}
None => {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_merchant_connector_account_by_profile_id_connector_name(
key_manager_state,
@@ -568,7 +553,7 @@ pub async fn get_mca_from_payout_attempt(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
todo!()
}
@@ -585,21 +570,15 @@ pub async fn get_mca_from_object_reference_id(
) -> CustomResult<domain::MerchantConnectorAccount, errors::ApiErrorResponse> {
let db = &*state.store;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let default_profile_id = merchant_account.default_profile.as_ref();
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let default_profile_id = Option::<&String>::None;
match default_profile_id {
Some(profile_id) => {
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
{
db.find_merchant_connector_account_by_profile_id_connector_name(
&state.into(),
@@ -617,7 +596,7 @@ pub async fn get_mca_from_object_reference_id(
},
)
}
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
let _db = db;
let _profile_id = profile_id;
diff --git a/crates/router/src/utils/connector_onboarding.rs b/crates/router/src/utils/connector_onboarding.rs
index 3c1aea6f7a..8ea71fb9d6 100644
--- a/crates/router/src/utils/connector_onboarding.rs
+++ b/crates/router/src/utils/connector_onboarding.rs
@@ -56,10 +56,7 @@ pub async fn check_if_connector_exists(
.await
.to_not_found_response(ApiErrorResponse::MerchantAccountNotFound)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_connector_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let _connector = state
.store
.find_by_merchant_connector_account_merchant_id_merchant_connector_id(
@@ -73,7 +70,7 @@ pub async fn check_if_connector_exists(
id: connector_id.get_string_repr().to_string(),
})?;
- #[cfg(all(feature = "v2", feature = "merchant_connector_account_v2"))]
+ #[cfg(feature = "v2")]
{
let _ = connector_id;
let _ = key_store;
diff --git a/crates/router/src/utils/user/sample_data.rs b/crates/router/src/utils/user/sample_data.rs
index bbae84a225..a877ad7315 100644
--- a/crates/router/src/utils/user/sample_data.rs
+++ b/crates/router/src/utils/user/sample_data.rs
@@ -44,10 +44,7 @@ pub async fn generate_sample_data(
.await
.change_context::<SampleDataError>(SampleDataError::DataDoesNotExist)?;
- #[cfg(all(
- any(feature = "v1", feature = "v2"),
- not(feature = "merchant_account_v2")
- ))]
+ #[cfg(feature = "v1")]
let (profile_id_result, business_country_default, business_label_default) = {
let merchant_parsed_details: Vec<api_models::admin::PrimaryBusinessDetails> =
serde_json::from_value(merchant_from_db.primary_business_details.clone())
@@ -72,7 +69,7 @@ pub async fn generate_sample_data(
(profile_id, business_country_default, business_label_default)
};
- #[cfg(all(feature = "v2", feature = "merchant_account_v2"))]
+ #[cfg(feature = "v2")]
let (profile_id_result, business_country_default, business_label_default) = {
let profile_id = req
.profile_id.clone()
diff --git a/crates/scheduler/Cargo.toml b/crates/scheduler/Cargo.toml
index df870d8fb9..0ffd97c2f0 100644
--- a/crates/scheduler/Cargo.toml
+++ b/crates/scheduler/Cargo.toml
@@ -6,7 +6,7 @@ rust-version.workspace = true
license.workspace = true
[features]
-default = ["kv_store", "olap", "v1"]
+default = ["kv_store", "olap"]
olap = ["storage_impl/olap", "hyperswitch_domain_models/olap"]
kv_store = []
email = ["external_services/email"]
diff --git a/crates/storage_impl/Cargo.toml b/crates/storage_impl/Cargo.toml
index 168f74791a..557f6969fb 100644
--- a/crates/storage_impl/Cargo.toml
+++ b/crates/storage_impl/Cargo.toml
@@ -8,7 +8,7 @@ readme = "README.md"
license.workspace = true
[features]
-default = ["olap", "oltp", "v1"]
+default = ["olap", "oltp"]
oltp = []
olap = ["hyperswitch_domain_models/olap"]
payouts = ["hyperswitch_domain_models/payouts"]
diff --git a/justfile b/justfile
index ab50ec0301..4cbaf38efe 100644
--- a/justfile
+++ b/justfile
@@ -39,12 +39,12 @@ clippy_v2 *FLAGS:
jq -r '
[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array
| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates
- | del( .[] | select( any( . ; . == ("v1") ) ) ) # Exclude some features from features list
+ | del( .[] | select( . == ("default", "v1") ) ) # Exclude some features from features list
| join(",") # Construct a comma-separated string of features for passing to `cargo`
')"
set -x
- cargo clippy {{ check_flags }} --features "${FEATURES}" {{ FLAGS }}
+ cargo clippy {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}
set +x
check_v2 *FLAGS:
@@ -55,12 +55,12 @@ check_v2 *FLAGS:
jq -r '
[ ( .workspace_members | sort ) as $package_ids # Store workspace crate package IDs in `package_ids` array
| .packages[] | select( IN(.id; $package_ids[]) ) | .features | keys[] ] | unique # Select all unique features from all workspace crates
- | del( .[] | select( any( . ; . == ("v1") ) ) ) # Exclude some features from features list
+ | del( .[] | select( . == ("default", "v1") ) ) # Exclude some features from features list
| join(",") # Construct a comma-separated string of features for passing to `cargo`
')"
set -x
- cargo check {{ check_flags }} --features "${FEATURES}" {{ FLAGS }}
+ cargo check {{ check_flags }} --no-default-features --features "${FEATURES}" {{ FLAGS }}
set +x
run_v2:
@@ -75,7 +75,7 @@ run_v2:
')"
set -x
- cargo run --package router --features "${FEATURES}"
+ cargo run --package router --no-default-features --features "${FEATURES}"
set +x
check *FLAGS:
@@ -114,7 +114,7 @@ run *FLAGS:
alias r := run
-doc_flags := '--all-features --all-targets --exclude-features "v2 merchant_account_v2 payment_v2"'
+doc_flags := '--all-features --all-targets --exclude-features "v2 payment_v2"'
# Generate documentation
doc *FLAGS:
@@ -134,10 +134,6 @@ euclid-wasm features='dummy_connector':
# Run pre-commit checks
precommit: fmt clippy
-# Check compilation of v2 feature on base dependencies
-hack_v2:
- scripts/ci-checks-v2.sh
-
# Use the env variables if present, or fallback to default values
db_user := env_var_or_default('DB_USER', 'db_user')
diff --git a/scripts/ci-checks-v2.sh b/scripts/ci-checks-v2.sh
deleted file mode 100755
index 93bd2921a3..0000000000
--- a/scripts/ci-checks-v2.sh
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-crates_to_check='api_models
-diesel_models
-hyperswitch_domain_models
-storage_impl'
-
-v2_feature_set='v2,merchant_account_v2,payment_v2,customer_v2,routing_v2,business_profile_v2,payment_methods_v2'
-
-packages_checked=()
-packages_skipped=()
-
-# List of cargo commands that will be executed
-all_commands=()
-
-# Function to get defined features for a crate
-features_to_run() {
- local crate_name=$1
- cargo metadata --format-version 1 --no-deps | jq --raw-output --arg crate_name "${crate_name}" --arg v2_features "${v2_feature_set}" '[ .packages[] | select(.name == $crate_name) | .features | keys[] | select( IN( .; ( $v2_features | split(",") )[] ) ) ] | join(",")'
-}
-
-# If we are running this on a pull request, then only check for packages that are modified
-if [[ "${GITHUB_EVENT_NAME:-}" == 'pull_request' ]]; then
- # Obtain the pull request number and files modified in the pull request
- pull_request_number="$(jq --raw-output '.pull_request.number' "${GITHUB_EVENT_PATH}")"
- files_modified="$(
- gh api \
- --header 'Accept: application/vnd.github+json' \
- --header 'X-GitHub-Api-Version: 2022-11-28' \
- --paginate \
- "https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${pull_request_number}/files" \
- --jq '.[].filename'
- )"
-
- while IFS= read -r package_name; do
- # A package must be checked if it has been modified
- if grep --quiet --extended-regexp "^crates/${package_name}" <<< "${files_modified}"; then
- if [[ "${package_name}" == "storage_impl" ]]; then
- all_commands+=("cargo hack clippy --features 'v2,payment_v2,customer_v2' -p storage_impl")
- else
- valid_features="$(features_to_run "$package_name")"
- all_commands+=("cargo hack clippy --feature-powerset --depth 2 --ignore-unknown-features --at-least-one-of 'v2 ' --include-features '${valid_features}' --package '${package_name}'")
- fi
- printf '::debug::Checking `%s` since it was modified %s\n' "${package_name}"
- packages_checked+=("${package_name}")
- else
- printf '::debug::Skipping `%s` since it was not modified: %s\n' "${package_name}"
- packages_skipped+=("${package_name}")
- fi
- done <<< "${crates_to_check}"
- printf '::notice::Packages checked: %s; Packages skipped: %s\n' "${packages_checked[*]}" "${packages_skipped[*]}"
-
-else
- # If we are doing this locally or on merge queue, then check for all the V2 crates
- all_commands+=("cargo hack clippy --features 'v2,payment_v2,customer_v2' -p storage_impl")
- common_command="cargo hack clippy --feature-powerset --depth 2 --ignore-unknown-features --at-least-one-of 'v2 '"
- while IFS= read -r crate; do
- if [[ "${crate}" != "storage_impl" ]]; then
- valid_features="$(features_to_run "$crate")"
- crate_with_features="--include-features '${valid_features}' --package '${crate}' "
- all_commands+=("${common_command} ${crate_with_features}")
- fi
- done <<< "${crates_to_check}"
-fi
-
-if ((${#all_commands[@]} == 0)); then
- echo "There are no commands to be executed"
- exit 0
-fi
-
-echo "The list of commands that will be executed:"
-printf "%s\n" "${all_commands[@]}"
-echo
-
-# Execute the commands
-for command in "${all_commands[@]}"; do
- if [[ "${CI:-false}" == "true" && "${GITHUB_ACTIONS:-false}" == "true" ]]; then
- printf '::group::Running `%s`\n' "${command}"
- fi
-
- bash -c -x "${command}"
-
- if [[ "${CI:-false}" == "true" && "${GITHUB_ACTIONS:-false}" == "true" ]]; then
- echo '::endgroup::'
- fi
-done