Exemple #1
0
        private static void callbackCaller(Dictionary <string, object> response, string callerId)
        {
            IDelegator delegator = null;

            try
            {
                Jsonable.CheckForErrors(response);

                lock (AmazonIapV2Impl.callbackLock)
                {
                    delegator = AmazonIapV2Impl.callbackDictionary[callerId];
                    AmazonIapV2Impl.callbackDictionary.Remove(callerId);

                    delegator.ExecuteSuccess(response);
                }
            }
            catch (AmazonException e)
            {
                lock (AmazonIapV2Impl.callbackLock)
                {
                    if (delegator == null)
                    {
                        delegator = AmazonIapV2Impl.callbackDictionary[callerId];
                    }
                    AmazonIapV2Impl.callbackDictionary.Remove(callerId);

                    delegator.ExecuteError(e);
                }
            }
        }
Exemple #2
0
        public static void FireEvent(string jsonMessage)
        {
            try
            {
                logger.Debug("eventReceived");
                Dictionary <string, object> jsonDict = Json.Deserialize(jsonMessage) as Dictionary <string, object>;
                string eventId = jsonDict["eventId"] as string;
                Dictionary <string, object> response = null;

                if (jsonDict.ContainsKey("response"))
                {
                    response = jsonDict["response"] as Dictionary <string, object>;
                    Jsonable.CheckForErrors(response);
                }

                lock (eventLock)
                {
                    foreach (var delegator in eventListeners[eventId])
                    {
                        if (response != null)
                        {
                            delegator.ExecuteSuccess(response);
                        }
                        else
                        {
                            delegator.ExecuteSuccess();
                        }
                    }
                }
            }
            catch (AmazonException e)
            {
                logger.Debug("Event call threw exception: " + e.ToString());
            }
        }
Exemple #3
0
 public static ResetInput CreateFromJson(string jsonMessage)
 {
     try
     {
         Dictionary <string, object> jsonMap = Json.Deserialize(jsonMessage) as Dictionary <string, object>;
         Jsonable.CheckForErrors(jsonMap);
         return(CreateFromDictionary(jsonMap));
     }
     catch (System.ApplicationException ex)
     {
         throw new AmazonException("Error encountered while UnJsoning", ex);
     }
 }
        public override Dictionary <string, object> GetObjectDictionary()
        {
            try
            {
                Dictionary <string, object> objectDictionary = new Dictionary <string, object>();

                objectDictionary.Add("requestId", RequestId);
                objectDictionary.Add("productDataMap", (ProductDataMap != null) ? Jsonable.unrollObjectIntoMap(ProductDataMap) : null);
                objectDictionary.Add("unavailableSkus", UnavailableSkus);
                objectDictionary.Add("status", Status);
                return(objectDictionary);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while getting object dictionary", ex);
            }
        }
        public override Dictionary <string, object> GetObjectDictionary()
        {
            try
            {
                Dictionary <string, object> objectDictionary = new Dictionary <string, object>();

                objectDictionary.Add("requestId", RequestId);
                objectDictionary.Add("amazonUserData", (AmazonUserData != null) ? AmazonUserData.GetObjectDictionary() : null);
                objectDictionary.Add("receipts", (Receipts != null) ? Jsonable.unrollObjectIntoList(Receipts) : null);
                objectDictionary.Add("status", Status);
                objectDictionary.Add("hasMore", HasMore);
                return(objectDictionary);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while getting object dictionary", ex);
            }
        }
Exemple #6
0
 public override void NotifyFulfillment(NotifyFulfillmentInput notifyFulfillmentInput)
 {
     Start();
     Jsonable.CheckForErrors(Json.Deserialize(NotifyFulfillmentJson(notifyFulfillmentInput.ToJson())) as Dictionary <string, object>);
 }