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_processing_html($orderID)
 {
     $res = '';
     $order = ordGetOrder($orderID);
     $order_amount = roundf(PaymentModule::_convertCurrency($order['order_amount'], 0, $this->_getSettingValue('CONF_CHRONOPAY_CURCODE')));
     $currency = currGetCurrencyByID($this->_getSettingValue('CONF_CHRONOPAY_CURCODE'));
     $zone_iso2 = $order['billing_state'];
     $countries = cnGetCountries(array('offset' => 0, 'CountRowOnPage' => 1000000), $count_row);
     foreach ($countries as $country) {
         if ($country['country_name'] == $order['billing_country']) {
             $country_iso3 = $country['country_iso_3'];
             $zones = znGetZones($country['countryID']);
             foreach ($zones as $zone) {
                 if ($zone['zone_name'] == $zone_iso2) {
                     $zone_iso2 = $zone['zone_code'];
                     break;
                 }
             }
             break;
         }
     }
     $post_1 = array('product_id' => $this->_getSettingValue('CONF_CHRONOPAY_PRODUCT_ID'), 'product_name' => CONF_SHOP_NAME, 'product_price' => $order_amount, 'product_price_currency' => $currency['currency_iso_3'], 'f_name' => $order['billing_firstname'], 's_name' => $order['billing_lastname'], 'street' => $order['billing_address'], 'city' => $order['billing_city'], 'state' => $zone_iso2, 'country' => $country_iso3, 'email' => $order['customer_email'], 'cb_url' => getTransactionResultURL('success'), 'cb_type' => 'P', 'decline_url' => getTransactionResultURL('failure'));
     $hidden_fields_html = '';
     reset($post_1);
     while (list($k, $v) = each($post_1)) {
         $hidden_fields_html .= '<input type="hidden" name="' . $k . '" value="' . $v . '" />' . "\n";
     }
     $res = '
                             <form method="post" action="' . xHtmlSpecialChars($this->processing_url) . '" style="text-align:center;">
                                     ' . $hidden_fields_html . '
                                     <input type="submit" value="' . CHRONOPAY_TXT_SUBMIT . '" />
                             </form>
                             ';
     return $res;
 }
Example #3
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 #4
0
 function after_processing_html($orderID)
 {
     $order = ordGetOrder($orderID);
     //get order amount
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_USD_CURRENCY') > 0) {
         $curr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_USD_CURRENCY'));
         $curr_rate = $curr["currency_value"];
     }
     if (!isset($curr) || !$curr) {
         $curr_rate = 1;
     }
     $order_amount = roundf($order["order_amount"] * $curr_rate);
     //get billing country ISO 2-chars code
     $q = db_query("select country_iso_3 from " . COUNTRIES_TABLE . " where country_name = '" . $order["billing_country"] . "';");
     $row = db_fetch_row($q);
     if ($row) {
         $bcountry = $row[0];
     } else {
         $bcountry = "";
     }
     $res = "";
     $res .= "<table width='100%'>\n" . "        <tr>\n" . "                <td align='center'>\n" . "<form method='POST' name='verisignLINKform' action='https://payments.verisign.com/payflowlink'>\n" . "<input type=\"hidden\" name=\"LOGIN\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_LOGIN') . "\">\n" . "<input type=\"hidden\" name=\"PARTNER\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_PARTNER') . "\">\n" . "<input type=\"hidden\" name=\"AMOUNT\" value=\"" . $order_amount . "\">" . "<input type=\"hidden\" name=\"TYPE\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_VERISIGNLINK_TRANSTYPE') . "\">\n" . "<input type=\"hidden\" name=\"DESCRIPTION\" value=\"Order #{$orderID}\">\n" . "<input type=\"hidden\" name=\"NAME\" value=\"" . $order["billing_firstname"] . " " . $order["billing_lastname"] . "\">\n" . "<input type=\"hidden\" name=\"ADDRESS\" value=\"" . str_replace("\n", "", $order["billing_address"]) . "\">\n" . "<input type=\"hidden\" name=\"CITY\" value=\"" . $order["billing_city"] . "\">\n" . "<input type=\"hidden\" name=\"STATE\" value=\"" . $order["billing_state"] . "\">\n" . "<input type=\"hidden\" name=\"COUNTRY\" value=\"" . $bcountry . "\">\n" . "<input type=\"hidden\" name=\"EMAIL\" value=\"" . $order["customer_email"] . "\">\n" . "<input type=\"submit\" value=\"" . CVERISIGNLINK_TXT_AFTER_PROCESSING_HTML_1 . "\">\n" . "                </form>\n" . "                </td>\n" . "        </tr>\n" . "</table>";
     // xMailTxtHTMLDATA($order["customer_email"], "VeriSign payment", $res);
     return $res;
 }
