/** * Function pay_go **/ function pay_go() { global $gOptions; $orderId = $_SESSION['order_info']['code']; $returnUrl = HOST_NAME . 'pay_get.php?type=Fondy'; //&order_sid=' . $_GET['order_sid']; $fondy = new Fondy(); $fondyArgs = array('order_id' => $orderId . Fondy::ORDER_SEPARATOR . time(), 'merchant_id' => MERCHANT_ID, 'order_desc' => 'Shopping', 'amount' => round($_SESSION['order_info']['totalsum'] * 100), 'currency' => 'UAH', 'server_callback_url' => $returnUrl, 'response_url' => $returnUrl . '&send_email=1', 'lang' => 'RU', 'sender_email' => $_SESSION['client']['email'], 'delayed' => 'N'); $fondyArgs['signature'] = $fondy->getSignature($fondyArgs, MERCHANT_SECRET); $fondyArgsArray = array(); foreach ($fondyArgs as $key => $value) { $fondyArgsArray[] = "<input type='hidden' name='{$key}' value='{$value}'/>"; } echo ' <form action="' . Fondy::URL . '" method="post" id="fondy_payment_form"> ' . implode('', $fondyArgsArray) . ' <input type="submit" id="submit_fondy_payment_form" /> <script type="text/javascript"> document.getElementById("submit_fondy_payment_form").click(); </script> </form>'; exit; }
function plgVmConfirmedOrder($cart, $order) { if (!($method = $this->getVmPluginMethod($order['details']['BT']->virtuemart_paymentmethod_id))) { return null; // Another method was selected, do nothing } if (!$this->selectedThisElement($method->payment_element)) { return false; } include_once dirname(__FILE__) . DS . "/Fondy.cls.php"; if (!class_exists('VirtueMartModelCurrency')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'currency.php'; } JFactory::getLanguage()->load($filename = 'com_virtuemart', JPATH_ADMINISTRATOR); $vendorId = 0; $html = ""; if (!class_exists('VirtueMartModelOrders')) { require JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php'; } $this->getPaymentCurrency($method); if ($method->FONDY_SYSTEM_CURRENCY == 1) { $currencyModel = new VirtueMartModelCurrency(); $currencyObj = $currencyModel->getCurrency($order['details']['BT']->order_currency); $currency = $currencyObj->currency_code_3; } else { switch ($method->FONDY_COUNTRY) { case "RU": $currency = "RUB"; break; case "EN": $currency = "USD"; break; default: $currency = "UAH"; break; } } list($lang, ) = explode('-', JFactory::getLanguage()->getTag()); $paymentMethodID = $order['details']['BT']->virtuemart_paymentmethod_id; $responseUrl = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&pm=' . $paymentMethodID); $callbackUrl = JROUTE::_(JURI::root() . 'index.php?option=com_virtuemart&view=pluginresponse&task=pluginnotification&tmpl=component&pm=' . $paymentMethodID); $user =& $cart->BT; $formFields = array('order_id' => $cart->order_number . Fondy::ORDER_SEPARATOR . time(), 'merchant_id' => $method->FONDY_MERCHANT, 'order_desc' => $cart->order_number, 'amount' => Fondy::getAmount($order), 'currency' => $currency, 'server_callback_url' => $callbackUrl, 'response_url' => $responseUrl, 'lang' => strtoupper($lang), 'sender_email' => $user['email']); $formFields['signature'] = Fondy::getSignature($formFields, $method->FONDY_SECRET_KEY); $fondyArgsArray = array(); foreach ($formFields as $key => $value) { $fondyArgsArray[] = "<input type='hidden' name='{$key}' value='{$value}'/>"; } $html = ' <form action="' . Fondy::URL . '" method="post" id="fondy_payment_form"> ' . implode('', $fondyArgsArray) . '</form>' . "<div><img src='https://fondy.eu/img/loader.gif' width='50px' style='margin:20px 20px;'></div>" . "<script> setTimeout(function() {\n document.getElementById('fondy_payment_form').submit();\n }, 100);\n </script>"; // 2 = don't delete the cart, don't send email and don't redirect return $this->processConfirmedOrderPaymentResponse(2, $cart, $order, $html, ''); }