Mobile Payment Compatibility Checker

Mobile Payment Compatibility Checker

Verify payment technology support for various devices and regions.

${resultsHtml}
`; lucide.createIcons(); attachCheckerListeners(); }; const renderConfig = () => { const configContent = document.getElementById('content-configuration'); if(!configContent) return; const methodsHtml = appData.paymentMethods.map(method => `
`).join(''); configContent.innerHTML = `

Manage Payment Methods

${methodsHtml}

Add New Method

Note: This adds a custom method to the list for tracking, but does not have built-in compatibility logic.

`; lucide.createIcons(); attachConfigListeners(); }; // --- EVENT HANDLERS & LOGIC --- const attachCheckerListeners = () => { const handler = () => { appData.inputs.device = document.getElementById('device-select').value; appData.inputs.country = document.getElementById('country-select').value; runCompatibilityCheck(); renderChecker(); }; document.getElementById('device-select').addEventListener('change', handler); document.getElementById('country-select').addEventListener('change', handler); document.getElementById('download-pdf-btn').addEventListener('click', generatePdf); }; const attachConfigListeners = () => { document.querySelectorAll('.config-input').forEach(input => { input.addEventListener('change', e => { const id = e.target.dataset.id; const method = appData.paymentMethods.find(m => m.id === id); if(method) method.name = e.target.value; renderChecker(); }); }); document.querySelectorAll('.remove-method-btn').forEach(btn => { btn.addEventListener('click', e => { const id = e.currentTarget.dataset.id; appData.paymentMethods = appData.paymentMethods.filter(m => m.id !== id); runCompatibilityCheck(); renderConfig(); renderChecker(); }); }); document.getElementById('add-method-btn').addEventListener('click', () => { const nameInput = document.getElementById('new-method-name'); if (nameInput.value) { const newId = nameInput.value.toLowerCase().replace(/\s/g, ''); if(!appData.paymentMethods.some(m => m.id === newId)) { appData.paymentMethods.push({ id: newId, name: nameInput.value }); appData.results[newId] = { status: 'Partial', notes: 'Custom method; support must be verified manually.' }; renderConfig(); renderChecker(); nameInput.value = ''; } else { alert('A method with a similar name already exists.'); } } }); }; const generatePdf = () => { loadingOverlay.style.display = 'flex'; const { jsPDF } = window.jspdf; const pdfContent = document.getElementById('pdf-content-area'); const pdfHeader = document.getElementById('pdf-header'); document.getElementById('pdf-subheader').textContent = `For: ${appData.inputs.device} in ${appData.inputs.country}`; pdfHeader.classList.remove('hidden'); html2canvas(pdfContent, { scale: 2, useCORS: true, logging: false }) .then(canvas => { pdfHeader.classList.add('hidden'); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'PNG', 0, 0, pdfWidth, imgHeight); pdf.save(`Payment-Compatibility-Report.pdf`); loadingOverlay.style.display = 'none'; }).catch(err => { console.error("PDF generation failed:", err); pdfHeader.classList.add('hidden'); loadingOverlay.style.display = 'none'; alert('An error occurred generating the PDF.'); }); }; // --- TAB NAVIGATION & INITIALIZATION --- const switchTab = (tabIndex) => { activeTabIndex = tabIndex; document.querySelectorAll('.tab-btn').forEach((btn, i) => btn.classList.toggle('active', i === tabIndex)); document.querySelectorAll('.tab-content').forEach((content, i) => content.classList.toggle('hidden', i !== tabIndex)); updateNavButtons(); }; const updateNavButtons = () => { prevTabBtn.disabled = activeTabIndex === 0; nextTabBtn.disabled = activeTabIndex === tabIdentifiers.length - 1; }; const initializeUI = () => { const tabs = [ { name: 'Compatibility Checker', id: 'compatibility-checker' }, { name: 'Configuration', id: 'configuration' } ]; tabIdentifiers = tabs.map(t => t.id); tabsContainer.innerHTML = tabs.map(tab => ``).join(''); mainContent.innerHTML = tabs.map(tab => `
`).join(''); tabs.forEach((tab, index) => { document.getElementById(`tab-${tab.id}`).addEventListener('click', () => switchTab(index)); }); renderChecker(); renderConfig(); switchTab(0); }; initializeUI(); prevTabBtn.addEventListener('click', () => { if (activeTabIndex > 0) switchTab(activeTabIndex - 1); }); nextTabBtn.addEventListener('click', () => { if (activeTabIndex < tabIdentifiers.length - 1) switchTab(activeTabIndex + 1); }); });
Scroll to Top