Example #1
0
        public async Task OnGet(Guid orderId)
        {
            Order = await couseOrderService.GetOrder(orderId);

            var openId       = User.Claims.FirstOrDefault(x => x.Type == "wxopenid").Value;
            var notifyUrl    = Request.Host + "/WxNotifyUrl";
            var payOrderData = await payService.PayOrder(openId, Order, notifyUrl);

            PayData = payOrderData.Item1;
            await couseOrderService.UpdateOrder(payOrderData.Item2);
        }
        public async Task OnGet(Guid orderId)
        {
            Order = await couseOrderService.GetOrder(orderId);

            var openId    = User.Claims.FirstOrDefault(x => x.Type == "wxopenid").Value;
            var notifyUrl = Request.Scheme + "://" + Request.Host + "/WxNotifyUrl";

            logger.LogInformation("notify url Host :" + notifyUrl);
            var payOrderData = await payService.PayNativeOrder(openId, Order, notifyUrl);

            byte[] bytes = new byte[payOrderData.Item1.Length];
            payOrderData.Item1.Position = 0;
            payOrderData.Item1.Read(bytes, 0, bytes.Length);
            PayQrcode = Convert.ToBase64String(bytes);
            await couseOrderService.UpdateOrder(payOrderData.Item2);
        }