Esempio n. 1
0
        /// <summary>
        /// Check if this is a special response
        /// If a special response then call the special response handler to modify the response xml
        /// </summary>
        /// <param name="responseData">The PaymentItems response string xml data</param>
        /// <returns>The response string xml data, modified if a special response else the inputed xml data</returns>
        public XmlDocument SpecialResponse(XmlDocument response, string noun, string verb, ServerStores serverStores)
        {
            MoneyTransactionLogging moneyLog = new MoneyTransactionLogging();

            Dictionary <string, string> specialResponses = new Dictionary <string, string>();

            specialResponses.Add("GetUserInventory", "HangoutUsers");
            specialResponses.Add("PurchaseGameCurrencyPayPal", "HangoutPurchase");
            specialResponses.Add("PurchaseGameCurrencyCreditCard", "HangoutPurchase");
            specialResponses.Add("PurchaseItems", "HangoutUsers");

            string value = SpecialCommand(noun, verb, specialResponses);

            switch (value)
            {
            case "GetUserInventory":
                response = PaymentItemsSortFilter.AddItemsToUserInventory(response, serverStores);
                break;

            case "PurchaseItems":
                response = PaymentItemsSortFilter.AddAssetsToPurchaseResponse(response, serverStores);
                break;

            case "PurchaseGameCurrencyPayPal":
                moneyLog.PayPalLogResponse(response, "InProgress");
                break;

            case "PurchaseGameCurrencyCreditCard":
                moneyLog.CreditCardLogResponse(response);
                break;
            }

            return(response);
        }
Esempio n. 2
0
        /// <summary>
        /// Filter, Sort, and Page the Store Inventory
        /// </summary>
        /// <param name="response">XML Document response from the GetStoreInventory cached response</param>
        /// <param name="dataSetResponse">Dataset containing the GetStoreInventory cached response</param>
        /// <param name="command">PaymentItem Command sent, used to retrieve the Filter, OrderBy, StartIndex and BlockSize parameters</param>
        /// <returns>xml string response of the filtered, sorted and paged store inventory</returns>
        public string FilterSortStoreInventoryResponse(XmlDocument response, object dataSetResponse, PaymentCommand command)
        {
            ResultFilter resultFilter = PaymentItemsSortFilter.GetFilterParameters(command);

            string filter = resultFilter.Filter;            //"itemOffer_title Like '%basic%'";
            string sort   = resultFilter.OrderBy;           //"itemOffer_endDate desc, item_itemTypeName asc";

            if (filter == null)
            {
                filter = "";
            }

            if (sort == null)
            {
                sort = "";
            }

            filter = AddItemTypeNamesToFilter(filter, resultFilter.ItemTypeNames);

            int startIndex;
            int blockSize;

            if (!int.TryParse(resultFilter.StartIndex, out startIndex))
            {
                startIndex = -1;
            }
            if (!int.TryParse(resultFilter.BlockSize, out blockSize))
            {
                blockSize = -1;
            }


            response = PaymentItemsSortFilter.FilterSortTheStoreResponse(response, dataSetResponse, filter, sort, startIndex, blockSize);

            return(response.InnerXml);
        }