コード例 #1
0
        /// <summary>
        /// 写日志
        /// </summary>
        private void WriteLog(AlipayResult result)
        {
            var log = GetLog();

            if (log.IsTraceEnabled == false)
            {
                return;
            }
            log.Class(GetType().FullName)
            .Caption("请求支付宝支付")
            .Content("支付方式 : {0}", GetPayWay().Description())
            .Content("支付网关 : {0}", GetGatewayUrl())
            .Content()
            .Content("请求参数:")
            .Content(_builder.GetDictionary())
            .Content()
            .Content("返回结果:")
            .Content(result.GetDictionary())
            .Content()
            .Content("原始请求:")
            .Content(_builder.ToString())
            .Content()
            .Content("原始响应: ")
            .Content(result.Raw)
            .Trace();
        }
コード例 #2
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="config">支付宝配置</param>
        /// <param name="builder">支付宝参数生成器</param>
        /// <param name="result">支付宝结果</param>
        protected void WriteLog(AlipayConfig config, AlipayParameterBuilder builder, AlipayResult result)
        {
            var log = GetLog();

            if (log.IsTraceEnabled == false)
            {
                return;
            }

            log.Class(GetType().FullName)
            .Caption("支付宝支付")
            .Content($"支付宝方式 : {GetPayWay().Description()}")
            .Content($"支付网关 : {config.GetGatewayUrl()}")
            .Content("请求参数:")
            .Content(builder.GetDictionary())
            .Content()
            .Content("返回结果:")
            .Content(result.GetDictionary())
            .Content()
            .Content("原始请求:")
            .Content(builder.ToString())
            .Content()
            .Content("原始响应:")
            .Content(result.Raw)
            .Trace();
        }
コード例 #3
0
 /// <summary>
 /// 创建结果
 /// </summary>
 /// <param name="builder">支付宝参数生成器</param>
 /// <param name="result">支付宝结果</param>
 /// <returns></returns>
 protected virtual PayResult CreateResult(AlipayParameterBuilder builder, AlipayResult result)
 {
     return(new PayResult(result.Success, result.GetTradeNo(), result.Raw)
     {
         Parameter = builder.ToString(),
         Message = result.GetMessage()
     });
 }
コード例 #4
0
 public void TestConfig()
 {
     _builder = new AlipayParameterBuilder(new AlipayConfig {
         AppId = "a"
     });
     _output.WriteLine(_builder.ToString());
     Assert.Equal("app_id=a&charset=utf-8&format=json&sign_type=RSA2&timestamp=2000-10-10 10:10:10&version=1.0", _builder.ToString());
 }
コード例 #5
0
 /// <summary>
 /// 创建结果
 /// </summary>
 protected override PayResult CreateResult(AlipayParameterBuilder builder, AlipayResult result)
 {
     return(new PayResult(result.Success, result.GetTradeNo(), result.Raw)
     {
         Parameter = builder.ToString(),
         Message = result.GetMessage(),
         Result = result.GetValue(AlipayConst.QrCode)
     });
 }
コード例 #6
0
        /// <summary>
        /// 请求结果
        /// </summary>
        protected override Task <PayResult> RequstResult(AlipayConfig config, AlipayParameterBuilder builder)
        {
            var result = builder.ToString();

            WriteLog(config, builder, result);
            return(Task.FromResult(new PayResult {
                Result = result
            }));
        }
コード例 #7
0
 /// <summary>
 /// 写日志
 /// </summary>
 protected void WriteLog(AlipayConfig config, AlipayParameterBuilder builder, string content)
 {
     Logger.Error(GetType().FullName + " 支付宝支付:"
                  + $"支付方式 : {EnumUtil.GetEnumDescription(GetPayWay())}"
                  + $"支付网关 : {config.GetGatewayUrl()}"
                  + "请求参数:" + builder.GetDictionary()
                  + "原始请求:" + builder.ToString()
                  + "内容: " + content
                  );
 }
コード例 #8
0
        /// <summary>
        /// 获取调试参数
        /// </summary>
        /// <param name="param">支付参数</param>
        public virtual async Task <string> Debug(PayParam param)
        {
            var config = await ConfigProvider.GetConfigAsync();

            Validate(config, param);
            var builder = new AlipayParameterBuilder(config, param);

            Config(builder, param);
            return(builder.ToString());
        }
コード例 #9
0
        /// <summary>
        /// 写日志
        /// </summary>
        protected void WriteLog(AlipayConfig config, AlipayParameterBuilder builder, string content)
        {
            var log = GetLog();

            if (log.IsTraceEnabled == false)
            {
                return;
            }
            log.Class(GetType().FullName)
            .Caption("支付宝支付")
            .Content($"支付方式 :  {GetType()}")
            .Content($"支付网关 : {config.GetGatewayUrl()}")
            .Content("请求参数:")
            .Content(builder.GetDictionary())
            .Content()
            .Content("原始请求:")
            .Content(builder.ToString())
            .Content()
            .Content("内容: ")
            .Content(content)
            .Trace();
        }
コード例 #10
0
 public void TestAppId()
 {
     _builder.AppId("a");
     Assert.Equal("app_id=a&charset=utf-8&format=json&sign_type=RSA2&timestamp=2000-10-10 10:10:10&version=1.0", _builder.ToString());
 }
コード例 #11
0
 public void TestAppId()
 {
     _builder.AppId("a");
     Assert.Equal("app_id=a", _builder.ToString());
 }