Esempio n. 1
0
        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)));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        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));
        }
Esempio n. 4
0
        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));
        }