const fs = require('fs');
const path = require('path');

const cbDir = 'dist/callback';
if (fs.existsSync(cbDir)) {
  console.log("dist/callback exists. Listing contents:");
  const files = fs.readdirSync(cbDir);
  files.forEach(f => {
    console.log(`- ${f}`);
    const content = fs.readFileSync(path.join(cbDir, f), 'utf8');
    const lines = content.split('\n');
    lines.forEach((line, i) => {
      if (line.includes('voucher') || line.includes('status') || line.includes('used') || line.includes('paid')) {
        console.log(`  Line ${i+1}: ${line.trim()}`);
      }
    });
  });
} else {
  console.log("dist/callback does not exist.");
}
