public async Task <T> ExecuteAsync <T>(IJdPayRequest <T> request) where T : JdPayResponse { // 字典排序 var sortedTxtParams = new JdPayDictionary(request.GetParameters()); var xml = BuildEncryptXml(request, sortedTxtParams); var body = await Client.DoPostAsync(request.GetRequestUrl(), xml); return(DecryptResponseXml <T>(JdPayUtil.FotmatXmlString(body))); }
public Task <T> PageExecuteAsync <T>(IJdPayRequest <T> request, string reqMethod) where T : JdPayResponse { // 字典排序 var sortedTxtParams = new JdPayDictionary(request.GetParameters()); var encyptParams = GetEncryptDicContent(request, sortedTxtParams); var rsp = Activator.CreateInstance <T>(); rsp.Body = GetHtmlRequestContent(request.GetRequestUrl(), encyptParams, reqMethod); return(Task.FromResult(rsp)); }
public async Task <T> ExecuteAsync <T>(IJdPayRequest <T> request) where T : JdPayResponse { // 字典排序 var sortedTxtParams = new JdPayDictionary(request.GetParameters()); var content = GetEncryptXmlContent(request, sortedTxtParams); Logger.LogInformation(0, "Request Content:{content}", content); var rspContent = await Client.DoPostAsync(request.GetRequestUrl(), content); Logger.LogInformation(1, "Response Content:{content}", rspContent); var formatStr = JdPayUtil.FotmatXmlString(rspContent); return(DecryptResponseXmlContent <T>(formatStr)); }
public async Task <T> ExecuteAsync <T>(IJdPayRequest <T> request) where T : JdPayResponse { // 字典排序 var sortedTxtParams = new JdPayDictionary(request.GetParameters()); var reqContent = GetEncryptXmlContent(request, sortedTxtParams); var rspContent = await Client.DoPostAsync(request.GetRequestUrl(), reqContent); if (string.IsNullOrEmpty(rspContent)) { throw new Exception("rspContent is Empty!"); } var formatStr = JdPayUtil.FotmatXmlString(rspContent); return(DecryptResponseXmlContent <T>(formatStr)); }