fix: accept paypal 2xx responses in plan sync
This commit is contained in:
@@ -136,7 +136,7 @@ class PayPalPlanSyncService
|
|||||||
'grant_type' => 'client_credentials',
|
'grant_type' => 'client_credentials',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!$res->ok()) {
|
if (!$res->successful()) {
|
||||||
Log::warning('PayPal auth failed', ['body' => $res->body()]);
|
Log::warning('PayPal auth failed', ['body' => $res->body()]);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ class PayPalPlanSyncService
|
|||||||
->post(rtrim($apiBase, '/').'/v1/catalogs/products', $payload);
|
->post(rtrim($apiBase, '/').'/v1/catalogs/products', $payload);
|
||||||
$createdId = $create->json('id');
|
$createdId = $create->json('id');
|
||||||
if ($createdId) {
|
if ($createdId) {
|
||||||
if (!$create->ok()) {
|
if (!$create->successful()) {
|
||||||
Log::warning('PayPal product create returned non-OK but provided id', [
|
Log::warning('PayPal product create returned non-OK but provided id', [
|
||||||
'status' => $create->status(),
|
'status' => $create->status(),
|
||||||
'body' => $create->body(),
|
'body' => $create->body(),
|
||||||
@@ -237,7 +237,7 @@ class PayPalPlanSyncService
|
|||||||
|
|
||||||
$planId = $res->json('id');
|
$planId = $res->json('id');
|
||||||
if ($planId) {
|
if ($planId) {
|
||||||
if (!$res->ok()) {
|
if (!$res->successful()) {
|
||||||
Log::warning('PayPal plan create returned non-OK but provided id', [
|
Log::warning('PayPal plan create returned non-OK but provided id', [
|
||||||
'code' => $code,
|
'code' => $code,
|
||||||
'status' => $res->status(),
|
'status' => $res->status(),
|
||||||
@@ -262,7 +262,7 @@ class PayPalPlanSyncService
|
|||||||
->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10))
|
->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10))
|
||||||
->get(rtrim($apiBase, '/').'/v1/billing/plans/'.$planId);
|
->get(rtrim($apiBase, '/').'/v1/billing/plans/'.$planId);
|
||||||
|
|
||||||
if (!$res->ok()) {
|
if (!$res->successful()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -276,7 +276,7 @@ class PayPalPlanSyncService
|
|||||||
->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10))
|
->timeout((int) config('dewemoji.billing.providers.paypal.timeout', 10))
|
||||||
->post(rtrim($apiBase, '/').'/v1/billing/plans/'.$planId.'/deactivate');
|
->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
|
private function deactivateOtherPlansForProduct(string $mode, string $token, string $productId, array $keepIds): int
|
||||||
@@ -290,7 +290,7 @@ class PayPalPlanSyncService
|
|||||||
'page' => 1,
|
'page' => 1,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!$res->ok()) {
|
if (!$res->successful()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user