public ResponseInfo <FeeResponseDatamap> GetFee(string ordertype, string amount, string providerid, int orderfrom, string memberId = null) { var config = new ApiSetting(null); FeeRequestDatamap info = new FeeRequestDatamap() { orderType = ordertype, amount = amount, providerCode = providerid, memberId = memberId == null ? config.DefaultMemberId : memberId }; var response = SecurityHttpClient.Post <FeeRequestDatamap, FeeResponseDatamap>(config.JavaFee_Uri, info, orderfrom.ToString(), "v1"); switch (response.respCode) { case "CS00002": throw new ErrorCodeException(response.respCode, "金额不能为空"); case "CS00004": throw new ErrorCodeException(response.respCode, "请求来源不能为空"); case "CS00005": throw new ErrorCodeException(response.respCode, "订单类型不能为空"); case "00006": throw new ErrorCodeException(response.respCode, "版本信息错误"); case "00002": throw new ErrorCodeException(response.respCode, "Java获取数据超时,请稍后重试!"); } return(response); }
public ResponseInfo <CreateOrderOrderResult> CreateOrder(OrderInfo orderinfo) { _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfo)); ApiSetting setting = new ApiSetting(null); if (string.IsNullOrWhiteSpace(orderinfo.memberId)) { orderinfo.memberId = setting.DefaultMemberId; orderinfo.memberName = "匿名用户"; } var datmap = new CreateOrderDatamap() { memberId = orderinfo.memberId, orderList = new OrderInfo[] { orderinfo } }; var response = SecurityHttpClient.Post <CreateOrderDatamap, CreateOrderOrderResult>(setting.JavaOrder_Uri + "generateOrder", datmap); if (response == null) { throw new ApplicationException("调用java下单接口失败!"); } if (response.respCode != "0") { throw new ApplicationException("调用java下单接口失败!" + response.respCode + ":" + response.respMsg); } if (response.dataMap == null) { throw new ApplicationException("调用java下单接口失败!返回数据为null"); } response.dataMap.orderId = response.dataMap.orderIds.First().Value; return(response); }
public ActionResult LostCoffee(CoffeeInit req) { var clientInfo = this.TempData["ClientInfo"] as ClientInfo; string EtmID = clientInfo.EtmCode; //string EtmID = "ETM0027"; var list = ObjectXmlSerializer.LoadFromXml <List <CoffeeInit> >(Server.MapPath("~/cache/Coffee.xml")); if (list.Find(o => o.EtmID == EtmID).CupNumber < req.CupNumber) { return(this.Json(new { retCode = 1, Message = "提交失败,饮品剩余数量不足!" })); } list.Find(o => o.EtmID == EtmID).CupNumber -= req.CupNumber; //检测剩余杯数,发短信 try { if (list.Find(o => o.EtmID == EtmID).CupNumber <= int.Parse(ConfigurationManager.AppSettings["EnableSmsCupNumber"]) && list.Find(o => o.EtmID == EtmID).SendSMS == "0" && ConfigurationManager.AppSettings["EnableSms"] == "true") { list.Find(o => o.EtmID == EtmID).CupNumber = 1; const string takedateUrl = "api/Coffee/SendSms"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var resultT = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, EtmID); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(resultT.dataMap))); } } catch (Exception ex) { Logger.Write(Log.Log_Type.Info, string.Format("短信发送失败etmid={0},err={1}", EtmID, ex.ToString())); } Logger.Write(Log.Log_Type.Info, string.Format("减库存etmid={0},CupNumber={1}", EtmID, req.CupNumber)); ObjectXmlSerializer.SaveToXml <List <CoffeeInit> >(Server.MapPath("~/cache/Coffee.xml"), list); return(this.Json(new { retCode = 0, Message = "成功" })); }
public ResponseInfo <GetOrdersDatamap> Gets(GetOrdersCondition condition) { var config = new ApiSetting(null); var response = SecurityHttpClient.Post <GetOrdersCondition, GetOrdersDatamap>(config.JavaOrder_Uri + "queryOrders", condition); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <CreateOrderOrderResult> CreateMallOrder(MallOrderInfos orderinfos) { _log.Debug("order data:" + JsonConvert.SerializeObject(orderinfos)); var config = new ApiSetting(null); var response = SecurityHttpClient.Post <MallOrderInfos, CreateOrderOrderResult>(config.JavaOrder_Uri + "generateOrder", orderinfos); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
/// <summary> /// 完成回调 /// </summary> /// <param name="groupId"></param> /// <returns></returns> public ActionResult FinishCallBack(string groupId) { const string takedateUrl = "api/Coffee/FinishCallBack"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, groupId); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); return(Json(result.dataMap)); }
public void HandleShip(string orderid, string memberid) { var config = new ApiSetting(null); HandleShipRequest info = new HandleShipRequest() { orderId = orderid, memberId = memberid }; var response = SecurityHttpClient.Post <HandleShipRequest, HandleShipResponse>(config.JavaOrder_Uri + "convenShipping", info, "1", "v1"); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } }
public ResponseInfo <TransferorderDatamap> GetTransferOrderDetail(string orderid, string memberid) { GetOrderCondition info = new GetOrderCondition() { memberId = memberid, orderId = orderid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <GetOrderCondition, TransferorderDatamap>(config.JavaOrder_Uri + "queryOrdersById", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <RefundOrderDatamap> Refund(string orderid, string memberid) { RefundOrderInfo info = new RefundOrderInfo() { orderId = orderid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <RefundOrderInfo, RefundOrderDatamap>(config.JavaOrder_Uri + "orderStatusRefund", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <CancelOrderDatamap> Cancel(string orderid, string memberid) { CancelOrderInfo info = new CancelOrderInfo() { memberId = memberid, orderId = orderid }; ApiSetting setting = new ApiSetting(null); var response = SecurityHttpClient.Post <CancelOrderInfo, CancelOrderDatamap>(setting.JavaOrder_Uri + "cancel", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <FinishOrderDatamap> Finish(string orderid, string memberid, string provideid) { FinishOrderInfo info = new FinishOrderInfo() { memberId = memberid, orderId = orderid, providerId = provideid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <FinishOrderInfo, FinishOrderDatamap>(config.JavaOrder_Uri + "finishedCall", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ResponseInfo <UpdateProviderResopneBody> UpdateProvider(string orderid, string memberid, string providerid) { var info = new SendSupplierBody() { memberId = memberid, orderId = orderid, providerId = providerid }; var config = new ApiSetting(null); var response = SecurityHttpClient.Post <SendSupplierBody, UpdateProviderResopneBody>(config.JavaOrder_Uri + "updateProviderId", info); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } return(response); }
public ActionResult UpdateOrderStatus() { string OrderId = Request.QueryString["OrderId"]; Logger.Write(Log.Log_Type.Info, string.Format("更新订单{0}", OrderId)); if (!string.IsNullOrWhiteSpace(OrderId)) { const string takedateUrl = "api/Coffee/FinishCallBack"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <string, ResponseData <string> >(fullPath, OrderId); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); ViewData["pageData"] = result; } return(View()); }
public ActionResult OrderPost(CoffeeOrder ord) { var clientInfo = this.TempData["ClientInfo"] as ClientInfo; ord.CreateIP = clientInfo.Ip; ord.OrderETMID = clientInfo.EtmCode; //ord.OrderETMID = "ETM0027"; //ord.OrderFrom = 1; const string takedateUrl = "api/Coffee/OrderPost"; var fullPath = ETong.Coffee.Web.Models.Config.GetApiFullPath(takedateUrl); var client = new HttpClientUtility(new Uri(fullPath)); Logger.Write(Log.Log_Type.Info, string.Format("调用{0}", fullPath)); var result = SecurityHttpClient.Post <CoffeeOrder, OrderGroupResult>(fullPath, ord); Logger.Write(Log.Log_Type.Info, string.Format("{0}结束,result={1}", fullPath, Json(result.dataMap))); return(Json(result)); }
/// <summary> /// 通知发货失败 /// </summary> /// <param name="orderid">订单号</param> /// <param name="memberid">会员号</param> /// <param name="errormessage">错误信息</param> /// <param name="isReverseFail">是否冲正失败</param> public void NotifyShipFail(string orderid, string memberid, string errormessage, bool isReverseFail) { var config = new ApiSetting(null); ShipFailRequest info = new ShipFailRequest() { orderId = orderid, memberId = memberid }; info.orderSubStatus = "2"; if (isReverseFail) { info.orderSubStatus = "3"; } info.failReason = errormessage; var response = SecurityHttpClient.Post <ShipFailRequest, ShipFailResponse>(config.JavaOrder_Uri + "convenShippingFail", info, "1", "v1"); if (response.respCode != "0") { throw new ApplicationException(response.respMsg); } }
private static ResponseInfo <string> Execute(testobject o) { //直接调用 return(SecurityHttpClient.Post <testobject, string>("http://localhost:27215/api/Values?ak=1", o)); }