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

feat(euclid_wasm): Add wasm support for billing connectors (#10012)

spritianeja037749ce575a74
diff --git a/crates/connector_configs/src/connector.rs b/crates/connector_configs/src/connector.rs
index fbc6f5adbc..e27d73101d 100644
--- a/crates/connector_configs/src/connector.rs
+++ b/crates/connector_configs/src/connector.rs
@@ -3,7 +3,9 @@ use std::collections::HashMap;
#[cfg(feature = "payouts")]
use api_models::enums::PayoutConnectors;
use api_models::{
- enums::{AuthenticationConnectors, Connector, PmAuthConnectors, TaxConnectors},
+ enums::{
+ AuthenticationConnectors, BillingConnectors, Connector, PmAuthConnectors, TaxConnectors,
+ },
payments,
};
use serde::{Deserialize, Serialize};
@@ -419,6 +421,20 @@ impl ConnectorConfig {
}
}
+ pub fn get_billing_connector_config(
+ connector: BillingConnectors,
+ ) -> Result<Option<ConnectorTomlConfig>, String> {
+ let connector_data = Self::new()?;
+ match connector {
+ BillingConnectors::Chargebee => Ok(connector_data.chargebee),
+ BillingConnectors::Stripebilling => Ok(connector_data.stripebilling),
+ BillingConnectors::Recurly => Ok(connector_data.recurly),
+ BillingConnectors::Custombilling => Ok(connector_data.custombilling),
+ #[cfg(feature = "dummy_connector")]
+ BillingConnectors::DummyBillingConnector => Ok(connector_data.dummy_connector),
+ }
+ }
+
pub fn get_authentication_connector_config(
connector: AuthenticationConnectors,
) -> Result<Option<ConnectorTomlConfig>, String> {
diff --git a/crates/connector_configs/toml/development.toml b/crates/connector_configs/toml/development.toml
index ff655c6868..259c517ce2 100644
--- a/crates/connector_configs/toml/development.toml
+++ b/crates/connector_configs/toml/development.toml
@@ -1584,6 +1584,20 @@ merchant_secret="Source verification key"
[celero.connector_auth.HeaderKey]
api_key="Celero API Key"
+[chargebee]
+[chargebee.connector_auth.HeaderKey]
+api_key = "Chargebee API Key"
+
+[chargebee.connector_webhook_details]
+merchant_secret = "Webhook URL Username"
+additional_secret = "Webhook URL Password"
+
+[chargebee.metadata.site]
+name = "site"
+label = "Site"
+placeholder = "Enter chargebee site"
+required = true
+type = "Text"
[checkbook]
[[checkbook.bank_transfer]]
diff --git a/crates/connector_configs/toml/production.toml b/crates/connector_configs/toml/production.toml
index dc206745b8..6be4b7b937 100644
--- a/crates/connector_configs/toml/production.toml
+++ b/crates/connector_configs/toml/production.toml
@@ -1350,6 +1350,21 @@ merchant_secret = "Source verification key"
[celero.connector_auth.HeaderKey]
api_key="Celero API Key"
+[chargebee]
+[chargebee.connector_auth.HeaderKey]
+api_key = "Chargebee API Key"
+
+[chargebee.connector_webhook_details]
+merchant_secret = "Webhook URL Username"
+additional_secret = "Webhook URL Password"
+
+[chargebee.metadata.site]
+name = "site"
+label = "Site"
+placeholder = "Enter chargebee site"
+required = true
+type = "Text"
+
[checkbook]
[[checkbook.bank_transfer]]
payment_method_type = "ach"
diff --git a/crates/connector_configs/toml/sandbox.toml b/crates/connector_configs/toml/sandbox.toml
index a5f4beecf0..7e00d2fd2b 100644
--- a/crates/connector_configs/toml/sandbox.toml
+++ b/crates/connector_configs/toml/sandbox.toml
@@ -1583,6 +1583,20 @@ merchant_secret = "Source verification key"
[celero.connector_auth.HeaderKey]
api_key="Celero API Key"
+[chargebee]
+[chargebee.connector_auth.HeaderKey]
+api_key = "Chargebee API Key"
+
+[chargebee.connector_webhook_details]
+merchant_secret = "Webhook URL Username"
+additional_secret = "Webhook URL Password"
+
+[chargebee.metadata.site]
+name = "site"
+label = "Site"
+placeholder = "Enter chargebee site"
+required = true
+type = "Text"
[checkbook]
[[checkbook.bank_transfer]]
@@ -4619,7 +4633,6 @@ required = true
type = "MultiSelect"
options = ["PAN_ONLY", "CRYPTOGRAM_3DS"]
-
[stax]
[[stax.credit]]
payment_method_type = "Mastercard"
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index e4d41b86a0..f2d2fa8c8e 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -381,6 +381,14 @@ pub fn get_connector_config(key: &str) -> JsResult {
Ok(serde_wasm_bindgen::to_value(&res)?)
}
+#[wasm_bindgen(js_name = getBillingConnectorConfig)]
+pub fn get_billing_connector_config(key: &str) -> JsResult {
+ let key = api_model_enums::BillingConnectors::from_str(key)
+ .map_err(|_| "Invalid key received".to_string())?;
+ let res = connector::ConnectorConfig::get_billing_connector_config(key)?;
+ Ok(serde_wasm_bindgen::to_value(&res)?)
+}
+
#[cfg(feature = "payouts")]
#[wasm_bindgen(js_name = getPayoutConnectorConfig)]
pub fn get_payout_connector_config(key: &str) -> JsResult {