public ResultJson SureWeiChatOrder(PayOrderRequest request)
        {
            var order = Order_InfoFunc.Instance.SelectByModel(new Order_Info {
                OrderNo = request.OrderNo
            }).FirstOrDefault();
            //创建日志记录组件实例
            ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

            //记录错误日志
            log.Error("error1231");
            if (OrderFunc.Instance.UpdateModel(new Order_Info {
                Id = order.Id, Status = 3, PayType = 3
            }))
            {
                //记录错误日志
                log.Error("SendMail");
                SendMail.Instance.SendEmail(order.Phone, "{\"code\":\"" + order.OrderNo + "\",\"code2\":\"" + order.TotalPrice + "\"}", Enum_SendEmailCode.NoticeOfPaymentCode);
                //记录错误日志
                log.Error("SendMailSuccess");
                //记录错误日志
                log.Error(order.Phone);
                return(new ResultJson {
                    HttpCode = 200, Message = "该订单支付成功!"
                });
            }
            else
            {
                return(new ResultJson {
                    HttpCode = 300, Message = "该订单修改失败!"
                });
            }
        }
        public async Task <IActionResult> PayOrder(PayOrderRequest request)
        {
            var order = await _context.Orders.FindAsync(request.Id);

            if (order == null || order.Customer != request.Customer)
            {
                return(BadRequest());
            }

            order.Paid = true;
            _context.Entry(order).State = EntityState.Modified;
            await _context.SaveChangesAsync();

            await _notificationService.SendPaidNotification(order);

            return(Ok());
        }
        public ResultJson WeiChatOrder(PayOrderRequest request)
        {
            var result           = OrderQuery.Instance.Run(null, request.OrderNo);
            var trade_state_desc = result.GetValue("trade_state_desc") == null ? null : result.GetValue("trade_state_desc").ToString();
            var order            = Order_InfoFunc.Instance.SelectByModel(new Order_Info {
                OrderNo = request.OrderNo
            }).FirstOrDefault();

            if (order.Status != 1)
            {
                return(new ResultJson {
                    HttpCode = 300, Message = "此订单并非微信订单!"
                });
            }
            if (trade_state_desc == "支付成功")
            {
                SendMail.Instance.SendEmail(order.Phone, "{\"code\":\"" + order.OrderNo + "\",\"code2\":\"" + order.TotalPrice + "\"}", Enum_SendEmailCode.NoticeOfPaymentCode);
                if (OrderFunc.Instance.UpdateModel(new Order_Info {
                    Id = order.Id, Status = 3, PayType = 3
                }))
                {
                    return(new ResultJson {
                        HttpCode = 200, Message = "该订单支付成功!"
                    });
                }
                else
                {
                    return(new ResultJson {
                        HttpCode = 300, Message = "该订单修改失败!"
                    });
                }
            }
            else
            {
                if (order.LastCodeTime == null || order.LastCodeTime.Value.AddMinutes(30) < DateTime.Now)
                {
                    OrderFunc.Instance.UpdateModel(new Order_Info {
                        Id = order.Id, WechatFaild = true
                    });
                }
                return(new ResultJson {
                    HttpCode = 300, Message = "此订单并未成功支付!"
                });
            }
        }
Example #4
0
 /// <summary>
 ///  订单支付
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <PayOrderResponse> PayOrder(PayOrderRequest request)
 {
     return(await new PayOrderExecutor().Client(this).Execute <PayOrderResponse, PayOrderResult, PayOrderRequest>(request).ConfigureAwait(false));
 }
Example #5
0
 /// <summary>
 ///  订单支付
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public PayOrderResponse PayOrder(PayOrderRequest request)
 {
     return(new PayOrderExecutor().Client(this).Execute <PayOrderResponse, PayOrderResult, PayOrderRequest>(request));
 }