fix(channels): sanitize card data and format suffixes

This commit is contained in:
2026-09-28 14:26:22 +08:00
parent 99d4a85ece
commit ea4a54f5c6
4 changed files with 51 additions and 25 deletions
+6 -8
View File
@@ -71,14 +71,12 @@ const TXN_SCENES = [
function getChannelIdentifier(channel: ChannelWithAccountNames): string {
if (channel.channelType === "PAYMENT_CARD") {
let suffix = channel.cardNumberSuffix?.trim()
if (
!suffix &&
channel.cardNumberFull &&
channel.cardNumberFull.length >= 4
) {
suffix = channel.cardNumberFull.slice(-4)
}
const digits = (
channel.cardNumberSuffix ||
channel.cardNumberFull ||
""
).replace(/\D/g, "")
const suffix = digits.length >= 4 ? digits.slice(-4) : digits
return suffix ? `•••• ${suffix}` : ""
}
if (channel.channelType === "E_WALLET") {