| @@ 103-115 (lines=13) @@ | ||
| 100 | * |
|
| 101 | * @return array list of event types |
|
| 102 | */ |
|
| 103 | public function createWebhooks(Array $webhooks, $webhookUrl, $status = 'active') |
|
| 104 | {
|
|
| 105 | $this->endpoint = 'webhooks'; |
|
| 106 | $this->url = sprintf('%s%s', $this->url, $this->endpoint);
|
|
| 107 | $request = [ |
|
| 108 | 'url' => $webhookUrl, |
|
| 109 | 'eventTypes' => $webhooks, |
|
| 110 | 'status' => $status |
|
| 111 | ]; |
|
| 112 | $this->requestJson = json_encode($request); |
|
| 113 | $response = $this->post($this->url, $this->requestJson); |
|
| 114 | return new AuthnetWebhooksResponse($response); |
|
| 115 | } |
|
| 116 | ||
| 117 | /** |
|
| 118 | * Sends a test ping to a URL for (a) designated webhook(s) |
|
| @@ 172-184 (lines=13) @@ | ||
| 169 | * |
|
| 170 | * @return array list of event types |
|
| 171 | */ |
|
| 172 | public function updateWebhook($webhookId, $webhookUrl, Array $eventTypes, $status = 'active') |
|
| 173 | {
|
|
| 174 | $this->endpoint = 'webhooks'; |
|
| 175 | $this->url = sprintf('%s%s/%s', $this->url, $this->endpoint, $webhookId);
|
|
| 176 | $request = [ |
|
| 177 | 'url' => $webhookUrl, |
|
| 178 | 'eventTypes' => $eventTypes, |
|
| 179 | 'status' => $status |
|
| 180 | ]; |
|
| 181 | $this->requestJson = json_encode($request); |
|
| 182 | $response = $this->put($this->url, $this->requestJson); |
|
| 183 | return new AuthnetWebhooksResponse($response); |
|
| 184 | } |
|
| 185 | ||
| 186 | /** |
|
| 187 | * Delete a webhook |
|