public VirtualCurrencyPack(string name, string description, string itemId, string productId, double price, int currencyAmount, VirtualCurrency currency)
     : base(name, description, itemId)
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
     this.CurrencyAmount = currencyAmount;
     this.Currency = currency;
 }
        /// <summary>
        /// see parent
        /// </returns>
        public override JSONObject toJSONObject()
        {
            JSONObject jsonObject = base.toJSONObject();

            try {
                JSONObject purchasableObj = new JSONObject(JSONObject.Type.OBJECT);

                if (PurchaseType is PurchaseWithMarket)
                {
                    purchasableObj.AddField(JSONConsts.PURCHASE_TYPE, JSONConsts.PURCHASE_TYPE_MARKET);

                    MarketItem mi = ((PurchaseWithMarket)PurchaseType).MarketItem;
                    purchasableObj.AddField(JSONConsts.PURCHASE_MARKET_ITEM, mi.toJSONObject());
                }
                else if (PurchaseType is PurchaseWithVirtualItem)
                {
                    purchasableObj.AddField(JSONConsts.PURCHASE_TYPE, JSONConsts.PURCHASE_TYPE_VI);

                    purchasableObj.AddField(JSONConsts.PURCHASE_VI_ITEMID, ((PurchaseWithVirtualItem)PurchaseType).ItemId);
                    purchasableObj.AddField(JSONConsts.PURCHASE_VI_AMOUNT, ((PurchaseWithVirtualItem)PurchaseType).Amount);
                }

                jsonObject.AddField(JSONConsts.PURCHASABLE_ITEM, purchasableObj);
            } catch (System.Exception e) {
                StoreUtils.LogError(TAG, "An error occurred while generating JSON object. " + e.Message);
            }

            return(jsonObject);
        }
 public NonConsumableItem(AndroidJavaObject jniNonConsumableItem)
     : base(jniNonConsumableItem)
 {
     // Google Market Item
     using(AndroidJavaObject jniGoogleMarketItem = jniNonConsumableItem.Call<AndroidJavaObject>("getGoogleItem")) {
         this.MarketItem = new MarketItem(jniGoogleMarketItem);
     }
 }
 public VirtualCurrencyPack(AndroidJavaObject jniVirtualCurrencyPack)
     : base(jniVirtualCurrencyPack)
 {
     this.CurrencyAmount = jniVirtualCurrencyPack.Call<int>("getCurrencyAmount");
     // Google Market Item
     AndroidJavaObject jniGoogleMarketItem = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getGoogleItem");
     this.MarketItem = new MarketItem(jniGoogleMarketItem);
     // Virtual Currency
     AndroidJavaObject jniVirtualCurrency = jniVirtualCurrencyPack.Call<AndroidJavaObject>("getVirtualCurrency");
     this.Currency = new VirtualCurrency(jniVirtualCurrency);
 }
        public VirtualCurrencyPack(JSONObject jsonVcp)
            : base(jsonVcp)
        {
            this.CurrencyAmount = System.Convert.ToInt32(((JSONObject)jsonVcp[JSONConsts.CURRENCYPACK_AMOUNT]).n);
            this.MarketItem = new MarketItem(jsonVcp);

            string currencyItemId = jsonVcp[JSONConsts.CURRENCYPACK_CURRENCYITEMID].str;
            try {
                this.Currency = StoreInfo.GetVirtualCurrencyByItemId(currencyItemId);
            } catch {
                Debug.Log("Couldn't find the associated currency. itemId: " + currencyItemId);
            }
        }
 public NonConsumableItem(JSONObject jsonNon)
     : base(jsonNon)
 {
     this.MarketItem = new MarketItem(jsonNon);
 }
 public NonConsumableItem(string name, string description, string itemId, string productId, double price)
     : base(name, description, itemId)
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.NONCONSUMABLE, price);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='marketItem'>
 /// The representation of the item in the platform's market.
 /// </param>
 public PurchaseWithMarket(MarketItem marketItem)
     : base()
 {
     this.MarketItem = marketItem;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='productId'>
 /// The productId to purchase in the platform's market.
 /// </param>
 /// <param name='price'>
 /// The price in the platform's market.
 /// </param>
 public PurchaseWithMarket(string productId, double price)
     : base()
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='marketItem'>
 /// The representation of the item in the platform's market.
 /// </param>
 public PurchaseWithMarket(MarketItem marketItem) :
     base()
 {
     this.MarketItem = marketItem;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="com.soomla.unity.PurchaseWithMarket"/> class.
 /// </summary>
 /// <param name='productId'>
 /// The productId to purchase in the platform's market.
 /// </param>
 /// <param name='price'>
 /// The price in the platform's market.
 /// </param>
 public PurchaseWithMarket(string productId, double price) :
     base()
 {
     this.MarketItem = new MarketItem(productId, MarketItem.Consumable.CONSUMABLE, price);
 }