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 ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
<?php
namespace HiEvents\Http\Actions\Organizers\Stripe;
use HiEvents\DomainObjects\Enums\Permission;
use HiEvents\DomainObjects\OrganizerDomainObject;
use HiEvents\Exceptions\ResourceNotFoundException;
use HiEvents\Http\Actions\BaseAction;
use HiEvents\Http\Attributes\RequiresPermission;
use HiEvents\Resources\Organizer\Stripe\OrganizerStripeConnectAccountsResponseResource;
use HiEvents\Services\Application\Handlers\Organizer\Payment\Stripe\GetStripeConnectAccountsHandler;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Throwable;
#[RequiresPermission(Permission::MANAGE_PAYMENTS)]
class GetStripeConnectAccountsAction extends BaseAction
{
public function __construct(
private readonly GetStripeConnectAccountsHandler $getStripeConnectAccountsHandler,
) {}
/**
* @throws Throwable
*/
public function __invoke(int $organizerId): JsonResponse
{
$this->isActionAuthorized($organizerId, OrganizerDomainObject::class);
try {
$result = $this->getStripeConnectAccountsHandler->handle($organizerId, $this->getAuthenticatedAccountId());
} catch (ResourceNotFoundException $e) {
return $this->errorResponse(
message: $e->getMessage(),
statusCode: Response::HTTP_NOT_FOUND,
);
}
return $this->resourceResponse(
resource: OrganizerStripeConnectAccountsResponseResource::class,
data: $result,
);
}
}