fix(channels): sanitize card data and format suffixes
This commit is contained in:
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user