コード例 #1
0
ファイル: OrderQueryBLL.cs プロジェクト: radtek/crm
        /// <summary>
        /// 第三方支付通知失败处理
        /// </summary>
        public void SetNotificationFailed()
        {
            AppOrderBLL   appOrderBLL   = new AppOrderBLL(new BasicUserInfo());
            PayChannelBLL payChannelBLL = new PayChannelBLL(new BasicUserInfo());

            WeiXinOrderQuery orderQuery      = new WeiXinOrderQuery();
            PayChannelEntity payChannelEntiy = null;

            WeiXinOrderQuery.OrderQueryPara para = null;

            try
            {
                //获取当天未支付成功的订单
                AppOrderEntity[] appOrderList = appOrderBLL.GetUnpaidOrder();
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = string.Format("找到{0}条通知失败或未支付成功数据", appOrderList.Count())
                });
                foreach (var order in appOrderList)
                {
                    //读取微信微信配置信息
                    payChannelEntiy = payChannelBLL.GetByID(order.PayChannelID);
                    if (payChannelEntiy != null)
                    {
                        if (payChannelEntiy.PayType == 6)//微信公众号支付
                        {
                            para = new WeiXinOrderQuery.OrderQueryPara();
                            para = payChannelEntiy.ChannelParameters.DeserializeJSONTo <WeiXinOrderQuery.OrderQueryPara>();
                            para.out_trade_no = order.OrderID.ToString();
                            WeiXinOrderQuery.OrderQueryInfo result = orderQuery.OrderQuery(para);

                            if (result.return_code == "SUCCESS" && result.result_code == "SUCCESS")
                            {
                                if (result.trade_state == "SUCCESS") //交易状态=支付成功
                                {
                                    order.Status = 2;                //付款成功
                                    appOrderBLL.Update(order);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
            }
        }
コード例 #2
0
ファイル: OrderQueryBLL.cs プロジェクト: radtek/crm
        public static bool Notify(AppOrderEntity pEntity, out string msg)
        {
            string content    = string.Format("OrderID={0}&OrderStatus={1}&CustomerID={2}&UserID={3}&ChannelID={4}&SerialPay={5}", pEntity.AppOrderID, pEntity.Status, pEntity.AppClientID, pEntity.AppUserID, pEntity.PayChannelID, pEntity.OrderID);
            var    channelbll = new PayChannelBLL(new JIT.Utility.BasicUserInfo());
            var    channel    = channelbll.GetByID(pEntity.PayChannelID);

            Loggers.Debug(new DebugLogInfo()
            {
                Message = "开始调用通知接口:" + pEntity.ToJSON()
            });
            var i = Notify(channel.NotifyUrl, content, out msg);

            Loggers.Debug(new DebugLogInfo()
            {
                Message = i ? "调用通知接口成功" : "调用通知接口失败"
            });
            return(i);
        }