Example #1
0
 function after_payment_php($orderID, $OutSum, $SignatureValue, $flag)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     if ($this->_getSettingValue('CONF_ROBOXCHANGE_SHOPCURRENCY') > 0) {
         $exhange_curr = currGetCurrencyByID($this->_getSettingValue('CONF_ROBOXCHANGE_SHOPCURRENCY'));
         $exhange_rate = $exhange_curr["currency_value"];
         $exhange_round = $exhange_curr["roundval"];
     } else {
         $exhange_rate = 1;
         $exhange_round = 2;
     }
     if ((double) $exhange_rate == 0) {
         $exhange_rate = 1;
     }
     $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", "");
     if ($flag == "result") {
         $mrh_pass = $this->_getSettingValue('CONF_ROBOXCHANGE_MERCHANTPASS2');
     } else {
         $mrh_pass = $this->_getSettingValue('CONF_ROBOXCHANGE_MERCHANTPASS1');
     }
     $OutSum_x = _formatPrice($OutSum, $exhange_round, ".", "");
     $my_crc = strtoupper(md5($OutSum . ":" . $orderID . ":" . $mrh_pass));
     if ($order_amount > 0 && $my_crc == strtoupper($SignatureValue) && $OutSum_x == $order_amount) {
         ostSetOrderStatusToOrder($order["orderID"], $this->_getSettingValue('CONF_ROBOXCHANGE_STATUS_AFTER_PAY'));
         $res = "OK" . $orderID;
     }
     return $res;
 }
Example #2
0
 function after_payment_php($orderID, $params)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     $skey = $this->_getSettingValue('CONF_ZP_MERCHANT_KEY');
     $merch_bd = strtoupper($this->_getSettingValue('CONF_ZP_LMI_PAYEE_PURSE'));
     if ($this->_getSettingValue('CONF_ZP_SHOPCURRENCY') > 0) {
         $exhange_curr = currGetCurrencyByID($this->_getSettingValue('CONF_ZP_SHOPCURRENCY'));
         $exhange_rate = $exhange_curr["currency_value"];
         $exhange_round = $exhange_curr["roundval"];
     } else {
         $exhange_rate = 1;
         $exhange_round = 2;
     }
     if ((double) $exhange_rate == 0) {
         $exhange_rate = 1;
     }
     $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", "");
     $OutSum_x = _formatPrice($params["LMI_PAYMENT_AMOUNT"], $exhange_round, ".", "");
     $crc = strtoupper(md5($merch_bd . $params["LMI_PAYMENT_AMOUNT"] . $params["LMI_PAYMENT_NO"] . $params["LMI_MODE"] . $params["LMI_SYS_INVS_NO"] . $params["LMI_SYS_TRANS_NO"] . $params["LMI_SYS_TRANS_DATE"] . $skey . $params["LMI_PAYER_PURSE"] . $params["LMI_PAYER_WM"]));
     if ($order_amount > 0 && $merch_bd == strtoupper($params["LMI_PAYEE_PURSE"]) && $OutSum_x == $order_amount && $crc == strtoupper($params["LMI_HASH"])) {
         ostSetOrderStatusToOrder($order["orderID"], $this->_getSettingValue('CONF_ZP_STATUS_AFTER_PAY'));
         $res = "YES";
     }
     return $res;
 }
