コード例 #1
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = B2BAccountFactory.DeleteB2BAccountAttribute(handler : handler,  accountId :  accountId,  attributeFQN :  attributeFQN,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<void/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static void DeleteB2BAccountAttribute(ServiceClientMessageHandler handler,
                                                     int accountId, string attributeFQN,
                                                     HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent)
        {
            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.Customer.B2BAccountClient.DeleteB2BAccountAttributeClient(
                accountId:  accountId, attributeFQN:  attributeFQN);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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;
                }
            }
            var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null;
        }
コード例 #2
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = B2BAccountFactory.GetB2BAccounts(handler : handler,  startIndex :  startIndex,  pageSize :  pageSize,  sortBy :  sortBy,  filter :  filter,  fields :  fields,  q :  q,  qLimit :  qLimit,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<B2BAccountCollection/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Customer.B2BAccountCollection GetB2BAccounts(ServiceClientMessageHandler handler,
                                                                                      int?startIndex = null, int?pageSize = null, string sortBy = null, string filter = null, string fields = null, string q = null, int?qLimit = null, string responseFields = null,
                                                                                      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.Customer.B2BAccountClient.GetB2BAccountsClient(
                startIndex:  startIndex, pageSize:  pageSize, sortBy:  sortBy, filter:  filter, fields:  fields, q:  q, qLimit:  qLimit, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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>
        ///
        /// <example>
        ///  <code>
        /// var result = B2BAccountFactory.UpdateUser(handler : handler,  user :  user,  accountId :  accountId,  userId :  userId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<B2BUser/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Customer.B2BUser UpdateUser(ServiceClientMessageHandler handler,
                                                                     Mozu.Api.Contracts.Customer.B2BUser user, int accountId, string userId, string responseFields = null,
                                                                     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.Customer.B2BAccountClient.UpdateUserClient(
                user:  user, accountId:  accountId, userId:  userId, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #4
0
        /// <summary>
        /// Resets the password for a customer account.
        /// <example>
        ///  <code>
        /// var result = CustomerAccountFactory.ResetPassword(handler : handler,  resetPasswordInfo :  resetPasswordInfo,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<void/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static void ResetPassword(ServiceClientMessageHandler handler,
                                         Mozu.Api.Contracts.Customer.ResetPasswordInfo resetPasswordInfo,
                                         HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent)
        {
            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.Customer.CustomerAccountClient.ResetPasswordClient(
                resetPasswordInfo:  resetPasswordInfo);

            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;
                }
            }
            var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null;
        }
コード例 #5
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = LocationInventoryFactory.GetLocationInventory(handler : handler,  productCode :  productCode,  locationCode :  locationCode,  responseFields :  responseFields,  dataViewMode: dataViewMode,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<LocationInventory/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductAdmin.LocationInventory GetLocationInventory(ServiceClientMessageHandler handler,
                                                                                             string productCode, string locationCode, 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.LocationInventoryClient.GetLocationInventoryClient(
                productCode:  productCode, locationCode:  locationCode, responseFields:  responseFields, dataViewMode: dataViewMode);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #6
0
        /// <summary>
        /// Retrieves a list of the taxable territories configured for the site.
        /// <example>
        ///  <code>
        /// var result = TaxableTerritoryFactory.GetTaxableTerritories(handler : handler,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<List<TaxableTerritory>/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static List <Mozu.Api.Contracts.SiteSettings.General.TaxableTerritory> GetTaxableTerritories(ServiceClientMessageHandler handler,

                                                                                                            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.Settings.General.TaxableTerritoryClient.GetTaxableTerritoriesClient(
                );

            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);
        }
コード例 #7
0
        /// <summary>
        /// Retrieves the current login state of a customer account by providing the customer's email address.
        /// <example>
        ///  <code>
        /// var result = CustomerAccountFactory.GetLoginStateByEmailAddress(handler : handler,  emailAddress :  emailAddress,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<LoginState/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Customer.LoginState GetLoginStateByEmailAddress(ServiceClientMessageHandler handler,
                                                                                         string emailAddress, string responseFields = null,
                                                                                         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.Customer.CustomerAccountClient.GetLoginStateByEmailAddressClient(
                emailAddress:  emailAddress, responseFields:  responseFields);

            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);
        }
