コード例 #1
0
        public APIResult GetPlaceData()
        {
            try
            {
                APIResult result = new APIResult();

                MerchantApiData merchantData = GetMerchantApiData();
                MResultPlace    placeRequest = GetPlaceData(merchantData.PlaceId);

                if (placeRequest.success)
                {
                    result.success = true;
                    result.message = "";
                    result.data    = placeRequest.response;
                }
                else
                {
                    result.success = false;
                    result.message = placeRequest.Errore.response;
                    result.data    = null;
                }

                return(result);
            }
            catch (Exception e)
            {
                APIResult exceptionData = new APIResult();

                exceptionData.success = false;
                exceptionData.message = e.Message;
                exceptionData.data    = null;

                return(exceptionData);
            }
        }
コード例 #2
0
        private MResultPlace GetPlaceData(string placeId)
        {
            try
            {
                ConfigEnv configData = GetConfigData();

                MerchantApiData merchantData = GetMerchantApiData();
                MPlace          place        = new MPlace();
                place.session_id = merchantData.MerchantId;
                place.place_id   = placeId;

                ILoyalzooMerchant m         = new Merchant();
                MResultPlace      placeData = m.Place(configData, place);

                return(placeData);
            }
            catch (Exception e)
            {
                MResultPlace exceptionData = new MResultPlace();
                exceptionData.success  = false;
                exceptionData.response = null;
                exceptionData.Errore   = new Errore {
                    success = false, response = e.Message
                };

                return(exceptionData);
            }
        }
コード例 #3
0
        public APIResult GetCustomerDetails()
        {
            try
            {
                APIResult result = new APIResult();

                APIResult customerIdRequest = GetCustomerSessionId();

                if (customerIdRequest.success)
                {
                    CResultCreate customerData = GetCustomerData((string)customerIdRequest.data);

                    if (customerData.success)
                    {
                        Dictionary <string, int> placeList = new Dictionary <string, int>();

                        if (customerData.response.rewards != null)
                        {
                            foreach (KeyValuePair <string, int> item in customerData.response.rewards)
                            {
                                MResultPlace placeRequest = GetPlaceData(item.Key);
                                if (placeRequest.success)
                                {
                                    placeList.Add(placeRequest.response.name, item.Value);
                                }
                            }
                        }

                        customerData.response.rewards = placeList;

                        result.success = true;
                        result.message = "";
                        result.data    = customerData.response;
                    }
                    else
                    {
                        result.success = false;
                        result.message = customerData.Errore.response;
                        result.data    = null;
                    }
                }
                else
                {
                    result.success = false;
                    result.message = customerIdRequest.message;
                    result.data    = null;
                }

                return(result);
            }
            catch (Exception e)
            {
                APIResult exceptionData = new APIResult();

                exceptionData.success = false;
                exceptionData.message = e.Message;
                exceptionData.data    = null;

                return(exceptionData);
            }
        }