$Grequest = new GoogleRequest($merchant_id, $merchant_key, $server_type, $currency); //$response->SetLogFiles($path . '/google_error.log', $path . '/google_message.log', L_ALL); //Setup the log file $Gresponse->SetLogFiles(RESPONSE_HANDLER_ERROR_LOG_FILE, RESPONSE_HANDLER_LOG_FILE, L_ALL); // Retrieve the XML sent in the HTTP POST request to the ResponseHandler $xml_response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input"); if (get_magic_quotes_gpc()) { $xml_response = stripslashes($xml_response); } list($root, $data) = $Gresponse->GetParsedXML($xml_response); $Gresponse->SetMerchantAuthentication($merchant_id, $merchant_key); $status = $Gresponse->HttpAuthentication(); if (!$status) { die('authentication failed'); } $orderData = _getOrder($data); /** * Commands to send the various order processing APIs * Send charge order : $Grequest->SendChargeOrder($data[$root]['google-order-number']['VALUE'], <amount>); * Send process order : $Grequest->SendProcessOrder($data[$root]['google-order-number']['VALUE']); * Send deliver order: $Grequest->SendDeliverOrder($data[$root]['google-order-number']['VALUE'], <carrier>, <tracking-number>, * <send_mail>); * Send archive order: $Grequest->SendArchiveOrder($data[$root]['google-order-number']['VALUE']); * */ switch ($root) { case "request-received": break; case "error": break; case "diagnosis":
$order["email"] = $Email; $res = cartGetCartContent(); $order["orderContent"] = $res["cart_content"]; $d = oaGetDiscountPercent($res, $_SESSION["log"]); $order["order_amount"] = $res["total_price"] - $res["total_price"] / 100 * $d; return $order; } if (isset($_GET["selectedNewAddressID"])) { if (!isset($_GET["defaultBillingAddressID"])) { RedirectProtected("index.php?order2_shipping=yes" . "&shippingAddressID=" . $_GET["selectedNewAddressID"]); } else { RedirectProtected("index.php?order2_shipping=yes" . "&shippingAddressID=" . $_GET["selectedNewAddressID"] . "&defaultBillingAddressID=" . $_GET["defaultBillingAddressID"]); } } $shippingAddressID = $_GET["shippingAddressID"]; $order = _getOrder(); $strAddress = regGetAddressStr($shippingAddressID); $moduleFiles = GetFilesInDirectory("core/modules/shipping", "php"); foreach ($moduleFiles as $fileName) { include $fileName; } $shipping_methods = shGetAllShippingMethods(true); $shipping_costs = array(); $res = cartGetCartContent(); $sh_address = regGetAddress($shippingAddressID); $addresses = array($sh_address, $sh_address); $j = 0; foreach ($shipping_methods as $key => $shipping_method) { $_ShippingModule = modGetModuleObj($shipping_method["module_id"], SHIPPING_RATE_MODULE); if ($_ShippingModule) { if ($_ShippingModule->allow_shipping_to_address(regGetAddress($shippingAddressID))) {
function getOrder() { $customer_id = isset($_POST['id']) ? $_POST['id'] : 0; $password = isset($_POST['password']) ? $_POST['password'] : '******'; $order_id = $_POST['order_id']; $order = _getOrder($order_id, $customer_id); if (is_array($order)) { $order['items'] = _getOrderItems($order_id); } echo json_encode($order); }