first commit

This commit is contained in:
2026-01-14 16:40:33 +03:00
commit f803480f7b
184 changed files with 5573 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
<?php
namespace Gemini\AlfaBank\Requests\Webhooks;
use Gemini\AlfaBank\Data\WebhookData;
use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Http\Response;
use Saloon\Traits\Body\HasJsonBody;
use Saloon\Contracts\Body\HasBody;
class CreateWebhookRequest extends Request implements HasBody
{
use HasJsonBody;
protected Method $method = Method::POST;
public function __construct(
protected string $object,
protected string $callbackUri,
protected ?array $accounts = null,
protected int $version = 1
) {}
public function resolveEndpoint(): string
{
return '/api/v1/webhooks';
}
protected function defaultBody(): array
{
$body = [
'object' => $this->object,
'callbackUri' => $this->callbackUri,
'version' => $this->version,
];
if ($this->accounts !== null) {
$body['data'] = ['accounts' => $this->accounts];
}
return $body;
}
public function createDtoFromResponse(Response $response): WebhookData
{
return WebhookData::from($response->json());
}
}