public static Dictionary <string, GetPurchaseUpdatesResponse> MapFromJson(Dictionary <string, object> jsonMap)
        {
            Dictionary <string, GetPurchaseUpdatesResponse> result = new Dictionary <string, GetPurchaseUpdatesResponse>();

            foreach (var entry in jsonMap)
            {
                GetPurchaseUpdatesResponse value = CreateFromDictionary(entry.Value as Dictionary <string, object>);
                result.Add(entry.Key, value);
            }
            return(result);
        }
        public static GetPurchaseUpdatesResponse CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new GetPurchaseUpdatesResponse();


                if (jsonMap.ContainsKey("requestId"))
                {
                    request.RequestId = (string)jsonMap["requestId"];
                }

                if (jsonMap.ContainsKey("amazonUserData"))
                {
                    request.AmazonUserData = AmazonUserData.CreateFromDictionary(jsonMap["amazonUserData"] as Dictionary <string, object>);
                }

                if (jsonMap.ContainsKey("receipts"))
                {
                    request.Receipts = PurchaseReceipt.ListFromJson(jsonMap["receipts"] as List <object>);
                }

                if (jsonMap.ContainsKey("status"))
                {
                    request.Status = (string)jsonMap["status"];
                }

                if (jsonMap.ContainsKey("hasMore"))
                {
                    request.HasMore = (bool)jsonMap["hasMore"];
                }

                return(request);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
        public static GetPurchaseUpdatesResponse CreateFromDictionary(Dictionary<string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return null;
                }

                var request = new GetPurchaseUpdatesResponse();

                if(jsonMap.ContainsKey("requestId"))
                {
                    request.RequestId = (string) jsonMap["requestId"];
                }

                if(jsonMap.ContainsKey("amazonUserData"))
                {
                    request.AmazonUserData = AmazonUserData.CreateFromDictionary(jsonMap["amazonUserData"] as Dictionary<string, object>);
                }

                if(jsonMap.ContainsKey("receipts"))
                {
                    request.Receipts = PurchaseReceipt.ListFromJson(jsonMap["receipts"] as List<object>);
                }

                if(jsonMap.ContainsKey("status"))
                {
                    request.Status = (string) jsonMap["status"];
                }

                if(jsonMap.ContainsKey("hasMore"))
                {
                    request.HasMore = (bool) jsonMap["hasMore"];
                }

                return request;
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
Exemple #4
0
 public void ExecuteSuccess(Dictionary <string, object> objectDictionary)
 {
     responseDelegate(GetPurchaseUpdatesResponse.CreateFromDictionary(objectDictionary));
 }