/// <summary> /// Starts a purchase process in the market. /// </summary> /// <param name="productId">id of the item to buy.</param> protected override void _buyMarketItem(string productId, string payload) { SoomlaWpStore.domain.PurchasableVirtualItem wpPVI = SoomlaWpStore.data.StoreInfo.getPurchasableItem(productId); if (wpPVI.GetPurchaseType() is SoomlaWpStore.purchasesTypes.PurchaseWithMarket) { SoomlaWpStore.purchasesTypes.PurchaseWithMarket wpPWM = (SoomlaWpStore.purchasesTypes.PurchaseWithMarket)wpPVI.GetPurchaseType(); SoomlaWpStore.SoomlaStore.GetInstance().buyWithMarket( wpPWM.getMarketItem(), payload ); } }
protected PurchasableVirtualItem(SoomlaWpStore.domain.PurchasableVirtualItem wpPurchasableVirtualItem) : base(wpPurchasableVirtualItem) { SoomlaUtils.LogDebug(TAG, "Trying to create PurchasableVirtualItem with itemId: " + wpPurchasableVirtualItem.getItemId()); SoomlaWpStore.purchasesTypes.PurchaseType wpPT = wpPurchasableVirtualItem.GetPurchaseType(); if (wpPT is SoomlaWpStore.purchasesTypes.PurchaseWithMarket) { SoomlaWpStore.purchasesTypes.PurchaseWithMarket wpPWM = (SoomlaWpStore.purchasesTypes.PurchaseWithMarket)wpPT; string productId = wpPWM.getMarketItem().getProductId(); /*MarketItem.Consumable consType = MarketItem.Consumable.CONSUMABLE; * if(wpPWM.getMarketItem().getManaged() == SoomlaWpStore.domain.MarketItem.Managed.MANAGED) * { * consType = MarketItem.Consumable.CONSUMABLE; * } * if (wpPWM.getMarketItem().getManaged() == SoomlaWpStore.domain.MarketItem.Managed.UNMANAGED) * { * consType = MarketItem.Consumable.NONCONSUMABLE; * } * if (wpPWM.getMarketItem().getManaged() == SoomlaWpStore.domain.MarketItem.Managed.SUBSCRIPTION) * { * consType = MarketItem.Consumable.SUBSCRIPTION; * }*/ double price = wpPWM.getMarketItem().getPrice(); MarketItem mi = new MarketItem(productId, price); mi.MarketTitle = wpPWM.getMarketItem().getMarketTitle(); mi.MarketPriceAndCurrency = wpPWM.getMarketItem().getMarketPrice(); mi.MarketDescription = wpPWM.getMarketItem().getMarketDescription(); if (wpPWM.getMarketItem().isPriceSuccessfullyParsed()) { mi.MarketPriceMicros = wpPWM.getMarketItem().getMarketPriceMicros(); mi.MarketCurrencyCode = wpPWM.getMarketItem().getMarketCurrencyCode(); } PurchaseType = new PurchaseWithMarket(mi); } if (wpPT is SoomlaWpStore.purchasesTypes.PurchaseWithVirtualItem) { SoomlaWpStore.purchasesTypes.PurchaseWithVirtualItem wpPWVI = (SoomlaWpStore.purchasesTypes.PurchaseWithVirtualItem)wpPT; string itemId = wpPWVI.getTargetItemId(); int amount = wpPWVI.getAmount(); PurchaseType = new PurchaseWithVirtualItem(itemId, amount); } }