public async Task <T> ExecuteAsync <T>(IQPayRequest <T> request) where T : QPayResponse { // 字典排序 var sortedTxtParams = new QPayDictionary(request.GetParameters()) { { APPID, Options.AppId }, { MCHID, Options.MchId }, { NONCE_STR, Guid.NewGuid().ToString("N") } }; sortedTxtParams.Add(SIGN, QPaySignature.SignWithKey(sortedTxtParams, Options.Key)); var rspContent = await Client.DoPostAsync(request.GetRequestUrl(), sortedTxtParams); if (string.IsNullOrEmpty(rspContent)) { throw new Exception("rspContent is Empty!"); } var parser = new QPayXmlParser <T>(); var rsp = parser.Parse(rspContent); CheckResponseSign(rsp); return(rsp); }
public async Task <T> ExecuteAsync <T>(IQPayCertificateRequest <T> request) where T : QPayResponse { // 字典排序 var sortedTxtParams = new QPayDictionary(request.GetParameters()) { { APPID, Options.AppId }, { MCHID, Options.MchId }, { NONCE_STR, Guid.NewGuid().ToString("N") } }; sortedTxtParams.Add(SIGN, Md5.GetMD5WithKey(sortedTxtParams, Options.Key)); var body = await Client.DoPostAsync(request.GetRequestUrl(), sortedTxtParams); var parser = new QPayXmlParser <T>(); var rsp = parser.Parse(body); CheckResponseSign(rsp); return(rsp); }