Ejemplo n.º 1
0
 /**
  * Displays the register/remove Webhook button in the payment config.
  * @param String $type Can be either CC or ELV
  */
 function displayWebhookButton($type)
 {
     if (empty($this->privateKey)) {
         return;
     }
     $webhooks = new WebHooks($this->privateKey);
     $hooks = $webhooks->loadAllWebHooks($type);
     $action = empty($hooks) ? 'register' : 'remove';
     $buttonAction = 'CREATE';
     if ($action === 'remove') {
         $buttonAction = 'REMOVE';
     }
     $buttonText = constant('MODULE_PAYMENT_PAYMILL_' . $type . '_WEBHOOKS_LINK_' . $buttonAction);
     $this->description .= '<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>';
     $this->description .= '<script type="text/javascript" src="javascript/paymill_button_webhook.js"></script>';
     $this->description .= '<p><form id="register_webhooks" method="GET">';
     $parameters = 'notification_action=' . $action . '&type=' . $type;
     $this->description .= '<input id="listener" type="hidden" value="' . zen_href_link('paymill_webhook_listener.php', $parameters, 'SSL', false, false) . '"> ';
     $this->description .= '<button type="submit">' . $buttonText . '</button></form></p>';
 }