Ejemplo n.º 1
0
        public RetrieveProductsCommand(SkubanaConfig config, IEnumerable <string> skus) : base(config, SkubanaEndpoint.RetrieveProductsUrl)
        {
            Condition.Requires(skus, "skus").IsNotNull().IsNotEmpty();

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "sku", string.Join(",", skus.Select(s => $"\"{ s }\"")) }
            };
            this.Throttler = new Throttling.Throttler(5, 1);
        }
Ejemplo n.º 2
0
        protected SkubanaCommand(SkubanaConfig config, string relativeUrl, Dictionary <string, string> requestParameters, object payload, bool isApiCommand = true)
        {
            Condition.Requires(config, "config").IsNotNull();
            Condition.Requires(relativeUrl, "relativeUrl").IsNotNullOrEmpty();

            this.Config            = config;
            this.RelativeUrl       = relativeUrl;
            this.RequestParameters = requestParameters;
            this.Payload           = payload;
            this._isApiCommand     = isApiCommand;
        }
Ejemplo n.º 3
0
        public GetProductStockCommand(SkubanaConfig config, string sku, long warehouseId) : base(config, SkubanaEndpoint.RetrieveProductStockUrl)
        {
            Condition.Requires(sku, "sku").IsNotNullOrEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "sku", sku },
                { "warehouseId", warehouseId.ToString() }
            };
        }
        public RetrieveProductsUpdatedAfterCommand(SkubanaConfig config, DateTime updatedAfterUtc, int page, int limit) : base(config, SkubanaEndpoint.RetrieveProductsUrl)
        {
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "modifiedDateFrom", updatedAfterUtc.ConvertDateTimeToStr() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
        public GetAccessTokenCommand(SkubanaConfig config, string redirectUrl, string code) : base(config, SkubanaEndpoint.GetAccessTokenUrl, null, null, isApiCommand: false)
        {
            Condition.Requires(redirectUrl, "redirectUrl").IsNotNullOrEmpty();
            Condition.Requires(code, "code").IsNotNullOrEmpty();

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "grant_type", "authorization_code" },
                { "redirect_uri", redirectUrl },
                { "code", code }
            };
        }
Ejemplo n.º 6
0
        public RetrieveProductsStocksTotalCommand(SkubanaConfig config, long warehouseId, int page, int limit) : base(config, SkubanaEndpoint.GetProductsStocksTotalUrl)
        {
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "warehouseId", warehouseId.ToString() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
Ejemplo n.º 7
0
        public RetrieveOrdersCommand(SkubanaConfig config, DateTime startDateUtc, DateTime endDateUtc, long warehouseId, int page, int limit) : base(config, SkubanaEndpoint.RetrieveOrdersUrl)
        {
            Condition.Requires(endDateUtc, "endDateUtc").IsGreaterThan(startDateUtc);
            Condition.Requires(warehouseId, "warehouseId").IsNotEqualTo(0);
            Condition.Requires(page, "page").IsGreaterOrEqual(1);
            Condition.Requires(limit, "limit").IsGreaterOrEqual(1);

            this.RequestParameters = new Dictionary <string, string>()
            {
                { "modifiedDateFrom", startDateUtc.ConvertDateTimeToStr() },
                { "modifiedDateTo", endDateUtc.ConvertDateTimeToStr() },
                { "warehouseId", warehouseId.ToString() },
                { "page", page.ToString() },
                { "limit", limit.ToString() }
            };
        }
Ejemplo n.º 8
0
        public AdjustProductsStockCommand(SkubanaConfig config, IEnumerable <SkubanaProductStock> skusQuantities, long warehouseId) : base(config, SkubanaEndpoint.AdjustProductStockUrl)
        {
            Condition.Requires(skusQuantities, "skusQuantities").IsNotNull().IsNotEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            var body = new List <AdjustProductStockRequestBodyItem>();

            foreach (var skuQuantity in skusQuantities)
            {
                body.Add(new AdjustProductStockRequestBodyItem()
                {
                    MasterSku         = skuQuantity.ProductSku,
                    OnHandQuantity    = skuQuantity.OnHandQuantity > maxQuantity ? maxQuantity : skuQuantity.OnHandQuantity,
                    WarehouseId       = warehouseId,
                    StockLocationName = skuQuantity.LocationName
                });
            }

            this.Payload = body;
        }
Ejemplo n.º 9
0
        public CreateProductsStockCommand(SkubanaConfig config, IEnumerable <SkubanaProductStock> productsStock, long warehouseId) : base(config, SkubanaEndpoint.CreateProductStockUrl)
        {
            Condition.Requires(productsStock, "productsStock").IsNotNull().IsNotEmpty();
            Condition.Requires(warehouseId, "warehouseId").IsGreaterThan(0);

            var body = new List <CreateProductStockRequestBodyItem>();

            foreach (var productStock in productsStock)
            {
                body.Add(new CreateProductStockRequestBodyItem()
                {
                    ProductId         = productStock.ProductId,
                    Quantity          = productStock.OnHandQuantity > maxQuantity ? maxQuantity : productStock.OnHandQuantity,
                    WarehouseId       = warehouseId,
                    StockLocationName = productStock.LocationName,
                    Pickable          = true,
                    Receivable        = true
                });
            }
            ;

            this.Payload = body;
        }
Ejemplo n.º 10
0
 public OrdersService(SkubanaConfig config) : base(config)
 {
 }
Ejemplo n.º 11
0
 public ListWarehousesCommand(SkubanaConfig config) : base(config, SkubanaEndpoint.ListWarehousesUrl)
 {
     this.Throttler = new Throttling.Throttler(5, 1);
 }
Ejemplo n.º 12
0
 public IGlobalService CreateGlobalService(SkubanaConfig config)
 {
     return(new GlobalService(config));
 }
Ejemplo n.º 13
0
 public IInventoryService CreateInventoryService(SkubanaConfig config)
 {
     return(new InventoryService(config));
 }
Ejemplo n.º 14
0
 public IAuthenticationService CreateAuthenticationService(SkubanaConfig config, SkubanaAppCredentials appCredentials)
 {
     return(new AuthenticationService(config, appCredentials));
 }
Ejemplo n.º 15
0
 protected SkubanaCommand(SkubanaConfig config, string relativeUrl, object payload) : this(config, relativeUrl, null, payload)
 {
 }
Ejemplo n.º 16
0
 public IProductsService CreateProductsService(SkubanaConfig config)
 {
     return(new ProductsService(config));
 }
Ejemplo n.º 17
0
 public ServiceBaseWithTokenAuth(SkubanaConfig config) : base(config)
 {
 }
Ejemplo n.º 18
0
        public ServiceBaseWithBasicAuth(SkubanaConfig config, SkubanaAppCredentials appCredentials) : base(config)
        {
            Condition.Requires(appCredentials, "appCredentials").IsNotNull();

            this.AppCredentials = appCredentials;
        }
Ejemplo n.º 19
0
 public IOrdersService CreateOrdersService(SkubanaConfig config)
 {
     return(new OrdersService(config));
 }
Ejemplo n.º 20
0
 protected SkubanaCommand(SkubanaConfig config, string relativeUrl) : this(config, relativeUrl, null, null)
 {
 }
Ejemplo n.º 21
0
 public ProductsService(SkubanaConfig config) : base(config)
 {
 }
Ejemplo n.º 22
0
 public InventoryService(SkubanaConfig config) : base(config)
 {
 }
Ejemplo n.º 23
0
 public GlobalService(SkubanaConfig config) : base(config)
 {
 }