public function gateway() { if ($error = getRequest('err_msg')) { $error = $error[0]; $error = iconv("windows-1251", "utf-8", urldecode($error)); cmsController::getInstance()->errorUrl = "/emarket/ordersList/"; $this->errorNewMessage($error); } $orderId = payment::getResponseOrderId(); if (!$orderId) { throw new publicException("Order identificator wasn't recieved from payment system"); } $order = order::get($orderId); if ($order instanceof order) { $paymentId = $order->getValue('payment_id'); if ($paymentId) { $payment = payment::get($paymentId, $order); return $payment->poll(); } else { throw new publicException("No payment method inited for order #{$orderId}"); } } else { throw new publicException("Order #{$orderId} doesn't exists"); } }