/// <summary> /// 订单查询 /// </summary> /// <param name="outTradeNo">商户平台业务流水号</param> /// <returns>返回响应参数 SortedDictionary</returns> public PayCenterData paycenterQueryOrder(string outTradeNo) { Log.Info(this.GetType().ToString(), "===========查询订单请求开始============"); //易票联网关订单类地址 string url = Resource.ORDER_URL; string httpUrl = url + "?"; //1、实例化支付请求实体类,并设置需要的参数-------- PayCenterData data = new PayCenterData(); data.SetValue("partner", Resource.PARTNER); data.SetValue("trans_type", "query"); data.SetValue("out_trade_no", outTradeNo); data.SetValue("version", Resource.VERSION.ToString()); //2、签名 string sign = data.MakeSign(); //3、请求实体类自动签名并得到支付参数-------------- string requestStr = data.ToRequestUrl() + "&sign=" + HttpUtility.UrlEncode(sign, Encoding.GetEncoding("GBK")); httpUrl += requestStr; Log.Info(this.GetType().ToString(), "请求地址:" + httpUrl); //4、发起请求并得到响应 String responseXml = HttpUtil.HttpPost(httpUrl, requestStr); Log.Info(this.GetType().ToString(), "响应xml:" + responseXml); PayCenterData responseData = new PayCenterData(); SortedDictionary <string, object> sd = responseData.FromXml(responseXml); return(responseData); }
/// <summary> /// 退款请求 /// </summary> /// <param name="outTradeNo">商户平台业务流水号</param> /// <param name="outRefundNo">商户平台退款单号</param> /// <param name="totalAmount">订单总金额</param> /// <param name="refundAmount">退款金额</param> /// <returns>返回响应参数 SortedDictionary</returns> public PayCenterData paycenterRefundRequest(string outTradeNo, string outRefundNo, string totalAmount, string refundAmount) { Log.Info(this.GetType().ToString(), "===========退款请求开始============"); //易票联网关订单类地址 string url = Resource.ORDER_URL; string httpUrl = url + "?"; //1、实例化支付请求实体类,并设置需要的参数-------- PayCenterData data = new PayCenterData(); data.SetValue("partner", Resource.PARTNER); data.SetValue("trans_type", "refund"); data.SetValue("sign_type", "SHA256withRSA"); data.SetValue("out_trade_no", outTradeNo); data.SetValue("out_refund_no", outRefundNo); data.SetValue("total_amount", totalAmount); data.SetValue("refund_amount", refundAmount); //2、签名 string sign = data.MakeSign(); //3、请求实体类自动签名并得到支付参数-------------- string requestStr = data.ToRequestUrl() + "&sign=" + HttpUtility.UrlEncode(sign, Encoding.GetEncoding("GBK")); httpUrl += requestStr; Log.Info(this.GetType().ToString(), "请求地址:" + httpUrl); //4、发起请求并得到响应 String responseXml = HttpUtil.HttpPost(httpUrl, requestStr); Log.Info(this.GetType().ToString(), "响应xml:" + responseXml); PayCenterData responseData = new PayCenterData(); SortedDictionary <string, object> sd = responseData.FromXml(responseXml); return(responseData); }