function callback()
 {
     global $osC_Database, $osC_ShoppingCart;
     require_once 'ext/googlecheckout/googleresponse.php';
     require_once 'ext/googlecheckout/googlemerchantcalculations.php';
     require_once 'ext/googlecheckout/googleresult.php';
     require_once 'ext/googlecheckout/googlerequest.php';
     $fh = fopen('log.txt', 'a+');
     $merchant_id = MODULE_PAYMENT_GCHECKOUT_MERCHANT_ID;
     $merchant_key = MODULE_PAYMENT_GCHECKOUT_MERCHANT_KEY;
     $server_type = MODULE_PAYMENT_GCHECKOUT_SERVER;
     $currency = MODULE_PAYMENT_GCHECKOUT_CURRENCY;
     $Gresponse = new GoogleResponse($merchant_id, $merchant_key);
     $Gresponse->SetLogFiles('includes/logs/gerror.log', 'includes/logs/gmessage.log', 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);
     fwrite($fh, var_export($data, true));
     fclose($fh);
     $Gresponse->SetMerchantAuthentication($merchant_id, $merchant_key);
     $status = $Gresponse->HttpAuthentication();
     if (!$status) {
         exit;
     }
     switch ($root) {
         case "request-received":
             break;
         case "error":
             break;
         case "diagnosis":
             break;
         case "checkout-redirect":
             break;
         case "merchant-calculation-callback":
             break;
         case "new-order-notification":
             $serial_number = $data['new-order-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $orders_id = $data['new-order-notification']['shopping-cart']['merchant-private-data']['orders_id']['VALUE'];
             $google_order_number = $data['new-order-notification']['google-order-number']['VALUE'];
             $osC_Database->simpleQuery("insert into " . TABLE_ORDER_GOOGLE . " (orders_id, google_order_number) values ('" . $orders_id . "','" . $google_order_number . "')");
             $Gresponse->SendAck();
             break;
         case "order-state-change-notification":
             $serial_number = $data['order-state-change-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $Gresponse->SendAck();
             break;
         case "charge-amount-notification":
             $google_order_number = $data['charge-amount-notification']['google-order-number']['VALUE'];
             $totalcharge = $data['charge-amount-notification']['total-charge-amount']['VALUE'];
             $currency = $data['charge-amount-notification']['total-charge-amount']['currency'];
             $Qorder = $osC_Database->query('select orders_id from :table_order_google where google_order_number = :google_order_number');
             $Qorder->bindTable(':table_order_google', TABLE_ORDER_GOOGLE);
             $Qorder->bindValue(':google_order_number', $google_order_number);
             $Qorder->execute();
             $order_id = 0;
             while ($Qorder->next()) {
                 $order_id = $Qorder->valueInt('orders_id');
             }
             $Qorder->freeResult();
             $Qtotal = $osC_Database->query('select value, text from :table_orders_total where orders_id = :orders_id and class = "total" limit 1');
             $Qtotal->bindTable(':table_orders_total', TABLE_ORDERS_TOTAL);
             $Qtotal->bindInt(':orders_id', $order_id);
             $Qtotal->execute();
             $total = $Qtotal->toArray();
             $neddtopay = true;
             $comment = 'Google Order Number:<strong> ' . $google_order_number . '</strong>';
             if (abs($totalcharge - $total['value']) < 0.001) {
                 $comment .= '';
                 $neddtopay = false;
             } else {
                 $topay = $total['value'] - $totalcharge;
                 $comment .= 'You have paid ' . $totalcharge . ' ' . $currency . ', and you still have to pay ' . $topay . ' ' . $currency;
             }
             $comments = 'Google Checkout Verified [' . $comment . ']';
             if ($order_id != 0) {
                 if ($neddtopay) {
                     osC_Order::process($order_id, ORDERS_STATUS_PARTLY_PAID, $comments);
                 } else {
                     osC_Order::process($order_id, $this->order_status, $comments);
                 }
             }
             $serial_number = $data['charge-amount-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $Gresponse->SendAck();
             break;
         case "chargeback-amount-notification":
             $serial_number = $data['risk-information-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $Gresponse->SendAck();
             break;
         case "refund-amount-notification":
             $serial_number = $data['refund-amount-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $Gresponse->SendAck();
             break;
         case "risk-information-notification":
             $serial_number = $data['risk-information-notification']['serial-number'];
             $Gresponse->setSerialNumber($serial_number);
             $Gresponse->SendAck();
             break;
         default:
             $Gresponse->SendBadRequestStatus("Invalid or not supported Message");
             break;
     }
 }