feat(connector): wasm changes for Taxjar (#5879)

This commit is contained in:
Swangi Kumari
2024-09-16 12:23:47 +05:30
committed by GitHub
parent 9f9a414042
commit 90ebd54ec9
5 changed files with 31 additions and 1 deletions

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
#[cfg(feature = "payouts")]
use api_models::enums::PayoutConnectors;
use api_models::{
enums::{AuthenticationConnectors, Connector, PmAuthConnectors},
enums::{AuthenticationConnectors, Connector, PmAuthConnectors, TaxConnectors},
payments,
};
use serde::Deserialize;
@ -287,6 +287,15 @@ impl ConnectorConfig {
}
}
pub fn get_tax_processor_config(
connector: TaxConnectors,
) -> Result<Option<ConnectorTomlConfig>, String> {
let connector_data = Self::new()?;
match connector {
TaxConnectors::Taxjar => Ok(connector_data.taxjar),
}
}
pub fn get_pm_authentication_processor_config(
connector: PmAuthConnectors,
) -> Result<Option<ConnectorTomlConfig>, String> {

View File

@ -3876,6 +3876,10 @@ placeholder="Enter ThreeDS request id"
required=true
type="Text"
[taxjar]
[taxjar.connector_auth.HeaderKey]
api_key="Sandbox Token"
[billwerk]
[[billwerk.credit]]
payment_method_type = "Mastercard"

View File

@ -2859,6 +2859,10 @@ placeholder="Enter ThreeDS request id"
required=true
type="Text"
[taxjar]
[taxjar.connector_auth.HeaderKey]
api_key="Live Token"
[billwerk]
[[billwerk.credit]]
payment_method_type = "Mastercard"

View File

@ -3868,6 +3868,11 @@ placeholder="Enter ThreeDS request id"
required=true
type="Text"
[taxjar]
[taxjar.connector_auth.HeaderKey]
api_key="Sandbox Token"
[billwerk]
[[billwerk.credit]]
payment_method_type = "Mastercard"

View File

@ -327,6 +327,14 @@ pub fn get_authentication_connector_config(key: &str) -> JsResult {
Ok(serde_wasm_bindgen::to_value(&res)?)
}
#[wasm_bindgen(js_name = getTaxProcessorConfig)]
pub fn get_tax_processor_config(key: &str) -> JsResult {
let key = api_model_enums::TaxConnectors::from_str(key)
.map_err(|_| "Invalid key received".to_string())?;
let res = connector::ConnectorConfig::get_tax_processor_config(key)?;
Ok(serde_wasm_bindgen::to_value(&res)?)
}
#[wasm_bindgen(js_name = getPMAuthenticationProcessorConfig)]
pub fn get_pm_authentication_processor_config(key: &str) -> JsResult {
let key: api_model_enums::PmAuthConnectors = api_model_enums::PmAuthConnectors::from_str(key)