/** * * @param payqr_button $payqrButton * @return string */ public function genereateButton(payqr_button $payqrButton) { $this->config = $payqrButton->getPayqrItems(); $this->payqrButton = $payqrButton; if (!isset($this->config['merchant_id'], $this->config['secret_key_in'], $this->config['secret_key_out']) || empty($this->config['merchant_id']) && empty($this->config['secret_key_in']) && empty($this->config['secret_key_out'])) { return ""; } if (!in_array($this->page, $this->allowed_pages)) { return ""; } if (!$this->setPageButtonParam()) { return ""; } return $this->payqrButton->getHtmlButton(); }
$modx->getService('error', 'error.modError', '', ''); // Boot up any service classes or packages (models) you will need $path = $modx->getOption('payqr_core_path', null, $modx->getOption('core_path') . 'components/payqr/') . 'model/payqr/'; $modx->getService('payqr', 'payqr', $path); // Load the modRestService class and pass it some basic configuration $rest = $modx->getService('rest', 'rest.modRestService', '', array('basePath' => dirname(__FILE__) . '/Controllers/', 'controllerClassSeparator' => '', 'controllerClassPrefix' => 'Payqr', 'xmlRootNode' => 'response')); // Prepare the request $rest->prepare(); // Make sure the user has the proper permissions, send the user a 401 error if not if (!$rest->checkPermissions()) { $rest->sendUnauthorized(true); } // require_once $modx->getOption('payqr_core_path', null, $modx->getOption('core_path') . 'components/payqr/') . 'model/payqr/Payqr/payqr_config.php'; $payqr_button = new payqr_button($modx, []); $config = $payqr_button->getPayqrItems(); $payqrConfig = payqr_config::init($config['merchant_id'], $config['secret_key_in'], $config['secret_key_out']); if (isset($config['log_url']) && !empty($config['log_url'])) { payqr_config::$enabledLog = true; $log_file_name = pathinfo($config['log_url']); payqr_config::setLogFile($log_file_name['basename']); } payqr_logs::addEnter(); try { $Payqr = new payqr_receiver(); // создаем объект payqr_receiver $Payqr->receiving(); // получаем идентификатор счета на оплату в PayQR // проверяем тип уведомления от PayQR switch ($Payqr->getType()) { case 'invoice.deliverycases.updating':