Example #3
0
 function after_processing_php($orderID)
 {
     //сохранить сумму квитанции
     $orderID = (int) $orderID;
     $order = ordGetOrder($orderID);
     if ($order) {
         $q = db_query("select count(*) from " . CINVOICEPHYS_DB_TABLE . "  where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         $row = db_fetch_row($q);
         if ($row[0] > 0) {
             //удалить все старые записи
             db_query("delete from " . CINVOICEPHYS_DB_TABLE . " where orderID=" . (int) $orderID . " AND module_id=" . (int) $this->ModuleConfigID);
         }
         //добавить новую запись
         db_query("insert into " . CINVOICEPHYS_DB_TABLE . " (module_id, orderID, order_amount_string) values (" . $this->ModuleConfigID . ", " . (int) $orderID . ", '" . show_price($order["order_amount"], $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_CURRENCY')) . "' )");
         //отправить квитанцию покупателю по электронной почте
         if ($this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_EMAIL_HTML_INVOICE') == 1) {
             //html
             $mySmarty = new Smarty();
             //core smarty object
             //define smarty vars
             $mySmarty->template_dir = "core/modules/tpl/";
             $mySmarty->assign("billing_lastname", $order["billing_lastname"]);
             $mySmarty->assign("billing_firstname", $order["billing_firstname"]);
             $mySmarty->assign("billing_city", $order["billing_city"]);
             $mySmarty->assign("billing_address", $order["billing_address"]);
             $mySmarty->assign("invoice_description", str_replace("[orderID]", (string) $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_INVOICE_PHYS_DESCRIPTION')));
             //сумма квитанции
             $sql = '
                 SELECT
                 order_amount_string
                 FROM ' . CINVOICEPHYS_DB_TABLE . '
                 WHERE orderID=' . (int) $orderID . ' AND module_id=' . (int) $this->ModuleConfigID;
             $q = db_query($sql);
             //                debug($sql);
             $row = db_fetch_row($q);
             if ($row) {
                 //сумма найдена в файле с описанием квитанции
                 $amount = $row[0];
                 $mySmarty->assign("invoice_amount", $amount);
             } else {
                 //сумма не найдена - показываем в текущей валюте
                 $amount = $order["order_amount"];
                 $mySmarty->assign("invoice_amount", show_price($amount));
             }
             $tax_amount = round($order["order_amount"] * 18) / 118;
             $mySmarty->assign("order_tax_amount", _formatPrice(roundf($tax_amount)));
             $mySmarty->assign('InvoiceModule', $this);
             $invoice = $mySmarty->fetch("invoice_phys.tpl");
             $attachment = 'invoice/invoce_' . $order['orderID'] . '.pdf';
             require_once 'lib/mpdf/mpdf.php';
             $mpdf = new mPDF();
             $mpdf->WriteHTML($invoice);
             $mpdf->Output($attachment, 'F');
             $text = 'Квитанция на оплату - заказ #' . $orderID;
             if (file_exists($attachment)) {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
                 xMailTxtHTMLDATA('*****@*****.**', $text, $text, CONF_GENERAL_EMAIL, CONF_SHOP_NAME, $attachment);
             } else {
                 xMailTxtHTMLDATA($order["customer_email"], $text, $invoice);
                 xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, $text . $orderID, $invoice);
                 xMailTxtHTMLDATA('*****@*****.**', $text . $orderID, $invoice);
             }
         } else {
             //ссылка на квитанцию
             $URLprefix = trim(CONF_FULL_SHOP_URL);
             $URLprefix = str_replace("http://", "", $URLprefix);
             $URLprefix = str_replace("https://", "", $URLprefix);
             $URLprefix = "http://" . $URLprefix;
             if ($URLprefix[strlen($URLprefix) - 1] != '/') {
                 $URLprefix .= "/";
             }
             $invoice_url = $URLprefix . "index.php?do=invoice_phys&moduleID=" . $this->ModuleConfigID . "&orderID={$orderID}&order_time=" . base64_encode($order["order_time_mysql"]) . "&customer_email=" . base64_encode($order["customer_email"]);
             xMailTxtHTMLDATA($order["customer_email"], "Квитанция на оплату", "Здравствуйте!<br><br>Спасибо за Ваш заказ.<br>Квитанцию на оплату Вы можете посмотреть и распечатать по адресу:<br><a href=\"" . $invoice_url . "\">" . $invoice_url . "</a><br><br>С уважением,<br>" . CONF_SHOP_NAME);
         }
     }
     return "";
 }
Example #4
0
function ordGetOrderContent($orderID)
{
    $q = db_query('select name, Price, Quantity, tax, load_counter, itemID from ' . ORDERED_CARTS_TABLE . ' where orderID=' . (int) $orderID);
    $q_order = db_query('select currency_code, currency_value, customerID, order_time, currency_round from ' . ORDERS_TABLE . ' where orderID=' . (int) $orderID);
    $order = db_fetch_row($q_order);
    $currency_code = $order['currency_code'];
    $currency_value = $order['currency_value'];
    $currency_round = $order['currency_round'];
    $data = array();
    while ($row = db_fetch_row($q)) {
        $productID = GetProductIdByItemId($row['itemID']);
        $row['pr_item'] = $productID;
        $product = GetProduct($productID);
        if ($product['eproduct_filename'] != null && $product['eproduct_filename'] != '') {
            if (file_exists('core/files/' . $product['eproduct_filename'])) {
                $row['eproduct_filename'] = $product['eproduct_filename'];
                $row['file_size'] = (string) round(filesize('core/files/' . $product['eproduct_filename']) / 1048576, 3);
                if ($order['customerID'] != null) {
                    $custID = $order['customerID'];
                } else {
                    $custID = -1;
                }
                $row['getFileParam'] = 'orderID=' . $orderID . '&' . 'productID=' . $productID . '&' . 'customerID=' . $custID;
                //additional security for non authorized customers
                if ($custID == -1) {
                    $row['getFileParam'] .= '&order_time=' . base64_encode($order['order_time']);
                }
                $row['getFileParam'] = cryptFileParamCrypt($row['getFileParam'], null);
                $row['load_counter_remainder'] = $product['eproduct_download_times'] - $row['load_counter'];
                $currentDate = dtGetParsedDateTime(get_current_time());
                $betweenDay = _getDayBetweenDate(dtGetParsedDateTime($order['order_time']), $currentDate);
                $row['day_count_remainder'] = $product['eproduct_available_days'] - $betweenDay;
            }
        }
        $row['PriceToShow'] = _formatPrice(roundf($currency_value * $row['Price'] * $row['Quantity']), $currency_round) . ' ' . $currency_code;
        $row['PriceOne'] = _formatPrice(roundf($currency_value * $row['Price']), $currency_round) . ' ' . $currency_code;
        $data[] = $row;
    }
    return $data;
}
Example #5
0
 function _my_formatPrice($price)
 {
     return _formatPrice(roundf($price));
 }
Example #6
0
File: w1.php Project: gblok/rsc
 function after_processing_html($orderID)
 {
     $order = ordGetOrder($orderID);
     $exhange_rate = 1;
     $exhange_round = 2;
     $order_amount = _formatPrice(roundf($order["order_amount"] * $exhange_rate), $exhange_round, ".", "");
     $fields = array();
     $fields1 = array();
     $fields["WMI_MERCHANT_ID"] = $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_MERCHANT_ID');
     $fields["WMI_PAYMENT_AMOUNT"] = $order_amount;
     $fields["WMI_CURRENCY_ID"] = $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_CURRENCY_ID');
     $fields["WMI_PAYMENT_NO"] = $orderID;
     $fields["WMI_DESCRIPTION"] = "BASE64:" . base64_encode(str_replace("[orderID]", $orderID, $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_DESCRIPTION')));
     $fields["WMI_SUCCESS_URL"] = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?transaction_result=success';
     $fields["WMI_FAIL_URL"] = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?transaction_result=failure';
     $fields["WMI_AUTO_ACCEPT"] = "1";
     // доступные формы оплаты
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_INTERNET')) {
         $fields1["WalletOneRUB"] = 1;
         $fields1["WalletOneUAH"] = 1;
         $fields1["WalletOneZAR"] = 1;
         $fields1["UkashEUR"] = 1;
         $fields1["MoneyMailRUB"] = 1;
         $fields1["RbkMoneyRUB"] = 1;
         $fields1["ZPaymentRUB"] = 1;
         $fields1["WebCredsRUB"] = 1;
         $fields1["EasyPayBYR"] = 1;
         $fields1["QiwiWalletRUB"] = 1;
         $fields["WMI_PTENABLED"] = 1;
     }
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_TERMINAL')) {
         $fields1["CashTerminalRUB"] = 1;
         $fields1["CashTerminalUAH"] = 1;
         $fields["WMI_PTENABLED"] = 1;
     }
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_MCOMMERCE')) {
         $fields1["BeelineRUB"] = 1;
         $fields1["MtsRUB"] = 1;
         $fields1["MegafonRUB"] = 1;
         $fields["WMI_PTENABLED"] = 1;
     }
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_CARDS')) {
         $fields1["AlfaclickRUB"] = 1;
         $fields1["Privat24UAH"] = 1;
         $fields1["PsbRetailRUB"] = 1;
         $fields1["SvyaznoyBankRUB"] = 1;
         $fields1["BankTransferRUB"] = 1;
         $fields1["BankTransferUAH"] = 1;
         $fields1["BankTransferUSD"] = 1;
         $fields1["BankTransferZAR"] = 1;
         $fields1["BankTransferKZT"] = 1;
         $fields1["CreditCardRUB"] = 1;
         $fields1["LiqPayRUB"] = 1;
         $fields1["LiqPayUSD"] = 1;
         $fields1["LiqPayEUR"] = 1;
         $fields1["LiqPayUAH"] = 1;
         $fields1["NsmepUAH"] = 1;
         $fields["WMI_PTENABLED"] = 1;
     }
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_PTENABLED_NAL')) {
         $fields1["MobileRetailsRUB"] = 1;
         $fields1["SberbankRUB"] = 1;
         $fields1["PrivatbankUAH"] = 1;
         $fields1["RussianPostRUB"] = 1;
         $fields1["ContactRUB"] = 1;
         $fields1["UnistreamRUB"] = 1;
         $fields1["AnelikRUB"] = 1;
         $fields1["LiderRUB"] = 1;
         $fields["WMI_PTENABLED"] = 1;
     }
     // Формирование сообщения, путем объединения значений формы,
     // отсортированных по именам ключей в порядке возрастания.
     uksort($fields, "strcasecmp");
     $fieldValues = "";
     foreach ($fields as $name => $val) {
         if ($name == 'WMI_PTENABLED') {
             uksort($fields1, "strcasecmp");
             foreach ($fields1 as $_i => $_v) {
                 $fieldValues .= $_i;
             }
         } else {
             $fieldValues .= $val;
         }
     }
     // Формирование значения параметра WMI_SIGNATURE, путем
     // вычисления отпечатка, сформированного выше сообщения,
     // по алгоритму MD5 или SHA1 и представление его в Base64
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_HASH_METOD') == 2) {
         $signature = base64_encode(pack("H*", md5($fieldValues . $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_SECRET_KEY'))));
         $fields["WMI_SIGNATURE"] = $signature;
     } elseif ($this->_getSettingValue('CONF_PAYMENTMODULE_WMI_HASH_METOD') == 3) {
         $signature = base64_encode(pack("H*", sha1($fieldValues . $this->_getSettingValue('CONF_PAYMENTMODULE_WMI_SECRET_KEY'))));
         $fields["WMI_SIGNATURE"] = $signature;
     }
     // Формирование HTML-кода платежной формы
     $res = "";
     $res .= "<table width='100%'>\n" . "        <tr>\n" . "                <td align='center'>\n" . "<form method=\"post\" action=\"https://merchant.w1.ru/checkout/default.aspx\" accept-charset=\"UTF-8\" id='payform'>\n";
     foreach ($fields as $key => $val) {
         if ($key == 'WMI_PTENABLED') {
             foreach ($fields1 as $_i => $_v) {
                 $res .= "    <input type=\"hidden\" name=\"WMI_PTENABLED\" value=\"{$_i}\"/>\n";
             }
         } else {
             $res .= "    <input type=\"hidden\" name=\"{$key}\" value=\"{$val}\"/>\n";
         }
     }
     $res .= "        <table cellspacing='0' cellpadding='0' class='fsttab'><tr><td><table cellspacing='0' cellpadding='0' class='sectb'><tr><td><a href='#' onclick='document.getElementById(\"payform\").submit(); return false'>" . STRING_PAY_NOW . "</a></td></tr></table></td></tr></table>\n" . "</form>\n" . "                </td>\n" . "        </tr>\n" . "</table>";
     return $res;
 }
Example #7
0
function addUnitToPrice($price)
{
    global $selected_currency_details;
    $price = _formatPrice($price, $selected_currency_details["roundval"]);
    return $selected_currency_details[2] ? $price . $selected_currency_details[0] : $selected_currency_details[0] . $price;
}