fix(core): Replace euclid enum with RoutableConnectors enum (#2994)

Signed-off-by: chikke srujan <121822803+srujanchikke@users.noreply.github.com>
Co-authored-by: hyperswitch-bot[bot] <148525504+hyperswitch-bot[bot]@users.noreply.github.com>
This commit is contained in:
chikke srujan
2023-11-28 20:34:30 +05:30
committed by GitHub
parent 1c5a9b5452
commit ff6a0dd0b5
18 changed files with 153 additions and 449 deletions

View File

@ -7,6 +7,7 @@ use std::{
};
use api_models::{admin as admin_api, routing::ConnectorSelection};
use common_enums::RoutableConnectors;
use currency_conversion::{
conversion::convert as convert_currency, types as currency_conversion_types,
};
@ -17,7 +18,6 @@ use euclid::{
graph::{self, Memoization},
state_machine, truth,
},
enums,
frontend::{
ast,
dir::{self, enums as dir_enums},
@ -61,8 +61,8 @@ pub fn convert_forex_value(amount: i64, from_currency: JsValue, to_currency: JsV
.get()
.ok_or("Forex Data not seeded")
.err_to_js()?;
let from_currency: enums::Currency = serde_wasm_bindgen::from_value(from_currency)?;
let to_currency: enums::Currency = serde_wasm_bindgen::from_value(to_currency)?;
let from_currency: common_enums::Currency = serde_wasm_bindgen::from_value(from_currency)?;
let to_currency: common_enums::Currency = serde_wasm_bindgen::from_value(to_currency)?;
let converted_amount = convert_currency(forex_data, from_currency, to_currency, amount)
.map_err(|_| "conversion not possible for provided values")
.err_to_js()?;
@ -80,7 +80,7 @@ pub fn seed_knowledge_graph(mcas: JsValue) -> JsResult {
.iter()
.map(|mca| {
Ok::<_, strum::ParseError>(ast::ConnectorChoice {
connector: dir_enums::Connector::from_str(&mca.connector_name)?,
connector: RoutableConnectors::from_str(&mca.connector_name)?,
#[cfg(not(feature = "connector_choice_mca_id"))]
sub_label: mca.business_sub_label.clone(),
})
@ -183,7 +183,9 @@ pub fn run_program(program: JsValue, input: JsValue) -> JsResult {
#[wasm_bindgen(js_name = getAllConnectors)]
pub fn get_all_connectors() -> JsResult {
Ok(serde_wasm_bindgen::to_value(enums::Connector::VARIANTS)?)
Ok(serde_wasm_bindgen::to_value(
common_enums::RoutableConnectors::VARIANTS,
)?)
}
#[wasm_bindgen(js_name = getAllKeys)]