/// <summary> /// 同步交易详情数据 /// </summary> /// <param name="info"></param> /// <returns></returns> public Trade QueryTradeFullinfo(ShipInfo info, long?id) { ITopClient client = new DefaultTopClient(url, info.AppKey, info.AppSecret); var pageIndex = 1L; TradeFullinfoGetResponse rsp = null; var trade = new Trade(); try { TradeFullinfoGetRequest req = new TradeFullinfoGetRequest { Fields = "tid,type,status,payment,orders", Tid = id }; rsp = client.Execute(req, info.SessionKey); pageIndex++; if (!rsp.IsError) { trade = rsp.Trade; } } catch (Exception e) { } return(trade); }
/// <summary> /// 获取单笔交易的详细信息 /// </summary> /// <param name="sessionKey"></param> /// <param name="tid"></param> /// <param name="ErrorMsg"></param> /// <returns></returns> internal tbOrdersInfo GetTradeFullinfo(string sessionKey, string tid, int ShopId, out string ErrorMsg) { //show_ext 这个字段导致接口报错 tbOrdersInfo newtrade = null; try { ErrorMsg = null; ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json"); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields += "seller_nick, buyer_nick, title, type, created, tid, seller_rate, buyer_rate,"; req.Fields += " status, payment, adjust_fee, post_fee, total_fee, pay_time, end_time, modified, "; req.Fields += "consign_time, buyer_obtain_point_fee, point_fee, real_point_fee, received_payment, commission_fee,"; req.Fields += "seller_memo, alipay_no,alipay_id,buyer_message, pic_path, num_iid, num, price, "; req.Fields += "receiver_name, receiver_state, receiver_city, receiver_district, receiver_address,"; req.Fields += "receiver_zip, receiver_mobile, receiver_phone,seller_flag, seller_alipay_no, seller_mobile, "; req.Fields += "seller_phone, seller_name, seller_email, available_confirm_fee, has_post_fee, timeout_action_time,"; req.Fields += "snapshot_url, cod_fee, cod_status, shipping_type, trade_memo, buyer_email,buyer_area,"; req.Fields += "trade_from,is_lgtype,is_force_wlb,is_brand_sale,buyer_cod_fee,discount_fee,seller_cod_fee,"; req.Fields += "express_agency_fee,invoice_name,service_orders,credit_cardfee,step_trade_status,step_paid_fee,"; req.Fields += "mark_desc,has_yfx,yfx_fee,yfx_id,yfx_type,trade_source,eticket_ext,send_time, is_daixiao,"; req.Fields += "is_part_consign, arrive_interval, arrive_cut_time, consign_interval,zero_purchase,alipay_point,pcc_af,"; req.Fields += "orders,promotion_details,invoice_name,orders.is_www,orders.store_code,service_tags"; if (!string.IsNullOrEmpty(tid)) { req.Tid = long.Parse(tid); } else { ErrorMsg = "订单编号不能为空"; return(null); } TradeFullinfoGetResponse response = client.Execute(req, sessionKey); if (response.IsError) { ErrorMsg = response.SubErrMsg; return(null); } else { Top.Api.Domain.Trade trade = new Top.Api.Domain.Trade(); newtrade = new tbOrdersInfo(); //订单信息转化 newtrade = ChangeLocationType(response.Trade, ShopId); } } catch (Exception ex) { throw ex; } return(newtrade); }
public static Trade GetOrderInfo(string strUrl, string strAppKey, string strAppSecret, long lTid, string strSessionKey) { ITopClient client = new DefaultTopClient(strUrl, strAppKey, strAppSecret); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields = "seller_nick,buyer_nick,title,type,created,sid,tid,seller_rate,buyer_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,commission_fee,pic_path,num_iid,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,orders.title,orders.pic_path,orders.price,orders.num,orders.iid,orders.num_iid,orders.sku_id,orders.refund_status,orders.status,orders.oid,orders.total_fee,orders.payment,orders.discount_fee,orders.adjust_fee,orders.sku_properties_name,orders.item_meal_name,orders.buyer_rate,orders.seller_rate,orders.outer_iid,orders.outer_sku_id,orders.refund_id,orders.seller_type"; req.Tid = lTid; TradeFullinfoGetResponse response = client.Execute(req); if (response == null) { return(null); } return(response.Trade); }
public static Trade GetTradeContact(long tid, string sessionKey) { try { ITopClient client = TBManager.GetClient(); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields = "consign_time,receiver_mobile,receiver_city,receiver_name"; req.Tid = tid; TradeFullinfoGetResponse response = client.Execute(req, sessionKey); return(response.Trade); } catch (Exception ex) { CHENGTUAN.Components.ExceptionReporter.WriteLog(ex, CHENGTUAN.Entity.ExceptionPostion.TBApply_Components); return(null); } }
/// <summary> /// 读取子订单(部分信息) /// </summary> /// <param name="orderId"></param> /// <returns></returns> public List <Trade> getTradePartial(string orderId) { List <Trade> list = new List <Trade>(); ITopClient client = new DefaultTopClient(Url, Appkey, Appsecret); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields = "tid,created,pay_time,modified,orders"; req.Tid = helpcommon.ParmPerportys.GetLongParms(orderId); TradeFullinfoGetResponse response = client.Execute(req, Sessionkey); if (response.Trade != null) { list.Add(response.Trade); } return(list); }
public Trade GetBuyerInfoByTid(long tid) { try { ITopClient client = TBManager.GetClient(); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields = "receiver_name,receiver_mobile,status"; req.Tid = tid; TradeFullinfoGetResponse response = client.Execute(req, Users.SessionKey); return(response.Trade); } catch (Exception ex) { CHENGTUAN.Components.ExceptionReporter.WriteLog(ex, CHENGTUAN.Entity.ExceptionPostion.TopApi); return(null); } }
/// <summary> /// 获取单笔交易的详细信息 /// </summary> /// <param name="strSessionKey"></param> /// <param name="tid"></param> /// <returns></returns> public static Trade GetTradeByTid(string strSessionKey, string tid) { try { ITopClient client = TBManager.GetClient(); TradeFullinfoGetRequest req = new TradeFullinfoGetRequest(); req.Fields = @"tid,type,buyer_nick,receiver_name,receiver_state,receiver_city,receiver_district,receiver_address, receiver_mobile,receiver_phone,receiver_zip,buyer_area,post_fee,created,seller_nick,payment,status,shipping_type,pay_time,modified, orders.outer_iid,orders.discount_fee,orders.payment,orders.refund_status,orders.status,orders.pic_path,orders.sku_properties_name,orders.adjust_fee, orders.outer_sku_id,orders.cid,orders.refund_id,orders.item_meal_name,orders.num,orders.title,orders.price,orders.oid,orders.total_fee,orders.num_iid,orders.sku_id,orders.seller_type"; req.Tid = long.Parse(tid); TradeFullinfoGetResponse rsp = client.Execute(req, strSessionKey); return(rsp.Trade); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TopApi); return(null); } }
protected void Page_Load(object sender, EventArgs e) { orderIds = Page.Request.QueryString["orderIds"]; if (string.IsNullOrEmpty(orderIds)) { litmsg.Text = "没有要转换的订单"; } else { int result = 0; int.TryParse(Page.Request.QueryString["shippingModeId"], out result); shippingMode = SubsiteSalesHelper.GetShippingMode(result, true); if (shippingMode == null) { litmsg.Text = "没有选择配送方式"; } else { distributor = HiContext.Current.User as Hidistro.Membership.Context.Distributor; cookie = HiContext.Current.Context.Request.Cookies["TopSession_" + HiContext.Current.User.UserId.ToString()]; string serverUrl = "http://gw.api.taobao.com/router/rest"; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); string appKey = Cryptographer.Decrypt(masterSettings.Topkey); string appSecret = Cryptographer.Decrypt(masterSettings.TopSecret); client = new DefaultTopClient(serverUrl, appKey, appSecret, "json"); TradeFullinfoGetRequest request2 = new TradeFullinfoGetRequest(); request2.Fields = "tid,receiver_name,receiver_state,payment,receiver_district,receiver_city,receiver_address,receiver_phone,receiver_zip,receiver_mobile,post_fee,adjust_fee,total_fee,orders"; TradeFullinfoGetRequest request = request2; string[] strArray = orderIds.Split(new char[] { ',' }); int count = 0; decimal expenditure = 0M; foreach (string str4 in strArray) { request.Tid = new long?(long.Parse(str4)); TradeFullinfoGetResponse response = client.Execute <TradeFullinfoGetResponse>(request, cookie.Value); if (!response.IsError) { try { PurchaseOrderInfo purchaseOrder = GetPurchaseOrder(response.Trade); if ((purchaseOrder != null) && SubsiteSalesHelper.CreatePurchaseOrder(purchaseOrder)) { expenditure += purchaseOrder.OrderTotal; count++; } } catch { litmsg.Text = "生成采购单发生错误,请重新尝试"; } } } if (count > 0) { SendHttpRequest(count, expenditure); litmsg.Text = string.Format("你选择的{0}淘宝订单已经成功的转换了{1}个采购单", strArray.Length, count); } else { litmsg.Text = "生成采购单失败,可能您选择的淘宝订单在系统中没有找到对应的商品"; } } } }