/// <summary> /// 取消接口 /// </summary> /// <param name="requestData"></param> /// <returns></returns> public string CancelOrder(string request) { var requestBody = _ctripGateway.CheckCancelOrder(request); var data = requestBody.Data; var response = _ticketGateway.CancelOrder(new OrderCancelRequest { Body = new OrderCancelBody { OrderInfo = new OrderCancelInfo { OrderId = data.vendorOrderId, OrderPrice = 0, OrderQuantity = data.cancelCount, reason = "", Seq = data.sequenceId } } }); if (response.Head.Code == "000000") { var responseBody = new CancelOrderBodyRespose { orderStatus = "3", cancelCount = data.cancelCount, charge = 0, auditDuration = 0 }; return(_ctripGateway.CancelOrder(responseBody)); } else if (response.Head.Code == "114007") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForNotCount, "取消数量不正确,同时不支持部分取消")); } else if (response.Head.Code == "114004") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderNumberNotExist, response.Head.Describe)); } else if (response.Head.Code == "114009" || response.Head.Code == "114013") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForConsume, response.Head.Describe)); } else if (response.Head.Code == "114010") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForCancel, response.Head.Describe)); } else if (response.Head.Code == "114011") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForExpired, response.Head.Describe)); } else if (response.Head.Code == "114012") { return(_ctripGateway.ErrorResult(ResultCode.SystemError, response.Head.Describe)); } return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForError, response.Head.Describe)); }
/// <summary> /// 取消接口 /// </summary> /// <param name="requestData"></param> /// <returns></returns> public object CancelOrder(string request) { var requestBody = _ctripGateway.CheckCancelOrder(request); if (requestBody == null) { return(_ctripGateway.ErrorResult(ResultCode.JsonParsingFailure, "报文解析失败")); } var data = requestBody.Data; var CancelOrderRequest = new OrderCancelRequest { Body = new OrderCancelBody { OrderInfo = new OrderCancelInfo { OrderId = data.SupplierOrderId, OtaOrderId = data.OtaOrderId, OrderPrice = 0, OrderQuantity = data.Items.Sum(a => a.Quantity), reason = "", Seq = data.SequenceId, Items = new List <CancelOrderItemInfo>() } } }; foreach (var row in data.Items) { CancelOrderRequest.Body.OrderInfo.Items.Add(new CancelOrderItemInfo { ItemId = row.ItemId, ProductId = row.PLU, Quantity = row.Quantity, Amount = row.Amount }); } var response = _ticketGateway.CancelOrderDetail(CancelOrderRequest); if (response.Head.Code == "000000") { var responseBody = new CancelOrderBodyRespose { supplierConfirmType = 1, items = new List <CancelOrderitemRespose>() }; foreach (var row in data.Items) { responseBody.items.Add(new CancelOrderitemRespose { itemId = row.ItemId }); } return(_ctripGateway.CancelOrder(responseBody)); } else if (response.Head.Code == "114003" || response.Head.Code == "114014") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForNotCount, response.Head.Describe)); } else if (response.Head.Code == "114004") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderNumberNotExist, response.Head.Describe)); } else if (response.Head.Code == "114009") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForConsume, response.Head.Describe)); } else if (response.Head.Code == "114010" || response.Head.Code == "114013") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForCancel, response.Head.Describe)); } else if (response.Head.Code == "114011") { return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForExpired, response.Head.Describe)); } else if (response.Head.Code == "114012") { return(_ctripGateway.ErrorResult(ResultCode.SystemError, response.Head.Describe)); } return(_ctripGateway.ErrorResult(ResultCode.CancelOrderForError, response.Head.Describe)); }