コード例 #1
0
 /**
  * Tests Services_Paymill_Webhooks->create()
  */
 public function testCreateEmailWebhook()
 {
     $events = array('transaction.succeeded', 'subscription.created');
     $params = array('email' => $this->_email, 'event_types' => $events);
     $webhook = $this->_webhook->create($params);
     $this->assertInternalType('array', $webhook);
     $this->assertArrayHasKey('id', $webhook);
     $this->assertNotEmpty($webhook['id']);
     $this->assertEquals($this->_email, $webhook['email']);
     $this->assertContains('subscription.created', $webhook['event_types']);
     $this->assertContains('transaction.succeeded', $webhook['event_types']);
     $webhookId = $webhook['id'];
     return $webhookId;
 }
コード例 #2
0
 /**
  * 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']);
     }
 }
コード例 #3
0
 /**
  * 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;
     }
 }
 function _set($data, $set_type = 'edit')
 {
     global $db;
     if ($this->position != 'admin') {
         return false;
     }
     $webhooks = new Services_Paymill_Webhooks(XT_PAYMILL_PRIVATE_API_KEY, 'https://api.paymill.com/v2/');
     $result = $webhooks->create(array("url" => $data['endpoint_url'], "event_types" => array('refund.succeeded', 'chargeback.executed')));
     if (array_key_exists('id', $result)) {
         $db->Execute($db->Prepare("INSERT INTO " . $this->_table . "(`hook_id`, `type`, `endpoint_url`) VALUES (?, ?, ?)"), array($result['id'], print_r($result['event_types'], true), $result['url']));
         return true;
     }
     return false;
 }
コード例 #5
0
 public function createHook(array $params)
 {
     $this->_initHooks();
     $result = $this->_hooks->create($params);
 }
コード例 #6
0
ファイル: paymill.php プロジェクト: SiWe0401/paymill-opencart
 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')));
 }
コード例 #7
0
 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')));
 }
コード例 #8
0
 /**
  * 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')));
 }