public void insert(Transaction transaction)
 {
     ContentValues values = new ContentValues();
     values.Put(COLUMN__ID, transaction.orderId);
     values.Put(COLUMN_PRODUCT_ID, transaction.productId);
     values.Put(COLUMN_STATE, transaction.purchaseState.ToString());
     values.Put(COLUMN_PURCHASE_TIME, transaction.purchaseTime);
     values.Put(COLUMN_DEVELOPER_PAYLOAD, transaction.developerPayload);
     mDb.Replace(TABLE_TRANSACTIONS, null /* nullColumnHack */, values);
 }
 public static Transaction createTransaction(ICursor cursor)
 {
     Transaction purchase = new Transaction();
     purchase.orderId = cursor.GetString(0);
     purchase.productId = cursor.GetString(1);
     purchase.purchaseState = (PurchaseState)Enum.Parse(typeof(PurchaseState), cursor.GetInt(2).ToString());
     purchase.purchaseTime = cursor.GetLong(3);
     purchase.developerPayload = cursor.GetString(4);
     return purchase;
 }
 public static Transaction parse(JsonObject json)
 {
     Transaction transaction = new Transaction();
     int response = int.Parse(json[PURCHASE_STATE]);
     transaction.purchaseState = (PurchaseState)Enum.Parse(typeof(PurchaseState), json[response]);
     transaction.productId = json[PRODUCT_ID];
     transaction.packageName = json[PACKAGE_NAME];
     transaction.purchaseTime = json[PURCHASE_TIME];
     transaction.orderId = json[ORDER_ID];
     transaction.notificationId = json[NOTIFICATION_ID];
     transaction.developerPayload = json[DEVELOPER_PAYLOAD];
     return transaction;
 }
 public static void addTransaction(Context context, Transaction transaction)
 {
     BillingDB db = new BillingDB(context);
     db.insert(transaction);
     db.close();
 }