예제 #1
0
 /// <summary>
 /// 写日志
 /// </summary>
 protected void WriteLog(WechatpayConfig config, WechatpayParameterBuilder builder, WechatpayResult result)
 {
     Logger.Error(GetType().FullName + " 微信支付:"
                  + $"支付方式 : {EnumUtil.GetEnumDescription(GetPayWay())}"
                  + $"支付网关 : {config.GetOrderUrl()}"
                  + "请求参数:" + builder.ToXml()
                  + "返回结果:" + result.GetParams()
                  + "原始请求:" + builder.ToString()
                  + "原始响应: " + result.Raw
                  );
 }
예제 #2
0
 /// <summary>
 /// 发送请求
 /// </summary>
 protected virtual async Task <string> Request(WechatpayConfig config, WechatpayParameterBuilder builder)
 {
     if (IsSend == false)
     {
         return(string.Empty);
     }
     return(await Web.Client()
            .Post(config.GetOrderUrl())
            .XmlData(builder.ToXml())
            .ResultAsync());
 }
예제 #3
0
        /// <summary>
        /// 写日志
        /// </summary>
        protected virtual void WriteLog <TResponse>(WechatpayConfig config, WechatpayParameterBuilder builder, WechatpayResult <TResponse> result) where TResponse : WechatpayResponse
        {
            var logContent = LogContentBuilder.CreateLogContentBuilder()
                             .SetEventId(Guid.NewGuid()).SetMoudle(GetType().FullName).SetTitle("微信支付")
                             .AddContent($"支付方式 : {GetType()}")
                             .AddContent($"支付网关 : {config.GetOrderUrl()}")
                             .AddContent($"原始响应:{result?.Raw}")
                             .Build();

            Logger.LogInfo(logContent);
        }
예제 #4
0
        /// <summary>
        /// 写日志
        /// </summary>
        /// <param name="config">微信支付配置</param>
        /// <param name="builder">微信支付参数生成器</param>
        /// <param name="result">微信支付结果</param>
        protected void WriteLog(WechatpayConfig config, WechatpayParameterBuilder builder, WechatpayResult result)
        {
            var log = GetLog();

            if (log.IsTraceEnabled == false)
            {
                return;
            }
            log.Class(GetType().FullName)
            .Caption("微信支付")
            .Content($"支付方式 : {GetPayWay().Description()}")
            .Content($"支付网关 : {config.GetOrderUrl()}")
            .Content("请求参数:")
            .Content(builder.ToXml())
            .Content()
            .Content("返回结果:")
            .Content(result.GetParams())
            .Content()
            .Content("原始响应: ")
            .Content(result.Raw)
            .Trace();
        }
예제 #5
0
 /// <summary>
 /// 获取接口地址
 /// </summary>
 /// <param name="config">支付配置</param>
 protected override string GetUrl(WechatpayConfig config)
 {
     return(config.GetOrderUrl());
 }