public async Task SaveEvent(OrderDTO order, OrderEventType eventType)
        {
            List <OrderEvent> result = await GetOrderEvent(order.Id);

            _repository.Create(new OrderEvent(order.Id, order.ToJson(),
                                              eventType.Name, result.Count == 0 ? 1 : (result.Max(x => x.Version)) + 1), "");
            await _repository.SaveAsync();
        }
        public static Orders ToOrderEntity(this OrderDTO order)
        {
            var json   = order.ToJson();
            var result = json.ToType <Orders>();

            result.Customer = null;
            return(result);
        }
Example #3
0
        public Result Notify([FromBody] OrderDTO entity)
        {
            var result = new Result()
            {
            };

            LogHelper.Log.Debug("Notify:" + entity.ToJson());

            // 校验Key
            var key = EncryptHelper.Md5To32(EncryptHelper.Md5To32(entity.Order_QRPrice + entity.Order_Type) + AliPayConfig.secret_key);

            if (key != entity.Order_Sign)
            {
                result.Message = "处理订单失败,客户端密匙有误!";
                return(result);
            }

            var order = PayService.GetOrder(entity.Order_QRPrice);

            if (order == null)
            {
                result.Message = "处理订单失败,未找到记录";
                return(result);
            }
            else
            {
                order.Order_Status = "Finished";

                CacheHelper.RemoveCache(order.Order_OutTradeNO);
                CacheHelper.SetCacheValue(order.Order_OutTradeNO, order, 24 * 60);
                result.IsSucc  = true;
                result.Datas   = order;
                result.Message = "收款处理成功";
            }
            return(result);
        }