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

refactor(first_name): check if first_name is sent as empty string (#4832)

Narayan Bhat5cb84f66e4c5
diff --git a/crates/api_models/src/payments.rs b/crates/api_models/src/payments.rs
index 30329e132b..f4e49058c9 100644
--- a/crates/api_models/src/payments.rs
+++ b/crates/api_models/src/payments.rs
@@ -2904,7 +2904,11 @@ impl AddressDetails {
pub fn unify_address_details(self, other: Option<&Self>) -> Self {
if let Some(other) = other {
- let (first_name, last_name) = if self.first_name.is_some() {
+ let (first_name, last_name) = if self
+ .first_name
+ .as_ref()
+ .is_some_and(|first_name| !first_name.is_empty_after_trim())
+ {
(self.first_name, self.last_name)
} else {
(other.first_name.clone(), other.last_name.clone())