From bba32d60731b8e0cbc0b2b5d6aad617a0b340ea1 Mon Sep 17 00:00:00 2001 From: Chikke Srujan Date: Thu, 12 Dec 2024 19:16:14 +0530 Subject: [PATCH 1/6] fix connector dependencies --- crates/connector_configs/Cargo.toml | 4 ++-- crates/connector_configs/src/connector.rs | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index f87289680987..797a8c6d60fb 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -7,11 +7,11 @@ rust-version.workspace = true license.workspace = true [features] -default = ["payouts", "dummy_connector"] +default = ["payouts"] production = [] development = [] sandbox = [] -dummy_connector = ["api_models/dummy_connector", "development"] +dummy_connector = ["api_models/dummy_connector"] payouts = ["api_models/payouts"] v1 = ["api_models/v1", "common_utils/v1"] diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index c1f7cfc366c7..e456b6b3d503 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -256,7 +256,10 @@ impl ConnectorConfig { not(any(feature = "production", feature = "development")) ))] let config = toml::from_str::(include_str!("../toml/sandbox.toml")); - #[cfg(feature = "development")] + #[cfg(all( + feature = "development", + not(any(feature = "sandbox", feature = "production")) + ))] let config = toml::from_str::(include_str!("../toml/development.toml")); #[cfg(not(any(feature = "sandbox", feature = "development", feature = "production")))] From 534aaf206fa110d3024993ca15680956d7578662 Mon Sep 17 00:00:00 2001 From: Jeeva Ramachandran Date: Thu, 12 Dec 2024 19:48:10 +0530 Subject: [PATCH 2/6] update toml --- crates/connector_configs/toml/production.toml | 8 -------- crates/connector_configs/toml/sandbox.toml | 7 ------- 2 files changed, 15 deletions(-) diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml index 443d3fd72ac7..fec39992c4e1 100644 --- a/crates/connector_configs/toml/production.toml +++ b/crates/connector_configs/toml/production.toml @@ -2895,9 +2895,6 @@ merchant_secret="Source verification key" api_key="API Key" [zen.connector_webhook_details] merchant_secret="Source verification key" -[zen.metadata.apple_pay] -terminal_uuid="Terminal UUID" -pay_wall_secret="Pay Wall Secret" [[zen.metadata.apple_pay]] name="terminal_uuid" @@ -2936,11 +2933,6 @@ key1 = "Merchant ID" [netcetera.connector_auth.CertificateAuth] certificate="Base64 encoded PEM formatted certificate chain" private_key="Base64 encoded PEM formatted private key" -[netcetera.metadata] -merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -three_ds_requestor_name="ThreeDS requestor name" -three_ds_requestor_id="ThreeDS request id" [netcetera.metadata.endpoint_prefix] name="endpoint_prefix" diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml index 1e9d274780b7..29209d01eba7 100644 --- a/crates/connector_configs/toml/sandbox.toml +++ b/crates/connector_configs/toml/sandbox.toml @@ -365,8 +365,6 @@ merchant_secret="Source verification key" [airwallex.connector_auth.BodyKey] api_key="API Key" key1="Client ID" -[airwallex.connector_webhook_details] -merchant_secret="Source verification key" [airwallex.connector_webhook_details] merchant_secret="Source verification key" @@ -3941,11 +3939,6 @@ type="Toggle" [netcetera.connector_auth.CertificateAuth] certificate="Base64 encoded PEM formatted certificate chain" private_key="Base64 encoded PEM formatted private key" -[netcetera.metadata] -merchant_country_code="3 digit numeric country code" -merchant_name="Name of the merchant" -three_ds_requestor_name="ThreeDS requestor name" -three_ds_requestor_id="ThreeDS request id" [netcetera.metadata.endpoint_prefix] name="endpoint_prefix" From a99efc271c6b8560582e3967ee170871aa16c477 Mon Sep 17 00:00:00 2001 From: Chikke Srujan Date: Tue, 17 Dec 2024 23:22:57 +0530 Subject: [PATCH 3/6] clippy fix --- crates/connector_configs/Cargo.toml | 2 +- crates/connector_configs/src/connector.rs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index 797a8c6d60fb..6815c159b9bf 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -7,7 +7,7 @@ rust-version.workspace = true license.workspace = true [features] -default = ["payouts"] +default = ["payouts","dummy_connector"] production = [] development = [] sandbox = [] diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index e456b6b3d503..ea6b7ffb2236 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -236,8 +236,11 @@ pub struct ConnectorConfig { pub xendit: Option, pub square: Option, pub stax: Option, + #[cfg(feature = "dummy_connector")] pub dummy_connector: Option, + #[cfg(feature = "dummy_connector")] pub stripe_test: Option, + #[cfg(feature = "dummy_connector")] pub paypal_test: Option, pub zen: Option, pub zsl: Option, From 9b76394684196c045db57e538a40cbf0d7992fb7 Mon Sep 17 00:00:00 2001 From: Chikke Srujan Date: Wed, 18 Dec 2024 14:03:56 +0530 Subject: [PATCH 4/6] refactor connector_config --- crates/connector_configs/Cargo.toml | 4 +-- crates/connector_configs/src/connector.rs | 34 ++++++----------------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index 6815c159b9bf..f87289680987 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -7,11 +7,11 @@ rust-version.workspace = true license.workspace = true [features] -default = ["payouts","dummy_connector"] +default = ["payouts", "dummy_connector"] production = [] development = [] sandbox = [] -dummy_connector = ["api_models/dummy_connector"] +dummy_connector = ["api_models/dummy_connector", "development"] payouts = ["api_models/payouts"] v1 = ["api_models/v1", "common_utils/v1"] diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs index ea6b7ffb2236..683673e0c254 100644 --- a/crates/connector_configs/src/connector.rs +++ b/crates/connector_configs/src/connector.rs @@ -7,7 +7,6 @@ use api_models::{ payments, }; use serde::Deserialize; -#[cfg(any(feature = "sandbox", feature = "development", feature = "production"))] use toml; use crate::common_config::{CardProvider, InputData, Provider, ZenApplePay}; @@ -236,11 +235,8 @@ pub struct ConnectorConfig { pub xendit: Option, pub square: Option, pub stax: Option, - #[cfg(feature = "dummy_connector")] pub dummy_connector: Option, - #[cfg(feature = "dummy_connector")] pub stripe_test: Option, - #[cfg(feature = "dummy_connector")] pub paypal_test: Option, pub zen: Option, pub zsl: Option, @@ -249,28 +245,14 @@ pub struct ConnectorConfig { impl ConnectorConfig { fn new() -> Result { - #[cfg(all( - feature = "production", - not(any(feature = "sandbox", feature = "development")) - ))] - let config = toml::from_str::(include_str!("../toml/production.toml")); - #[cfg(all( - feature = "sandbox", - not(any(feature = "production", feature = "development")) - ))] - let config = toml::from_str::(include_str!("../toml/sandbox.toml")); - #[cfg(all( - feature = "development", - not(any(feature = "sandbox", feature = "production")) - ))] - let config = toml::from_str::(include_str!("../toml/development.toml")); - - #[cfg(not(any(feature = "sandbox", feature = "development", feature = "production")))] - return Err(String::from( - "Atleast one features has to be enabled for connectorconfig", - )); - - #[cfg(any(feature = "sandbox", feature = "development", feature = "production"))] + let config_str = if cfg!(feature = "production") { + include_str!("../toml/production.toml") + } else if cfg!(feature = "sandbox") { + include_str!("../toml/sandbox.toml") + } else { + include_str!("../toml/development.toml") + }; + let config = toml::from_str::(config_str); match config { Ok(data) => Ok(data), Err(err) => Err(err.to_string()), From 2cb0d9c56220a4f3b533269302266c3a60ad62c2 Mon Sep 17 00:00:00 2001 From: Chikke Srujan Date: Wed, 18 Dec 2024 15:46:31 +0530 Subject: [PATCH 5/6] remove development feature flag --- crates/connector_configs/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index f87289680987..d832ca138755 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -11,7 +11,7 @@ default = ["payouts", "dummy_connector"] production = [] development = [] sandbox = [] -dummy_connector = ["api_models/dummy_connector", "development"] +dummy_connector = ["api_models/dummy_connector"] payouts = ["api_models/payouts"] v1 = ["api_models/v1", "common_utils/v1"] From e5bcc6016ca51e266903a15d992e8cebcfc54adf Mon Sep 17 00:00:00 2001 From: Chikke Srujan Date: Wed, 18 Dec 2024 17:44:18 +0530 Subject: [PATCH 6/6] minor fix --- crates/connector_configs/Cargo.toml | 1 - crates/euclid_wasm/Cargo.toml | 1 - 2 files changed, 2 deletions(-) diff --git a/crates/connector_configs/Cargo.toml b/crates/connector_configs/Cargo.toml index d832ca138755..84be33529dbf 100644 --- a/crates/connector_configs/Cargo.toml +++ b/crates/connector_configs/Cargo.toml @@ -9,7 +9,6 @@ license.workspace = true [features] default = ["payouts", "dummy_connector"] production = [] -development = [] sandbox = [] dummy_connector = ["api_models/dummy_connector"] payouts = ["api_models/payouts"] diff --git a/crates/euclid_wasm/Cargo.toml b/crates/euclid_wasm/Cargo.toml index f8c97699d06d..debaf462fb1e 100644 --- a/crates/euclid_wasm/Cargo.toml +++ b/crates/euclid_wasm/Cargo.toml @@ -14,7 +14,6 @@ default = ["payouts"] release = ["payouts"] dummy_connector = ["kgraph_utils/dummy_connector", "connector_configs/dummy_connector"] production = ["connector_configs/production"] -development = ["connector_configs/development"] sandbox = ["connector_configs/sandbox"] payouts = ["api_models/payouts", "euclid/payouts"] v1 = ["api_models/v1"]