mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-11-03 21:37:41 +08:00
add wasm function for billing connectors
This commit is contained in:
@ -3,7 +3,7 @@ use std::collections::HashMap;
|
|||||||
#[cfg(feature = "payouts")]
|
#[cfg(feature = "payouts")]
|
||||||
use api_models::enums::PayoutConnectors;
|
use api_models::enums::PayoutConnectors;
|
||||||
use api_models::{
|
use api_models::{
|
||||||
enums::{AuthenticationConnectors, Connector, PmAuthConnectors, TaxConnectors},
|
enums::{AuthenticationConnectors, BillingConnectors, Connector, PmAuthConnectors, TaxConnectors},
|
||||||
payments,
|
payments,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -418,6 +418,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(
|
pub fn get_authentication_connector_config(
|
||||||
connector: AuthenticationConnectors,
|
connector: AuthenticationConnectors,
|
||||||
) -> Result<Option<ConnectorTomlConfig>, String> {
|
) -> Result<Option<ConnectorTomlConfig>, String> {
|
||||||
|
|||||||
@ -1584,6 +1584,20 @@ merchant_secret="Source verification key"
|
|||||||
[celero.connector_auth.HeaderKey]
|
[celero.connector_auth.HeaderKey]
|
||||||
api_key="Celero API Key"
|
api_key="Celero API Key"
|
||||||
|
|
||||||
|
[chargebee]
|
||||||
|
[chargebee.connector_auth.HeaderKey]
|
||||||
|
api_key="Chargebee API Key"
|
||||||
|
|
||||||
|
[chargebee.connector_webhook_details]
|
||||||
|
merchant_secret="Username"
|
||||||
|
additional_secret="Password"
|
||||||
|
|
||||||
|
[chargebee.metadata.site]
|
||||||
|
name="site"
|
||||||
|
label="Site"
|
||||||
|
placeholder="Enter chargebee site"
|
||||||
|
required=true
|
||||||
|
type="Text"
|
||||||
|
|
||||||
[checkbook]
|
[checkbook]
|
||||||
[[checkbook.bank_transfer]]
|
[[checkbook.bank_transfer]]
|
||||||
|
|||||||
@ -1350,6 +1350,21 @@ merchant_secret = "Source verification key"
|
|||||||
[celero.connector_auth.HeaderKey]
|
[celero.connector_auth.HeaderKey]
|
||||||
api_key="Celero API Key"
|
api_key="Celero API Key"
|
||||||
|
|
||||||
|
[chargebee]
|
||||||
|
[chargebee.connector_auth.HeaderKey]
|
||||||
|
api_key="Chargebee API Key"
|
||||||
|
|
||||||
|
[chargebee.connector_webhook_details]
|
||||||
|
merchant_secret="Username"
|
||||||
|
additional_secret="Password"
|
||||||
|
|
||||||
|
[chargebee.metadata.site]
|
||||||
|
name="site"
|
||||||
|
label="Site"
|
||||||
|
placeholder="Enter chargebee site"
|
||||||
|
required=true
|
||||||
|
type="Text"
|
||||||
|
|
||||||
[checkbook]
|
[checkbook]
|
||||||
[[checkbook.bank_transfer]]
|
[[checkbook.bank_transfer]]
|
||||||
payment_method_type = "ach"
|
payment_method_type = "ach"
|
||||||
|
|||||||
@ -1583,6 +1583,20 @@ merchant_secret = "Source verification key"
|
|||||||
[celero.connector_auth.HeaderKey]
|
[celero.connector_auth.HeaderKey]
|
||||||
api_key="Celero API Key"
|
api_key="Celero API Key"
|
||||||
|
|
||||||
|
[chargebee]
|
||||||
|
[chargebee.connector_auth.HeaderKey]
|
||||||
|
api_key="Chargebee API Key"
|
||||||
|
|
||||||
|
[chargebee.connector_webhook_details]
|
||||||
|
merchant_secret="Username"
|
||||||
|
additional_secret="Password"
|
||||||
|
|
||||||
|
[chargebee.metadata.site]
|
||||||
|
name="site"
|
||||||
|
label="Site"
|
||||||
|
placeholder="Enter chargebee site"
|
||||||
|
required=true
|
||||||
|
type="Text"
|
||||||
|
|
||||||
[checkbook]
|
[checkbook]
|
||||||
[[checkbook.bank_transfer]]
|
[[checkbook.bank_transfer]]
|
||||||
@ -4619,6 +4633,13 @@ required = true
|
|||||||
type = "MultiSelect"
|
type = "MultiSelect"
|
||||||
options = ["PAN_ONLY", "CRYPTOGRAM_3DS"]
|
options = ["PAN_ONLY", "CRYPTOGRAM_3DS"]
|
||||||
|
|
||||||
|
[stripebilling]
|
||||||
|
[stripebilling.connector_auth.HeaderKey]
|
||||||
|
api_key="Stripe Billing API Key"
|
||||||
|
|
||||||
|
[stripebilling.connector_webhook_details]
|
||||||
|
merchant_secret="Username"
|
||||||
|
additional_secret="Password"
|
||||||
|
|
||||||
[stax]
|
[stax]
|
||||||
[[stax.credit]]
|
[[stax.credit]]
|
||||||
|
|||||||
@ -381,6 +381,14 @@ pub fn get_connector_config(key: &str) -> JsResult {
|
|||||||
Ok(serde_wasm_bindgen::to_value(&res)?)
|
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")]
|
#[cfg(feature = "payouts")]
|
||||||
#[wasm_bindgen(js_name = getPayoutConnectorConfig)]
|
#[wasm_bindgen(js_name = getPayoutConnectorConfig)]
|
||||||
pub fn get_payout_connector_config(key: &str) -> JsResult {
|
pub fn get_payout_connector_config(key: &str) -> JsResult {
|
||||||
|
|||||||
Reference in New Issue
Block a user