}
        }
    }
}
if (!is_null(Core_Array::getGet('ajaxLoad'))) {
    $aObjects = array();
    if (Core_Array::getGet('shop_country_id')) {
        $oShop_Country_Location = Core_Entity::factory('Shop_Country_Location');
        $oShop_Country_Location->queryBuilder()->where('shop_country_id', '=', intval(Core_Array::getGet('shop_country_id')));
        $aObjects = $oShop_Country_Location->findAll();
    } elseif (Core_Array::getGet('shop_country_location_id')) {
        $oShop_Country_Location_City = Core_Entity::factory('Shop_Country_Location_City');
        $oShop_Country_Location_City->queryBuilder()->where('shop_country_location_id', '=', intval(Core_Array::getGet('shop_country_location_id')));
        $aObjects = $oShop_Country_Location_City->findAll();
    } 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();
    public function getNotification()
    {
        $sum = $this->getSumWithCoeff();
        $oSite_Alias = $this->_shopOrder->Shop->Site->getCurrentAlias();
        $site_alias = !is_null($oSite_Alias) ? $oSite_Alias->name : '';
        $shop_path = $this->_shopOrder->Shop->Structure->getPath();
        $shopUrl = 'http://' . $site_alias . $shop_path;
        $handlerUrl = $shopUrl . "cart/?order_id={$this->_shopOrder->id}";
        $successUrl = $handlerUrl . "&payment=success";
        $failUrl = $handlerUrl . "&payment=fail";
        $cancelUrl = $handlerUrl;
        /* в режиме разработки переопределить домен для доставки нотификации о платеже */
        $handlerUrl = str_replace('hostcms.local', 'hostcms.webhook.begateway.com:8443', $handlerUrl);
        $oShop_Currency = Core_Entity::factory('Shop_Currency')->find($this->_begateway_currency_id);
        if (!is_null($oShop_Currency->id)) {
            $serviceName = 'Оплата счета N ' . $this->_shopOrder->id;
            $this->_setupLogger();
            $transaction = new \beGateway\GetPaymentToken();
            /* конвертировать RUR код в RUB */
            $currency = $oShop_Currency->code;
            $currency = $currency == 'RUR' ? 'RUB' : $currency;
            $transaction->money->setCurrency($currency);
            $transaction->money->setAmount($sum);
            $transaction->setDescription($serviceName);
            $transaction->setTrackingId($this->_shopOrder->id);
            $transaction->setLanguage('ru');
            $transaction->setNotificationUrl($handlerUrl . '&webhook=begateway');
            $transaction->setSuccessUrl($successUrl);
            $transaction->setDeclineUrl($failUrl);
            $transaction->setFailUrl($cancelUrl);
            $transaction->setCancelUrl($shopUrl);
            foreach ($this->_payment_methods as $pm) {
                $klass = $this->_camelize($pm);
                $settings = NULL;
                if (isset($this->_payment_methods_settings[$pm])) {
                    $settings = $this->_payment_methods_settings[$pm];
                }
                if ($pm == 'erip') {
                    $settings['account_number'] = (string) $this->_shopOrder->id;
                    $settings['order_id'] = (int) $this->_shopOrder->id;
                    $settings['service_info'][0] = sprintf($settings['service_info'][0], $this->_shopOrder->id);
                }
                $klass = "\\beGateway\\PaymentMethod\\" . $klass;
                $transaction->addPaymentMethod(new $klass($settings));
            }
            if ($this->_shopOrder->email) {
                $transaction->customer->setEmail($this->_shopOrder->email);
            }
            if ($this->_hideAddress) {
                $transaction->setAddressHidden();
            }
            $response = $transaction->submit();
            if ($response->isSuccess()) {
                ?>
        <h1>Оплата заказа</h1>
        <p>Сумма к оплате составляет <strong><?php 
                echo $sum;
                ?>
 <?php 
                echo $oShop_Currency->name;
                ?>
</strong></p>

        <p>Для оплаты нажмите кнопку "Оплатить".</p>

        <p style="color: rgb(112, 112, 112);">
          Внимание! Нажимая &laquo;Оплатить&raquo; Вы подтверждаете передачу контактных данных на сервер платежной системы для оплаты.
        </p>

        <form action="<?php 
                echo $response->getRedirectUrlScriptName();
                ?>
" name="pay" method="post">
          <input type="hidden" name="token" value="<?php 
                echo $response->getToken();
                ?>
">
          <input type="submit" name="button" value="Оплатить">
        </form>
        <?php 
            } else {
                ?>
        <h1>Ошибка создания идентификатора платежа</h1>
        <p>Вернитесь назад и попробуйте еще раз</p>
        <?php 
                if ($response->getMessage()) {
                    echo "<p>Причина: " . $response->getMessage();
                }
                ?>
        <?php 
            }
        } else {
            ?>
<h1>Не найдена валюта с идентификатором <?php 
            $this->_begateway_currency_id;
            ?>
!</h1><?php 
        }
    }
    public function getNotification()
    {
        $Sum = $this->getSumWithCoeff();
        $oSiteUser = Core::moduleIsActive('siteuser') ? Core_Entity::factory('Siteuser')->getCurrent() : NULL;
        $oSite_Alias = $this->_shopOrder->Shop->Site->getCurrentAlias();
        $site_alias = !is_null($oSite_Alias) ? $oSite_Alias->name : '';
        $shop_path = $this->_shopOrder->Shop->Structure->getPath();
        $handler_url = 'http://' . $site_alias . $shop_path . "cart/?order_id={$this->_shopOrder->id}";
        $successUrl = $handler_url . "&payment=success";
        $failUrl = $handler_url . "&payment=fail";
        ?>
		<h2>Оплата через систему Яндекс.Деньги</h2>
		
		<form method="POST" action="<?php 
        echo $this->getFormUrl();
        ?>
">
			<?php 
        if ($this->ym_org_mode) {
            ?>
				<input class="wide" name="scid" value="<?php 
            echo $this->ym_scid;
            ?>
" type="hidden">
				<input type="hidden" name="ShopID" value="<?php 
            echo $this->ym_shopid;
            ?>
">
				<input type="hidden" name="CustomerNumber" value="<?php 
            echo is_null($oSiteUser) ? 0 : $oSiteUser->id;
            ?>
">
				<input type="hidden" name="orderNumber" value="<?php 
            echo $this->_shopOrder->id;
            ?>
">
				<input type="hidden" name="shopSuccessURL" value="<?php 
            echo $successUrl;
            ?>
">
				<input type="hidden" name="shopFailURL" value="<?php 
            echo $failUrl;
            ?>
">
				<input type="hidden" name="cms_name" value="hostcms">
			<?php 
        } else {
            ?>
				   <input type="hidden" name="receiver" value="<?php 
            echo $this->ym_account;
            ?>
">
				   <input type="hidden" name="formcomment" value="<?php 
            echo $site_alias;
            ?>
">
				   <input type="hidden" name="short-dest" value="<?php 
            echo $site_alias;
            ?>
">
				   <input type="hidden" name="writable-targets" value="false">
				   <input type="hidden" name="comment-needed" value="true">
				   <input type="hidden" name="label" value="<?php 
            echo $this->_shopOrder->id;
            ?>
">
				   <input type="hidden" name="quickpay-form" value="shop">

				   <input type="hidden" name="targets" value="Заказ <?php 
            echo $this->_shopOrder->id;
            ?>
">
				   <input type="hidden" name="sum" value="<?php 
            echo $Sum;
            ?>
" data-type="number" >
				   <input type="hidden" name="comment" value="<?php 
            echo $this->_shopOrder->description;
            ?>
" >
				   <input type="hidden" name="need-fio" value="true">
				   <input type="hidden" name="need-email" value="true" >
				   <input type="hidden" name="need-phone" value="false">
				   <input type="hidden" name="need-address" value="false">
	   
			<?php 
        }
        ?>
				<style>
					.ym_table tr td{
						padding: 10px;
					}
					.ym_table td{
						padding: 10px;
					}
				</style>
				<table class="ym_table" border = "1" cellspacing = "20" width = "80%" bgcolor = "#FFFFFF" align = "center" bordercolor = "#000000">
					<tr>
						<td>Сумма, руб.</td>
						<td> <input type="text" name="Sum" value="<?php 
        echo $Sum;
        ?>
" readonly="readonly"> </td>
					</tr>
					
					<tr>
						<td>Способ оплаты</td>
						<td> 
						    <?php 
        if ($this->ym_org_mode) {
            ?>
								<select name="paymentType">
							<?php 
        } else {
            ?>
								<select name="payment-type">
							<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_pc) {
            ?>
									<option value="PC">Оплата из кошелька в Яндекс.Деньгах</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_ac) {
            ?>
									<option value="AC">Оплата с произвольной банковской карты</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_gp && $this->ym_org_mode) {
            ?>
									<option value="GP">Оплата наличными через кассы и терминалы</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_mc && $this->ym_org_mode) {
            ?>
									<option value="MC">Платеж со счета мобильного телефона</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_ab && $this->ym_org_mode) {
            ?>
									<option value="AB">Оплата через Альфа-Клик</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_sb && $this->ym_org_mode) {
            ?>
									<option value="SB">Оплата через Сбербанк: оплата по SMS или Сбербанк Онлайн</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_wm && $this->ym_org_mode) {
            ?>
									<option value="WM">Оплата из кошелька в системе WebMoney</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_ma && $this->ym_org_mode) {
            ?>
									<option value="MA">Оплата через MasterPass</option>
								<?php 
        }
        ?>
								<?php 
        if ($this->ym_method_pb && $this->ym_org_mode) {
            ?>
									<option value="PB">Оплата через интернет-банк Промсвязьбанка</option>
								<?php 
        }
        ?>
							</select>
						</td>
					</tr>
				</table>

				<table border="0" cellspacing="1" align="center"  width = "80%" bgcolor="#CCCCCC" >
					<tr bgcolor="#FFFFFF">
						<td width="490"></td>
						<td width="48"><input type="submit" name = "BuyButton" value = "Оплатить"></td>
					</tr>
				</table>
		</form>
	<?php 
    }
<?php

require_once '../../bootstrap.php';
Core_Auth::authorization('repairmanjacktwitterexport');
$oUser = Core_Entity::factory('User')->getCurrent();
$export = new repairmanjacktwitterexport_notifier($oUser->login);
ob_start();
////////////
$oAdmin_Form_Controller = new Admin_Form_Controller();
$oAdmin_Form_Controller->setUp();
$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>'));
    }
