コード例 #1
0
 public Com.ChinaPalmPay.Platform.RentCar.Model.Alipay Addalipay(Com.ChinaPalmPay.Platform.RentCar.Model.Alipay ali)
 {
     if (ali != null)
     {
         using (DataContext db = new SqlserverContext())
         {
             Table <Com.ChinaPalmPay.Platform.RentCar.Model.Alipay> T_order = db.GetTable <Com.ChinaPalmPay.Platform.RentCar.Model.Alipay>();
             T_order.InsertOnSubmit(ali);
             db.SubmitChanges();
             return(ali);
         }
     }
     return(null);
 }
コード例 #2
0
        public bool alipayPayment(Com.ChinaPalmPay.Platform.RentCar.Model.Alipay alipay)
        {
            //验证是否是支付宝发出的通知
            //如果alipay通知正确,存入消息队列
            if (!String.IsNullOrWhiteSpace(alipay.out_trade_no) && alipay.total_fee != 0 && !String.IsNullOrWhiteSpace(alipay.trade_status) &&
                !String.IsNullOrWhiteSpace(alipay.trade_no))
            {
                //1.发送到消息队列 2.存入缓存
                //交易成功
                if (alipay.trade_status.Equals(Commons.success) || alipay.trade_status.Equals(Commons.finished))
                {
                    Order order = alipayDb.QueryOrder(alipay.out_trade_no);
                    if (order != null)
                    {
                        Recharge charge = new Recharge()
                        {
                            ID      = Guid.NewGuid().ToString(),
                            UserID  = order.UserID,
                            OrderID = alipay.out_trade_no,
                            //单位:分
                            Amount     = alipay.total_fee * 100,
                            Creater    = Commons.orderHandler.USER.ToString(),
                            CreateTime = DateTime.Now.ToString(),
                            PayOrderID = alipay.trade_no,
                            Remark     = "支付宝交易",
                            Type       = (int)Commons.PayType.RECHARGE
                        };
                        OrderLog orderlog = new OrderLog()
                        {
                            CarID      = order.CarID,
                            CreateTime = DateTime.Now.ToString(),
                            OrderID    = alipay.out_trade_no,
                            Remark     = "支付宝订单支付完成",
                            State      = (int)Commons.Type.USING,
                            Time       = DateTime.Now.ToString(),
                            UserID     = order.UserID
                        };
                        alipayQueue.Send(alipay);
                        alipayQueue.Send(charge);
                        //alipayQueue.Send(orderlog);
                        LogerHelper.debug("支付宝操作成功");
                        return(true);
                    }
                }
            }

            return(false);
        }