Exemplo n.º 1
0
        /// <summary>
        /// Updates one or more properties of fulfillment information for the specified order.
        /// <example>
        ///  <code>
        /// var result = FulfillmentInfoFactory.SetFulFillmentInfo(handler : handler,  fulfillmentInfo :  fulfillmentInfo,  orderId :  orderId,  updateMode :  updateMode,  version :  version,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<FulfillmentInfo/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo SetFulFillmentInfo(ServiceClientMessageHandler handler,
                                                                                                        Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo fulfillmentInfo, string orderId, string updateMode = null, string version = 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.Orders.FulfillmentInfoClient.SetFulFillmentInfoClient(
                fulfillmentInfo:  fulfillmentInfo, orderId:  orderId, updateMode:  updateMode, version:  version, 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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates one or more properties of fulfillment information for the specified order.
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</param>
        /// <param name="responseFields">Use this field to include those fields which are not included by default.</param>
        /// <param name="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">System-supplied integer that represents the current version of the order, which prevents users from unintentionally overriding changes to the order. When a user performs an operation for a defined order, the system validates that the version of the updated order matches the version of the order on the server. After the operation completes successfully, the system increments the version number by one.</param>
        /// <param name="fulfillmentInfo">Properties of the information needed to fulfill an order, whether via in-store pickup or direct shipping.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var fulfillmentinfo = new FulfillmentInfo();
        ///   var fulfillmentInfo = await fulfillmentinfo.SetFulFillmentInfoAsync( fulfillmentInfo,  orderId,  updateMode,  version,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo> SetFulFillmentInfoAsync(Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo fulfillmentInfo, string orderId, string updateMode = null, string version = null, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo> response;
            var client = Mozu.Api.Clients.Commerce.Orders.FulfillmentInfoClient.SetFulFillmentInfoClient(fulfillmentInfo, orderId, updateMode, version, responseFields);

            client.WithContext(_apiContext);
            response = await client.ExecuteAsync();

            return(await response.ResultAsync());
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="orderId">Unique identifier of the order.</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="updateMode">Specifies whether to update the original order, update the order in draft mode, or update the order in draft mode and then commit the changes to the original. Draft mode enables users to make incremental order changes before committing the changes to the original order. Valid values are "ApplyToOriginal," "ApplyToDraft," or "ApplyAndCommit."</param>
        /// <param name="version">Determines whether or not to check versioning of items for concurrency purposes.</param>
        /// <param name="fulfillmentInfo">Properties of the information needed to fulfill an order, whether via in-store pickup or direct shipping.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=SetFulFillmentInfo( fulfillmentInfo,  orderId,  updateMode,  version,  responseFields);
        ///   var fulfillmentInfoClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo> SetFulFillmentInfoClient(Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo fulfillmentInfo, string orderId, string updateMode = null, string version = null, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Orders.FulfillmentInfoUrl.SetFulFillmentInfoUrl(orderId, updateMode, version, responseFields);
            const string verb       = "PUT";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.CommerceRuntime.Fulfillment.FulfillmentInfo>(fulfillmentInfo);

            return(mozuClient);
        }