/// <summary>
        /// Creates a purchase order transaction on the specified customer purchase order account.
        /// <example>
        ///  <code>
        /// var result = CustomerPurchaseOrderAccountFactory.CreatePurchaseOrderTransaction(handler : handler,  purchaseOrderTransaction :  purchaseOrderTransaction,  accountId :  accountId,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode);
        /// var optionalCasting = ConvertClass<PurchaseOrderTransaction/>(result);
        /// return optionalCasting;
        ///  </code>
        /// </example>
        /// </summary>
        public static Mozu.Api.Contracts.Customer.PurchaseOrderTransaction CreatePurchaseOrderTransaction(ServiceClientMessageHandler handler,
                                                                                                          Mozu.Api.Contracts.Customer.PurchaseOrderTransaction purchaseOrderTransaction, int accountId, 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.Customer.Accounts.CustomerPurchaseOrderAccountClient.CreatePurchaseOrderTransactionClient(
                purchaseOrderTransaction:  purchaseOrderTransaction, accountId:  accountId, 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);
        }
        /// <summary>
        /// Creates a purchase order transaction on the specified customer purchase order account.
        /// </summary>
        /// <param name="accountId">Unique identifier of the customer account.</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="purchaseOrderTransaction">The purchase order transaction type to add to the specified customer account.</param>
        /// <returns>
        ///  <see cref="Mozu.Api.MozuClient" />{<see cref="Mozu.Api.Contracts.Customer.PurchaseOrderTransaction"/>}
        /// </returns>
        /// <example>
        /// <code>
        ///   var mozuClient=CreatePurchaseOrderTransaction( purchaseOrderTransaction,  accountId,  responseFields);
        ///   var purchaseOrderTransactionClient = mozuClient.WithBaseAddress(url).Execute().Result();
        /// </code>
        /// </example>
        public static MozuClient <Mozu.Api.Contracts.Customer.PurchaseOrderTransaction> CreatePurchaseOrderTransactionClient(Mozu.Api.Contracts.Customer.PurchaseOrderTransaction purchaseOrderTransaction, int accountId, string responseFields = null)
        {
            var          url        = Mozu.Api.Urls.Commerce.Customer.Accounts.CustomerPurchaseOrderAccountUrl.CreatePurchaseOrderTransactionUrl(accountId, responseFields);
            const string verb       = "POST";
            var          mozuClient = new MozuClient <Mozu.Api.Contracts.Customer.PurchaseOrderTransaction>()
                                      .WithVerb(verb).WithResourceUrl(url)
                                      .WithBody <Mozu.Api.Contracts.Customer.PurchaseOrderTransaction>(purchaseOrderTransaction);

            return(mozuClient);
        }
        /// <summary>
        /// Creates a purchase order transaction on the specified customer purchase order account.
        /// </summary>
        /// <param name="accountId">Unique identifier of the customer account.</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="purchaseOrderTransaction">The purchase order transaction type to add to the specified customer account.</param>
        /// <returns>
        /// <see cref="Mozu.Api.Contracts.Customer.PurchaseOrderTransaction"/>
        /// </returns>
        /// <example>
        /// <code>
        ///   var customerpurchaseorderaccount = new CustomerPurchaseOrderAccount();
        ///   var purchaseOrderTransaction = await customerpurchaseorderaccount.CreatePurchaseOrderTransactionAsync( purchaseOrderTransaction,  accountId,  responseFields);
        /// </code>
        /// </example>
        public virtual async Task <Mozu.Api.Contracts.Customer.PurchaseOrderTransaction> CreatePurchaseOrderTransactionAsync(Mozu.Api.Contracts.Customer.PurchaseOrderTransaction purchaseOrderTransaction, int accountId, string responseFields = null)
        {
            MozuClient <Mozu.Api.Contracts.Customer.PurchaseOrderTransaction> response;
            var client = Mozu.Api.Clients.Commerce.Customer.Accounts.CustomerPurchaseOrderAccountClient.CreatePurchaseOrderTransactionClient(purchaseOrderTransaction, accountId, responseFields);

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

            return(await response.ResultAsync());
        }