Skip to content

Commit 3bdd0f4

Browse files
authored
Implement handling for new iCard swiper (#383)
Handles our new iCard swiper, which outputs format "ACMCARD(4 digits)(UIN)(otherstuff)" <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added ACM card scanning support to the ticket entry flow. Users can now scan their physical ACM card to automatically retrieve their event tickets, replacing the need for manual identity entry. Invalid scans provide helpful error feedback. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 838b40b commit 3bdd0f4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ui/pages/tickets/ScanTickets.page.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,18 @@ const ScanTicketsPageInternal: React.FC<ScanTicketsPageProps> = ({
564564

565565
let email = inputValue;
566566

567+
// Check if input is from ACM card swiper (format: ACMCARD followed by 4 digits, followed by 9 digits)
568+
if (email.startsWith("ACMCARD")) {
569+
const uinMatch = email.match(/^ACMCARD(\d{4})(\d{9})/);
570+
if (!uinMatch) {
571+
setError("Invalid card swipe. Please try again.");
572+
setIsLoading(false);
573+
setShowModal(true);
574+
return;
575+
}
576+
email = uinMatch[2]; // Extract the 9-digit UIN
577+
}
578+
567579
// Check if input is UIN (all digits)
568580
if (/^\d+$/.test(email)) {
569581
try {

0 commit comments

Comments
 (0)