1 | <?php |
||
2 | |||
3 | namespace Sebdesign\VivaPayments; |
||
4 | |||
5 | use Sebdesign\VivaPayments\Responses\WebhookVerificationKey; |
||
6 | |||
7 | class Webhook |
||
8 | { |
||
9 | 3 | public function __construct(protected Client $client) |
|
10 | { |
||
11 | } |
||
12 | |||
13 | /** |
||
14 | * Get a webhook authorization code. |
||
15 | * |
||
16 | * @see https://developer.vivawallet.com/webhooks-for-payments/#generate-a-webhook-verification-key |
||
17 | * |
||
18 | * @param array<string,mixed> $guzzleOptions Additional parameters for the Guzzle client |
||
19 | */ |
||
20 | 6 | public function getVerificationKey(array $guzzleOptions = []): WebhookVerificationKey |
|
21 | { |
||
22 | 6 | $response = $this->client->get( |
|
23 | 6 | $this->client->getUrl()->withPath('/api/messages/config/token'), |
|
24 | 6 | array_merge_recursive( |
|
25 | 6 | $this->client->authenticateWithBasicAuth(), |
|
26 | $guzzleOptions |
||
27 | ) |
||
28 | ); |
||
29 | |||
30 | /** @phpstan-ignore-next-line */ |
||
31 | 6 | return new WebhookVerificationKey(...$response); |
|
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
32 | } |
||
33 | } |
||
34 |