Add PayPal support for add-on and gift voucher checkout
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\Integrations\IntegrationWebhookRecorder;
|
||||
use App\Services\PayPal\PayPalAddonWebhookService;
|
||||
use App\Services\PayPal\PayPalGiftVoucherWebhookService;
|
||||
use App\Services\PayPal\PayPalWebhookService;
|
||||
use App\Services\PayPal\PayPalWebhookVerifier;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -15,6 +17,8 @@ class PayPalWebhookController extends Controller
|
||||
public function __construct(
|
||||
private readonly PayPalWebhookVerifier $verifier,
|
||||
private readonly PayPalWebhookService $webhooks,
|
||||
private readonly PayPalAddonWebhookService $addonWebhooks,
|
||||
private readonly PayPalGiftVoucherWebhookService $giftVoucherWebhooks,
|
||||
private readonly IntegrationWebhookRecorder $recorder,
|
||||
) {}
|
||||
|
||||
@@ -42,7 +46,13 @@ class PayPalWebhookController extends Controller
|
||||
is_string($eventType) ? $eventType : null,
|
||||
);
|
||||
|
||||
$handled = is_string($eventType) ? $this->webhooks->handle($payload) : false;
|
||||
$handled = false;
|
||||
|
||||
if (is_string($eventType)) {
|
||||
$handled = $this->webhooks->handle($payload) || $handled;
|
||||
$handled = $this->addonWebhooks->handle($payload) || $handled;
|
||||
$handled = $this->giftVoucherWebhooks->handle($payload) || $handled;
|
||||
}
|
||||
|
||||
Log::info('PayPal webhook processed', [
|
||||
'event_type' => $eventType,
|
||||
|
||||
Reference in New Issue
Block a user