public IActionResult GetOrder([FromBody] GetOrderRequest request) { if (CheckToken(request, out CourierToken courierToken)) { Order order = _context.Orders .Include(o => o.Address) .Include(o => o.Customer) .Include(o => o.ProductOrders) .ThenInclude(o => o.Product) .AsNoTracking() .FirstOrDefault(o => o.ID == request.OrderID); List <OrderProduct> orderProducts = new List <OrderProduct>(); foreach (var po in order.ProductOrders) { orderProducts.Add(new OrderProduct(po.Product) { Quantity = po.Quantity }); } OrderDetails orderDetails = new OrderDetails(order) { OrderProducts = orderProducts }; return(Ok(orderDetails)); } else { return(BadRequest(ModelState)); } }
public async Task PaymentCallBack(IFormCollection collection) { int orderId = _paymentService.GetOrderIdFor(collection); GetOrderRequest request = new GetOrderRequest { OrderId = orderId }; GetOrderResponse response = _orderService.GetOrder(request); OrderPaymentRequest orderPaymentRequest = _mapper.Map <OrderView, OrderPaymentRequest>(response.Order); TransactionResult transactionResult = await _paymentService.HandleCallBack(orderPaymentRequest, collection); if (transactionResult.PaymentOk) { SetOrderPaymentRequest paymentRequest = new SetOrderPaymentRequest(); paymentRequest.Amount = transactionResult.Amount; paymentRequest.PaymentToken = transactionResult.PaymentToken; paymentRequest.PaymentMerchant = transactionResult.PaymentMerchant; paymentRequest.OrderId = orderId; paymentRequest.CustomerEmail = _cookieAuthentication.GetAuthenticationToken(); _orderService.SetOrderPayment(paymentRequest); } else { _logger.LogWarning(string.Format("Payment not ok for order id {0}, payment token {1}", orderId, transactionResult.PaymentToken)); } }
public void GivenTheUserCreatesARequestToRetrieveTheDetailsOfAnOrderById(int orderId) { getOrderRequest = new GetOrderRequest( request, settings.OrderingApiBaseUrl, orderId); }
public List <WaveApi> GetWaveAPI(string domainName, string Processcenterid, DateTime DateS, DateTime DateE) { try { string url = domainName + "/div/divide/getUnDividingOBPData"; var request = new GetOrderRequest { // Token = "5A9C85B6E068F2236A039E6157C5DF5B", processCenterId = Processcenterid, beginUpdateTime = DateS.ToString("yyyy-MM-dd HH:mm:ss"), endUpdateTime = DateE.ToString("yyyy-MM-dd HH:mm:ss"), }; var result = new Common.HttpHelper().Post <WaveApiResponse>(url, request); if (result.isSuccess) { return(result.data); } return(null); } catch (Exception ex) { log.Error("GetWaveAPI", ex); return(null); } }
private async Task <string> ProcessGetOrderRequest(GetOrderRequest request) { try { OrderDto orderDto = await _orderService.GetOrder(request.Order); string result; if (orderDto == null) { WebMessageBase response = new WebMessageBase("get_order"); response.Status = MessageStatus.FAIL; response.Message = "Order with ID: " + request.Order + " not found"; result = JsonConvert.SerializeObject(response, Formatting.Indented); return(result); } OrderRequestResponse orderResponse = new OrderRequestResponse("get_order", orderDto.FromDto()); result = JsonConvert.SerializeObject(orderResponse, Formatting.Indented); return(result); } catch (Exception e) { WebMessageBase response = new WebMessageBase(); response.Status = MessageStatus.FAIL; response.Message = "Could not get order !"; string result = JsonConvert.SerializeObject(response, Formatting.Indented); _log("During processing get_order request an error occured: " + e.Message); return(result); } }
public override Task <GetOrderResponse> GetOrder(GetOrderRequest request, grpc::ServerCallContext context) { var response = new GetOrderResponse(); var order = this.repository.GetOrder(request.OrderID); if (order != null) { response.OrderID = order.OrderId; response.CreatedOn = (ulong)order.CreatedOn; response.TaxRate = (uint)order.TaxRate; foreach (var li in order.LineItems) { response.LineItems.Add(new LineItem { SKU = li.SKU, Quantity = (uint)li.Quantity, UnitPrice = (uint)li.UnitPrice, }); } var status = OrderStatus.Open; if (order.Activities.FirstOrDefault(a => a.ActivityType == ActivityType.Canceled) != null) { status = OrderStatus.Canceled; } response.Status = status; } return(Task.FromResult(response)); }
public async Task <IActionResult> GetOrderAsync( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "order/{orderId}")] GetOrderRequest req) { var order = await _orderService.GetOrderAsync(req); return(new OkObjectResult(order)); }
public override async Task <GetOrderReply> GetOrder(GetOrderRequest request, ServerCallContext context) { var orders = GetOrders(); var order = orders.Find(x => x.Id == request.Id); return(order); }
public GetOrderResponse GetOrder(GetOrderRequest agor_gor) { GetOrderResponse lgor_response; lgor_response = new GetOrderResponse(); lgor_response.status = new Status(); try { IOrderServiceBusiness liosb_iosb; liosb_iosb = new OrderServiceBusiness(); lgor_response = liosb_iosb.GetOrder(agor_gor); } catch (Exception ae_e) { Exception le_e; le_e = ae_e.InnerException != null ? ae_e.InnerException : ae_e; lgor_response.status.CodeResp = "01"; lgor_response.status.MessageResp = ae_e.InnerException != null ? "Error en la ejecucion del servicio" : ae_e.Message; lgor_response.result = null; Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, "ERROR EN LA CAPA DE SERVICIO OrderService:GetOrder"); Common.CreateTrace.WriteLog(Common.CreateTrace.LogLevel.Error, " :: " + le_e.Message); } return(lgor_response); }
public void GetOrderWithJsonServClt() { GetOrderRequest request = new GetOrderRequest { Id = 1, CustomerName = "客户_1", //IsTakeAway = true, StatusCode = StatusCode.Active, CreatedDate = DateTime.Now }; OrderResponse response = null; using (JsonServiceClient client = new JsonServiceClient(listenOnUrl)) { response = client.Get <OrderResponse>(request); } if (response != null) { response.PrintDump(); } Console.WriteLine("成功获取指定的订单详情。"); Console.ReadLine(); }
public Order GetOrder(GetOrderRequest request) { // Create customer with circular reference //var cust = new Customer //{ // FirstName = "John", // LastName = "Doe", // DateOfBirth = DateTime.UtcNow //}; //cust.Orders = new List<Order> //{ // new Order // { // OrderId = "abc123", // DateTimePlaced = DateTime.UtcNow, // Customer = cust, // } //}; var order = new Order { OrderId = request.OrderId, //Customer = cust, DateTimePlaced = DateTime.Now, Skus = new List <string> { "a1", "a2" } }; return(order); }
public void PaymentCallBack(FormCollection collection) { int orderId = _paymentService.GetOrderIdFor(collection); GetOrderRequest request = new GetOrderRequest() { OrderId = orderId }; GetOrderResponse response = _orderService.GetOrder(request); OrderPaymentRequest orderPaymentRequest = response.Order.ConvertToOrderPaymentRequest(); TransactionResult transactionResult = _paymentService.HandleCallBack(orderPaymentRequest, collection); if (transactionResult.PaymentOk) { SetOrderPaymentRequest paymentRequest = new SetOrderPaymentRequest(); paymentRequest.Amount = transactionResult.Amount; paymentRequest.PaymentToken = transactionResult.PaymentToken; paymentRequest.PaymentMerchant = transactionResult.PaymentMerchant; paymentRequest.OrderId = orderId; _orderService.SetOrderPayment(paymentRequest); } else { LoggingFactory.GetLogger().Log(String.Format( "Payment not ok for order id {0}, payment token {1}", orderId, transactionResult.PaymentToken)); } }
public Task <Order> GetOrderAsync(GetOrderRequest request) { // Create customer with circular reference var cust = new Customer { FirstName = "John", LastName = "Doe", DateOfBirth = DateTime.UtcNow }; cust.Orders = new List <Order> { new Order { OrderId = "abc123", DateTimePlaced = DateTime.UtcNow, Customer = cust, } }; var order = new Order { OrderId = request.OrderId, Customer = cust, DateTimePlaced = DateTime.Now, Skus = new List <string> { "a1", "a2" } }; return(Task.FromResult(order)); }
public string InvokeGetOrder(List <string> amazonOrderIdList) { try { Console.WriteLine("Starting {0} at {1}", System.Reflection.MethodBase.GetCurrentMethod().Name, DateTime.Now); // Create a request. GetOrderRequest request = new GetOrderRequest(); request.SellerId = api.SellerId; request.MWSAuthToken = api.MWSAuthToken; request.AmazonOrderId = amazonOrderIdList; response = client.GetOrder(request); Console.WriteLine("Response:"); rhmd = response.ResponseHeaderMetadata; // Is recommended logging the request id and timestamp of every call. Console.WriteLine("RequestId: " + rhmd.RequestId); Console.WriteLine("Timestamp: " + rhmd.Timestamp); string responseXml = response.ToXML(); Console.WriteLine(responseXml); return(responseXml); } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } }
public IEnumerable <Order> GetOrders(GetOrderRequest request) { var orders = context.Orders.AsQueryable(); if (request.OrderId.HasValue) { orders = orders.Where(o => o.Id == request.OrderId); } if (!string.IsNullOrWhiteSpace(request.Username)) { orders = orders.Where(o => o.User.Username.ToLower().Equals(request.Username.ToLower())); } if (!string.IsNullOrWhiteSpace(request.ProductName)) { orders = orders.Where(o => o.Products.Any(p => p.Product.Name.ToLower().Equals(request.ProductName.ToLower()))); } if (request.StartDate.HasValue) { orders = orders.Where(o => o.CreationDate.Date >= request.StartDate); } if (request.EndDate.HasValue) { orders = orders.Where(o => o.CreationDate.Date <= request.EndDate); } return(orders); }
/// <summary> /// 查询订单详情 /// </summary> /// <param name="orderId"></param> /// <param name="openId"></param> /// <returns></returns> public HttpResponseMessage GetOrder([FromUri] GetOrderRequest request) { _logInfo.Info("获取订单详情请求" + Request.RequestUri); var viewModel = new OrderViewModel(); if (!ModelState.IsValid) { viewModel.BusinessStatus = -10000; string msg = ModelState.Values.Where(item => item.Errors.Count == 1).Aggregate(string.Empty, (current, item) => current + (item.Errors[0].ErrorMessage + "; ")); viewModel.StatusMessage = "输入参数错误," + msg; return(viewModel.ResponseToJson()); } try { var carOrder = _orderService.FindCarOrderBy(request, Request.GetQueryNameValuePairs()).ConvertToViewModel(); _logInfo.Info("获取订单详情返回值" + carOrder.ToJson()); if (carOrder != null) { viewModel.CarOrder = carOrder; viewModel.BusinessStatus = 1; } else { viewModel.BusinessStatus = -1; viewModel.StatusMessage = "无此订单信息"; } } catch (Exception ex) { viewModel.BusinessStatus = -10002; viewModel.StatusMessage = "查询订单列表失败"; } return(viewModel.ResponseToJson()); }
public IEnumerable <GetOrderResult> GetOrders(GetOrderRequest request) { var orders = orderRepository.GetOrders(request); var result = mapper.Map <IEnumerable <GetOrderResult> >(orders.ToList()); return(result); }
public GetOrderResponse GetOrder(GetOrderRequest request) { GetOrderResponse response = new GetOrderResponse(); Order order = _orderRepository.FindBy(request.OrderId); response.Order = _mapper.Map <Order, OrderView>(order); return(response); }
public ActionResult <GetOrderResponse> GetOrder(long id) { var request = new GetOrderRequest { Id = id }; var response = _service.GetOrder(request); return(response); }
public GetOrderResult GetOrder(GetOrderRequest request) { var order = _orderRepository.First(o => o.OrderNo.Equals(request.OrderNo)); GetOrderResult rs = new GetOrderResult(); rs.Data = order; return(rs); }
public override async Task <GetOrderResponse> GetOrder(GetOrderRequest request, ServerCallContext context) { var order = await _ordersRepository.GetAsync(Guid.Parse(request.Id)); return(new GetOrderResponse() { Item = GrpcMapper.MapOrder(order) }); }
public GetOrderResponse GetOrderById(GetOrderRequest request) { GetOrderResponse response = new GetOrderResponse(); OrderBusinessComponent bc = DependencyInjectionHelper.GetOrderBusinessComponent(); response.Order = OrderAdapter.OrderToDto(bc.GetOrderById(request.Id)); return(response); }
public GetTransferOrderResponse GetTransferOrderDetail(string orderid, string memberid) { GetOrderCondition info = new GetOrderCondition() { memberId = memberid, orderId = orderid }; var password = GetPassword(info.memberId); var datetime = DateTime.Now; var request = new GetOrderRequest { dataMap = info, sign = BuildSign(info, datetime, password), reqTime = datetime.ToString(DateTimeFormat) }; var jSetting = new JsonSerializerSettings(); jSetting.NullValueHandling = NullValueHandling.Ignore; var content = JsonConvert.SerializeObject(request, jSetting); _log.Debug("Post data:" + content); var config = new CommonConfig(null); var req = (HttpWebRequest)WebRequest.Create(config.JavaOrder_Uri + "queryOrdersById"); req.Method = "POST"; req.ContentType = "Application/Json"; req.Credentials = CredentialCache.DefaultCredentials; req.Timeout = 300000; // 如果服务器返回错误,他还会继续再去请求,不会使用之前的错误数据,做返回数据 //req.ServicePoint.Expect100Continue = false; WriteRequestData(req, content); var response = req.GetResponse(); if (response == null) { throw new Exception("请求失败!"); } var stream = response.GetResponseStream(); if (stream == null) { throw new Exception("请求Stream为空!"); } var sr = new StreamReader(stream, Encoding.UTF8); var retXml = sr.ReadToEnd(); sr.Close(); _log.Debug(retXml); var obj = JsonConvert.DeserializeObject <GetTransferOrderResponse>(retXml); if (obj.respCode != "0") { throw new ApplicationException(obj.respMsg); } return(obj); }
public ActionResult <GetOrderResponse> GetOrder(long id) { var getRequest = new GetOrderRequest { Id = id }; var getResponse = _orderService.GetOrder(getRequest); return(getResponse); }
public IActionResult GetOrders(GetOrderRequest request) { var res = _orderServiceDb.GetOrders(request); if (res == null) { return(BadRequest()); } return(Ok(res)); }
public GetOrderResponse GetOrder(GetOrderRequest request) { GetOrderResponse response = new GetOrderResponse(); Order order = _orderRepository.FindBy(request.OrderId); response.Order = order.ConvertToOrderView(); return(response); }
public List <Order> ListSpecificOrders(IEnumerable <string> orderIds) { var request = new GetOrderRequest { SellerId = _amazonSellerSettings.SellerId, AmazonOrderId = new OrderIdList().WithId(orderIds.Select(x => x).ToArray()) }; return(GetOrder(request)); }
public async Task <Order> GetOrder(string symbol, string origClientOrderId = null, long?orderId = null) { var req = new GetOrderRequest() { Symbol = symbol, OrigClientOrderId = origClientOrderId, OrderId = orderId }; var resp = await _connecter.PrivateRequest(req); return(JsonConvert.DeserializeObject <Order>(resp.Content)); }
public async Task <GetOrderResponse> GetOrderAsync(GetOrderRequest request, CancellationToken cancellationToken) { var order = await _orderRepository.GetByIdAsync(request.OrderId); return(new GetOrderResponse { Basket = order.Basket, Payment = order.Payment }); }
public GetOrderRespose WorkOrderProcess(GetOrderRequest GOR) { GetOrderRespose SM = new GetOrderRespose(); try { if (GOR.UserId == "" || GOR.UserId == null) { SM.Status = "Failure"; SM.Message = "Enter UserId"; return(SM); } if (GOR.WorkOrderNo == "" || GOR.WorkOrderNo == null) { SM.Status = "Failure"; SM.Message = "Invalid WorkOrderNo"; return(SM); } query = "Sp_WorkOrderWebApi"; dbcommand = new SqlCommand(query, conn); dbcommand.Connection.Open(); dbcommand.CommandType = CommandType.StoredProcedure; dbcommand.Parameters.AddWithValue("@QueryType", "WorkOrderProcess"); dbcommand.Parameters.AddWithValue("@WorkOrderNo", GOR.WorkOrderNo); dbcommand.Parameters.AddWithValue("@UserId", GOR.UserId); dbcommand.CommandTimeout = 0; SqlDataAdapter da = new SqlDataAdapter(dbcommand); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { SM.WorkOrderId = dt.Rows[0]["WorkOrderId"].ToString(); SM.WorkOrderNo = dt.Rows[0]["WorkOrderNo"].ToString(); SM.Status = "Success"; SM.Message = "Record Found"; } else { SM.Status = "Failure"; SM.Message = "Invalid WorkOrder No"; return(SM); } } catch (Exception Ex) { SM.Status = "Failure"; SM.Message = Ex.Message; } //finally //{ // //dbcommand.Connection.Close(); //} return(SM); }
public GetOrderResponse GetOrder(GetOrderRequest request) { var order = _repository.GetOrder(request.Id); var response = new GetOrderResponse() { Order = OrderApiDto.FromDomain(order) }; return response; }