Beispiel #1
0
function db_addGoogleCheckoutOrder($email, $ordernumber, $purchaseDate, $fulfillmentorderstate, $financialorderstate)
{
    $user = db_getUserByEmail($email);
    $purchaseDateMillis = 1000 * strtotime($purchaseDate);
    $sql = "INSERT INTO mdl_shoppingcart_order (userid, purchasedate, lastmodification," . " ordernumber, financialorderstate, fulfillmentorderstate, cancelled, payment) VALUES (" . "" . $user->id . "," . "'" . $purchaseDateMillis . "'," . "'" . $purchaseDateMillis . "'," . "'" . $ordernumber . "'," . "'" . $fulfillmentorderstate . "'," . "'" . $financialorderstate . "'," . "0," . "1)";
    return execute_sql($sql, false);
}
     $items = get_arr_result($data[$root]['shopping-cart']['items']['item']);
     foreach ($items as $item) {
         $itemname = $item['item-name']['VALUE'];
         $itemdescription = $item['item-description']['VALUE'];
         $currency = $item['unit-price']['currency'];
         $unitprice = $item['unit-price']['VALUE'];
         $quantity = $item['quantity']['VALUE'];
         //Get item from store inventory
         $sql_getitem = 'SELECT * from mdl_shoppingcart_store_inventory WHERE name = "' . $itemname . '" and description = "' . $itemdescription . '"';
         $dbitem = db_getrecord($sql_getitem);
         //Insert order summary for this item
         db_addOrderItem($dborder->id, $dbitem->id, $quantity, $unitprice);
         $total += $quantity * $unitprice;
     }
     db_modifyOrderTotal($dborder->id, $total);
     $user = db_getUserByEmail($email);
     $Gresponse->SendAck();
     //$data[$root]['serial-number']
     break;
 case "authorization-amount-notification":
     break;
 case "order-state-change-notification":
     $new_financial_state = $data[$root]['new-financial-order-state']['VALUE'];
     $new_fulfillment_order = $data[$root]['new-fulfillment-order-state']['VALUE'];
     $ordernumber = $data[$root]['google-order-number']['VALUE'];
     $date = $data[$root]['timestamp']['VALUE'];
     $dborder = db_getOrderByOrderNumber($ordernumber);
     $financialStateHasChanged = true;
     $fulfillmentStateHasChanged = true;
     if ($dborder->financialorderstate == $new_financial_state) {
         $financialStateHasChanged = false;