示例#1
0
function validTransction($transaction_id)
{
    if (DiamondPurchasedHistory::transactionIdExists($transaction_id) != null) {
        return false;
    } else {
        return true;
    }
}
示例#2
0
 $user_id = $items[0]['merchant-private-item-data']['user-id']['VALUE'];
 $diamonds = $items[0]['merchant-private-item-data']['diamonds']['VALUE'];
 $google_order_number = $data[$root]['google-order-number']['VALUE'];
 //TODO: Make the entry in the database for local use...
 $udid = $user_id;
 $amount = $unit_price;
 $product_id = "";
 $transaction_id = $google_order_number;
 $purchase_date = $data[$root]['timestamp']['VALUE'];
 $app_item_id = "";
 $quantity = 1;
 $bid = "";
 $bvrs = "";
 $valid_transction = 1;
 $level = User::getUserLevel($udid);
 if (DiamondPurchasedHistory::addPurchasedDiamond($udid, $amount, $diamonds, $product_id, $transaction_id, $purchase_date, $app_item_id, $quantity, $bid, $bvrs, $valid_transction, $level)) {
     if (User::userExists($udid) != null) {
         if (User::addUserPurchasedDiamonds($udid, $diamonds)) {
             $Grequest->SendDeliverOrder($google_order_number);
             break;
         } else {
             $fp = fopen('log.txt', 'a');
             fwrite($fp, 'Enable award diamond to user' . date('l jS \\of F Y h:i:s A') . "\r\n");
             foreach ($recipt as $key => $value) {
                 fwrite($fp, $key . '=>' . $value . "\r\n");
             }
             fwrite($fp, 'udid=>' . $udid . "\r\n");
             fwrite($fp, 'amount=>' . $amount . "\r\n");
             fclose($fp);
             break;
         }