WayLog = trim($_SESSION['log_way']); $this->WayEvents = trim($_SESSION['events_way']); if (!is_array($array)) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'Массив данных не был передан в конструктор', FILE_APPEND); exit; } $this->array = $array; if(empty($this->array['request_url'])) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'Нет адреса для запроса', FILE_APPEND); exit; } if((strpos($this->array['request_url'], 'https://oos-stage.pscb.ru/')===false)&&(strpos($this->array['request_url'], 'https://oos.pscb.ru/')===false)&&(strpos($this->array['request_url'], 'https://oosdemo.pscb.ru/')===false)) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.' Не Cоответствующий URL', FILE_APPEND); exit; } $parsed_url= parse_url($this->array['request_url']?? null); $this->config = [ 'domain' => $parsed_url['host'], 'orderId'=> $this->array["orderId"], 'marketPlace'=> $this->array['marketPlace'], 'secretKey'=> $this->array['secretKey'] ]; } function CancelPayment() { $paymentParams = new СancelTransmitting($this->config); $res = $paymentParams->rejectPayment(); file_put_contents($this->WayEvents.'/RejectPayment.json', PHP_EOL.$res); $res =json_decode($res); foreach($res as $Part_res =>$Value_Part_res) { if($Part_res == 'errorDescription'&&!empty($Value_Part_res)) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'orderId: '.$this->config['orderId'].' '.$Value_Part_res, FILE_APPEND); } if($Part_res == 'errorDescription') { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'orderId: '.$this->config['orderId'].' Есть ошибка в переданных параметрах или повторный OrderID '.$Value_Part_res, FILE_APPEND); } } if(!empty($this->config['orderId'])) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'orderId: '.$this->config['orderId'].' Получена команда на запуск модуля', FILE_APPEND); } if(empty($this->config['orderId'])) { file_put_contents($this->WayLog.'/cancellation.log',PHP_EOL.'Получена команда на запуск модуля', FILE_APPEND); } return $res; } } ?>