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): expose funding source and card segment type values (#13872)

Ayush Anande5d762a3c925
diff --git a/crates/euclid_wasm/src/lib.rs b/crates/euclid_wasm/src/lib.rs
index ad2898d9b9..6cd523dc47 100644
--- a/crates/euclid_wasm/src/lib.rs
+++ b/crates/euclid_wasm/src/lib.rs
@@ -37,8 +37,9 @@ use api_models::payment_methods::CountryCodeWithName;
#[cfg(feature = "payouts")]
use common_enums::PayoutStatus;
use common_enums::{
- CardType, CountryAlpha2, DisputeStatus, EventClass, EventType, IntentStatus, MandateStatus,
- MerchantCategoryCode, MerchantCategoryCodeWithName, RefundStatus, SubscriptionStatus,
+ CardSegmentType, CardType, CountryAlpha2, DisputeStatus, EventClass, EventType, FundingSource,
+ IntentStatus, MandateStatus, MerchantCategoryCode, MerchantCategoryCodeWithName, RefundStatus,
+ SubscriptionStatus,
};
use strum::IntoEnumIterator;
@@ -554,6 +555,18 @@ pub fn get_card_type_values() -> JsResult {
Ok(serde_wasm_bindgen::to_value(&types)?)
}
+#[wasm_bindgen(js_name = getFundingSourceValues)]
+pub fn get_funding_source_values() -> JsResult {
+ let funding_sources: Vec<FundingSource> = FundingSource::iter().collect();
+ Ok(serde_wasm_bindgen::to_value(&funding_sources)?)
+}
+
+#[wasm_bindgen(js_name = getCardSegmentTypeValues)]
+pub fn get_card_segment_type_values() -> JsResult {
+ let segment_types: Vec<CardSegmentType> = CardSegmentType::iter().collect();
+ Ok(serde_wasm_bindgen::to_value(&segment_types)?)
+}
+
#[wasm_bindgen(js_name = getValidWebhookStatus)]
pub fn get_valid_webhook_status(key: &str) -> JsResult {
let event_class = EventClass::from_str(key)