From e4fe94c3b59dc3797e7a85330f65990066cc3bbb Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Fri, 3 Dec 2021 09:15:49 +0000 Subject: [PATCH] Allow C12 cards for fervidex integrations --- .../users/FervidexIntegrationPage.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx index cd28488ea..eb79adb40 100644 --- a/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx +++ b/client/src/app/pages/dashboard/users/FervidexIntegrationPage.tsx @@ -136,8 +136,11 @@ function FervidexForm({ }); }} /> - {formSettings.cards.some(x => x !== "" && x.length !== 16) && ( -
CardIDs should be 16 characters!
+ {formSettings.cards.some(c => !isCardIDValid(c)) && ( +
+ CardIDs should be 16 characters, or a C followed by 12 + characters! +
)} {formSettings.cards.some(x => x.startsWith("E004")) && (
@@ -166,3 +169,15 @@ function FervidexForm({ ); } + +function isCardIDValid(cardID: string) { + if (cardID.startsWith("E004")) { + return false; + } + + if (cardID[0] === "C") { + return cardID.length === 13; + } + + return cardID.length === 16; +}