fix: accept paypal 2xx responses in plan sync
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user