public async Task <ShopVisibleOrders> GetOrdersToExportAdvancedAsync(ProcessingOptions processingOptions, AvailableExportTypes exportType, bool returnAddressesOnly, bool includeCustomerTokens, int ordersToReturn, int[] orderStatusOverride, int[] itemStatusOverride, int[] includeSupplierIds, int buyersRemorse = 60) { var orders = new ShopVisibleOrders(); includeSupplierIds = includeSupplierIds ?? new int[0]; orderStatusOverride = orderStatusOverride ?? new int[0]; itemStatusOverride = itemStatusOverride ?? new int[0]; var requestParameters = processingOptions.ToPipedStrings(exportType, buyersRemorse, includeSupplierIds, returnAddressesOnly, includeCustomerTokens, ordersToReturn, orderStatusOverride, itemStatusOverride); await ActionPolicies.GetAsync.Do(async() => { var xmlnewOrders = await this._client.GetOrdersToExportAdvancedAsync( this._credentials.ClientName, this._credentials.Guid, requestParameters ); var newOrders = XmlSerializeHelpers.Deserialize <ShopVisibleOrders>(xmlnewOrders.OuterXml); if (newOrders.Response.ResponseHasErrors && newOrders.Response.ResponseCode != "SUCCESS") { throw new Exception( string.Format( "Sync Orders. Client: {0}, Parameters: ({1}) ErrorDescription: {2}", this._credentials.ClientName, requestParameters, newOrders.Response.ResponseDescription)); } orders.Orders.AddRange(newOrders.Orders); }); return(orders); }
public async Task UpdateProductsAsync(ShopVisibleProductsInventory products) { var xml = XmlSerializeHelpers.Serialize(products); await ActionPolicies.GetAsync.Do(async() => { await this._client.SetProductInventoryAsync(this._credentials.ClientName, this._credentials.Guid, "false", xml); }); }
public ShopVisibleOrders GetOrders(DateTime startDateUtc, DateTime endDateUtc) { var orders = new ShopVisibleOrders(); ActionPolicies.Get.Do(() => { var currentStartDate = startDateUtc; while (currentStartDate < endDateUtc) { var currentEndDate = currentStartDate.AddHours(1); if (currentEndDate > endDateUtc) { currentEndDate = endDateUtc; } var xmlnewOrders = this._client.GetOrdersByDateTimeRange(this._credentials.ClientName, this._credentials.Guid, currentStartDate.ToString(CultureInfo.InvariantCulture), currentEndDate.ToString(CultureInfo.InvariantCulture), "true"); var newOrders = XmlSerializeHelpers.Deserialize <ShopVisibleOrders>(xmlnewOrders.OuterXml); if (newOrders.Response.ResponseHasErrors && newOrders.Response.ResponseCode != "SUCCESS") { throw new Exception( string.Format( "Sync Orders. Client: {0}, DateRange: ({1};{2}), IterationDateRange: ({3};{4}), ErrorDescription: {5}", this._credentials.ClientName, startDateUtc, endDateUtc, currentStartDate, currentEndDate, newOrders.Response.ResponseDescription)); } orders.Orders.AddRange(newOrders.Orders); currentStartDate = currentEndDate; } if (this.ConcatModifiedOrders(startDateUtc, endDateUtc)) { var xmlmodifiedOrders = this._client.GetChangedOrdersByDateRange(this._credentials.ClientName, this._credentials.Guid, startDateUtc.ToString(CultureInfo.InvariantCulture), endDateUtc.ToString(CultureInfo.InvariantCulture), "true"); var modifiedOrders = XmlSerializeHelpers.Deserialize <ShopVisibleOrders>(xmlmodifiedOrders.OuterXml); if (modifiedOrders.Response.ResponseHasErrors && modifiedOrders.Response.ResponseCode != "SUCCESS") { throw new Exception(string.Format( "Sync Changed Orders. Client: {0}, DateRange: ({1};{2}), ErrorDescription: {3}", this._credentials.ClientName, startDateUtc, endDateUtc, modifiedOrders.Response.ResponseDescription)); } orders.Orders.AddRange(modifiedOrders.Orders); } }); return(orders); }
public async Task <List <ShopVisibleProductInventory> > GetInventoryAsync() { var inventory = new ShopVisibleProductsInventory(); await ActionPolicies.GetAsync.Do(async() => { var xmlInventory = await this._client.GetProductInventoryAsync(this._credentials.ClientName, this._credentials.Guid); inventory = XmlSerializeHelpers.Deserialize <ShopVisibleProductsInventory>(xmlInventory.OuterXml); }); return(inventory.Products); }
public List <ShopVisibleProductInventory> GetInventory() { var inventory = new ShopVisibleProductsInventory(); ActionPolicies.Submit.Do(() => { var xmlInventory = this._client.GetProductInventory(this._credentials.ClientName, this._credentials.Guid); inventory = XmlSerializeHelpers.Deserialize <ShopVisibleProductsInventory>(xmlInventory.OuterXml); }); return(inventory.Products); }
public bool IsInventoryReceived() { try { var xmlInventory = this._client.GetProductInventory(this._credentials.ClientName, this._credentials.Guid); XmlSerializeHelpers.Deserialize <ShopVisibleProductsInventory>(xmlInventory.OuterXml); return(true); } catch (Exception) { return(false); } }
public bool IsOrdersReceived() { try { var endDateUtc = DateTime.UtcNow.AddMinutes(-5); var startDateUtc = endDateUtc.AddHours(-1); var xmlnewOrders = this._client.GetOrdersByDateTimeRange(this._credentials.ClientName, this._credentials.Guid, startDateUtc.ToString(CultureInfo.InvariantCulture), endDateUtc.ToString(CultureInfo.InvariantCulture), "true"); var newOrders = XmlSerializeHelpers.Deserialize <ShopVisibleOrders>(xmlnewOrders.OuterXml); if (newOrders.Response.ResponseHasErrors && newOrders.Response.ResponseCode != "SUCCESS") { return(false); } return(true); } catch (Exception) { return(false); } }
public void UpdateProducts(ShopVisibleProductsInventory products) { var xml = XmlSerializeHelpers.Serialize(products); ActionPolicies.Submit.Do(() => this._client.SetProductInventory(this._credentials.ClientName, this._credentials.Guid, "false", xml)); }