fix: guard paypal plan sync against runtime exceptions

This commit is contained in:
Dwindi Ramadhana
2026-02-14 19:57:52 +07:00
parent 6ac626191a
commit 5cc626ee0c

View File

@@ -332,8 +332,19 @@ class AdminDashboardController extends Controller
public function syncPaypalPlans(PayPalPlanSyncService $sync): RedirectResponse
{
$resultSandbox = $sync->sync('sandbox');
$resultLive = $sync->sync('live');
try {
$resultSandbox = $sync->sync('sandbox');
$resultLive = $sync->sync('live');
} catch (\Throwable $e) {
report($e);
$this->logAdminAction('paypal_plan_sync_failed', [
'error' => $e->getMessage(),
]);
return back()->withErrors([
'pricing' => 'PayPal sync failed. Check server logs for details (network/credentials/proxy).',
]);
}
$this->logAdminAction('paypal_plan_sync', [
'sandbox' => $resultSandbox,