Skip to content

Commit 68eb051

Browse files
committed
PHPAY-36: feat: adding webhooks list
1 parent b016ce6 commit 68eb051

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

examples/asaas/webhook.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,22 @@
3838
->getGateway();
3939

4040
/**
41-
* store asaas customer
41+
* store a new webhook
4242
*
43-
* @param array $customer
43+
* @param array $webhook
4444
* @return array
45-
* @see available fields in https://docs.asaas.com/reference/criar-novo-cliente
45+
* @see available fields in https://docs.asaas.com/reference/criar-novo-webhook
4646
*/
4747
$webhook = $phpay
4848
->webhook($webhook)
4949
->create();
5050

51-
print_r($webhook);
51+
/**
52+
* get all webhooks
53+
*
54+
* @param array $customer
55+
* @return array
56+
*/
57+
$webhooks = $phpay
58+
->webhook()
59+
->getAll();

src/Gateways/Asaas/Resources/Webhook/Interface/WebhookInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
interface WebhookInterface
66
{
77
public function create(array $webhook = []): array;
8+
public function getAll(): array;
89
}

src/Gateways/Asaas/Resources/Webhook/Webhook.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,15 @@ public function create(array $webhook = []): array
4646
{
4747
return $this->post('webhooks', $this->webhook);
4848
}
49+
50+
/**
51+
* get all webhooks
52+
*
53+
* @param string $id
54+
* @return array
55+
*/
56+
public function getAll(): array
57+
{
58+
return $this->get("webhooks");
59+
}
4960
}

0 commit comments

Comments
 (0)