public ITopClient GetTopClient() { DefaultTopClient client = new DefaultTopClient(url_api, this.AppKey, this.AppSecret); client.SetDisableTrace(true); return(client); }
/// <summary> /// 调用Api关闭订单 /// </summary> /// <param name="tid">订单号</param> /// <param name="reason">关单理由</param> public ApiResult CloseOrderByApi(long tid, string reason, Models.UserTaoOAuth taoUserOAuth) { try { DefaultTopClient client = new DefaultTopClient(url_api, this.AppKey, this.AppSecret); client.SetDisableTrace(true); TradeCloseRequest request = new TradeCloseRequest { Tid = tid, CloseReason = reason }; TradeCloseResponse tcr = client.Execute <TradeCloseResponse>(request, taoUserOAuth.access_token); if (tcr.IsError) { return(new ApiResult(false, tcr.ErrMsg)); } return(new ApiResult(true, tcr.Trade.Status)); } catch (Exception e) { throw new Exception("TradeCloseRequest Failure.", e); } }