Exemplo n.º 1
0
        public override async Task <PrepayData> GetPrepayData(PayParams payEntity)
        {
            if (!Env.IsProduction())
            {
                payEntity.Amount = 1;
            }

            var mch    = GetMchData(payEntity.MchId);
            var result = await WxPay.BuildWxPayQrCode(
                payEntity.AppId,
                mch.MchId,
                mch.MchKey,
                payEntity.Title,
                payEntity.Amount,
                payEntity.Attach,
                payEntity.OrderId.ToString(),
                payEntity.LocalTradeNo,
                $"{WxsdkOptions.Value.GlobalSettings.ThisHost}{PayResultNotifyUrl}");

            return(new PrepayData(result.Result.QrcodeUrl, result.UnifiedorderResult.ResultXml));
        }
Exemplo n.º 2
0
        public override async Task <PrepayData> GetPrepayData(PayParams payParams)
        {
            if (!Env.IsProduction())
            {
                payParams.Amount = 1;
            }

            var mch    = GetMchData(payParams.MchId);
            var result = await WxPay.BuildApp(
                payParams.AppId,
                mch.MchId,
                mch.MchKey,
                payParams.Title,
                payParams.Amount,
                payParams.Attach,
                payParams.OrderId.ToString(),
                payParams.LocalTradeNo,
                payParams.ClientIp,
                $"{WxsdkOptions.Value.GlobalSettings.ThisHost.Trim().TrimEnd('/')}{PayResultNotifyUrl}");

            return(new PrepayData(result.Result.ToJsonWithCamelCase(),
                                  result.UnifiedorderResult.ResultXml));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取支付数据
        /// </summary>
        /// <param name="payParams"></param>
        /// <returns></returns>
        public override async Task <PrepayData> GetPrepayData(PayParams payParams)
        {
            if (!Env.IsProduction())
            {
                payParams.Amount = 1;
            }

            var mch    = GetMchData(payParams.MchId);
            var result = await WxPay.BuildH5(
                appId : payParams.AppId,
                mchId : mch.MchId,
                mchKey : mch.MchKey,
                title : payParams.Title,
                totalAmount : payParams.Amount,
                attach : payParams.Attach,
                orderId : payParams.OrderId.ToString(),
                localTradeNo : payParams.LocalTradeNo,
                clientIp : payParams.ClientIp,
                notifyUrl : $"{WxsdkOptions.Value.GlobalSettings.ThisHost.Trim().TrimEnd('/')}{PayResultNotifyUrl}",
                redirect_url : payParams.RedirectUrl);

            return(new PrepayData(result.Result.MwebUrl, result.UnifiedorderResult.ResultXml));
        }
Exemplo n.º 4
0
 public abstract Task <PrepayData> GetPrepayData(PayParams payEntity);