Example #5
0
 function after_processing_html($orderID)
 {
     $order = ordGetOrder($orderID);
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_CURR_TYPE') > 0) {
         $MCcurr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_CURR_TYPE'));
     } else {
         $MCcurr = array("currency_value" => 1);
     }
     $order_amount = round(100 * $order["order_amount"] * $MCcurr["currency_value"]) / 100;
     $res = "";
     $res .= "<table width='100%'>\n" . "\t<tr>\n" . "\t\t<td align='center'>\n" . "<form method='POST' action='http://www.aitsafe.com/cf/addmulti.cfm'>\n" . "<input type=\"hidden\" name=\"userid\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_MALSE_USERID') . "\">\n" . "<INPUT TYPE=\"HIDDEN\" NAME=\"qty1\">" . "<INPUT TYPE=\"HIDDEN\" NAME=\"noqty1\" VALUE=1>" . "<INPUT TYPE=\"HIDDEN\" NAME=\"product1\" VALUE=\"Order #" . $orderID . " (" . show_price($order_amount) . ")\">" . "<INPUT TYPE=\"HIDDEN\" NAME=\"price1\" VALUE=\"" . $order_amount . "\">" . "<input type=\"submit\" name=\"submit\" value=\"" . CMALSE_TXT_AFTER_PROCESSING_HTML_1 . "\">\n" . "\t\t</td>\n" . "\t</tr>\n" . "</table>";
     return $res;
 }
Example #6
0
 function after_processing_html($orderID)
 {
     $order = ordGetOrder($orderID);
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_2CO_USD_CURRENCY') > 0) {
         $TWOCOcurr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_2CO_USD_CURRENCY'));
         $TWOCOcurr_rate = $TWOCOcurr["currency_value"];
     }
     if (!isset($TWOCOcurr) || !$TWOCOcurr) {
         $TWOCOcurr_rate = 1;
     }
     $order_amount = round(100 * $order["order_amount"] * $TWOCOcurr_rate) / 100;
     $res = "";
     $res .= "<table width='100%'>\n" . "        <tr>\n" . "                <td align='center'>\n" . "<form method='POST' name='two_check_out_form' action='https://www.2checkout.com/2co/buyer/purchase'>\n" . "<input type=\"hidden\" name=\"sid\" value=\"" . $this->_getSettingValue('CONF_PAYMENTMODULE_2CHECKOUT_ID') . "\">\n" . "<input type=\"hidden\" name=\"total\" value=\"" . $order_amount . "\">\n" . "<input type=\"hidden\" name=\"cart_order_id\" value=\"" . $orderID . "\">\n" . "<input type=\"hidden\" name=\"card_holder_name\" value=\"" . $order["billing_firstname"] . " " . $order["billing_lastname"] . "\">\n" . "<input type=\"hidden\" name=\"street_address\" value=\"" . $order["billing_address"] . "\">\n" . "<input type=\"hidden\" name=\"city\" value=\"" . $order["billing_city"] . "\">\n" . "<input type=\"hidden\" name=\"state\" value=\"" . $order["billing_state"] . "\">\n" . "<input type=\"hidden\" name=\"country\" value=\"" . $order["billing_country"] . "\">\n" . "<input type=\"hidden\" name=\"email\" value=\"" . $order["customer_email"] . "\">\n" . "<input type=\"hidden\" name=\"ship_street_address\" value=\"" . $order["shipping_address"] . "\">\n" . "<input type=\"hidden\" name=\"ship_city\" value=\"" . $order["shipping_city"] . "\">\n" . "<input type=\"hidden\" name=\"ship_state\" value=\"" . $order["shipping_state"] . "\">\n" . "<input type=\"hidden\" name=\"ship_country\" value=\"" . $order["shipping_country"] . "\">\n" . "<input type=\"hidden\" name=\"c_prod\" value=\"ShopCMS order\">\n" . "<input type=\"hidden\" name=\"id_type\" value=\"2\">\n" . "<input type=\"submit\" value=\"" . C2CHECKOUT_TXT_1 . "\">\n" . "                </form>\n" . "                </td>\n" . "        </tr>\n" . "</table>";
     //                                "<script>document.two_check_out_form.submit();</script>";
     //echo "<pre>".str_replace("<", "&lt;", $res);
     return $res;
 }
