コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="agentcode"></param>
        /// <param name="express_service"></param>
        /// <param name="sku"></param>
        /// <param name="warehouse"></param>
        /// <param name="to_region"></param>
        /// <param name="to_country"></param>
        /// <param name="to_zip_code"></param>
        /// <param name="to_city"></param>
        /// <param name="weight"></param>
        /// <param name="size"></param>
        /// <returns></returns>
        public SummaryInfo GetDirectExpressShippingFee(PriceRequest requst)
        {
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("Packing", requst.Packing.Length.ToString() + "*" + requst.Packing.Width.ToString() + "*" + requst.Packing.Height.ToString());
            param.Add("weight_in_gram", requst.Weight.ToString());
            param.Add("Country", requst.ShipToCountryName);
            param.Add("service", requst.ExpressService);

            CK1V3Request request = new CK1V3Request
            {
                Category   = "direct-express",
                Handler    = "package",
                Action     = "pricing",
                Parameters = param
            };
            //Packing packing = new Packing();

            string        json     = ResponseJson(request);
            PriceResponse response = JsonConvert.DeserializeObject <PriceResponse>(json);
            SummaryInfo   summary  = new SummaryInfo();

            summary = response.body.Summary[0];

            return(summary);
        }
コード例 #2
0
        public IEnumerable <Express> GetOutBoundList(string warehouse)
        {
            List <Express> list = new List <Express>();

            CK1V3Request request = new CK1V3Request
            {
                Category   = "Outbound",
                Handler    = "misc",
                Action     = "list-all-service",
                Parameters = new Dictionary <string, string>()
            };

            request.Parameters.Add("warehouse", warehouse);
            string json = ResponseJson(request);
            CK1OutboundExpressResponse response = JsonConvert.DeserializeObject <CK1OutboundExpressResponse>(json);

            try
            {
                foreach (var service in response.body)
                {
                    list.Add(new Express
                    {
                        Code = service.Code,
                        Name = service.Name
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex.InnerException;
            }
            return(list);
        }
コード例 #3
0
        private string ResponseJson(CK1V3Request request)
        {
            Dictionary <string, string> Dispatcher =
                new Dictionary <string, string>()
            {
                { "category", request.Category },
                { "handler", request.Handler },
            };

            Dispatcher.Add("action", request.Action);

            var    requestUrl = Evisou.Ims.Contract.Model.CK1APIV3.CK1API_SDK_Base.CreateRequestUrl(Dispatcher);
            string json       = HttpHelper.HttpGet(requestUrl, request.Parameters);

            return(json);
        }