Add PayPal support for add-on and gift voucher checkout

This commit is contained in:
Codex Agent
2026-02-04 14:54:40 +01:00
parent 7025418d9e
commit 17025df47b
24 changed files with 1599 additions and 34 deletions

View File

@@ -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,