Example #7
0
 /**
  * Convert from one currency type to another type
  * @param float $_Value - currency value
  * @param mixed $_FromType - could be currency ID or currency ISO3
  * @param mixed $_ToType
  */
 function _convertCurrency($_Value, $_FromType, $_ToType)
 {
     if (!intval($_FromType)) {
         if (strlen($_FromType) == 3) {
             $FromCurrency = currGetCurrencyByISO3($_FromType);
         } else {
             $FromCurrency = array('currency_value' => 1);
         }
     } else {
         $FromCurrency = currGetCurrencyByID($_FromType);
     }
     if (!intval($_ToType)) {
         if (strlen($_ToType) == 3) {
             $ToCurrency = currGetCurrencyByISO3($_ToType);
         } else {
             $ToCurrency = array('currency_value' => 1);
         }
     } else {
         $ToCurrency = currGetCurrencyByID($_ToType);
     }
     return $_Value / $FromCurrency['currency_value'] * $ToCurrency['currency_value'];
 }
Example #8
0
function ordOrderProcessing($shippingMethodID, $paymentMethodID, $shippingAddressID, $billingAddressID, $shippingModuleFiles, $paymentModulesFiles, $customers_comment, $cc_number, $cc_holdername, $cc_expires, $cc_cvv, $log, $smarty_mail, $shServiceID = 0)
{
    $customerID = $log != null ? regGetIdByLogin($log) : NULL;
    if ($log != null) {
        $customerInfo = regGetCustomerInfo2($log);
    } else {
        $customerInfo['first_name'] = $_SESSION['first_name'];
        $customerInfo['last_name'] = $_SESSION['last_name'];
        $customerInfo['Email'] = $_SESSION['email'];
        $customerInfo['affiliationLogin'] = $_SESSION['affiliationLogin'];
    }
    $order_time = get_current_time();
    $frandl = mt_rand(3, 999);
    $order_active_link = md5($order_time) . $frandl;
    $customer_ip = stGetCustomerIP_Address();
    $statusID = CONF_ACTIVE_ORDER == 1 ? 0 : ostGetNewOrderStatus();
    $customer_affiliationLogin = isset($customerInfo['affiliationLogin']) ? $customerInfo['affiliationLogin'] : '';
    $customer_email = $customerInfo['Email'];
    $currencyID = currGetCurrentCurrencyUnitID();
    if ($currencyID != 0) {
        $currentCurrency = currGetCurrencyByID($currencyID);
        $currency_code = $currentCurrency['currency_iso_3'];
        $currency_value = $currentCurrency['currency_value'];
        $currency_round = $currentCurrency['roundval'];
    } else {
        $currency_code = '';
        $currency_value = 1;
        $currency_round = 2;
    }
    // get shipping address
    if ($shippingAddressID != 0) {
        $shippingAddress = regGetAddress($shippingAddressID);
        $shippingAddressCountry = cnGetCountryById($shippingAddress['countryID']);
        $shippingAddress['country_name'] = $shippingAddressCountry['country_name'];
    } else {
        $shippingCountryName = cnGetCountryById($_SESSION['receiver_countryID']);
        $shippingCountryName = $shippingCountryName['country_name'];
        $shippingAddress['first_name'] = $_SESSION['receiver_first_name'];
        $shippingAddress['last_name'] = $_SESSION['receiver_last_name'];
        $shippingAddress['country_name'] = $shippingCountryName;
        $shippingAddress['state'] = $_SESSION['receiver_state'];
        $shippingAddress['city'] = $_SESSION['receiver_city'];
        $shippingAddress['address'] = $_SESSION['receiver_address'];
        $shippingAddress['zoneID'] = $_SESSION['receiver_zoneID'];
    }
    if (is_null($shippingAddress['state']) || trim($shippingAddress['state']) == '') {
        $zone = znGetSingleZoneById($shippingAddress['zoneID']);
        $shippingAddress['state'] = $zone['zone_name'];
    }
    // get billing address
    if ($billingAddressID != 0) {
        $billingAddress = regGetAddress($billingAddressID);
        $billingAddressCountry = cnGetCountryById($billingAddress['countryID']);
        $billingAddress['country_name'] = $billingAddressCountry['country_name'];
    } else {
        $billingCountryName = cnGetCountryById($_SESSION['billing_countryID']);
        $billingCountryName = $billingCountryName['country_name'];
        $billingAddress['first_name'] = $_SESSION['billing_first_name'];
        $billingAddress['last_name'] = $_SESSION['billing_last_name'];
        $billingAddress['country_name'] = $billingCountryName;
        $billingAddress['state'] = $_SESSION['billing_state'];
        $billingAddress['city'] = $_SESSION['billing_city'];
        $billingAddress['address'] = $_SESSION['billing_address'];
        $billingAddress['zoneID'] = $_SESSION['billing_zoneID'];
    }
    if (is_null($billingAddress['state']) || trim($billingAddress['state']) == '') {
        $zone = znGetSingleZoneById($billingAddress['zoneID']);
        $billingAddress['state'] = $zone['zone_name'];
    }
    $cartContent = cartGetCartContent();
    foreach ($cartContent['cart_content'] as $key => $cartItem) {
        if (!empty($cartItem['opt_margin']) && $paymentMethodID == 2) {
            $cost = $cartItem['costUC'];
            $margin = $cost / 100 * CONF_PERCENT_MARGIN;
            $cost += $margin;
            $costShow = show_price($cost * $cartItem['quantity']);
            $cartContent['cart_content'][$key]['costUC'] = $cost;
            $cartContent['cart_content'][$key]['cost'] = $costShow;
        }
    }
    if ($log != null) {
        $addresses = array($shippingAddressID, $billingAddressID);
    } else {
        $addresses = array(array('countryID' => $_SESSION['receiver_countryID'], 'zoneID' => $_SESSION['receiver_zoneID']), array('countryID' => $_SESSION['billing_countryID'], 'zoneID' => $_SESSION['billing_zoneID']));
    }
    $orderDetails = array('first_name' => $shippingAddress['first_name'], 'last_name' => $shippingAddress['last_name'], 'email' => $customerInfo['Email'], 'order_amount' => oaGetOrderAmountExShippingRate($cartContent, $addresses, $log, FALSE));
    $shippingMethod = shGetShippingMethodById($shippingMethodID);
    $shipping_email_comments_text = $shippingMethod['email_comments_text'];
    $shippingName = $shippingMethod['Name'];
    $paymentMethod = payGetPaymentMethodById($paymentMethodID);
    $paymentName = $paymentMethod['Name'];
    $payment_email_comments_text = $paymentMethod['email_comments_text'];
    if (isset($paymentMethod['calculate_tax']) && (int) $paymentMethod['calculate_tax'] == 0) {
        $order_amount = oaGetOrderAmount($cartContent, $addresses, $shippingMethodID, $log, $orderDetails, TRUE, $shServiceID);
        $d = oaGetDiscountPercent($cartContent, $log);
        $tax = 0;
        $shipping_costUC = oaGetShippingCostTakingIntoTax($cartContent, $shippingMethodID, $addresses, $orderDetails, FALSE, $shServiceID, TRUE);
        $discount_percent = oaGetDiscountPercent($cartContent, $log);
    } else {
        $order_amount = oaGetOrderAmount($cartContent, $addresses, $shippingMethodID, $log, $orderDetails, TRUE, $shServiceID);
        $d = oaGetDiscountPercent($cartContent, $log);
        $tax = oaGetProductTax($cartContent, $d, $addresses);
        $shipping_costUC = oaGetShippingCostTakingIntoTax($cartContent, $shippingMethodID, $addresses, $orderDetails, TRUE, $shServiceID, TRUE);
        $discount_percent = oaGetDiscountPercent($cartContent, $log);
    }
    $shServiceInfo = '';
    if (is_array($shipping_costUC)) {
        list($shipping_costUC) = $shipping_costUC;
        $shServiceInfo = $shipping_costUC['name'];
        $shipping_costUC = $shipping_costUC['rate'];
    }
    $paymentMethod = payGetPaymentMethodById($paymentMethodID);
    if ($paymentMethod) {
        $currentPaymentModule = modGetModuleObj($paymentMethod['module_id'], PAYMENT_MODULE);
    } else {
        $currentPaymentModule = null;
    }
    if ($currentPaymentModule != null) {
        //define order details for payment module
        $order_payment_details = array('customer_email' => $customer_email, 'customer_ip' => $customer_ip, 'order_amount' => $order_amount, 'currency_code' => $currency_code, 'currency_value' => $currency_value, 'shipping_cost' => $shipping_costUC, 'order_tax' => $tax, 'shipping_info' => $shippingAddress, 'billing_info' => $billingAddress);
        $process_payment_result = $currentPaymentModule->payment_process($order_payment_details);
        //gets payment processing result
        if (!($process_payment_result == 1)) {
            //die ($process_payment_result);
            if (isset($_POST)) {
                $_SESSION['order4confirmation_post'] = $_POST;
            }
            xSaveData('PaymentError', $process_payment_result);
            if (!$customerID) {
                RedirectProtected('index.php?order4_confirmation_quick=yes' . '&shippingMethodID=' . $_GET['shippingMethodID'] . '&paymentMethodID=' . $_GET['paymentMethodID'] . '&shServiceID=' . $shServiceID);
            } else {
                RedirectProtected('index.php?order4_confirmation=yes' . '&shippingAddressID=' . $_GET['shippingAddressID'] . '&shippingMethodID=' . $_GET['shippingMethodID'] . '&billingAddressID=' . $_GET['billingAddressID'] . '&paymentMethodID=' . $_GET['paymentMethodID'] . '&shServiceID=' . $shServiceID);
            }
            return false;
        }
    }
    $customerID = (int) $customerID;
    //    debug($cartContent['cart_content']);
    //
    //    exit;
    $sql = 'INSERT INTO ' . ORDERS_TABLE . '
    SET
    customerID =  ' . (int) $customerID . ',
    order_time = "' . xEscSQL($order_time) . '",
    customer_ip = "' . xToText($customer_ip) . '",
    shipping_type = "' . xToText($shippingName) . '",
    payment_type = "' . xToText($paymentName) . '",
    customers_comment = "' . xToText($customers_comment) . '",
    statusID = ' . (int) $statusID . ',
    shipping_cost = "' . (double) $shipping_costUC . '",
    order_discount = "' . (double) $discount_percent . '",
    order_amount= "' . (double) $order_amount . '",
    currency_code = "' . xEscSQL($currency_code) . '",
    currency_value = "' . (double) $currency_value . '",
    customer_firstname = "' . xToText($customerInfo['first_name']) . '",
    customer_lastname = "' . xToText($customerInfo['last_name']) . '",
    customer_email = "' . xToText($customer_email) . '",
    shipping_firstname = "' . xToText($shippingAddress['first_name']) . '",
    shipping_lastname = "' . xToText($shippingAddress['last_name']) . '",
    shipping_country= "' . xToText($shippingAddress['country_name']) . '",
    shipping_state= "' . xToText($shippingAddress['state']) . '",
    shipping_city= "' . xToText($shippingAddress['city']) . '",
    shipping_address= "' . xToText($shippingAddress['address']) . '",
    billing_firstname= "' . xToText($billingAddress['first_name']) . '",
    billing_lastname= "' . xToText($billingAddress['last_name']) . '",
    billing_country= "' . xToText($billingAddress['country_name']) . '",
    billing_state= "' . xToText($billingAddress['state']) . '",
    billing_city= "' . xToText($billingAddress['city']) . '",
    billing_address= "' . xToText($billingAddress['address']) . '",
    cc_number= "' . xEscSQL($cc_number) . '",
    cc_holdername= "' . xToText($cc_holdername) . '",
    cc_expires= "' . xEscSQL($cc_expires) . '",
    cc_cvv= "' . xEscSQL($cc_cvv) . '",
    affiliateID= "' . (isset($_SESSION['refid']) ? $_SESSION['refid'] : regGetIdByLogin($customer_affiliationLogin)) . '",
    shippingServiceInfo= "' . $shServiceInfo . '",
    custlink= "' . xEscSQL($order_active_link) . '",
    currency_round= "' . (int) $currency_round . '",
    paymethod= ' . (int) $paymentMethodID;
    db_query($sql);
    $orderID = db_insert_id(ORDERS_TABLE);
    if (!CONF_ACTIVE_ORDER) {
        stChangeOrderStatus($orderID, $statusID);
    }
    $paymentMethod = payGetPaymentMethodById($paymentMethodID);
    if ($paymentMethod) {
        $currentPaymentModule = modGetModuleObj($paymentMethod['module_id'], PAYMENT_MODULE);
        //                $currentPaymentModule = payGetPaymentModuleById( $paymentMethod['module_id'], $paymentModulesFiles );
    } else {
        $currentPaymentModule = null;
    }
    //save shopping cart content to database and update in-stock information
    if ($log != null) {
        cartMoveContentFromShoppingCartsToOrderedCarts($orderID, $shippingMethodID, $paymentMethodID, $shippingAddressID, $billingAddressID, $shippingModuleFiles, $paymentModulesFiles, $smarty_mail);
    } else {
        _moveSessionCartContentToOrderedCart($orderID, $paymentMethodID);
        //update in-stock information
        if ($statusID != ostGetCanceledStatusId() && CONF_CHECKSTOCK) {
            $q1 = db_query('select itemID, Quantity FROM ' . ORDERED_CARTS_TABLE . ' WHERE orderID=' . (int) $orderID);
            while ($item = db_fetch_row($q1)) {
                $q2 = db_query('select productID FROM ' . SHOPPING_CART_ITEMS_TABLE . ' WHERE itemID=' . (int) $item['itemID']);
                $pr = db_fetch_row($q2);
                if ($pr) {
                    db_query('update ' . PRODUCTS_TABLE . ' set in_stock = in_stock - ' . (int) $item['Quantity'] . ' where productID=' . (int) $pr[0]);
                    $q = db_query('select name, in_stock FROM ' . PRODUCTS_TABLE . ' WHERE productID=' . (int) $pr[0]);
                    $productsta = db_fetch_row($q);
                    if ($productsta[1] == 0) {
                        if (CONF_AUTOOFF_STOCKADMIN) {
                            db_query('update ' . PRODUCTS_TABLE . ' set enabled=0 where productID=' . (int) $pr[0]);
                        }
                        if (CONF_NOTIFY_STOCKADMIN) {
                            $smarty_mail->assign('productstaname', $productsta[0]);
                            $smarty_mail->assign('productstid', $pr[0]);
                            $stockadmin = $smarty_mail->fetch('notify_stockadmin.tpl');
                            $ressta = xMailTxtHTMLDATA(CONF_ORDERS_EMAIL, CUSTOMER_ACTIVATE_99 . ' - ' . CONF_SHOP_NAME, $stockadmin);
                        }
                    }
                }
            }
        }
        //now save registration form aux fields into CUSTOMER_REG_FIELDS_VALUES_TABLE_QUICKREG
        //for quick checkout orders these fields are stored separately than for registered customer (SS_customers)
        db_query('delete from ' . CUSTOMER_REG_FIELDS_VALUES_TABLE_QUICKREG . ' where orderID=' . (int) $orderID);
        foreach ($_SESSION as $key => $val) {
            if (strstr($key, 'additional_field_') && strlen(trim($val)) > 0) {
                $id = (int) str_replace('additional_field_', '', $key);
                if ($id > 0) {
                    db_query('insert into ' . CUSTOMER_REG_FIELDS_VALUES_TABLE_QUICKREG . ' (orderID, reg_field_ID, reg_field_value) values (' . (int) $orderID . ', ' . (int) $id . ', "' . xToText(trim($val)) . '");');
                }
            }
        }
    }
    if ($currentPaymentModule != null) {
        $currentPaymentModule->after_processing_php($orderID);
    }
    _sendOrderNotifycationToAdmin($orderID, $smarty_mail, $tax);
    _sendOrderNotifycationToCustomer($orderID, $smarty_mail, $customerInfo['Email'], $log, $payment_email_comments_text, $shipping_email_comments_text, $tax, $order_active_link);
    if ($log == null) {
        _quickOrderUnsetSession();
    }
    unset($_SESSION['order4confirmation_post']);
    return $orderID;
}
Example #9
0
 $q = db_query($sql);
 $offer = array();
 while ($row = db_fetch_assoc($q)) {
     $offer['name'] = $row['name'];
     $offer['price'] = $row['Price'];
     $offer['code'] = $row['product_code'];
 }
 //    debug($offer);
 if (CONF_ACTIVE_ORDER == 1) {
     $statusID = 0;
 } else {
     $statusID = ostGetNewOrderStatus();
 }
 $currencyID = currGetCurrentCurrencyUnitID();
 if ($currencyID != 0) {
     $currentCurrency = currGetCurrencyByID($currencyID);
     $currency_code = $currentCurrency["currency_iso_3"];
     $currency_value = $currentCurrency["currency_value"];
     $currency_round = $currentCurrency["roundval"];
 } else {
     $currency_code = "";
     $currency_value = 1;
     $currency_round = 2;
 }
 $order_time = get_current_time();
 $customer_ip = stGetCustomerIP_Address();
 $sql = '
     INSERT INTO ' . ORDERS_TABLE . '
     SET
     customerID = 0,
     order_time = "' . xEscSQL($order_time) . '",
