|
@@ 95-107 (lines=13) @@
|
| 92 |
|
* @throws AuthnetInvalidJsonException |
| 93 |
|
* @throws AuthnetCurlException |
| 94 |
|
*/ |
| 95 |
|
public function createWebhooks(array $webhooks, string $webhookUrl, string $status = 'active') : object |
| 96 |
|
{ |
| 97 |
|
$this->endpoint = 'webhooks'; |
| 98 |
|
$this->url = sprintf('%s%s', $this->url, $this->endpoint); |
| 99 |
|
$request = [ |
| 100 |
|
'url' => $webhookUrl, |
| 101 |
|
'eventTypes' => $webhooks, |
| 102 |
|
'status' => $status |
| 103 |
|
]; |
| 104 |
|
$this->requestJson = json_encode($request); |
| 105 |
|
$response = $this->post($this->url, $this->requestJson); |
| 106 |
|
return new AuthnetWebhooksResponse($response); |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
/** |
| 110 |
|
* Sends a test ping to a URL for (a) designated webhook(s) |
|
@@ 191-203 (lines=13) @@
|
| 188 |
|
* @throws AuthnetInvalidJsonException |
| 189 |
|
* @throws AuthnetCurlException |
| 190 |
|
*/ |
| 191 |
|
public function updateWebhook(string $webhookId, string $webhookUrl, array $eventTypes, string $status = 'active') : object |
| 192 |
|
{ |
| 193 |
|
$this->endpoint = 'webhooks'; |
| 194 |
|
$this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId); |
| 195 |
|
$request = [ |
| 196 |
|
'url' => $webhookUrl, |
| 197 |
|
'eventTypes' => $eventTypes, |
| 198 |
|
'status' => $status |
| 199 |
|
]; |
| 200 |
|
$this->requestJson = json_encode($request); |
| 201 |
|
$response = $this->put($this->url, $this->requestJson); |
| 202 |
|
return new AuthnetWebhooksResponse($response); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
/** |
| 206 |
|
* Delete a webhook |