function sendTransactionRequest($cart, $order, $doRedirect = true) { $result = JRequest::getVar('result'); $on = JRequest::getVar('on'); $desc = JRequest::getVar('desc'); $twpg_amount = round($order['details']['BT']->order_total, 2); if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) { return NULL; } $bankHandler = new Ubrir(array('shopId' => $method->twpg_id, 'order_id' => $order['details']['BT']->order_number, 'sert' => $method->twpg_sert, 'amount' => $twpg_amount, 'approve_url' => JURI::root() . 'plugins/vmpayment/' . $this->_currentMethod->payment_element . '/result.php?id=' . $order['details']['BT']->order_number, 'cancel_url' => JURI::root() . 'plugins/vmpayment/' . $this->_currentMethod->payment_element . '/result.php?id=' . $order['details']['BT']->order_number, 'decline_url' => JURI::root() . 'plugins/vmpayment/' . $this->_currentMethod->payment_element . '/result.php?id=' . $order['details']['BT']->order_number)); $response_order = $bankHandler->prepare_to_pay(); if (!empty($response_order)) { $db =& JFactory::getDBO(); $sql = " INSERT INTO #__virtuemart_payment_plg_" . $this->_currentMethod->payment_element . " \n\t\t(`virtuemart_order_id`, `order_number`, `type`, `session_id`) \n\t\tVALUES \n\t\t('" . $order['details']['BT']->order_number . "', '" . $response_order->OrderID[0] . "', 1, '" . $response_order->SessionID[0] . "') "; $db->setQuery($sql); if (!$db->query()) { exit('error_1101'); } } else { exit('error_1102'); } $cart->emptyCart(); $twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0]; echo '<p>Данный заказ необходимо оплатить одним из методов, приведенных ниже: </p> <INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">'; if ($method->two == 0) { // если активны два процессинга, то работаем еще и с Uniteller echo ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">'; include dirname(__FILE__) . "/include/uni_form.php"; } }
function onAfterOrderConfirm(&$order, &$methods, $method_id) { parent::onAfterOrderConfirm($order, $methods, $method_id); // echo HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify¬if_payment='.$this->name; // die; $amount = $order->cart->full_total->prices[0]->price_value_with_tax; $url = JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?id=' . $order->order_number; $readyToPay = false; // возможность платежа $bankHandler = new Ubrir(array('shopId' => $this->payment_params->twpg_id, 'order_id' => $order->order_number, 'sert' => $this->payment_params->twpg_private_pass, 'amount' => $amount, 'approve_url' => $url, 'cancel_url' => $url, 'decline_url' => $url)); $response_order = $bankHandler->prepare_to_pay(); // что вернул банк if (!empty($response_order)) { $db = JFactory::getDBO(); $sql = " INSERT INTO #__twpg_orders \n\t\t\t(`shoporderid`, `OrderID`, `SessionID`) \n\t\t\tVALUES \n\t\t\t('" . $order->order_number . "', '" . $response_order->OrderID[0] . "', '" . $response_order->SessionID[0] . "') "; $db->setQuery($sql); if (!$db->query()) { exit('error_1101'); } } else { switch ($response_order) { case 30: echo 'Неверный формат сообщения'; break; case 10: echo 'ИМ не имеет доступа к этой операции'; break; case 54: case 96: echo 'недопустимая операция'; break; } exit; } $twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0]; echo '<p>Данный заказ необходимо оплатить одним из методов, приведенных ниже: </p> <INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">'; if ($this->payment_params->two == 1) { $id = trim($this->payment_params->uniteller_id); $login = trim($this->payment_params->uniteller_login); $pass = trim($this->payment_params->uniteller_pass); $orderid = $order->order_number; $amount = round($amount, 2); $sign = strtoupper(md5(md5($id) . '&' . md5($login) . '&' . md5($pass) . '&' . md5($orderid) . '&' . md5($amount))); echo '<form action="https://91.208.121.201/estore_listener.php" name="uniteller" method="post" hidden> <input type="number" name="SHOP_ID" value="' . $id . '"> <input type="text" name="LOGIN" value="' . $login . '"> <input type="text" name="ORDER_ID" value="' . $orderid . '"> <input type="number" name="PAY_SUM" value="' . $amount . '"> <input type="text" name="VALUE_1" value="' . $orderid . '"> <input type="text" name="URL_OK" value="' . JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?status=ok&"> <input type="text" name="URL_NO" value="' . JURI::root() . 'plugins/hikashoppayment/ubrir/catcher.php?status=no&"> <input type="text" name="SIGN" value="' . $sign . '"> <input type="text" name="LANG" value="RU"> </form>'; // die; echo '<INPUT TYPE="button" value="Оплатить MasterCard" onclick="document.forms.uniteller.submit()">'; } }
public function process($template = null) { $this->order->order(); $currency = strtoupper(mainConfiguration::getInstance()->get('system', 'default-currency')); $amount = number_format($this->order->getActualPrice(), 2, '.', ''); $orderId = $this->order->getId(); $mnt_ubrir_id = $this->object->mnt_ubrir_id; $mnt_secret_key = $this->object->mnt_secret_key; $mnt_uni_id = $this->object->mnt_uni_id; $mnt_uni_login = $this->object->mnt_uni_login; $mnt_uni_pass = $this->object->mnt_uni_pass; $mnt_uni_emp = $this->object->mnt_uni_emp; $mnt_two = $this->object->mnt_two; $cmsController = cmsController::getInstance(); $answerUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . "/emarket/gateway/" . $this->order->getId() . '/'; $failUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/fail/'; $successUrl = 'http://' . $cmsController->getCurrentDomain()->getHost() . '/emarket/purchase/result/successful/'; if (is_array($mnt_ubrir_id)) { $mnt_ubrir_id = $mnt_ubrir_id[0]; } if (is_array($mnt_secret_key)) { $mnt_secret_key = $mnt_secret_key[0]; } $bankHandler = new Ubrir(array('shopId' => $mnt_ubrir_id, 'order_id' => $orderId, 'sert' => $mnt_secret_key, 'amount' => $amount, 'approve_url' => $answerUrl, 'cancel_url' => $failUrl, 'decline_url' => $failUrl)); $response_order = $bankHandler->prepare_to_pay(); $new_order_twpg = l_mysql_query('INSERT INTO `umi_twpg` (`umi_id`, `twpg_id`, `session_id`) VALUES ("' . $orderId . '", "' . $response_order->OrderID[0] . '", "' . $response_order->SessionID[0] . '")'); $param = array(); if (is_array($mnt_uni_id)) { $mnt_uni_id = $mnt_uni_id[0]; } //if(is_array($mnt_uni_login)) if (is_array($mnt_uni_pass)) { $mnt_uni_pass = $mnt_uni_pass[0]; } //var_dump($mnt_uni_login); die; $param['sign'] = strtoupper(md5(md5($mnt_uni_id) . '&' . md5($mnt_uni_login) . '&' . md5($mnt_uni_pass) . '&' . md5($orderId) . '&' . md5($amount))); $param['twpg_url'] = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0]; $param['uni_id'] = $mnt_uni_id; $param['uni_login'] = $mnt_uni_login; $param['amount'] = $amount; $param['order_id'] = $orderId; $param['urlno'] = $failUrl; $param['urlok'] = $successUrl; if ($mnt_two == 1) { $param['uni_submit'] = ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">'; } else { $param['uni_submit'] = ''; } $this->order->setPaymentStatus('initialized'); list($templateString) = def_module::loadTemplates("tpls/emarket/payment/ubrir/ubrir.tpl", "form_block"); return def_module::parseTemplate($templateString, $param); }
function _prePayment($data) { $app = JFactory::getApplication(); $currency = J2Store::currency(); // Prepare the payment form $vars = new JObject(); $vars->url = JRoute::_("index.php?option=com_j2store&view=checkout"); $vars->order_id = $data['order_id']; $vars->orderpayment_id = $data['orderpayment_id']; $vars->orderpayment_type = $this->_element; F0FTable::addIncludePath(JPATH_ADMINISTRATOR . '/components/com_j2store/tables'); $order = F0FTable::getInstance('Order', 'J2StoreTable'); $order->load($data['orderpayment_id']); $twpg_amount = round($order->order_total, 2); $bankHandler = new Ubrir(array('shopId' => $this->params->get('twpg_id', 'PLG_J2STORE_PAYMENT_UBRIR'), 'order_id' => $data['order_id'], 'sert' => $this->params->get('twpg_sert', 'PLG_J2STORE_PAYMENT_UBRIR'), 'amount' => $twpg_amount, 'approve_url' => JURI::root() . 'plugins/j2store/payment_ubrir/payment_ubrir/tmpl/result.php?id=' . $data['order_id'], 'cancel_url' => JURI::root() . 'plugins/j2store/payment_ubrir/payment_ubrir/tmpl/result.php?id=' . $data['order_id'], 'decline_url' => JURI::root() . 'plugins/j2store/payment_ubrir/payment_ubrir/tmpl/result.php?id=' . $data['order_id'])); $response_order = $bankHandler->prepare_to_pay(); if (!empty($response_order)) { $db =& JFactory::getDBO(); $sql = " UPDATE #__j2store_orders \n\t\tSET `transaction_id` = " . $response_order->OrderID[0] . ", `transaction_details` = '" . $response_order->SessionID[0] . "'\n\t\tWHERE `order_id` = " . $data['order_id']; $db->setQuery($sql); if (!$db->query()) { exit('error_1101'); } } else { exit('error_1102'); } $out = ''; $twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0]; $out .= '<p>Данный заказ необходимо оплатить одним из методов, приведенных ниже: </p> <INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">'; if ($this->params->get('two', 'PLG_J2STORE_PAYMENT_UBRIR') == 0) { // если активны два процессинга, то работаем еще и с Uniteller $out .= ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">'; include dirname(__FILE__) . "/payment_ubrir/library/include/uni_form.php"; } return $out; }
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } include GetLangFileName(dirname(__FILE__) . "/", "/ubrir.php"); include dirname(__FILE__) . "/sdk/ubrir_autoload.php"; include dirname(__FILE__) . "/view/style.php"; $shouldPay = strlen(CSalePaySystemAction::GetParamValue("SHOULD_PAY")) > 0 ? CSalePaySystemAction::GetParamValue("SHOULD_PAY") : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["SHOULD_PAY"]; $orderID = strlen(CSalePaySystemAction::GetParamValue("ORDER_ID")) > 0 ? CSalePaySystemAction::GetParamValue("ORDER_ID") : $GLOBALS["SALE_INPUT_PARAMS"]["ORDER"]["ID"]; $arOrder = CSaleOrder::GetByID(CSalePaySystemAction::GetParamValue("ORDER_ID")); // получаем текущий заказ if (!isset($_GET['status'])) { /* ---------------- если операция еще не совершена -------------- */ $readyToPay = false; // возможность платежа $bankHandler = new Ubrir(array('shopId' => CSalePaySystemAction::GetParamValue("ID"), 'order_id' => CSalePaySystemAction::GetParamValue("ORDER_ID"), 'sert' => CSalePaySystemAction::GetParamValue("SERT"), 'amount' => CSalePaySystemAction::GetParamValue("SHOULD_PAY"))); $response_order = $bankHandler->prepare_to_pay(); // что вернул банк include dirname(__FILE__) . "/include/twpg_db.php"; if ($readyToPay and !empty($response_order)) { $twpg_url = $response_order->URL[0] . '?orderid=' . $response_order->OrderID[0] . '&sessionid=' . $response_order->SessionID[0]; echo '<INPUT TYPE="button" value="Оплатить Visa" onclick="document.location = \'' . $twpg_url . '\'">'; } if (CSalePaySystemAction::GetParamValue("TWO") == 'Y') { // если активны два процессинга, то работаем еще и с Uniteller echo ' <INPUT TYPE="button" onclick="document.forms.uniteller.submit()" value="Оплатить MasterCard">'; include dirname(__FILE__) . "/include/uni_form.php"; } } else { $status = htmlspecialchars(stripslashes($_GET['status'])); switch ($status) { case 'APPROVED':