예제 #1
0
        /// <summary>
        /// 调用物流接口,根据订单号获取订单信息
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="userInfo">用户信息</param>
        /// <returns></returns>
        private OrderInfo CreateFlytOrderInfo(string orderId, UserInfo userInfo)
        {
            //调用物流接口,根据订单号获取订单信息
            VerifyOrderResponseContract order = null;

            if (userInfo.Pcid == "1067")//杭州处理中心
            {
                order = API_Helper.VerifyOrderForHangZhou(orderId, userInfo);
            }
            else
            {
                order = API_Helper.VerifyOrder(orderId, userInfo);
            }

            if (((!order.Success ?? false) || (!order?.Sucess ?? false)) && !string.IsNullOrWhiteSpace(order.Message))
            {
                throw new Exception(order.Message);
            }
            return(new OrderInfo
            {
                OrderId = order.OrderId,
                TraceId = string.IsNullOrWhiteSpace(order.TraceId) ? "" : order.TraceId,
                CountryId = order.CountryId,
                CountryName = order.CountryCnName,
                PostId = order.PostId,
                PostName = order.PostCnName,
                Zip = string.IsNullOrWhiteSpace(order.Zip) ? "" : order.Zip,
                Weight = order.Weight,
                CreateTime = DateTime.Now
            });
        }