Example #10
0
 function after_processing_html($orderID)
 {
     $orderID = (int) $orderID;
     $order = ordGetOrder($orderID);
     if ($this->_getSettingValue('CONF_PAYMENTMODULE_LINKPOINT_USD_CURRENCY') > 0) {
         $LPcurr = currGetCurrencyByID($this->_getSettingValue('CONF_PAYMENTMODULE_LINKPOINT_USD_CURRENCY'));
         $LPcurr_rate = $LPcurr["currency_value"];
     }
     if (!isset($LPcurr) || !$LPcurr) {
         $LPcurr_rate = 1;
     }
     $order_amount = round(100 * $order["order_amount"] * $LPcurr_rate) / 100;
     $res = "";
     $res .= "<table width='100%'>\n" . "\t<tr>\n" . "\t\t<td align='center'>\n" . "<form method='POST' action='linkpoint.php'>\n" . "<input type=\"hidden\" name=\"chargetotal\" value=\"" . $order_amount . "\">\n";
     foreach ($this->replSettings as $_Sett) {
         $res .= "<input type=\"hidden\" name=\"pSettingsAccordance[" . $_Sett . "]\" value=\"" . $this->_getSettingRealName($_Sett) . "\">\n";
     }
     $res .= "<input type=\"hidden\" name=\"oid\" value=\"" . $orderID . "\">\n" . "<input type=\"submit\" value=\"" . CLINKPOINT_TXT_AFTER_PROCESSING_HTML_1 . "\">\n" . "\t\t</form></td>\n" . "\t</tr>\n" . "</table>\n\n";
     return $res;
 }