Example #5
0
    /**
     * @return mixed|void
     * печатает форму отправки запроса на сайт платёжной системы
     */
    public function getNotification()
    {
        $redirect_mode = $this->_fondy_redirect_mode;
        // тестовый режим
        $order_id = $this->_shopOrder->id;
        // номер заказа
        $description = 'Оплата заказа №' . $order_id;
        // описание покупки
        $oShop_Currency = Core_Entity::factory('Shop_Currency')->find($this->_fondy_currency_id);
        $currency_code = $oShop_Currency->code;
        // валюта
        if ($currency_code == 'RUR') {
            $currency_code = 'RUB';
        }
        $currency_name = $oShop_Currency->name;
        // валюта
        $oSite_Alias = $this->_shopOrder->Shop->Site->getCurrentAlias();
        $site_alias = !is_null($oSite_Alias) ? $oSite_Alias->name : '';
        $shop_path = $this->_shopOrder->Shop->Structure->getPath();
        $protocol = isset($_SERVER["HTTPS"]) ? 'https://' : 'http://';
        $server_callback_url = $protocol . $site_alias . $shop_path . 'cart/?paymentcallback=fondy';
        //url на который будет отправлено уведомление о состоянии платежа
        $response_url = $protocol . $site_alias . $shop_path . 'cart/?order_id=' . $order_id . '&payment=success';
        //url на который будет перенаправлен плательщик после успешной оплаты
        $formFields = array('order_id' => $order_id . FondyForm::ORDER_SEPARATOR . time(), 'merchant_id' => $this->_fondy_merchant_id, 'order_desc' => $description, 'currency' => $currency_code, 'server_callback_url' => $server_callback_url, 'response_url' => $response_url, 'lang' => $this->_fondy_language);
        if ($this->_fondy_redirect_mode == 1) {
            $formFields['amount'] = round($this->getSumWithCoeff() * 100);
            $formFields['signature'] = FondyForm::getSignature($formFields, $this->_fondy_secret_key);
            $fondyArgsArray = array();
            foreach ($formFields as $key => $value) {
                $fondyArgsArray[] = "<input type='hidden' name='{$key}' value='{$value}'/>";
            }
            echo '	<form action="' . FondyForm::URL . '" method="post" id="fondy_payment_form">
				' . implode('', $fondyArgsArray) . '
				<input type="submit" id="submit_fondy_payment_form" />
				<script type="text/javascript">
				</script>
				</form>';
        } else {
            $formFields['amount'] = $this->getSumWithCoeff();
            $formFields['signature'] = FondyForm::getSignature($formFields, $this->_fondy_secret_key);
            echo '<script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
				<script src="https://api.fondy.eu/static_common/v1/checkout/ipsp.js"></script>
				<div id="checkout">
				<div id="checkout_wrapper"></div>
				</div>
				<script>
				var checkoutStyles = {
				"html , body" : {
				"overflow" : "hidden"
				},
				".col.col-shoplogo" : {
				"display" : "none"
				},
				".col.col-language" : {
				"display" : "none"
				},
				".pages-checkout" : {
				"background" : "transparent"
				},
				".col.col-login" : {
				"display" : "none"
				},
				".pages-checkout .page-section-overview" : {
				"background" : "#fff",
				"color" : "#252525",
				"border-bottom" : "1px solid #dfdfdf"
				},
				".col.col-value.order-content" : {
				"color" : "#252525"
				},
				".page-section-footer" : {
				"display" : "none"
				},
				".page-section-tabs" : {
				"display" : "none"
				},
				".page-section-shopinfo" : {
				"display": "none"
				},
				}
				function checkoutInit(url, val) {
				$ipsp("checkout").scope(function() {
				this.setCheckoutWrapper("#checkout_wrapper");
				this.addCallback(__DEFAULTCALLBACK__);
				this.setCssStyle(checkoutStyles);
				this.action("show", function(data) {
				$("#checkout_loader").remove();
				$("#checkout").show();
				});
				this.action("hide", function(data) {
				$("#checkout").hide();
				});
				this.action("resize", function(data) {
				$("#checkout_wrapper").width("100%").height(data.height);
				});
				this.loadUrl(url);
				});
				};
				var button = $ipsp.get("button");
				button.setMerchantId(' . $formFields['merchant_id'] . ');
				button.setAmount(' . $formFields['amount'] . ', "' . $formFields['currency'] . '", true);
				button.setHost("api.fondy.eu");
				button.addParam("order_desc","' . $formFields['order_desc'] . '");
				button.addParam("order_id","' . $formFields['order_id'] . '");
				button.addParam("lang","' . $formFields['lang'] . '");
				button.addParam("server_callback_url","' . $formFields['server_callback_url'] . '");
				button.setResponseUrl("' . $formFields['response_url'] . '");
				checkoutInit(button.getUrl());
				</script>';
        }
    }