Exemplo n.º 1
0
        /// <summary>
        /// 获取单笔交易的部分信息(性能高)
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="tid"></param>
        /// <param name="ErrorMsg"></param>
        /// <returns></returns>
        internal Trade GetTrade(string sessionKey, string tid, out string ErrorMsg)
        {
            ErrorMsg = null;
            List <Trade> ListTrades = new List <Trade>();

            try
            {
                ITopClient      client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
                TradeGetRequest req    = new TradeGetRequest();
                req.Fields = "tid,created,pay_time,end_time,status,snapshot_url,buyer_message,price,buyer_nick ,seller_nick, buyer_nick, title, type, created, tid, seller_rate,seller_can_rate, buyer_rate,can_rate, status, payment, discount_fee, adjust_fee, post_fee, total_fee, pay_time, end_time, modified, consign_time, buyer_obtain_point_fee, point_fee, real_point_fee, received_payment, pic_path, num_iid, num, price, cod_fee, cod_status, shipping_type, receiver_name, receiver_state, receiver_city, receiver_district, receiver_address, receiver_zip, receiver_mobile, receiver_phone,seller_flag,alipay_id,alipay_no,is_lgtype,is_force_wlb,is_brand_sale,buyer_area,has_buyer_message, credit_card_fee, lg_aging_type, lg_aging, step_trade_status,step_paid_fee,mark_desc,has_yfx,yfx_fee,yfx_id,yfx_type,trade_source,send_time,is_daixiao,is_wt,is_part_consign,zero_purchase,orders";
                if (tid == null)
                {
                    ErrorMsg = "交易编号不能为空!";
                    return(null);
                }
                req.Tid = long.Parse(tid);
                TradeGetResponse 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);
                    return(resp.Trade);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更改交易的收货地址
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="TradeShipping"></param>
        /// <param name="ErrorMsg"></param>
        internal Trade UpdateTradeShippingAddress(string sessionKey, TradeShippingaddressUpdate TradeShipping, out string ErrorMsg)
        {
            ErrorMsg = null;
            Trade newtrade = new Trade();

            try
            {
                ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
                TradeShippingaddressUpdateRequest req = new TradeShippingaddressUpdateRequest();
                if (TradeShipping.Tid != null)
                {
                    req.Tid = 2755739791L;
                }
                else
                {
                    ErrorMsg = "交易编号不能为空!";
                    return(null);
                }
                req.ReceiverName     = TradeShipping.ReceiverName;
                req.ReceiverPhone    = TradeShipping.ReceiverPhone;
                req.ReceiverMobile   = TradeShipping.ReceiverMobile;
                req.ReceiverState    = TradeShipping.ReceiverState;
                req.ReceiverCity     = TradeShipping.ReceiverCity;
                req.ReceiverDistrict = TradeShipping.ReceiverDistrict;
                req.ReceiverAddress  = TradeShipping.ReceiverAddress;
                req.ReceiverZip      = TradeShipping.ReceiverZip;
                TradeShippingaddressUpdateResponse 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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 添加一条备注
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="Tid">交易编号</param>
        /// <param name="Memo">交易备注。最大长度: 1000个字节</param>
        /// <param name="Flag">交易备注旗帜,可选值为:0(灰色), 1(红色), 2(黄色), 3(绿色), 4(蓝色), 5(粉红色),默认值为0</param>
        /// <param name="ErrorMsg">错误信息</param>
        /// <returns></returns>
        internal Trade AddTradeMemo(string sessionKey, string Tid, string Memo, int Flag, out string ErrorMsg)
        {
            ErrorMsg = null;
            Trade newtrade = new Trade();

            try
            {
                ITopClient          client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
                TradeMemoAddRequest req    = new TradeMemoAddRequest();
                if (!string.IsNullOrEmpty(Tid))
                {
                    req.Tid = long.Parse(Tid);
                }
                else
                {
                    ErrorMsg = "订单编号不能为空!";
                    return(null);
                }
                req.Memo = Memo;
                req.Flag = Flag;
                TradeMemoAddResponse 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);
        }