refactor: dto, requests, connector

This commit is contained in:
2026-01-19 10:46:57 +03:00
parent b2786d8606
commit 78e1e82331
32 changed files with 894 additions and 42 deletions

View File

@@ -38,7 +38,23 @@ class SbpConnector extends Connector implements HasPagination
return $this->alfaConfig->baseUrl;
}
protected function defaultConfig(): array
/**
* Parse payment notification from request body.
*/
public function parsePaymentNotification(array $data): \Apoloz\AlfaBank\Sbp\Data\Webhooks\SbpPaymentNotificationData
{
return \Apoloz\AlfaBank\Sbp\Data\Webhooks\SbpPaymentNotificationData::from($data);
}
/**
* Parse refund notification from request body.
*/
public function parseRefundNotification(array $data): \Apoloz\AlfaBank\Sbp\Data\Webhooks\SbpRefundNotificationData
{
return \Apoloz\AlfaBank\Sbp\Data\Webhooks\SbpRefundNotificationData::from($data);
}
protected function defaultHeaders(): array
{
$config = [
'cert' => $this->alfaConfig->certificatePath,
@@ -92,6 +108,7 @@ class SbpConnector extends Connector implements HasPagination
// Mutate the request to add SBP-specific headers and set the exact signed body.
$pendingRequest->headers()->add('Authorization', $signatureBase64);
$pendingRequest->headers()->add('key-name', $this->keyNameAlias);
// The SBP API documentation specifies this content-type for signed requests.
$pendingRequest->headers()->add('Content-Type', 'application/x-www-form-urlencoded');