0, 'pending' => 0, ]; // Clean merchants.json $merchants = $storage->get('merchants', []); $originalMerchantsCount = count($merchants); foreach ($merchants as $school => $info) { if (isset($info['merchant_id']) && strcasecmp($info['merchant_id'], $partnerMerchantId) === 0) { unset($merchants[$school]); $cleaned['merchants']++; } } if ($cleaned['merchants'] > 0) { $storage->set('merchants', $merchants); } // Clean pending_onboarding.json $pending = $storage->get('pending_onboarding', []); foreach ($pending as $trackId => &$entry) { if (!is_array($entry)) continue; if (isset($entry['merchant_id']) && strcasecmp($entry['merchant_id'], $partnerMerchantId) === 0) { // Remove the incorrect merchant_id and mark as incomplete unset($entry['merchant_id']); $entry['status'] = 'incomplete_onboarding'; $entry['note'] = 'Removed incorrect partner ID. Merchant needs to complete onboarding.'; $entry['cleaned_at'] = time(); $cleaned['pending']++; } } unset($entry); if ($cleaned['pending'] > 0) { $storage->set('pending_onboarding', $pending); } ?>
= $cleaned['merchants'] + $cleaned['pending'] ?> incorrect entries fixed:
merchants.jsonpending_onboarding.jsonNo incorrect merchant IDs found. Your data is clean!
This utility removed entries where your partner merchant ID (= htmlspecialchars($partnerMerchantId) ?>) was incorrectly saved as a merchant's ID.
These merchants will need to:
Total connected merchants: = count($merchants) ?>
Total pending entries: = count($pending) ?>
0): ?>= htmlspecialchars($info['merchant_id']) ?>Note: You can safely run this cleanup script multiple times. It only removes entries that match your partner merchant ID.