using System.Net.Http; using System.Text; using System.Threading.Tasks; using Hncore.Infrastructure.Common; using Hncore.Infrastructure.Serializer; using Hncore.Pass.PaymentCenter.WeiFuTong.AliJsPay; namespace Hncore.Pass.PaymentCenter.WeiFuTong.ClientExtension { public static class AliJsPay { /// /// 支付宝支付窗支付下单 /// /// /// /// public static async Task AliJsPayCreateOrderAsync(this WeiFuTongClient weiFuTongClient , AliJsPayRequest request) { StringBuilder log = new StringBuilder(); var body = request.ToXml(); log.Append("请求:\r\n" + body); var response = await weiFuTongClient.CreateHttpClient() .PostAsync(request.PaymentChannel.GetUrl(), new StringContent(body)); var resText = await response.Content.ReadAsStringAsync(); log.Append("\r\n响应:" + resText); LogHelper.Trace($"威富通-支付宝支付窗支付下单", log.ToString()); Util.CheckSignFromXml(resText, request.MchInfo); var res = XML.XmlDeserialize(resText); res.HandleError(); return res; } } }