/// <summary>
        /// 消费通知接口
        /// </summary>
        /// <param name="noticeOrderConsumedRequest"></param>
        /// <returns></returns>
        public static bool Run(NoticeOrderConsumedBodyRequest noticeOrderConsumedBodyRequest)
        {
            var request = new NoticeOrderConsumedRequest
            {
                header = new RequestHeader
                {
                    AccountId   = CtripConfig.AccountId,
                    ServiceName = "NoticeOrderConsumed",
                    RequestTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                    Version     = CtripConfig.Version
                }
            };
            var body = Api.BodyForAesEncrypt(noticeOrderConsumedBodyRequest);
            var sign = Helper.MakeSign(request.header, body);

            request.header.Sign = sign;
            request.body        = body;
            var data   = JsonSerializeHelper.ToJsonForlowercase(request);
            var contnt = HttpService.Post(data, CtripConfig.Website);

            if (!string.IsNullOrEmpty(contnt))
            {
                var requestBody = Api.CheckBodyData <PublicResponse>(contnt);
                if (requestBody == null)
                {
                    return(false);
                }
                if (requestBody.Data.header.resultCode == ResultCode.Success)
                {
                    return(true);
                }
            }
            return(false);
        }
Beispiel #2
0
        public OrderDetailViewModel Get(int id)
        {
            var order        = _travelAgencyOrderService.Get(id);
            var orderDetails = _travelAgencyOrderDetailService.GetList(order.OrderNo);
            var data         = new OrderDetailViewModel
            {
                Id                 = order.Id,
                ValidityDate       = order.ValidityDateStart,
                PlaceOrderTypeName = ((TraveAgencyPlaceOrderType)order.PlaceOrderType).GetDescription(),
                IdCard             = order.IdCard,
                Linkman            = order.Linkman,
                Mobile             = order.Mobile,
                Remark             = order.Remark,
                AuditStatus        = order.AuditStatus,
                RejectTime         = order.RejectTime,
                RejectReason       = order.RejectReason,
                OrderStatus        = order.OrderStatus,
                TicketItem         = new List <TicketItemModel>()
            };

            foreach (var row in orderDetails)
            {
                data.TicketItem.Add(new TicketItemModel
                {
                    TicketId    = row.TicketId,
                    TicketName  = row.TicketName,
                    BookCount   = row.Quantity,
                    Price       = row.Price,
                    TotalAmount = row.Quantity * row.Price
                });
            }
            data.TicketItemJson = JsonSerializeHelper.ToJsonForlowercase(data.TicketItem);
            return(data);
        }
Beispiel #3
0
        /// <summary>
        /// body AES加密
        /// </summary>
        /// <param name="body"></param>
        /// <returns></returns>
        public static string BodyForAesEncrypt(object body)
        {
            var bodyData = JsonSerializeHelper.ToJsonForlowercase(body);

            return(Helper.EncodeBytes(Helper.AESEncrypt(bodyData, CtripConfig.AesKey, CtripConfig.AesIv)));
        }