refactor: dto, requests, connector
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user