Exemple #1
0
        /// <summary>
        /// Handles the <c>onMarketPurchase</c> event, which is fired when a Market purchase has occurred.
        /// </summary>
        /// <param name="message">Message that contains information about the market purchase.</param>
        public void onMarketPurchase(string message)
        {
            Debug.Log("SOOMLA/UNITY onMarketPurchase:" + message);

            string[] vars = Regex.Split(message, "#SOOM#");

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(vars[0]);
            string payload             = "";
            string purchaseToken       = "";
            string orderId             = "";

            if (vars.Length > 1)
            {
                payload = vars[1];
            }
            if (vars.Length > 2)
            {
                purchaseToken = vars[2];
            }
            if (vars.Length > 3)
            {
                orderId = vars[3];
            }

            StoreEvents.OnMarketPurchase(pvi, purchaseToken, payload, orderId);
        }
Exemple #2
0
        /// <summary>
        /// Handles the <c>onMarketPurchase</c> event, which is fired when a Market purchase has occurred.
        /// </summary>
        /// <param name="message">Message that contains information about the market purchase.</param>
        public void onMarketPurchase(string message)
        {
            Debug.Log("SOOMLA/UNITY onMarketPurchase:" + message);

            var eventJSON = new JSONObject(message);

            PurchasableVirtualItem pvi = (PurchasableVirtualItem)StoreInfo.GetItemByItemId(eventJSON["itemId"].str);
            string payload             = "";
            var    extra = new Dictionary <string, string>();

            if (eventJSON.HasField("payload"))
            {
                payload = eventJSON["payload"].str;
            }
            if (eventJSON.HasField("extra"))
            {
                var extraJSON = eventJSON["extra"];
                if (extraJSON.keys != null)
                {
                    foreach (string key in extraJSON.keys)
                    {
                        if (extraJSON[key] != null)
                        {
                            extra.Add(key, extraJSON[key].str);
                        }
                    }
                }
            }

            StoreEvents.OnMarketPurchase(pvi, payload, extra);
        }
        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);
        }