/** * 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); } }
/** * Registers the webhook for this module * @param string $privateKey * @return null */ public function registerWebhookEndpoint($privateKey) { if ($this->isWebhookAvailable()) { return; } $url = Shopware()->Front()->Router()->assemble(array('module' => 'frontend', 'action' => 'webhook', 'controller' => 'payment_paymill', 'forceSecure' => true)); $webhook = new Services_Paymill_Webhooks($privateKey, 'https://api.paymill.com/v2/'); $result = $webhook->create(array('url' => $url, 'event_types' => array('refund.succeeded'))); if (isset($result['id']) && isset($result['livemode']) && $result['livemode']) { Shopware()->Db()->query('REPLACE INTO `paymill_webhook` VALUES(?)', $result['id']); } }
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; }
/** * 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); } } }
public function deleteHook($id) { $this->_initHooks(); $this->_hooks->delete($id); }
protected function addPaymillWebhook($privateKey) { $webhookObject = new Services_Paymill_Webhooks($privateKey, 'https://api.paymill.com/v2/'); $url = $this->url->link('payment/' . $this->getPaymentName() . '/webHookEndpoint'); $webhookUrl = str_replace('/admin', '', $url); $webhookObject->create(array("url" => $webhookUrl, "event_types" => array('refund.succeeded'))); }
public function registerHookPoint() { $webhooks = new Services_Paymill_Webhooks(trim(oxConfig::getInstance()->getShopConfVar('PAYMILL_PRIVATEKEY')), paymill_util::API_ENDPOINT); $webhooks->create(array("url" => oxConfig::getParameter('hook_url'), "event_types" => array('refund.succeeded', 'chargeback.executed'))); }
/** * Register the refund webhook * * @param string $private_key * @return array */ private function registerPaymillWebhook($private_key) { $webhook = new Services_Paymill_Webhooks($private_key, 'https://api.paymill.com/v2/'); return $webhook->create(array('url' => _PS_BASE_URL_ . __PS_BASE_URI__ . 'modules/pigmbhpaymill/webHookEndpoint.php', 'event_types' => array('refund.succeeded'))); }
/** * Creates the web-hooks for the status update */ public function registerAction() { $this->requireWebhooks(); $webHooks = new Services_Paymill_Webhooks($this->_privateKey, $this->_apiUrl); $eventList = $this->getEventList(); $data = array(); foreach ($eventList as $url => $eventName) { $parameters = array('url' => $url, 'event_types' => array($eventName)); $hook = $webHooks->create($parameters); $this->saveWebhook($hook['id'], $hook['url'], $hook['livemode'] ? 'live' : 'test', $this->_request['type'], $hook['created_at']); $data[] = $hook; } }