First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
$config = require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/lib/PayPalClient.php';
|
||||
require __DIR__ . '/lib/Storage.php';
|
||||
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
try {
|
||||
$client = new PayPalClient($config);
|
||||
$storage = new Storage($config['storage_path']);
|
||||
|
||||
echo "Partner diagnostics\n\n";
|
||||
echo "Env: " . $config['env'] . "\n";
|
||||
echo "Base API: " . (new PayPalClient($config))->getBaseApi() . "\n";
|
||||
echo "Partner Merchant ID (Payer ID): " . $config['partner_merchant_id'] . "\n\n";
|
||||
|
||||
// Try a simple pull of merchant-integrations
|
||||
$path = '/v1/customer/partners/' . urlencode($config['partner_merchant_id']) . '/merchant-integrations?page_size=20';
|
||||
$resp = $client->api('GET', $path);
|
||||
echo "GET $path => status: " . $resp['status'] . "\n";
|
||||
if ($resp['status'] >= 200 && $resp['status'] < 300) {
|
||||
$list = $resp['body']['merchant_integrations'] ?? [];
|
||||
echo "Integrations returned: " . count($list) . "\n";
|
||||
foreach ($list as $i => $mi) {
|
||||
$mid = $mi['merchant_id'] ?? 'n/a';
|
||||
$tid = $mi['tracking_id'] ?? 'n/a';
|
||||
$rid = $mi['partner_referral_id'] ?? ($mi['referral_id'] ?? 'n/a');
|
||||
$onb = $mi['onboarding_status'] ?? null;
|
||||
echo sprintf("%02d. merchant_id=%s tracking_id=%s referral_id=%s status=%s\n", $i+1, $mid, $tid, $rid, is_array($onb)? json_encode($onb): (string)$onb);
|
||||
}
|
||||
} else {
|
||||
echo json_encode($resp['body'], JSON_PRETTY_PRINT) . "\n";
|
||||
}
|
||||
|
||||
echo "\nRecent sync_debug entries:\n";
|
||||
$diag = $storage->get('sync_debug', []);
|
||||
$tail = array_slice($diag, -5);
|
||||
foreach ($tail as $row) {
|
||||
echo json_encode($row, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) . "\n";
|
||||
}
|
||||
|
||||
echo "\nPending entries:\n";
|
||||
$pending = $storage->get('pending_onboarding', []);
|
||||
foreach ($pending as $track => $row) {
|
||||
echo $track . ' => ' . json_encode($row, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE) . "\n";
|
||||
}
|
||||
|
||||
} catch (Throwable $e) {
|
||||
http_response_code(500);
|
||||
echo 'Diagnostics error: ' . $e->getMessage();
|
||||
}
|
||||
Reference in new issue
Block a user