From 946779b54e5fa83d93c94d96b40eb0adc45af60c Mon Sep 17 00:00:00 2001 From: Mitchell Date: Mon, 14 Feb 2022 01:36:13 +0100 Subject: [PATCH] Added WebhookCreated with secret result --- src/Client/Webhook.php | 4 ++-- src/Result/WebhookCreated.php | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 src/Result/WebhookCreated.php diff --git a/src/Client/Webhook.php b/src/Client/Webhook.php index 5cee4db..c99bf91 100644 --- a/src/Client/Webhook.php +++ b/src/Client/Webhook.php @@ -118,7 +118,7 @@ public function redeliverDelivery(string $storeId, string $webhookId, string $de } } - public function createWebhook(string $storeId, string $url, ?array $specificEvents, ?string $secret): \BTCPayServer\Result\Webhook + public function createWebhook(string $storeId, string $url, ?array $specificEvents, ?string $secret): \BTCPayServer\Result\WebhookCreated { $data = [ 'enabled' => true, @@ -152,7 +152,7 @@ public function createWebhook(string $storeId, string $url, ?array $specificEven if ($response->getStatus() === 200) { $data = json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR); - return new \BTCPayServer\Result\Webhook($data); + return new \BTCPayServer\Result\WebhookCreated($data); } else { throw $this->getExceptionByStatusCode($method, $url, $response); } diff --git a/src/Result/WebhookCreated.php b/src/Result/WebhookCreated.php new file mode 100755 index 0000000..af483e5 --- /dev/null +++ b/src/Result/WebhookCreated.php @@ -0,0 +1,14 @@ +getData(); + return $data['secret']; + } +}