微信支付提交的XML Data数据[撤销订单]
Example #1
0
        /// <summary>
        /// 【异步方法】撤销订单接口
        /// </summary>
        /// <param name="dataInfo"></param>
        /// <returns></returns>
        public static async Task <ReverseResult> ReverseAsync(TenPayV3ReverseRequestData dataInfo)
        {
            var          urlFormat     = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
            var          data          = dataInfo.PackageRequestHandler.ParseXML();
            var          formDataBytes = data == null ? new byte[0] : Encoding.UTF8.GetBytes(data);
            MemoryStream ms            = new MemoryStream();

            ms.Write(formDataBytes, 0, formDataBytes.Length);
            ms.Seek(0, SeekOrigin.Begin);//设置指针读取位置
            var resutlXml = await RequestUtility.HttpPostAsync(urlFormat, null, ms);

            return(new ReverseResult(resutlXml));
        }
Example #2
0
        /// <summary>
        /// 【异步方法】撤销订单接口
        /// </summary>
        /// <param name="dataInfo"></param>
        /// <param name="cert">证书绝对路径,如@"F:\apiclient_cert.p12"</param>
        /// <param name="certPassword">证书密码</param>
        /// <param name="timeOut"></param>
        /// <returns></returns>
        public static async Task <ReverseResult> ReverseAsync(TenPayV3ReverseRequestData dataInfo, string cert, string certPassword, int timeOut = Config.TIME_OUT)
        {
            var urlFormat = ReurnPayApiUrl("https://api.mch.weixin.qq.com/{0}secapi/pay/reverse");
            var data      = dataInfo.PackageRequestHandler.ParseXML();
            //var dataBytes = Encoding.UTF8.GetBytes(data);
            //using (MemoryStream ms = new MemoryStream(dataBytes))
            //{
            //调用证书
            X509Certificate2 cer = new X509Certificate2(cert, certPassword, X509KeyStorageFlags.PersistKeySet | X509KeyStorageFlags.MachineKeySet);
            var responseContent  = await CertPostAsync(cert, certPassword, data, urlFormat, timeOut);

            return(new ReverseResult(responseContent));
            //}
        }
Example #3
0
 /// <summary>
 /// 【异步方法】撤销订单接口
 /// </summary>
 /// <param name="dataInfo"></param>
 /// <returns></returns>
 public static async Task<ReverseResult> ReverseAsync(TenPayV3ReverseRequestData dataInfo)
 {
     var urlFormat = "https://api.mch.weixin.qq.com/secapi/pay/reverse";
     var data = dataInfo.PackageRequestHandler.ParseXML();
     var formDataBytes = data == null ? new byte[0] : Encoding.UTF8.GetBytes(data);
     MemoryStream ms = new MemoryStream();
     ms.Write(formDataBytes, 0, formDataBytes.Length);
     ms.Seek(0, SeekOrigin.Begin);//设置指针读取位置
     var resutlXml = await RequestUtility.HttpPostAsync(urlFormat, null, ms);
     return new ReverseResult(resutlXml);
 }