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(payment_methods): unmask last4 when metadata changed during /payments (#3633)

Chethan Rao8b1206d31c6c
diff --git a/crates/router/src/core/payments/tokenization.rs b/crates/router/src/core/payments/tokenization.rs
index 9691ea962f..7cff626334 100644
--- a/crates/router/src/core/payments/tokenization.rs
+++ b/crates/router/src/core/payments/tokenization.rs
@@ -209,9 +209,7 @@ where
let updated_card = Some(CardDetailFromLocker {
scheme: None,
last4_digits: Some(
- card.card_number.to_string().split_off(
- card.card_number.to_string().len() - 4,
- ),
+ card.card_number.clone().get_last4(),
),
issuer_country: None,
card_number: Some(card.card_number),