public async Task <IActionResult> QrCodePay(WeChatPayQrCodePayViewModel viewModel)
        {
            var request = new WeChatPayUnifiedOrderRequest
            {
                Body           = viewModel.Body,
                OutTradeNo     = viewModel.OutTradeNo,
                TotalFee       = viewModel.TotalFee,
                SpbillCreateIp = viewModel.SpbillCreateIp,
                NotifyUrl      = viewModel.NotifyUrl,
                TradeType      = viewModel.TradeType
            };
            var response = await _client.ExecuteAsync(request);

            // response.CodeUrl 给前端生成二维码
            ViewData["qrcode"]   = response.CodeUrl;
            ViewData["response"] = response.Body;
            return(View());
        }
Beispiel #2
0
        public async Task <IActionResult> QrCodePay(WeChatPayQrCodePayViewModel viewModel)
        {
            var request = new WeChatPayUnifiedOrderRequest
            {
                Body           = viewModel.Body,
                OutTradeNo     = viewModel.OutTradeNo,
                TotalFee       = viewModel.TotalFee,
                SpBillCreateIp = viewModel.SpBillCreateIp,
                NotifyUrl      = viewModel.NotifyUrl,
                TradeType      = viewModel.TradeType,
                ProfitSharing  = viewModel.ProfitSharing
            };

            var response = await _client.ExecuteAsync(request, _optionsAccessor.Value);

            // response.CodeUrl 给前端生成二维码
            //ViewData["qrcode"] = response.CodeUrl;
            //ViewData["response"] = response.Body;
            return(Ok(response.Body));
        }