Ejemplo n.º 1
0
        /// <summary>
        /// 调用物流接口,根据订单号获取订单信息
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="userInfo">用户信息</param>
        /// <returns></returns>
        private OrderInfo CreateFlytOrderInfo(string orderId, UserInfo userInfo)
        {
            //调用物流接口,根据订单号获取订单信息
            VerifyOrderResponseContract order = API_Helper.VerifyOrderBySingleFlyt(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 = string.IsNullOrWhiteSpace(order.CountryCnName) ? "" : order.CountryCnName,
                PostId = order.PostId,
                PostName = order.PostCnName,
                Zip = string.IsNullOrWhiteSpace(order.Zip) ? "" : order.Zip,
                Weight = order.Weight,
                CreateTime = DateTime.Now
            });
        }