From c8230cb19d005a755b1fef37e36ffc6224c6b7b9 Mon Sep 17 00:00:00 2001 From: Dwindi Ramadhana Date: Sat, 14 Feb 2026 22:37:34 +0700 Subject: [PATCH] fix: accept paypal 2xx responses in plan sync --- app/app/Services/Billing/PayPalPlanSyncService.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/app/Services/Billing/PayPalPlanSyncService.php b/app/app/Services/Billing/PayPalPlanSyncService.php index ee84946..1482630 100644 --- a/app/app/Services/Billing/PayPalPlanSyncService.php +++ b/app/app/Services/Billing/PayPalPlanSyncService.php @@ -136,7 +136,7 @@ class PayPalPlanSyncService 'grant_type' => 'client_credentials', ]); - if (!$res->ok()) { + if (!$res->successful()) { Log::warning('PayPal auth failed', ['body' => $res->body()]); return null; } @@ -175,7 +175,7 @@ class PayPalPlanSyncService ->post(rtrim($apiBase, '/').'/v1/catalogs/products', $payload); $createdId = $create->json('id'); if ($createdId) { - if (!$create->ok()) { + if (!$create->successful()) { Log::warning('PayPal product create returned non-OK but provided id', [ 'status' => $create->status(), 'body' => $create->body(), @@ -237,7 +237,7 @@ class PayPalPlanSyncService $planId = $res->json('id'); if ($planId) { - if (!$res->ok()) { + if (!$res->successful()) { Log::warning('PayPal plan create returned non-OK but provided id', [ 'code' => $code, 'status' => $res->status(), @@ -262,7 +262,7 @@ class PayPalPlanSyncService ->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10)) ->get(rtrim($apiBase, '/').'/v1/billing/plans/'.$planId); - if (!$res->ok()) { + if (!$res->successful()) { return null; } @@ -276,7 +276,7 @@ class PayPalPlanSyncService ->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10)) ->post(rtrim($apiBase, '/').'/v1/billing/plans/'.$planId.'/deactivate'); - return $res->ok(); + return $res->successful(); } private function deactivateOtherPlansForProduct(string $mode, string $token, string $productId, array $keepIds): int @@ -290,7 +290,7 @@ class PayPalPlanSyncService 'page' => 1, ]); - if (!$res->ok()) { + if (!$res->successful()) { return 0; }