コード例 #8
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = DestinationFactory.GetDestinations(handler : handler,  checkoutId :  checkoutId,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<List<Destination>/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static List <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.Destination> GetDestinations(ServiceClientMessageHandler handler,
                                                                                                        string checkoutId,
                                                                                                        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.Checkouts.DestinationClient.GetDestinationsClient(
                checkoutId:  checkoutId);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #9
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = ShippingInclusionRuleFactory.CreateShippingInclusionRule(handler : handler,  rule :  rule,  profilecode :  profilecode,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<ShippingInclusionRule/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingInclusionRule CreateShippingInclusionRule(ServiceClientMessageHandler handler,
                                                                                                                 Mozu.Api.Contracts.ShippingAdmin.Profile.ShippingInclusionRule rule, string profilecode, string responseFields = null,
                                                                                                                 HttpStatusCode expectedCode = HttpStatusCode.Created, HttpStatusCode successCode = HttpStatusCode.Created)
        {
            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.Shipping.Admin.Profiles.ShippingInclusionRuleClient.CreateShippingInclusionRuleClient(
                rule:  rule, profilecode:  profilecode, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #10
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = PriceListFactory.BulkUpdatePriceListEntries(handler : handler,  priceListEntriesIn :  priceListEntriesIn,  publishEvents :  publishEvents,  invalidateCache :  invalidateCache,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<void/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static void BulkUpdatePriceListEntries(ServiceClientMessageHandler handler,
                                                      List <Mozu.Api.Contracts.ProductAdmin.PriceListEntry> priceListEntriesIn, bool?publishEvents = null, bool?invalidateCache = null,
                                                      HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent)
        {
            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.PriceListClient.BulkUpdatePriceListEntriesClient(
                priceListEntriesIn:  priceListEntriesIn, publishEvents:  publishEvents, invalidateCache:  invalidateCache);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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;
                }
            }
            var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null;
        }
コード例 #11
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = PaymentSettingsFactory.GetThirdPartyPaymentWorkflowWithValues(handler : handler,  fullyQualifiedName :  fullyQualifiedName,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<ExternalPaymentWorkflowDefinition/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.SiteSettings.Order.ExternalPaymentWorkflowDefinition GetThirdPartyPaymentWorkflowWithValues(ServiceClientMessageHandler handler,
                                                                                                                                     string fullyQualifiedName, string responseFields = null,
                                                                                                                                     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.Settings.Checkout.PaymentSettingsClient.GetThirdPartyPaymentWorkflowWithValuesClient(
                fullyQualifiedName:  fullyQualifiedName, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #12
0
        /// <summary>
        /// Creates a new record in the Mozu database based on the information supplied in the request.
        /// <example>
        ///  <code>
        /// var result = UserDataFactory.CreateDBValue(handler : handler,  value :  value,  dbEntryQuery :  dbEntryQuery,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<void/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static void CreateDBValue(ServiceClientMessageHandler handler,
                                         string value, string dbEntryQuery,
                                         HttpStatusCode expectedCode = HttpStatusCode.NoContent, HttpStatusCode successCode = HttpStatusCode.NoContent)
        {
            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.Platform.UserDataClient.CreateDBValueClient(
                value:  value, dbEntryQuery:  dbEntryQuery);

            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;
                }
            }
            var noResponse = ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                                         ? (apiClient.Result())
                                         : null;
        }
コード例 #13
0
        /// <summary>
        /// Removes a previously added item from a defined order.
        /// <example>
        ///  <code>
        /// var result = OrderItemFactory.DeleteOrderItem(handler : handler,  orderId :  orderId,  orderItemId :  orderItemId,  updateMode :  updateMode,  version :  version,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Order/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.CommerceRuntime.Orders.Order DeleteOrderItem(ServiceClientMessageHandler handler,
                                                                                      string orderId, string orderItemId, string updateMode = null, string version = null,
                                                                                      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.Orders.OrderItemClient.DeleteOrderItemClient(
                orderId:  orderId, orderItemId:  orderItemId, updateMode:  updateMode, version:  version);

            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);
        }
コード例 #14
0
        /// <summary>
        /// Retrieves the details of a single category.
        /// <example>
        ///  <code>
        /// var result = ProductCategoryRuntimeFactory.GetCategory(handler : handler,  categoryId :  categoryId,  allowInactive :  allowInactive,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<Category/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductRuntime.Category GetCategory(ServiceClientMessageHandler handler,
                                                                             int categoryId, bool?allowInactive = null, string responseFields                   = null,
                                                                             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.Storefront.CategoryClient.GetCategoryClient(
                categoryId:  categoryId, allowInactive:  allowInactive, responseFields:  responseFields);

            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);
        }
コード例 #15
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = ProductFactory.ValidateDiscounts(handler : handler,  discountSelections :  discountSelections,  productCode :  productCode,  variationProductCode :  variationProductCode,  customerAccountId :  customerAccountId,  allowInactive :  allowInactive,  skipInventoryCheck :  skipInventoryCheck,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<DiscountValidationSummary/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductRuntime.DiscountValidationSummary ValidateDiscounts(ServiceClientMessageHandler handler,
                                                                                                    Mozu.Api.Contracts.ProductRuntime.DiscountSelections discountSelections, string productCode, string variationProductCode = null, int?customerAccountId = null, bool?allowInactive = null, bool?skipInventoryCheck = null, string responseFields = null,
                                                                                                    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.Storefront.ProductClient.ValidateDiscountsClient(
                discountSelections:  discountSelections, productCode:  productCode, variationProductCode:  variationProductCode, customerAccountId:  customerAccountId, allowInactive:  allowInactive, skipInventoryCheck:  skipInventoryCheck, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }
コード例 #16
0
        /// <summary>
        ///
        /// <example>
        ///  <code>
        /// var result = ProductFactory.ConfiguredProduct(handler : handler,  productOptionSelections :  productOptionSelections,  productCode :  productCode,  includeOptionDetails :  includeOptionDetails,  skipInventoryCheck :  skipInventoryCheck,  quantity :  quantity,  purchaseLocation :  purchaseLocation,  variationProductCodeFilter :  variationProductCodeFilter,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<ConfiguredProduct/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.ProductRuntime.ConfiguredProduct ConfiguredProduct(ServiceClientMessageHandler handler,
                                                                                            Mozu.Api.Contracts.ProductRuntime.ProductOptionSelections productOptionSelections, string productCode, bool?includeOptionDetails = null, bool?skipInventoryCheck = null, int?quantity = null, string purchaseLocation = null, string variationProductCodeFilter = null, string responseFields = null,
                                                                                            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.Storefront.ProductClient.ConfiguredProductClient(
                productOptionSelections:  productOptionSelections, productCode:  productCode, includeOptionDetails:  includeOptionDetails, skipInventoryCheck:  skipInventoryCheck, quantity:  quantity, purchaseLocation:  purchaseLocation, variationProductCodeFilter:  variationProductCodeFilter, responseFields:  responseFields);

            try
            {
                apiClient.WithContext(handler.ApiContext).ExecuteAsync(default(CancellationToken)).Wait();
            }
            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);
        }