/// <summary>
        ///
        /// </summary>
        /// <param name="currencyCode">The three character ISO currency code, such as USD for US Dollars.</param>
        /// <param name="productCode">The unique, user-defined product code of a product, used throughout  to reference and associate to a product.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="variationKey">System-generated key that represents the attribute values that uniquely identify a specific product variation.</param>
        /// <param name="localizedPrice">The details of the product variation localized price.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var productvariation = new ProductVariation();
        ///   var productVariationFixedPrice = await productvariation.UpdateProductVariationLocalizedPriceAsync(_dataViewMode,  localizedPrice,  productCode,  variationKey,  currencyCode,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice> UpdateProductVariationLocalizedPriceAsync(Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice localizedPrice, string productCode, string variationKey, string currencyCode, string responseFields = null, CancellationToken ct = default(CancellationToken))
        {
            MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice> response;
            var client = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.UpdateProductVariationLocalizedPriceClient(_dataViewMode, localizedPrice, productCode, variationKey, currencyCode, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync(ct).ConfigureAwait(false);

            return(await response.ResultAsync());
        }
        /// <summary>
        /// Updates the localized price value for a product variation and a specific localized currency.
        /// <example>
        ///  <code>
        /// var result = ProductVariationFactory.UpdateProductVariationLocalizedPrice(handler : handler,  localizedPrice :  localizedPrice,  productCode :  productCode,  variationKey :  variationKey,  currencyCode :  currencyCode,  responseFields :  responseFields,  dataViewMode: dataViewMode,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<ProductVariationFixedPrice/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice UpdateProductVariationLocalizedPrice(ServiceClientMessageHandler handler,
                                                                                                                      Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice localizedPrice, string productCode, string variationKey, string currencyCode, string responseFields = null, DataViewMode dataViewMode = DataViewMode.Live,
                                                                                                                      HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
        {
            SetSdKparameters();
            var currentClassName  = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;

            Debug.WriteLine(currentMethodName + '.' + currentMethodName);
            var apiClient = Mozu.Api.Clients.Commerce.Catalog.Admin.Products.ProductVariationClient.UpdateProductVariationLocalizedPriceClient(
                localizedPrice:  localizedPrice, productCode:  productCode, variationKey:  variationKey, currencyCode:  currencyCode, responseFields:  responseFields, dataViewMode: dataViewMode);

            try
            {
                apiClient.WithContext(handler.ApiContext).Execute();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                {
                    throw customException;
                }
                return(null);
            }
            return(ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="currencyCode">The three character ISO currency code, such as USD for US Dollars.</param>
        /// <param name="productCode">The unique, user-defined product code of a product, used throughout  to reference and associate to a product.</param>
        /// <param name="responseFields">Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.</param>
        /// <param name="variationKey">System-generated key that represents the attribute values that uniquely identify a specific product variation.</param>
        /// <param name="localizedPrice">The details of the product variation localized price.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=UpdateProductVariationLocalizedPrice(dataViewMode,  localizedPrice,  productCode,  variationKey,  currencyCode,  responseFields);
        ///   var productVariationFixedPriceClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice> UpdateProductVariationLocalizedPriceClient(DataViewMode dataViewMode, Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice localizedPrice, string productCode, string variationKey, string currencyCode, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Catalog.Admin.Products.ProductVariationUrl.UpdateProductVariationLocalizedPriceUrl(productCode, variationKey, currencyCode, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.ProductAdmin.ProductVariationFixedPrice>(localizedPrice).WithHeader(Headers.X_VOL_DATAVIEW_MODE, dataViewMode.ToString())
            ;

            return(mozuClient);
        }