Example #1
0
        /// <summary>
        /// Gets the category that the virtual good with the given <c>goodItemId</c> belongs to.
        /// </summary>
        /// <param name="goodItemId">Item id.</param>
        /// <exception cref="VirtualItemNotFoundException">Exception is thrown if category is not found.</exception>
        /// <returns>Category that the item with given id belongs to.</returns>
        public static VirtualCategory GetCategoryForVirtualGood(string goodItemId)
        {
            SoomlaUtils.LogDebug(TAG, "Trying to fetch a category for a good with itemId: " + goodItemId);

            VirtualCategory category;

            if (GoodsCategories != null && GoodsCategories.TryGetValue(goodItemId, out category))
            {
                return(category);
            }

            throw new VirtualItemNotFoundException("goodItemId of category", goodItemId);
        }