Beispiel #1
0
        private bool Notify_PaySucceed(object sender, PaySucceedEventArgs e)
        {
            // 支付成功时时的处理代码

            /* 建议添加以下校验。
             * 1、需要验证该通知数据中的OutTradeNo是否为商户系统中创建的订单号,
             * 2、判断Amount是否确实为该订单的实际金额(即商户订单创建时的金额),
             */
            // 支付宝支付
            if (e.GatewayType == typeof(Alipay.AlipayGateway))
            {
                var response = (Alipay.Response.NotifyResponse)e.NotifyResponse;

                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                    isRedirect = true;
                }
            }

            // 微信支付
            if (e.GatewayType == typeof(Wechatpay.WechatpayGateway))
            {
                var response = (Wechatpay.Response.NotifyResponse)e.NotifyResponse;

                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                    isRedirect = true;
                }
            }

            // 银联支付
            if (e.GatewayType == typeof(Unionpay.UnionpayGateway))
            {
                var response = (Unionpay.Response.NotifyResponse)e.NotifyResponse;

                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                    isRedirect = true;
                }
            }

            // QQ支付
            if (e.GatewayType == typeof(Qpay.QpayGateway))
            {
                var response = (Qpay.Response.NotifyResponse)e.NotifyResponse;

                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                    isRedirect = true;
                }
            }

            //处理成功返回true
            return(true);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <returns></returns>
        private bool Notify_PaySucceed(object sender, PaySucceedEventArgs e)
        {
            if (e.GatewayType == typeof(PaySharp.Wechatpay.WechatpayGateway))
            {
                var alipayNotifyResponse = (NotifyResponse)e.NotifyResponse;

                //校验订单信息
                string payNO      = alipayNotifyResponse.TradeNo;                //微信订单号
                string orderNO    = alipayNotifyResponse.OutTradeNo;             //商户订单号
                string orderTotal = alipayNotifyResponse.TotalAmount.ToString(); //订单金额
                string payDate    = alipayNotifyResponse.TimeEnd;                //支付完成时间

                CourseOrderBLL    courseOrderBLL    = new CourseOrderBLL();
                CourseOrderEntity courseOrderEntity = courseOrderBLL.GetByOrderNO(orderNO);

                //校验订单是否存在
                if (courseOrderEntity == null)
                {
                    return(false);
                }

                if (courseOrderEntity.orderTotal * 100 == Convert.ToDecimal(orderTotal))
                {
                    //2.更新订单的相关状态
                    if (courseOrderEntity.state == 1)
                    {
                        courseOrderEntity.payNo      = payNO;
                        courseOrderEntity.payDate    = DateTime.ParseExact(payDate, "yyyyMMddHHmmss", System.Globalization.CultureInfo.CurrentCulture);
                        courseOrderEntity.state      = 2;
                        courseOrderEntity.modifyDate = DateTime.Now;
                        courseOrderEntity.realTotal  = Convert.ToDecimal(orderTotal) / 100;
                        courseOrderEntity.payChannel = "微信支付-APP";
                        int rows = courseOrderBLL.ActionDal.ActionDBAccess.Updateable(courseOrderEntity).ExecuteCommand();

                        //3.返回一个xml格式的结果给微信服务器
                        if (rows > 0)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            //处理成功返回true
            return(false);
        }
        private bool Notify_PaySucceed(object sender, PaySucceedEventArgs e)
        {
            // 支付成功时时的处理代码

            /* 建议添加以下校验。
             * 1、需要验证该通知数据中的OutTradeNo是否为商户系统中创建的订单号,
             * 2、判断Amount是否确实为该订单的实际金额(即商户订单创建时的金额),
             */
            if (e.GatewayType == typeof(Alipay.AlipayGateway))
            {
                var alipayNotifyResponse = (NotifyResponse)e.NotifyResponse;

                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                }
            }

            //处理成功返回true
            return(true);
        }
Beispiel #4
0
        private bool Notify_PaySucceed(object sender, PaySucceedEventArgs e)
        {
            LogService.AppLog.Info("alipay feedback starts....");

            // 支付成功时时的处理代码

            /* 建议添加以下校验。
             * 1、需要验证该通知数据中的OutTradeNo是否为商户系统中创建的订单号,
             * 2、判断Amount是否确实为该订单的实际金额(即商户订单创建时的金额),
             */
            if (e.GatewayType == typeof(PaySharp.Alipay.AlipayGateway))
            {
                var alipayNotifyResponse = (NotifyResponse)e.NotifyResponse;
                LogService.AppLog.Info("info" + alipayNotifyResponse.AppId + ", time is:" + alipayNotifyResponse.NotifyTime);
                //同步通知,即浏览器跳转返回
                if (e.NotifyType == NotifyType.Sync)
                {
                    isRedirect = true;
                }
            }

            //处理成功返回true
            return(true);
        }