Skip to content

Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️

794 B
Raw Blame
<?php

namespace HiEvents\Http\Actions\Orders\Payment\Stripe;

use HiEvents\Http\Actions\BaseAction;
use HiEvents\Services\Application\Handlers\Order\Payment\Stripe\GetPaymentIntentHandler;
use Illuminate\Http\JsonResponse;

class GetPaymentIntentActionPublic extends BaseAction
{
    public function __construct(
        private readonly GetPaymentIntentHandler $getPaymentIntentHandler,
    ) {}

    /**
     * @response array{status: string, paymentIntentId: string, amount: string}
     */
    public function __invoke(int $eventId, string $orderShortId): JsonResponse
    {
        $createIntent = $this->getPaymentIntentHandler->handle(
            eventId: $eventId,
            orderShortId: $orderShortId
        );

        return new JsonResponse($createIntent->toArray());
    }
}