/**
  * Tests Services_Paymill_Webhooks->delete()
  * and cleans up the test web hooks
  */
 public function testDelete()
 {
     $webhooks = $this->_webhook->get();
     foreach ($webhooks as $webhook) {
         if (isset($webhook['email']) && $webhook['email'] == $this->_email || isset($webhook['url']) && $webhook['url'] == $this->_url) {
             $webhook = $this->_webhook->delete($webhook['id']);
             $this->assertEquals(null, $webhook);
         }
     }
 }
 /**
  * Removes all registered web-hooks
  */
 public function removeAction()
 {
     $this->requireWebhooks();
     $type = $this->_request['type'];
     $webHooks = new Services_Paymill_Webhooks($this->_privateKey, $this->_apiUrl);
     $hooks = $this->loadAllWebHooks($type);
     foreach ($hooks as $hook) {
         $webHooks->delete($hook);
         $this->removeWebhook($hook);
     }
 }
 function _unset($id = 0)
 {
     global $db;
     $id = (int) $id;
     if ($id == 0 || !is_int($id) || $this->position != 'admin') {
         return false;
     }
     $record = $db->Execute("SELECT * FROM " . $this->_table . " WHERE id = " . $id);
     $webhooks = new Services_Paymill_Webhooks(XT_PAYMILL_PRIVATE_API_KEY, 'https://api.paymill.com/v2/');
     $webhooks->delete($record->fields['hook_id']);
     $db->Execute("DELETE FROM " . $this->_table . " WHERE " . $this->_masterKey . " = '" . $id . "'");
     return true;
 }
 public function deleteHook($id)
 {
     $this->_initHooks();
     $this->_hooks->delete($id);
 }