= $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) ) //error on payment processing { //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; $sql = "insert into ".ORDERS_TABLE. " ( customerID, ". " order_time, ". " customer_ip, ". " shipping_type, ". " payment_type, ". " customers_comment, ". " statusID, ". " shipping_cost, ". " order_discount, ". " order_amount, ". " currency_code, ". " currency_value, ". " customer_firstname, ". " customer_lastname, ". " customer_email, ". " shipping_firstname, ". " shipping_lastname, ". " shipping_country, ". " shipping_state, ". " shipping_city, ". " shipping_address, ". " billing_firstname, ". " billing_lastname, ". " billing_country, ". " billing_state, ". " billing_city, ". " billing_address, ". " cc_number, ". " cc_holdername, ". " cc_expires, ". " cc_cvv, ". " affiliateID, ". " shippingServiceInfo, ". " custlink, ". " currency_round, ". " paymethod". " ) ". " values ( ". (int)$customerID.", ". "'".xEscSQL($order_time)."', ". "'".xToText($customer_ip)."', ". "'".xToText($shippingName)."', ". "'".xToText($paymentName)."', ". "'".xToText($customers_comment)."', ". (int)$statusID.", ". ( (float) $shipping_costUC ).", ". ( (float) $discount_percent ).", ". ( (float) $order_amount ).", ". "'".xEscSQL($currency_code)."', ". ( (float) $currency_value ).", ". "'".xToText($customerInfo["first_name"])."', ". "'".xToText($customerInfo["last_name"])."', ". "'".xToText($customer_email)."', ". "'".xToText($shippingAddress["first_name"])."', ". "'".xToText($shippingAddress["last_name"])."', ". "'".xToText($shippingAddress["country_name"])."', ". "'".xToText($shippingAddress["state"])."', ". "'".xToText($shippingAddress["city"])."', ". "'".xToText($shippingAddress["address"])."', ". "'".xToText($billingAddress["first_name"])."', ". "'".xToText($billingAddress["last_name"])."', ". "'".xToText($billingAddress["country_name"])."', ". "'".xToText($billingAddress["state"])."', ". "'".xToText($billingAddress["city"])."', ". "'".xToText($billingAddress["address"])."', ". "'".xEstCCExpiresDeCrypt($order["cc_expires"],null); if (strlen($order["cc_cvv"])>0) $order["cc_cvv"] = cryptCCNumberDeCrypt($order["cc_cvv"],null); } //additional reg fields $addregfields = GetRegFieldsValuesByOrderID( $orderID ); $order["reg_fields_values"] = $addregfields; $q_status_name = db_query( "select status_name from ".ORDER_STATUES_TABLE." where statusID=".(int)$order["statusID"] ); $status_name = db_fetch_row( $q_status_name ); $status_name = $status_name[0]; if ( $order["statusID"] == ostGetCanceledStatusId() ) $status_name = STRING_CANCELED_ORDER_STATUS; // clear cost ( without shipping, discount, tax ) $q1 = db_query( "select Price, Quantity from ".ORDERED_CARTS_TABLE." where orderID=".(int)$orderID); $clear_total_price = 0; while( $row=db_fetch_row($q1) ) $clear_total_price += $row["Price"]*$row["Quantity"]; $currency_round = $order["currency_round"]; $order["clear_total_priceToShow"] = _formatPrice(roundf($order["currency_value"]*$clear_total_price),$currency_round)." ".$order["currency_code"]; $order["order_discount_ToShow"] = _formatPrice(roundf($order["currency_value"]*$clear_total_price*((100-$order["order_discount"])/100)),$currency_round)." ".$order["currency_code"]; $order["shipping_costToShow"] = _formatPrice(roundf($order["currency_value"]*$order["shipping_cost"]),$currency_round)." ".$order["currency_code"]; $order["order_amountToShow"] = _formatPrice(roundf($order["currency_value"]*$order["order_amount"]),$currency_round)." ".$order["currency_code"]; $order["order_time_mysql"] = $order["order_time"]; $order["order_time"] = format_datetime( $order["order_time"] ); $order["status_name"] = $status_name; } return $order; } 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; } // ***************************************************************************** // Purpose deletes order // Inputs // Remarks this function deletes canceled orders only // Returns function ordDeleteOrder( $orderID ) { $q = db_query( "select statusID from ".ORDERS_TABLE." where orderID=".(int)$orderID ); $row = db_fetch_row( $q ); if ( $row["statusID"] != ostGetCanceledStatusId() ) return; db_query( "delete from ".ORDERED_CARTS_TABLE." where orderID=".(int)$orderID); db_query( "delete from ".ORDERS_TABLE." where orderID=".(int)$orderID); db_query( "delete from ".ORDER_STATUS_CHANGE_LOG_TABLE." where orderID=".(int)$orderID); } function DelOrdersBySDL( $statusdel ) { $q = db_query( "select orderID from ".ORDERS_TABLE." where statusID=".(int)$statusdel ); while( $row = db_fetch_row( $q ) ) { db_query( "delete from ".ORDERED_CARTS_TABLE." where orderID=".(int)$row["orderID"] ); db_query( "delete from ".ORDERS_TABLE." where orderID=".(int)$row["orderID"] ); db_query( "delete from ".ORDER_STATUS_CHANGE_LOG_TABLE." where orderID=".(int)$row["orderID"] ); } } // ***************************************************************************** // Purpose gets summarize order info to // Inputs // Remarks // Returns function getOrderSummarize( $shippingMethodID, $paymentMethodID, $shippingAddressID, $billingAddressID, $shippingModuleFiles, $paymentModulesFiles, $shServiceID = 0 ) { // result this function $sumOrderContent = array(); $q = db_query( "select email_comments_text from ".PAYMENT_TYPES_TABLE." where PID=".(int)$paymentMethodID ); $payment_email_comments_text = db_fetch_row( $q ); $payment_email_comments_text = $payment_email_comments_text[0]; $q = db_query( "select email_comments_text from ".SHIPPING_METHODS_TABLE." where SID=".(int)$shippingMethodID ); $shipping_email_comments_text = db_fetch_row( $q ); $shipping_email_comments_text = $shipping_email_comments_text[0]; $cartContent = cartGetCartContent(); $pred_total = oaGetClearPrice( $cartContent ); if ( isset($_SESSION["log"]) ) $log = $_SESSION["log"]; else $log = null; $d = oaGetDiscountPercent(