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

fix(wasm): fix failing `wasm-pack build` for `euclid_wasm` (#3284)

Shankar Singh C5eb671146466
diff --git a/crates/cards/Cargo.toml b/crates/cards/Cargo.toml
index cf3e25459c..6892350ce6 100644
--- a/crates/cards/Cargo.toml
+++ b/crates/cards/Cargo.toml
@@ -19,6 +19,8 @@ time = "0.3.21"
# First party crates
common_utils = { version = "0.1.0", path = "../common_utils" }
masking = { version = "0.1.0", path = "../masking" }
+
+[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
router_env = { version = "0.1.0", path = "../router_env", features = ["log_extra_implicit_fields", "log_custom_entries_to_extra"] }
[dev-dependencies]
diff --git a/crates/cards/src/validate.rs b/crates/cards/src/validate.rs
index 001eab3004..ca47c73c7c 100644
--- a/crates/cards/src/validate.rs
+++ b/crates/cards/src/validate.rs
@@ -1,6 +1,7 @@
use std::{fmt, ops::Deref, str::FromStr};
use masking::{PeekInterface, Strategy, StrongSecret, WithType};
+#[cfg(not(target_arch = "wasm32"))]
use router_env::logger;
use serde::{Deserialize, Deserializer, Serialize};
use thiserror::Error;
@@ -89,6 +90,7 @@ where
if let Some(value) = val_str.get(..6) {
write!(f, "{}{}", value, "*".repeat(val_str.len() - 6))
} else {
+ #[cfg(not(target_arch = "wasm32"))]
logger::error!("Invalid card number {val_str}");
WithType::fmt(val, f)
}