import { CheckNFCResponse } from "../types/ekycNFCType"; // Utility function to parse NFC response string to CheckNFCResponse export function parseNfcResponse(nfcResponseStr: string): CheckNFCResponse | null { try { // Parse JSON string const nfcResponse = JSON.parse(nfcResponseStr); return { address: nfcResponse.address, cardNumber: nfcResponse.cardNumber, character: nfcResponse.character, dateOfBirth: nfcResponse.dateOfBirth, expiredDate: nfcResponse.expiredDate, faceImage: nfcResponse.faceImage, fatherName: nfcResponse.fatherName, motherName: nfcResponse.motherName, hometown: nfcResponse.hometown, issueDate: nfcResponse.issueDate, mrz: nfcResponse.mrz, name: nfcResponse.name, nation: nfcResponse.nation, nationality: nfcResponse.nationality, partnerName: nfcResponse.partnerName, previousNumber: nfcResponse.previousNumber, religion: nfcResponse.religion, sex: nfcResponse.sex, nfcInfo: { dg1: nfcResponse.nfcInfo?.dg1, dg2: nfcResponse.nfcInfo?.dg2, dg13: nfcResponse.nfcInfo?.dg13, dg14: nfcResponse.nfcInfo?.dg14, dg15: nfcResponse.nfcInfo?.dg15, sod: nfcResponse.nfcInfo?.sod } }; } catch (error) { console.error('Error parsing NFC response:', error); return null; } };