/// <summary> /// Constructor. /// </summary> /// <remarks> /// Either variantId or sku must be specified. /// </remarks> /// <param name="price">Price</param> /// <param name="variantId">Product variant ID</param> /// <param name="sku">Product variant SKU</param> public AddPriceAction(PriceDraft price, int?variantId = null, string sku = null) { if (!variantId.HasValue && string.IsNullOrWhiteSpace(sku)) { throw new ArgumentException("Either variantId or sku are required"); } this.Action = "addPrice"; this.VariantId = variantId; this.Sku = sku; this.Price = price; }
public static PriceDraft GetPriceDraft(int centAmount, DateTime?validFrom = null, DateTime?validUntil = null, string currency = "EUR", string country = null) { var money = new Money() { CentAmount = centAmount, CurrencyCode = currency }; var priceDraft = new PriceDraft() { Value = money, ValidFrom = validFrom, ValidUntil = validUntil, Country = country }; return(priceDraft); }
/// <summary> /// Get Random Price Draft /// </summary> /// <returns></returns> internal PriceDraft GetRandomPriceDraft() { var money = new Money() { CentAmount = this.RandomInt(1000, 5000), CurrencyCode = "EUR" }; var priceDraft = new PriceDraft() { Value = money, //Country = "DE", ValidFrom = DateTime.Today.AddMonths(this.RandomInt(-5, -1)), ValidUntil = DateTime.Today.AddMonths(this.RandomInt(1, 5)) }; return(priceDraft); }
public AddPriceUpdateAction(int variantId, PriceDraft price, bool staged = true) : this(price, staged) { this.Sku = null; this.VariantId = variantId; }
public AddPriceUpdateAction(string sku, PriceDraft price, bool staged = true) : this(price, staged) { this.Sku = sku; }
private AddPriceUpdateAction(PriceDraft price, bool staged = true) { this.Price = price; this.Staged = staged; }
/// <summary> /// Constructor. /// </summary> /// <param name="priceId">Price ID</param> /// <param name="price">Price</param> public ChangePriceAction(string priceId, PriceDraft price) { this.Action = "changePrice"; this.PriceId = priceId; this.Price = price; }