public void Test_PostOrderToShipStation() { // arrange var shipstationService = new ShipStationService(); // act var result = shipstationService.PostOrderToShipStation(); }
public JsonResult _CreateShipmentLabel(string orderId) { var shipstationService = new ShipStationService(); var base64ResultStringTask = shipstationService.CreateShipmentLabel(orderId); base64ResultStringTask.Wait(); return(Json(new { base64ResultString = base64ResultStringTask.Result }, JsonRequestBehavior.AllowGet)); }
public async Task GivenShipStationOrdersServiceWithInternalErrors_WhenGetOrdersAsyncCalled_ThenOrdersReturnedWithoutSkippedOrder() { var totalOrders = 120; var ordersPosWithErrors = new int[] { 17, 50, 67, 119 }; var serverStub = PrepareShipStationServerStub(totalOrders, ordersPosWithErrors); var service = new ShipStationService(this._credentials, new ShipStationTimeouts(), serverStub); var orders = await service.GetOrdersAsync(DateTime.UtcNow.AddDays(-1), DateTime.UtcNow, CancellationToken.None, getShipmentsAndFulfillments : true); orders.Count().Should().Be(totalOrders - ordersPosWithErrors.Length); }
public JsonResult _PostShipStation(string orderId) { var shipstationService = new ShipStationService(); var result = 0; if (!shipstationService.IsOrderExistingInShipStation(orderId) && !shipstationService.IsTrackingExistOrderNumber(orderId)) { var resultTask = shipstationService.PostOrderToShipStationByOrderNumber(orderId); resultTask.Wait(); result = resultTask.Result; } return(Json(new { result = result })); }
public async Task GivenShipStationOrdersServiceWithInternalErrors_WhenDownloadOrdersAsyncCalled_ThenOrderPageWasSkipped() { var ordersPosWithErrors = new int[] { 62, 84 }; var totalExpectedOrders = 100; var serverStub = PrepareShipStationServerStub(totalExpectedOrders, ordersPosWithErrors); var service = new ShipStationService(this._credentials, new ShipStationTimeouts(), serverStub); var createdOrdersResponse = await service.GetCreatedOrdersAsync(DateTime.UtcNow.AddDays(-30), DateTime.UtcNow, CancellationToken.None); createdOrdersResponse.ReadErrors.Count.Should().Be(ordersPosWithErrors.Length); for (int i = 0; i < ordersPosWithErrors.Length; i++) { createdOrdersResponse.ReadErrors[i].Page.Should().Be(ordersPosWithErrors[i] + 1); createdOrdersResponse.ReadErrors[i].PageSize.Should().Be(1); } createdOrdersResponse.TotalEntitiesExpected.Should().Be(totalExpectedOrders); }
//[TestMethod] public void ShouldCreateShipmentLabelByOrderNumber() { // Arrange var shippingStationOrder = new ShipStationService(); Task <string> result_task; string result = ""; var orderNumber = "112-7461785-3785061"; //Act result_task = shippingStationOrder.CreateShipmentLabel(orderNumber); result_task.Wait(); result = result_task.Result; //Assert //Assert.IsTrue(result != ""); }
private async void DeleteCancelledOrders(List <MarketplaceOrder> ordersResults) { var shipStationService = new ShipStationService(); var orderId = ""; var marketPlace = ""; try { ordersResults = ordersResults.Where(o => o.OrderStatus == OrderStatus.Canceled).ToList(); if (ordersResults.Count > 0) { marketPlace = ordersResults.FirstOrDefault().Marketplace; foreach (var order in ordersResults) { orderId = order.OrderId; var shipStationTask = await shipStationService.DeleteOrderByOrderNumber(orderId); } } } catch (Exception ex) { _logger.LogError(LogEntryType.General, string.Format("Error in deleting orders for {1} to ShipStation. Order ID: {2}, Error message: {0}", EisHelper.GetExceptionMessage(ex), marketPlace, orderId), ex.StackTrace); _emailService.SendEmailAdminException(subject: string.Format("{0} - Delete ShipStation Order From Marketplaces Error", marketPlace), exParam: ex, useDefaultTemplate: true, url: "DeleteCancelledOrders Method", userName: string.Format("OrdersService , Order Id: {0}", orderId)); } }
public void DeleteShipStationOrder(string orderId) { //delete order from ship station try { var shipStationService = new ShipStationService(); var shipStationTask = shipStationService.DeleteOrderByOrderNumber(orderId); shipStationTask.Wait(); } catch (Exception ex) { var description = string.Format("{0} - Error in submitting delete order feed to Shipstation with OrderId: {1}. \nError Message: {2}", ChannelName, orderId, (ex.InnerException != null ? string.Format("{0} <br/>Inner Message: {1}", ex.Message, ex.InnerException.Message) : ex.Message)); _logger.Add(LogEntrySeverity.Error, LogEntryType.EshopoOrders, description, ex.StackTrace); _emailService.SendEmailAdminException(subject: "Eshopo - Delete ShipStation Order Error", exParam: ex, useDefaultTemplate: true, url: "/orders", userName: String.Format("Order Id: {0}", orderId)); } }
public ShipStationOrders() { _marketplaceMode = ConfigurationManager.AppSettings["MarketplaceMode"]; _shipStationService = new ShipStationService(); }