function ProcessResult() { $webhook = new \beGateway\Webhook(); if (!$webhook->isAuthorized() || !$webhook->isSuccess() || $this->_shopOrder->paid || is_null($order_id = intval(Core_Array::getRequest('order_id'))) || $order_id != $webhook->getTrackingId()) { return FALSE; } $sum = $this->getSumWithCoeff(); $oShop_Currency = Core_Entity::factory('Shop_Currency')->find($this->_begateway_currency_id); /* конвертировать RUR код в RUB */ $currency = $oShop_Currency->code; $currency = $currency == 'RUR' ? 'RUB' : $currency; $money = new \beGateway\Money(); $money->setCurrency($currency); $money->setAmount($sum); if ($money->getCents() == $webhook->getResponse()->transaction->amount && $currency == $webhook->getResponse()->transaction->currency) { $this->shopOrderBeforeAction(clone $this->_shopOrder); $result = array("Товар оплачен.", "Атрибуты:", "Номер сайта продавца: " . $this->_shop_id, "Внутренний номер покупки продавца: " . $this->_shopOrder->id, "Сумма платежа: " . $sum, "Валюта платежа: " . $oShop_Currency->code, "UID платежа: " . $webhook->getUid(), "Способ оплаты: " . $webhook->getPaymentMethod(), "Статус платежа: успешно"); if (isset($webhook->getResponse()->transaction->three_d_secure_verification)) { $result[] = "3-D Secure: " . $webhook->getResponse()->transaction->three_d_secure_verification->pa_status; } $this->_shopOrder->system_information = implode($result, "\n"); $this->_shopOrder->paid(); $this->setXSLs(); $this->send(); ob_start(); $this->changedOrder('changeStatusPaid'); ob_get_clean(); } }
$oShop_Order = Core_Entity::factory('Shop_Order')->find($order_id); if (!is_null($oShop_Order->id)) { // Вызов обработчика платежной системы Shop_Payment_System_Handler::factory($oShop_Order->Shop_Payment_System)->shopOrder($oShop_Order)->paymentProcessing(); } exit; } // Добавление товара в корзину if (Core_Array::getRequest('add')) { $shop_item_id = intval(Core_Array::getRequest('add')); if ($shop_item_id) { $oShop_Cart_Controller = Shop_Cart_Controller::instance(); $oShop_Cart_Controller->checkStock(FALSE)->shop_item_id($shop_item_id)->quantity(Core_Array::getRequest('count', 1))->add(); } // Ajax if (Core_Array::getRequest('_', FALSE)) { ob_start(); // Краткая корзина $Shop_Cart_Controller_Show = new Shop_Cart_Controller_Show($oShop); $Shop_Cart_Controller_Show->xsl(Core_Entity::factory('Xsl')->getByName(Core_Array::get(Core_Page::instance()->libParams, 'littleCartXsl')))->couponText(Core_Array::get($_SESSION, 'coupon_text'))->show(); echo json_encode(ob_get_clean()); exit; } } if (Core_Array::getGet('action') == 'repeat') { $guid = Core_Array::getGet('guid'); if (strlen($guid)) { $oShop_Order = $oShop->Shop_Orders->getByGuid($guid); if (!is_null($oShop_Order)) { $aShop_Order_Items = $oShop_Order->Shop_Order_Items->findAll(); $oShop_Cart_Controller = Shop_Cart_Controller::instance();
$oAdmin_Form_Controller->path('/admin/repairmanjacktwitterexport/index.php'); $oAdmin_Form_Controller->title('Экспорт в Twitter'); $oAdmin_Form_Entity_Form = new Admin_Form_Entity_Form($oAdmin_Form_Controller); $oAdmin_Form_Entity_Form->action($oAdmin_Form_Controller->getPath()); if ($oAdmin_Form_Controller->getAction() == 'accept') { try { $export->doAccessToken(Core_Array::getPost('pin', '')); } catch (Exception $e) { $oAdmin_Form_Entity_Form->add(Core::factory('Admin_Form_Entity_Code')->html('<div id="error">Ошибка ' . $e->getCode() . ': ' . $e->getMessage() . '</div>')); } } elseif ($oAdmin_Form_Controller->getAction() == 'revoke') { $export->revokeAuthorization(); } if (!$export->isAuthorized()) { try { $export->doRequestToken(); $aData = $export->getData(); $oAdmin_Form_Entity_Form->add(Core::factory('Admin_Form_Entity_Code')->html('<div id="message">Первый шаг - авторизация приложения в Twitter! Перейдите по кнопке ниже на страничку Twitter (откроется в новой вкладке/окне) и разрешите приложению доступ к Вашем аккаунту. Скопируйте выданный Twitter код доступа.</div>'))->add(new Admin_Form_Entity_Separator())->add(Core::factory('Admin_Form_Entity_Button')->name('button')->onclick("window.open('http://api.twitter.com/oauth/authorize?oauth_token=" . $aData['oauth_token'] . "')")->value('Авторизация')->class('applyButton'))->add(Core::factory('Admin_Form_Entity_Code')->html('<div id="message">Второй шаг - введите в текстовое поле полученный от Twitter код доступа и нажмите кнопку "Применить".</div>'))->add(new Admin_Form_Entity_Separator())->add(Core::factory('Admin_Form_Entity_Input')->name("pin")->style("width: 100px"))->add(new Admin_Form_Entity_Separator())->add(Core::factory('Admin_Form_Entity_Button')->name('accept')->value('Применить')->class('applyButton')->type('submit')->onclick($oAdmin_Form_Controller->getAdminSendForm('accept'))); } catch (Exception $e) { $oAdmin_Form_Entity_Form->add(Core::factory('Admin_Form_Entity_Code')->html('<div id="error">Ошибка ' . $e->getCode() . ': ' . $e->getMessage() . '</div>')); } } else { $result = $export->getData(); $oAdmin_Form_Entity_Form->add(Core::factory('Admin_Form_Entity_Code')->html('<div id="message">Авторизация пройдена, Ваш логин: ' . $result['screen_name'] . '</div>'))->add(new Admin_Form_Entity_Separator())->add(Core::factory('Admin_Form_Entity_Button')->name('revoke')->value('Сбросить авторизацию')->class('applyButton')->type('submit')->onclick($oAdmin_Form_Controller->getAdminSendForm('revoke'))); } Core::factory('Admin_Form_Entity_Title')->name("Экспорт в Twitter")->execute(); $oAdmin_Form_Entity_Form->execute(); //////////// $oAdmin_Answer = Core_Skin::instance()->answer(); $oAdmin_Answer->ajax(Core_Array::getRequest('_', FALSE))->content(ob_get_clean())->message('')->title("Экспорт в Twitter")->execute();