Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Connector): Plaid connector configs #5545

Merged
merged 11 commits into from
Aug 9, 2024
11 changes: 10 additions & 1 deletion crates/connector_configs/src/connector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
#[cfg(feature = "payouts")]
use api_models::enums::PayoutConnectors;
use api_models::{
enums::{AuthenticationConnectors, Connector},
enums::{AuthenticationConnectors, Connector, PmAuthConnectors},
payments,
};
use serde::Deserialize;
Expand Down Expand Up @@ -269,6 +269,15 @@ impl ConnectorConfig {
}
}

pub fn get_pm_authentication_processor_config(
connector: PmAuthConnectors,
) -> Result<Option<ConnectorTomlConfig>, String> {
let connector_data = Self::new()?;
match connector {
PmAuthConnectors::Plaid => Ok(connector_data.plaid),
}
}

pub fn get_connector_config(
connector: Connector,
) -> Result<Option<ConnectorTomlConfig>, String> {
Expand Down
8 changes: 8 additions & 0 deletions crates/euclid_wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,14 @@ pub fn get_authentication_connector_config(key: &str) -> JsResult {
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)
.map_err(|_| "Invalid key received".to_string())?;
let res = connector::ConnectorConfig::get_pm_authentication_processor_config(key)?;
Ok(serde_wasm_bindgen::to_value(&res)?)
}

#[wasm_bindgen(js_name = getRequestPayload)]
pub fn get_request_payload(input: JsValue, response: JsValue) -> JsResult {
let input: DashboardRequestPayload = serde_wasm_bindgen::from_value(input)?;
Expand Down
Loading