export enum ICType { Amusement = 1, Transport = 2 } export enum AmusementICVendor { Sega = 0x0078, Konami = 0x0068, BandaiNamcoEntertainment = 0x002A, BandaiNamcoGames = 0x003A, Nesica = 0x0079, Unknown = 0x0000 } type AmusementICCard = { type: ICType.Amusement, idm: string, accessCode: string, vendor: AmusementICVendor } type TransportICCard = { type: ICType.Transport, idm: string } export type ICCard = AmusementICCard | TransportICCard; /** * Converts an IC card IDm to the 20-digit "0008" number used by some networks * @param idm The IDm to convert */ export function icCard0008Number(idm: string): string { // 0008 is the numerical representation of the idm padded with zeros until it is 20 digits return BigInt(`0x${idm}`).toString().padStart(20, '0'); }