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(); } }
} elseif (Core_Array::getGet('shop_country_location_city_id')) { $oShop_Country_Location_City_Area = Core_Entity::factory('Shop_Country_Location_City_Area'); $oShop_Country_Location_City_Area->queryBuilder()->where('shop_country_location_city_id', '=', intval(Core_Array::getGet('shop_country_location_city_id'))); $aObjects = $oShop_Country_Location_City_Area->findAll(); } $aArray = array('…'); foreach ($aObjects as $Object) { $aArray['_' . $Object->id] = $Object->name; } echo json_encode($aArray); exit; } // Удаляение товара из корзины if (Core_Array::getGet('delete')) { $shop_item_id = intval(Core_Array::getGet('delete')); if ($shop_item_id) { $oShop_Cart_Controller = Shop_Cart_Controller::instance(); $oShop_Cart_Controller->shop_item_id($shop_item_id)->delete(); } } if (Core_Array::getPost('recount') || Core_Array::getPost('step') == 1) { $oShop_Cart_Controller = Shop_Cart_Controller::instance(); $aCart = $oShop_Cart_Controller->getAll($oShop); foreach ($aCart as $oShop_Cart) { $oShop_Cart_Controller->checkStock(FALSE)->shop_item_id($oShop_Cart->shop_item_id)->quantity(Core_Array::getPost('quantity_' . $oShop_Cart->shop_item_id))->postpone(is_null(Core_Array::getPost('postpone_' . $oShop_Cart->shop_item_id)) ? 0 : 1)->shop_warehouse_id(Core_Array::getPost('warehouse_' . $oShop_Cart->shop_item_id, 0))->update(); } // Запоминаем купон $_SESSION['hostcmsOrder']['coupon_text'] = trim(strval(Core_Array::getPost('coupon_text'))); } $Shop_Cart_Controller_Show = new Shop_Cart_Controller_Show($oShop); Core_Page::instance()->object = $Shop_Cart_Controller_Show;
$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();