public static void onMarketPurchaseCancelled(MarketPurchaseCancelledEvent _Event) { SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem(); SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onMarketPurchaseCancelled: " + purchasableVirtualItem.getItemId()); PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId()); StoreEvents.OnMarketPurchaseCancelled(pvi); }
/// <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 ); } }
public static void onMarketPurchase(MarketPurchaseEvent _Event) { SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem(); String payload = _Event.GetPayload(); String token = _Event.GetToken(); Debug.Log("SOOMLA/UNITY onMarketPurchase:" + purchasableVirtualItem.getItemId() + " " + payload + " " + token); PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId()); //TODO Implement extra on WP8 onMarketPurchase Dictionary <string, string> extra = new Dictionary <string, string>(); StoreEvents.OnMarketPurchase(pvi, payload, extra); }
public static void onItemPurchaseStarted(ItemPurchaseStartedEvent _Event, bool alsoPush) { SoomlaWpStore.domain.PurchasableVirtualItem purchasableVirtualItem = _Event.GetPurchasableVirtualItem(); SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onItemPurchaseStarted:" + purchasableVirtualItem.getItemId()); PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(purchasableVirtualItem.getItemId()); StoreEvents.OnItemPurchaseStarted(pvi); if (alsoPush) { sep.PushEventOnItemPurchaseStarted(_Event); } }
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); } }