Ejemplo n.º 1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="PurchasableVirtualItem"/> class.
    /// </summary>
    /// <param name="jsonObject">The json object.</param>
    public PurchasableVirtualItem(JSONObject jsonObject) : base(jsonObject){
        
        JSONObject purchasableObj = jsonObject[StoreJSONConsts.PURCHASABLE_ITEM];
        String purchaseType = purchasableObj[StoreJSONConsts.PURCHASE_TYPE].str;

        if (purchaseType == StoreJSONConsts.PURCHASE_TYPE_MARKET) {
            JSONObject marketItemObj =
                    purchasableObj[StoreJSONConsts.PURCHASE_MARKET_ITEM];

            mPurchaseType = new PurchaseWithMarket(new MarketItem(marketItemObj));
        } else if (purchaseType == StoreJSONConsts.PURCHASE_TYPE_VI) {
            String itemId = purchasableObj[StoreJSONConsts.PURCHASE_VI_ITEMID].str;
            int amount = (int)purchasableObj[StoreJSONConsts.PURCHASE_VI_AMOUNT].n;

            mPurchaseType = new PurchaseWithVirtualItem(itemId, amount);
        } else {
            SoomlaUtils.LogError(TAG, "IabPurchase type not recognized !");
        }

        if (mPurchaseType != null) {
            mPurchaseType.setAssociatedItem(this);
        }
    }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * @param mName see parent
  * @param mDescription see parent
  * @param mItemId see parent
  * @param purchaseType see parent
  */
 public NonConsumableItem(String mName, String mDescription, String mItemId,
                          PurchaseWithMarket purchaseType) : base(mName, mDescription, mItemId, purchaseType) {
     
 }