Ejemplo n.º 1
0
        /// <summary>
        /// 修改订单邮费价格
        /// </summary>
        /// <returns></returns>
        internal Trade UpdateTradePostage(string sessionKey, string Tid, string PostFee, out string ErrorMsg)
        {
            ErrorMsg = null;
            Trade newtrade = new Trade();

            try
            {
                ITopClient client             = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
                TradePostageUpdateRequest req = new TradePostageUpdateRequest();
                if (!string.IsNullOrEmpty(Tid))
                {
                    req.Tid = long.Parse(Tid);
                }
                else
                {
                    ErrorMsg = "交易编号不能为空!";
                    return(null);
                }
                req.PostFee = PostFee;
                TradePostageUpdateResponse response = client.Execute(req, sessionKey);
                if (response.IsError)
                {
                    ErrorMsg = response.SubErrMsg;
                    return(null);
                }
                else
                {
                    TopJsonParser         topjson = new TopJsonParser();
                    TradeMemoAddResponse1 resp    = topjson.Parse <TradeMemoAddResponse1>(response.Body);
                    if (!response.IsError)
                    {
                        newtrade = resp.Trade;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(newtrade);
        }
Ejemplo n.º 2
0
        public static bool UpdatePostage(long tid, float postage)
        {
            ITopClient client = Global.DefulatClient();
            TradePostageUpdateRequest req = new TradePostageUpdateRequest();
            req.Tid = tid;
            req.PostFee = postage.ToString();
            TradePostageUpdateResponse response = client.Execute(req, Global.SessionKey);
            if (response.Trade == null || String.IsNullOrEmpty(response.Trade.PostFee))
                return false;

            float retFee = 0.0f;
            float.TryParse(response.Trade.PostFee, out retFee);
            return postage == retFee;
        }