public void NotifyPaid(OPC_Sale saleOrder, bool enbaleCashingTimeRange, TimeSpan bein, TimeSpan end) { if (enbaleCashingTimeRange && !IsInCashingTimeRange(bein, end)) { return; } Logger.InfoFormat("Notify paid to it sale order no:{0}", saleOrder.SaleOrderNo); var apiClient = new DefaultApiClient(); var rsp = apiClient.Post(new OrderNotifyRequest() { Data = new PaidOrderNotificationEntity(saleOrder).CreateNotifiedEntity() }, true); if (rsp == null) { NotifyFailed(saleOrder, SaleOrderNotificationStatus.PaidFailed, apiClient.ErrorList()); return; } if (!rsp.Status) { Logger.Error(rsp.Data); Logger.Error(rsp.Message); var errors = new List <string> { rsp.Data, rsp.Message }; errors.AddRange(apiClient.ErrorList().Where(x => !string.IsNullOrEmpty(x))); NotifyFailed(saleOrder, SaleOrderNotificationStatus.PaidFailed, errors); return; } SaleOrderNotified(saleOrder, SaleOrderNotificationStatus.Paid); }
public void TestMethod1() { var client = new DefaultApiClient("http://guide.intime.com.cn:8008/production-o2o-rs/api/", "intime", "intime"); var reponse = client.Post(new GetProductsRequest() { Data = new GetProductsRequestData() { PageIndex = 1, LastUpdate = "2013-11-11", PageSize = 20 } }); client.Post(new GetProductsRequest() { Data = new GetProductsRequestData() { PageIndex = 1, LastUpdate = "2013-11-15", PageSize = 20 } }); client.Post(new GetStoresRequest() { Data = new GetStoresRequestData() { PageIndex = 1, PageSize = 20 } }); client.Post(new GetProductImagesRequest() { Data = new GetProductImagesRequestData() { PageIndex = 1, PageSize = 20, LastUpdate = "2013-11-15" } }); String message = reponse.Message; }
public void NotifyPaid(OPC_RMA saleRMA) { var apiClient = new DefaultApiClient(); var rsp = apiClient.Post(new OrderNotifyRequest { Data = new PaidRMANotificationEntity(saleRMA).CreateNotifiedEntity() }); if (!rsp.Status) { Logger.Error(rsp.Data); Logger.Error(rsp.Message); return; } SaleRMAPaidNotified(saleRMA); }
public void NotifyCreate(OPC_Sale saleOrder) { var entity = new CreateOrderNotificationEntity(saleOrder).CreateNotifiedEntity(); var apiClient = new DefaultApiClient(); try { var rsp = apiClient.Post(new OrderNotifyRequest() { Data = entity }, true); if (rsp == null) { Logger.Error("通知订单失败,信息部返回NULL"); NotifyFailed(saleOrder, SaleOrderNotificationStatus.CreateFailed, apiClient.ErrorList()); return; } if (!rsp.Status) { Logger.Error(rsp.Data); Logger.Error(rsp.Message); var errors = new List <string> { rsp.Data, rsp.Message }; errors.AddRange(apiClient.ErrorList().Where(x => !string.IsNullOrEmpty(x))); NotifyFailed(saleOrder, SaleOrderNotificationStatus.CreateFailed, errors); return; } } catch (Exception e) { Logger.Error(e); NotifyFailed(saleOrder, SaleOrderNotificationStatus.ExceptionThrow, new[] { e.Message }); return; } SaleOrderNotified(saleOrder, SaleOrderNotificationStatus.Create); }