Source: api/UsersApi.js

/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
/* Copyright (c) 2017 Mobify Research & Development Inc. All rights reserved. */
/* * *  *  * *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */

/**
 * OCC No description provided (generated by Swagger Codegen
 * https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: v2
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git Do not edit the class
 * manually.
 *
 */

import ApiClient from '../ApiClient'
import AddressList from '../models/AddressList'
import AddressOCC from '../models/AddressOCC'
import Address from '../models/Address'
import CartList from '../models/CartList'
import Cart from '../models/Cart'
import DeliveryModeList from '../models/DeliveryModeList'
import DeliveryMode from '../models/DeliveryMode'
import OrderEntryList from '../models/OrderEntryList'
import OrderEntryOCC from '../models/OrderEntryOCC'
import OrderEntry from '../models/OrderEntry'
import OrderHistoryList from '../models/OrderHistoryList'
import Order from '../models/Order'
import PaymentDetailsList from '../models/PaymentDetailsList'
import PaymentDetailsOCC from '../models/PaymentDetailsOCC'
import PaymentDetails from '../models/PaymentDetails'
import PromotionResultList from '../models/PromotionResultList'
import SaveCartResult from '../models/SaveCartResult'
import UserGroupList from '../models/UserGroupList'
import User from '../models/User'
import VoucherList from '../models/VoucherList'

/**
* Users service.
* @module api/UsersApi
* @version v2
*/
export default class UsersApi {

    /**
    * Constructs a new UsersApi.
    * @alias module:api/UsersApi
    * @class
    * @param {module:ApiClient} apiClient Optional API client implementation to
    * use, default to {@link module:ApiClient#instance} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance
    }

    /**
     * postUsers Registers a customer. The following two sets of parameters are
     * available: <ul> <li>First set is used to register a customer.
     * In this case the required parameters are: login, password, firstName,
     * lastName, titleCode.</li> <li>Second set is used to convert a
     * guest to a customer. In this case the required parameters are: guid,
     * password. </li> <ul>  Security: Permitted only for customer
     * managers, clients or trusted clients.
     * @param {module:models/UserSignUp} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersWithHttpInfo(body) {
        const postBody = body

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postUsers')
        }

        const pathParams = {
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postUsers Registers a customer. The following two sets of parameters are
     * available: <ul> <li>First set is used to register a customer.
     * In this case the required parameters are: login, password, firstName,
     * lastName, titleCode.</li> <li>Second set is used to convert a
     * guest to a customer. In this case the required parameters are: guid,
     * password. </li> <ul>  Security: Permitted only for customer
     * managers, clients or trusted clients.
     * @param {module:models/UserSignUp} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postUsers(body) {
        return this.usersWithHttpInfo(body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUserAddresses Returns customer's addresses.  Security: Permitted
     * for trusted clients, customers and customer managers. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/AddressList} and
     * HTTP response
     */
    usersAddressesByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getUserAddresses')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = AddressList

        return this.apiClient.callApi(
            '/users/{userId}/addresses', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUserAddresses Returns customer's addresses.  Security: Permitted
     * for trusted clients, customers and customer managers. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/AddressList}
     */
    getUserAddresses(userId, opts) {
        return this.usersAddressesByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * UsersAddressesByUserId Creates a new address.  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/AddressOCC} and
     * HTTP response
     */
    usersAddressesByUserId1WithHttpInfo(userId, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postUserAddress')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postUserAddress')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = AddressOCC

        return this.apiClient.callApi(
            '/users/{userId}/addresses', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * UsersAddressesByUserId Creates a new address.  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/AddressOCC}
     */
    postUserAddress(userId, body, opts) {
        return this.usersAddressesByUserId1WithHttpInfo(userId, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUserAddress Returns detailed information about address with a given
     * id.  Security: Permitted for customers, guests, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/Address} and
     * HTTP response
     */
    usersAddressesByUserIdAndAddressIdWithHttpInfo(userId, addressId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getUserAddress')
        }

        // verify the required parameter 'addressId' is set
        if (addressId === undefined || addressId === null) {
            throw new Error('Missing the required parameter \'addressId\' when calling getUserAddress')
        }

        const pathParams = {
            userId,
            addressId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = Address

        return this.apiClient.callApi(
            '/users/{userId}/addresses/{addressId}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUserAddress Returns detailed information about address with a given
     * id.  Security: Permitted for customers, guests, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/Address}
     */
    getUserAddress(userId, addressId, opts) {
        return this.usersAddressesByUserIdAndAddressIdWithHttpInfo(userId, addressId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUserAddress Updates the address. Attributes not provided in the
     * request will be defined again (set to null or default).  Security:
     * Permitted for customers, guests, customer managers or trusted client.
     * Trusted client or customer manager is able to impersonate as any other
     * user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {module:models/AddressOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersAddressesByUserIdAndAddressId1WithHttpInfo(userId, addressId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putUserAddress')
        }

        // verify the required parameter 'addressId' is set
        if (addressId === undefined || addressId === null) {
            throw new Error('Missing the required parameter \'addressId\' when calling putUserAddress')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling putUserAddress')
        }

        const pathParams = {
            userId,
            addressId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/addresses/{addressId}', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUserAddress Updates the address. Attributes not provided in the
     * request will be defined again (set to null or default).  Security:
     * Permitted for customers, guests, customer managers or trusted client.
     * Trusted client or customer manager is able to impersonate as any other
     * user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {module:models/AddressOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putUserAddress(userId, addressId, body) {
        return this.usersAddressesByUserIdAndAddressId1WithHttpInfo(userId, addressId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUserAddress Updates the address. Only attributes provided in the
     * request body will be changed.  Security: Permitted for customers, guests,
     * customer managers or trusted client. Trusted client or customer manager
     * is able to impersonate as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {module:models/AddressOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersAddressesByUserIdAndAddressId2WithHttpInfo(userId, addressId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchUserAddress')
        }

        // verify the required parameter 'addressId' is set
        if (addressId === undefined || addressId === null) {
            throw new Error('Missing the required parameter \'addressId\' when calling patchUserAddress')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchUserAddress')
        }

        const pathParams = {
            userId,
            addressId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/addresses/{addressId}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUserAddress Updates the address. Only attributes provided in the
     * request body will be changed.  Security: Permitted for customers, guests,
     * customer managers or trusted client. Trusted client or customer manager
     * is able to impersonate as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @param {module:models/AddressOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    patchUserAddress(userId, addressId, body) {
        return this.usersAddressesByUserIdAndAddressId2WithHttpInfo(userId, addressId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUserAddress Removes customer's address.  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersAddressesByUserIdAndAddressId3WithHttpInfo(userId, addressId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteUserAddress')
        }

        // verify the required parameter 'addressId' is set
        if (addressId === undefined || addressId === null) {
            throw new Error('Missing the required parameter \'addressId\' when calling deleteUserAddress')
        }

        const pathParams = {
            userId,
            addressId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/addresses/{addressId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUserAddress Removes customer's address.  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} addressId Address identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteUserAddress(userId, addressId) {
        return this.usersAddressesByUserIdAndAddressId3WithHttpInfo(userId, addressId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postUserAddressesVerification Verifies address  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/AddressOCC} and
     * HTTP response
     */
    usersAddressesVerificationByUserIdWithHttpInfo(userId, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postUserAddressesVerification')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postUserAddressesVerification')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = AddressOCC

        return this.apiClient.callApi(
            '/users/{userId}/addresses/verification', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postUserAddressesVerification Verifies address  Security: Permitted for
     * customers, guests, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/AddressOCC}
     */
    postUserAddressesVerification(userId, body, opts) {
        return this.usersAddressesVerificationByUserIdWithHttpInfo(userId, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUser Returns customer profile.  Security: Permitted for clients,
     * customers and customer managers
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/User} and HTTP
     * response
     */
    usersByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getUser')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = User

        return this.apiClient.callApi(
            '/users/{userId}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUser Returns customer profile.  Security: Permitted for clients,
     * customers and customer managers
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/User}
     */
    getUser(userId, opts) {
        return this.usersByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUser Updates customer profile. Attributes not provided in the request
     * body will be defined again (set to null or default).  Security: Permitted
     * for trusted clients, customers and customer managers. Trusted client or
     * customer manager is able to impersonate as any other user and change
     * profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/UserOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersByUserId1WithHttpInfo(userId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putUser')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling putUser')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUser Updates customer profile. Attributes not provided in the request
     * body will be defined again (set to null or default).  Security: Permitted
     * for trusted clients, customers and customer managers. Trusted client or
     * customer manager is able to impersonate as any other user and change
     * profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/UserOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putUser(userId, body) {
        return this.usersByUserId1WithHttpInfo(userId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUser Updates customer profile. Only attributes provided in the request
     * body will be changed.  Security: Permitted for trusted clients, customers
     * and customer managers. Trusted client or customer manager is able to
     * impersonate as any other user and change profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/UserOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersByUserId2WithHttpInfo(userId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchUser')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchUser')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUser Updates customer profile. Only attributes provided in the request
     * body will be changed.  Security: Permitted for trusted clients, customers
     * and customer managers. Trusted client or customer manager is able to
     * impersonate as any other user and change profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {module:models/UserOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    patchUser(userId, body) {
        return this.usersByUserId2WithHttpInfo(userId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getUser Removes customer profile.  Security: Permitted for trusted
     * clients, customers and customer managers. Trusted client is able to
     * impersonate as any other user and deactivate profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersByUserId3WithHttpInfo(userId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteUser')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getUser Removes customer profile.  Security: Permitted for trusted
     * clients, customers and customer managers. Trusted client is able to
     * impersonate as any other user and deactivate profile on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteUser(userId) {
        return this.usersByUserId3WithHttpInfo(userId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartDeliveryAddress Creates an address and assigns it to the cart as
     * the delivery address.  Security: Anonymous user may access cart by its
     * guid. Customer may access only own cart by its id. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/AddressOCC} and
     * HTTP response
     */
    usersCartsAddressesDeliveryByUserIdWithHttpInfo(userId, cartId, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartDeliveryAddress')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartDeliveryAddress')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCartDeliveryAddress')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = AddressOCC

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/addresses/delivery', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartDeliveryAddress Creates an address and assigns it to the cart as
     * the delivery address.  Security: Anonymous user may access cart by its
     * guid. Customer may access only own cart by its id. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/AddressOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/AddressOCC}
     */
    postCartDeliveryAddress(userId, cartId, body, opts) {
        return this.usersCartsAddressesDeliveryByUserIdWithHttpInfo(userId, cartId, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartDeliveryAddress Sets a delivery address for the cart. The address
     * country must be placed among the delivery countries of the current base
     * store.  Security: Permitted only for customers, guests, customer managers
     * or trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} addressId Address identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsAddressesDeliveryByUserId1WithHttpInfo(userId, cartId, addressId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putCartDeliveryAddress')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling putCartDeliveryAddress')
        }

        // verify the required parameter 'addressId' is set
        if (addressId === undefined || addressId === null) {
            throw new Error('Missing the required parameter \'addressId\' when calling putCartDeliveryAddress')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            addressId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/addresses/delivery', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartDeliveryAddress Sets a delivery address for the cart. The address
     * country must be placed among the delivery countries of the current base
     * store.  Security: Permitted only for customers, guests, customer managers
     * or trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} addressId Address identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putCartDeliveryAddress(userId, cartId, addressId) {
        return this.usersCartsAddressesDeliveryByUserId1WithHttpInfo(userId, cartId, addressId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartDeliveryAddress Removes the delivery address from the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsAddressesDeliveryByUserId2WithHttpInfo(userId, cartId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCartDeliveryAddress')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCartDeliveryAddress')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/addresses/delivery', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartDeliveryAddress Removes the delivery address from the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCartDeliveryAddress(userId, cartId) {
        return this.usersCartsAddressesDeliveryByUserId2WithHttpInfo(userId, cartId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCarts Lists all customer carts.  Security: Permitted only for
     * non-anonymous users.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response).
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/CartList} and
     * HTTP response
     */
    usersCartsByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCarts')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = CartList

        return this.apiClient.callApi(
            '/users/{userId}/carts', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCarts Lists all customer carts.  Security: Permitted only for
     * non-anonymous users.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response).
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/CartList}
     */
    getCarts(userId, opts) {
        return this.usersCartsByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCarts Creates a new cart or restores an anonymous cart as a user's
     * cart (if an old Cart Id is given in the request)  Security: Cart may be
     * created by everybody. Restoring anonymous carts is permitted only for non
     * anonymous users.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.toMergeCartGuid User's cart GUID to merge
     * anonymous cart to
     * @param {String} opts.oldCartId Anonymous cart GUID
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/Cart} and HTTP
     * response
     */
    usersCartsByUserId1WithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCart')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
            toMergeCartGuid: opts.toMergeCartGuid,
            oldCartId: opts.oldCartId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = Cart

        return this.apiClient.callApi(
            '/users/{userId}/carts', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCarts Creates a new cart or restores an anonymous cart as a user's
     * cart (if an old Cart Id is given in the request)  Security: Cart may be
     * created by everybody. Restoring anonymous carts is permitted only for non
     * anonymous users.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.toMergeCartGuid User's cart GUID to merge
     * anonymous cart to
     * @param {String} opts.oldCartId Anonymous cart GUID
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/Cart}
     */
    postCart(userId, opts) {
        return this.usersCartsByUserId1WithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCart Returns the cart with a given identifier.  Security: Anonymous
     * user may access cart by its guid. Customer may access only own cart by
     * its id. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/Cart} and HTTP
     * response
     */
    usersCartsByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = Cart

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCart Returns the cart with a given identifier.  Security: Anonymous
     * user may access cart by its guid. Customer may access only own cart by
     * its id. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/Cart}
     */
    getCart(userId, cartId, opts) {
        return this.usersCartsByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCart Deletes a cart with a given cart id.  Security: Anonymous user
     * may access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsByUserIdAndCartId1WithHttpInfo(userId, cartId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCart Deletes a cart with a given cart id.  Security: Anonymous user
     * may access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCart(userId, cartId) {
        return this.usersCartsByUserIdAndCartId1WithHttpInfo(userId, cartId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartCloneSavedcart Explicitly clones a cart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.name the name that should be applied to the cloned
     * cart
     * @param {String} opts.description the description that should be applied
     * to the cloned cart
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/SaveCartResult}
     * and HTTP response
     */
    usersCartsClonesavedcartByUserIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartCloneSavedcart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartCloneSavedcart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
            name: opts.name,
            description: opts.description
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = SaveCartResult

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/clonesavedcart', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartCloneSavedcart Explicitly clones a cart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.name the name that should be applied to the cloned
     * cart
     * @param {String} opts.description the description that should be applied
     * to the cloned cart
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/SaveCartResult}
     */
    postCartCloneSavedcart(userId, cartId, opts) {
        return this.usersCartsClonesavedcartByUserIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartDeliveryMode Returns the delivery mode selected for the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/DeliveryMode}
     * and HTTP response
     */
    usersCartsDeliverymodeByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartDeliveryMode')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartDeliveryMode')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = DeliveryMode

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/deliverymode', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartDeliveryMode Returns the delivery mode selected for the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/DeliveryMode}
     */
    getCartDeliveryMode(userId, cartId, opts) {
        return this.usersCartsDeliverymodeByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartDeliveryMode Sets the delivery mode with a given identifier for
     * the cart.  Security: Permitted only for customers, guests, customer
     * managers or trusted clients. Trusted client or customer manager may
     * impersonate as any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} deliveryModeId Delivery mode identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsDeliverymodeByUserIdAndCartId1WithHttpInfo(userId, cartId, deliveryModeId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putCartDeliveryMode')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling putCartDeliveryMode')
        }

        // verify the required parameter 'deliveryModeId' is set
        if (deliveryModeId === undefined || deliveryModeId === null) {
            throw new Error('Missing the required parameter \'deliveryModeId\' when calling putCartDeliveryMode')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            deliveryModeId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/deliverymode', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartDeliveryMode Sets the delivery mode with a given identifier for
     * the cart.  Security: Permitted only for customers, guests, customer
     * managers or trusted clients. Trusted client or customer manager may
     * impersonate as any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} deliveryModeId Delivery mode identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putCartDeliveryMode(userId, cartId, deliveryModeId) {
        return this.usersCartsDeliverymodeByUserIdAndCartId1WithHttpInfo(userId, cartId, deliveryModeId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartDeliveryMode Removes the delivery mode from the cart.  Security:
     * Permitted only for customers, guests, customer managers or trusted
     * clients. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsDeliverymodeByUserIdAndCartId2WithHttpInfo(userId, cartId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCartDeliveryMode')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCartDeliveryMode')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/deliverymode', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartDeliveryMode Removes the delivery mode from the cart.  Security:
     * Permitted only for customers, guests, customer managers or trusted
     * clients. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCartDeliveryMode(userId, cartId) {
        return this.usersCartsDeliverymodeByUserIdAndCartId2WithHttpInfo(userId, cartId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartDeliveryModes Returns all delivery modes supported for the current
     * base store and cart delivery address. A delivery address must be set for
     * the cart, otherwise an empty list will be returned.  Security: Permitted
     * only for customers, guests, customer managers or trusted clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/DeliveryModeList} and HTTP response
     */
    usersCartsDeliverymodesByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartDeliveryModes')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartDeliveryModes')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = DeliveryModeList

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/deliverymodes', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartDeliveryModes Returns all delivery modes supported for the current
     * base store and cart delivery address. A delivery address must be set for
     * the cart, otherwise an empty list will be returned.  Security: Permitted
     * only for customers, guests, customer managers or trusted clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/DeliveryModeList}
     */
    getCartDeliveryModes(userId, cartId, opts) {
        return this.usersCartsDeliverymodesByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * putCartEmail Assigns an email to the cart. This step is required to make
     * a guest checkout.  Security: Permitted only for client or trusted client
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.email Email of the guest user. It will be used
     * during checkout process
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsEmailByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putCartEmail')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling putCartEmail')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            email: opts.email
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/email', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * putCartEmail Assigns an email to the cart. This step is required to make
     * a guest checkout.  Security: Permitted only for client or trusted client
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.email Email of the guest user. It will be used
     * during checkout process
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putCartEmail(userId, cartId, opts) {
        return this.usersCartsEmailByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntries Returns cart entries.  Security: Anonymous user may access
     * cart by its guid. Customer may access only own cart by its id. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/OrderEntryList}
     * and HTTP response
     */
    usersCartsEntriesByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartEntries')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartEntries')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderEntryList

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntries Returns cart entries.  Security: Anonymous user may access
     * cart by its guid. Customer may access only own cart by its id. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderEntryList}
     */
    getCartEntries(userId, cartId, opts) {
        return this.usersCartsEntriesByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntries Adds a product to the cart.  Security: Anonymous user may
     * access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/OrderEntryOCC}
     * and HTTP response
     */
    usersCartsEntriesByUserIdAndCartId1WithHttpInfo(userId, cartId, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartEntries')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartEntries')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCartEntries')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderEntryOCC

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntries Adds a product to the cart.  Security: Anonymous user may
     * access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderEntryOCC}
     */
    postCartEntries(userId, cartId, body, opts) {
        return this.usersCartsEntriesByUserIdAndCartId1WithHttpInfo(userId, cartId, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntry Returns the details of the cart entries.  Security:
     * Anonymous user may access cart by its guid. Customer may access only own
     * cart by its id. Trusted client or customer manager may impersonate as any
     * user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/OrderEntry} and
     * HTTP response
     */
    usersCartsEntriesEntryNumberByUserIdWithHttpInfo(userId, cartId, entryNumber, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartEntry')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartEntry')
        }

        // verify the required parameter 'entryNumber' is set
        if (entryNumber === undefined || entryNumber === null) {
            throw new Error('Missing the required parameter \'entryNumber\' when calling getCartEntry')
        }

        const pathParams = {
            userId,
            cartId,
            entryNumber
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderEntry

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries/{entryNumber}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntry Returns the details of the cart entries.  Security:
     * Anonymous user may access cart by its guid. Customer may access only own
     * cart by its id. Trusted client or customer manager may impersonate as any
     * user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderEntry}
     */
    getCartEntry(userId, cartId, entryNumber, opts) {
        return this.usersCartsEntriesEntryNumberByUserIdWithHttpInfo(userId, cartId, entryNumber, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntry Updates the quantity of a single cart entry and details of
     * the store where the cart entry will be picked. Attributes not provided in
     * request will be defined again (set to null or default)  Security:
     * Anonymous user may access cart by its guid. Customer may access only own
     * cart by its id. Trusted client or customer manager may impersonate as any
     * user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/OrderEntryOCC}
     * and HTTP response
     */
    usersCartsEntriesEntryNumberByUserId1WithHttpInfo(userId, cartId, entryNumber, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putCartEntry')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling putCartEntry')
        }

        // verify the required parameter 'entryNumber' is set
        if (entryNumber === undefined || entryNumber === null) {
            throw new Error('Missing the required parameter \'entryNumber\' when calling putCartEntry')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling putCartEntry')
        }

        const pathParams = {
            userId,
            cartId,
            entryNumber
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderEntryOCC

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries/{entryNumber}', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntry Updates the quantity of a single cart entry and details of
     * the store where the cart entry will be picked. Attributes not provided in
     * request will be defined again (set to null or default)  Security:
     * Anonymous user may access cart by its guid. Customer may access only own
     * cart by its id. Trusted client or customer manager may impersonate as any
     * user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderEntryOCC}
     */
    putCartEntry(userId, cartId, entryNumber, body, opts) {
        return this.usersCartsEntriesEntryNumberByUserId1WithHttpInfo(userId, cartId, entryNumber, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntry Updates the quantity of a single cart entry and details of
     * the store where the cart entry will be picked.  Security: Anonymous user
     * may access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/OrderEntryOCC}
     * and HTTP response
     */
    usersCartsEntriesEntryNumberByUserId2WithHttpInfo(userId, cartId, entryNumber, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchCartEntry')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling patchCartEntry')
        }

        // verify the required parameter 'entryNumber' is set
        if (entryNumber === undefined || entryNumber === null) {
            throw new Error('Missing the required parameter \'entryNumber\' when calling patchCartEntry')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchCartEntry')
        }

        const pathParams = {
            userId,
            cartId,
            entryNumber
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderEntryOCC

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries/{entryNumber}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntry Updates the quantity of a single cart entry and details of
     * the store where the cart entry will be picked.  Security: Anonymous user
     * may access cart by its guid. Customer may access only own cart by its id.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @param {module:models/OrderEntryOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderEntryOCC}
     */
    patchCartEntry(userId, cartId, entryNumber, body, opts) {
        return this.usersCartsEntriesEntryNumberByUserId2WithHttpInfo(userId, cartId, entryNumber, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartEntry Deletes cart entry.  Security: Anonymous user may access
     * cart by its guid. Customer may access only own cart by its id. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsEntriesEntryNumberByUserId3WithHttpInfo(userId, cartId, entryNumber) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCartEntry')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCartEntry')
        }

        // verify the required parameter 'entryNumber' is set
        if (entryNumber === undefined || entryNumber === null) {
            throw new Error('Missing the required parameter \'entryNumber\' when calling deleteCartEntry')
        }

        const pathParams = {
            userId,
            cartId,
            entryNumber
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/entries/{entryNumber}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartEntry Deletes cart entry.  Security: Anonymous user may access
     * cart by its guid. Customer may access only own cart by its id. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} entryNumber Entry number. Zero-based numbering.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCartEntry(userId, cartId, entryNumber) {
        return this.usersCartsEntriesEntryNumberByUserId3WithHttpInfo(userId, cartId, entryNumber)
            .then((response) => {
                return response.data
            })
    }

    /**
     * patchCartFlagForDeletion Flags a cart for deletion (the cart doesn't
     * have corresponding save cart attributes anymore). The cart is not
     * actually deleted from the database. But with the removal of the saved
     * cart attributes, this cart will be taken care of by the cart removal job
     * just like any other cart.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/SaveCartResult}
     * and HTTP response
     */
    usersCartsFlagForDeletionByUserIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchCartFlagForDeletion')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling patchCartFlagForDeletion')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = SaveCartResult

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/flagForDeletion', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * patchCartFlagForDeletion Flags a cart for deletion (the cart doesn't
     * have corresponding save cart attributes anymore). The cart is not
     * actually deleted from the database. But with the removal of the saved
     * cart attributes, this cart will be taken care of by the cart removal job
     * just like any other cart.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/SaveCartResult}
     */
    patchCartFlagForDeletion(userId, cartId, opts) {
        return this.usersCartsFlagForDeletionByUserIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartPaymentDetail Defines details of a new credit card payment
     * details and assigns the payment to the cart.  Security: Permitted only
     * for customers, guests, customer managers or trusted clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/PaymentDetailsOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/PaymentDetailsOCC} and HTTP response
     */
    usersCartsPaymentdetailsByUserIdWithHttpInfo(userId, cartId, body, opts) {
        opts = opts || {}
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartPaymentDetail')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartPaymentDetail')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling postCartPaymentDetail')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = PaymentDetailsOCC

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/paymentdetails', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartPaymentDetail Defines details of a new credit card payment
     * details and assigns the payment to the cart.  Security: Permitted only
     * for customers, guests, customer managers or trusted clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {module:models/PaymentDetailsOCC} body
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/PaymentDetailsOCC}
     */
    postCartPaymentDetail(userId, cartId, body, opts) {
        return this.usersCartsPaymentdetailsByUserIdWithHttpInfo(userId, cartId, body, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * postCartPaymentDetail Sets credit card payment details for the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} paymentDetailsId Payment details identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsPaymentdetailsByUserId1WithHttpInfo(userId, cartId, paymentDetailsId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putCartPaymentDetail')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling putCartPaymentDetail')
        }

        // verify the required parameter 'paymentDetailsId' is set
        if (paymentDetailsId === undefined || paymentDetailsId === null) {
            throw new Error('Missing the required parameter \'paymentDetailsId\' when calling putCartPaymentDetail')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            paymentDetailsId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/paymentdetails', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * postCartPaymentDetail Sets credit card payment details for the cart.
     * Security: Permitted only for customers, guests, customer managers or
     * trusted clients. Trusted client or customer manager may impersonate as
     * any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} paymentDetailsId Payment details identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putCartPaymentDetail(userId, cartId, paymentDetailsId) {
        return this.usersCartsPaymentdetailsByUserId1WithHttpInfo(userId, cartId, paymentDetailsId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartPromotions Return information about promotions applied on cart.
     * Requests pertaining to promotions have been developed for the previous
     * version of promotions and vouchers and therefore some of them are
     * currently not compatible with the new promotion engine.  Security:
     * Permitted only for non anonymous users or clients. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/PromotionResultList} and HTTP response
     */
    usersCartsPromotionsByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartPromotions')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartPromotions')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = PromotionResultList

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/promotions', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartPromotions Return information about promotions applied on cart.
     * Requests pertaining to promotions have been developed for the previous
     * version of promotions and vouchers and therefore some of them are
     * currently not compatible with the new promotion engine.  Security:
     * Permitted only for non anonymous users or clients. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/PromotionResultList}
     */
    getCartPromotions(userId, cartId, opts) {
        return this.usersCartsPromotionsByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartPromotions Enables the promotion for the order based on the
     * promotionId defined for the cart. Requests pertaining to promotions have
     * been developed for the previous version of promotions and vouchers and
     * therefore some of them are currently not compatible with the new
     * promotion engine.  Security: Anonymous user may access cart by its guid.
     * Customer may access only own cart by its id. Trusted client or customer
     * manager may impersonate as any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsPromotionsByUserIdAndCartId1WithHttpInfo(userId, cartId, promotionId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartPromotion')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartPromotion')
        }

        // verify the required parameter 'promotionId' is set
        if (promotionId === undefined || promotionId === null) {
            throw new Error('Missing the required parameter \'promotionId\' when calling postCartPromotion')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            promotionId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/promotions', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartPromotions Enables the promotion for the order based on the
     * promotionId defined for the cart. Requests pertaining to promotions have
     * been developed for the previous version of promotions and vouchers and
     * therefore some of them are currently not compatible with the new
     * promotion engine.  Security: Anonymous user may access cart by its guid.
     * Customer may access only own cart by its id. Trusted client or customer
     * manager may impersonate as any user and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postCartPromotion(userId, cartId, promotionId) {
        return this.usersCartsPromotionsByUserIdAndCartId1WithHttpInfo(userId, cartId, promotionId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartPromotion Return information about promotion with given id,
     * applied on cart. Requests pertaining to promotions have been developed
     * for the previous version of promotions and vouchers and therefore some of
     * them are currently not compatible with the new promotion engine.
     * Security: Permitted only for non anonymous users or clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier (code)
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/PromotionResultList} and HTTP response
     */
    usersCartsPromotionsPromotionIdByUserIdWithHttpInfo(userId, cartId, promotionId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartPromotion')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartPromotion')
        }

        // verify the required parameter 'promotionId' is set
        if (promotionId === undefined || promotionId === null) {
            throw new Error('Missing the required parameter \'promotionId\' when calling getCartPromotion')
        }

        const pathParams = {
            userId,
            cartId,
            promotionId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = PromotionResultList

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/promotions/{promotionId}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartPromotion Return information about promotion with given id,
     * applied on cart. Requests pertaining to promotions have been developed
     * for the previous version of promotions and vouchers and therefore some of
     * them are currently not compatible with the new promotion engine.
     * Security: Permitted only for non anonymous users or clients. Trusted
     * client or customer manager may impersonate as any user and access cart on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier (code)
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/PromotionResultList}
     */
    getCartPromotion(userId, cartId, promotionId, opts) {
        return this.usersCartsPromotionsPromotionIdByUserIdWithHttpInfo(userId, cartId, promotionId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartPromotion Disables the promotion for the order based on the
     * promotionId defined for the cart. Requests pertaining to promotions have
     * been developed for the previous version of promotions and vouchers and
     * therefore some of them are currently not compatible with the new
     * promotion engine.  Security: Permitted only for trusted clients
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsPromotionsPromotionIdByUserId1WithHttpInfo(userId, cartId, promotionId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCartPromotion')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCartPromotion')
        }

        // verify the required parameter 'promotionId' is set
        if (promotionId === undefined || promotionId === null) {
            throw new Error('Missing the required parameter \'promotionId\' when calling deleteCartPromotion')
        }

        const pathParams = {
            userId,
            cartId,
            promotionId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/promotions/{promotionId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartPromotion Disables the promotion for the order based on the
     * promotionId defined for the cart. Requests pertaining to promotions have
     * been developed for the previous version of promotions and vouchers and
     * therefore some of them are currently not compatible with the new
     * promotion engine.  Security: Permitted only for trusted clients
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} promotionId Promotion identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCartPromotion(userId, cartId, promotionId) {
        return this.usersCartsPromotionsPromotionIdByUserId1WithHttpInfo(userId, cartId, promotionId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * patchCartRestoreSavedCart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/SaveCartResult}
     * and HTTP response
     */
    usersCartsRestoresavedcartByUserIdWithHttpInfo(userId, cartId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchCartRestoreSavedCart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling patchCartRestoreSavedCart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = SaveCartResult

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/restoresavedcart', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * patchCartRestoreSavedCart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/SaveCartResult}
     */
    patchCartRestoreSavedCart(userId, cartId) {
        return this.usersCartsRestoresavedcartByUserIdWithHttpInfo(userId, cartId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * patchSavedCart Explicitly saves a cart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.saveCartName the name that should be applied to the
     * saved cart
     * @param {String} opts.saveCartDescription the description that should be
     * applied to the saved cart
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/SaveCartResult}
     * and HTTP response
     */
    usersCartsSaveByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchSavedCart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling patchSavedCart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
            saveCartName: opts.saveCartName,
            saveCartDescription: opts.saveCartDescription
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = SaveCartResult

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/save', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * patchSavedCart Explicitly saves a cart
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.saveCartName the name that should be applied to the
     * saved cart
     * @param {String} opts.saveCartDescription the description that should be
     * applied to the saved cart
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/SaveCartResult}
     */
    patchSavedCart(userId, cartId, opts) {
        return this.usersCartsSaveByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getSavedCart Returns saved cart by it id for authenticated user
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/SaveCartResult}
     * and HTTP response
     */
    usersCartsSavedcartByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getSavedCart')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getSavedCart')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = SaveCartResult

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/savedcart', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getSavedCart Returns saved cart by it id for authenticated user
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/SaveCartResult}
     */
    getSavedCart(userId, cartId, opts) {
        return this.usersCartsSavedcartByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartVouchers Returns list of vouchers applied to the cart.  Security:
     * Permitted only for non anonymous users or clients. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/VoucherList} and
     * HTTP response
     */
    usersCartsVouchersByUserIdAndCartIdWithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCartVouchers')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling getCartVouchers')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = VoucherList

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/vouchers', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartVouchers Returns list of vouchers applied to the cart.  Security:
     * Permitted only for non anonymous users or clients. Trusted client or
     * customer manager may impersonate as any user and access cart on their
     * behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/VoucherList}
     */
    getCartVouchers(userId, cartId, opts) {
        return this.usersCartsVouchersByUserIdAndCartIdWithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCartVouchers Applies a voucher based on the voucherId defined for the
     * cart.  Security: Permitted only for non anonymous users or clients.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} voucherId Voucher identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsVouchersByUserIdAndCartId1WithHttpInfo(userId, cartId, voucherId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postCartVoucher')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postCartVoucher')
        }

        // verify the required parameter 'voucherId' is set
        if (voucherId === undefined || voucherId === null) {
            throw new Error('Missing the required parameter \'voucherId\' when calling postCartVoucher')
        }

        const pathParams = {
            userId,
            cartId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            voucherId
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/vouchers', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCartVouchers Applies a voucher based on the voucherId defined for the
     * cart.  Security: Permitted only for non anonymous users or clients.
     * Trusted client or customer manager may impersonate as any user and access
     * cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} voucherId Voucher identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    postCartVoucher(userId, cartId, voucherId) {
        return this.usersCartsVouchersByUserIdAndCartId1WithHttpInfo(userId, cartId, voucherId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * deleteCartVouchers Removes a voucher based on the voucherId defined for
     * the current cart.  Security: Permitted only for non anonymous users or
     * clients. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} voucherId Voucher identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersCartsVouchersVoucherIdByUserIdWithHttpInfo(userId, cartId, voucherId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deleteCartVouchers')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling deleteCartVouchers')
        }

        // verify the required parameter 'voucherId' is set
        if (voucherId === undefined || voucherId === null) {
            throw new Error('Missing the required parameter \'voucherId\' when calling deleteCartVouchers')
        }

        const pathParams = {
            userId,
            cartId,
            voucherId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/carts/{cartId}/vouchers/{voucherId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * deleteCartVouchers Removes a voucher based on the voucherId defined for
     * the current cart.  Security: Permitted only for non anonymous users or
     * clients. Trusted client or customer manager may impersonate as any user
     * and access cart on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart identifier <ul> <li>cart code for
     * logged in user</li> <li>cart guid for anonymous
     * user</li> <li>'current' for the last modified
     * cart</li> </ul>
     * @param {String} voucherId Voucher identifier (code)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deleteCartVouchers(userId, cartId, voucherId) {
        return this.usersCartsVouchersVoucherIdByUserIdWithHttpInfo(userId, cartId, voucherId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getCustomerGroups Returns all customer groups of a customer.  Security:
     * Permitted for customers, customer managers or trusted client. Trusted
     * client or customer manager is able to impersonate as any other user and
     * access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/UserGroupList}
     * and HTTP response
     */
    usersCustomergroupsByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getCustomerGroups')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = UserGroupList

        return this.apiClient.callApi(
            '/users/{userId}/customergroups', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getCustomerGroups Returns all customer groups of a customer.  Security:
     * Permitted for customers, customer managers or trusted client. Trusted
     * client or customer manager is able to impersonate as any other user and
     * access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/UserGroupList}
     */
    getCustomerGroups(userId, opts) {
        return this.usersCustomergroupsByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * putLogin Changes customer's login.  Security: Permitted for trusted
     * clients, customers and customer managers. Trusted client or customer
     * manager is able to impersonate as any other user and change login on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.password Customer's current password.
     * @param {String} opts.newLogin Customer's new login. Customer login is
     * case insensitive.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersLoginByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putLogin')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            password: opts.password,
            newLogin: opts.newLogin
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/login', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * putLogin Changes customer's login.  Security: Permitted for trusted
     * clients, customers and customer managers. Trusted client or customer
     * manager is able to impersonate as any other user and change login on
     * their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.password Customer's current password.
     * @param {String} opts.newLogin Customer's new login. Customer login is
     * case insensitive.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putLogin(userId, opts) {
        return this.usersLoginByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * UsersOrdersByUserId Returns order history data for all orders placed by
     * the specific user for the specific base store. Response contains orders
     * search result displayed in several pages if needed.  Security: Allowed
     * only for customers, customer managers, trusted clients Trusted client is
     * able to impersonate as any customer and access their orders.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.statuses Filters only certain order statuses. It
     * means: statuses=CANCELLED,CHECKED_VALID would only return orders
     * with status CANCELLED or CHECKED_VALID.
     * @param {String} opts.pageSize The number of results returned per page.
     * @param {String} opts.sort Sorting method applied to the return results.
     * @param {String} opts.currentPage The current result page requested.
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/OrderHistoryList} and HTTP response
     */
    usersOrdersByUserId1WithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getOrders')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            statuses: opts.statuses,
            pageSize: opts.pageSize,
            sort: opts.sort,
            currentPage: opts.currentPage,
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = OrderHistoryList

        return this.apiClient.callApi(
            '/users/{userId}/orders', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * UsersOrdersByUserId Returns order history data for all orders placed by
     * the specific user for the specific base store. Response contains orders
     * search result displayed in several pages if needed.  Security: Allowed
     * only for customers, customer managers, trusted clients Trusted client is
     * able to impersonate as any customer and access their orders.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.statuses Filters only certain order statuses. It
     * means: statuses=CANCELLED,CHECKED_VALID would only return orders
     * with status CANCELLED or CHECKED_VALID.
     * @param {String} opts.pageSize The number of results returned per page.
     * @param {String} opts.sort Sorting method applied to the return results.
     * @param {String} opts.currentPage The current result page requested.
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/OrderHistoryList}
     */
    getOrders(userId, opts) {
        return this.usersOrdersByUserId1WithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * UsersOrdersByUserId Authorizes cart and places the order. Response
     * contains the new order data.  Security: Allowed only for customers,
     * customer managers, clients or trusted clients. Trusted client is able to
     * impersonate as any customer and place order on his behalf
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart code for logged in user, cart GUID for guest
     * checkout
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.securityCode CCV security code.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/Order} and HTTP
     * response
     */
    usersOrdersByUserId2WithHttpInfo(userId, cartId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling postOrder')
        }

        // verify the required parameter 'cartId' is set
        if (cartId === undefined || cartId === null) {
            throw new Error('Missing the required parameter \'cartId\' when calling postOrder')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
            cartId,
            securityCode: opts.securityCode
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = Order

        return this.apiClient.callApi(
            '/users/{userId}/orders', 'POST',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * UsersOrdersByUserId Authorizes cart and places the order. Response
     * contains the new order data.  Security: Allowed only for customers,
     * customer managers, clients or trusted clients. Trusted client is able to
     * impersonate as any customer and place order on his behalf
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} cartId Cart code for logged in user, cart GUID for guest
     * checkout
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @param {String} opts.securityCode CCV security code.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/Order}
     */
    postOrder(userId, cartId, opts) {
        return this.usersOrdersByUserId2WithHttpInfo(userId, cartId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getOrder Returns specific order details based on a specific order code.
     * The response contains detailed order information.  Security: Allowed only
     * for customers, customer managers, clients or trusted clients. Trusted
     * client is able to impersonate as any customer and access their orders.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} code Order GUID (Globally Unique Identifier) or order
     * CODE
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/Order} and HTTP
     * response
     */
    usersOrdersByUserIdAndCodeWithHttpInfo(userId, code, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getOrder')
        }

        // verify the required parameter 'code' is set
        if (code === undefined || code === null) {
            throw new Error('Missing the required parameter \'code\' when calling getOrder')
        }

        const pathParams = {
            userId,
            code
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = Order

        return this.apiClient.callApi(
            '/users/{userId}/orders/{code}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getOrder Returns specific order details based on a specific order code.
     * The response contains detailed order information.  Security: Allowed only
     * for customers, customer managers, clients or trusted clients. Trusted
     * client is able to impersonate as any customer and access their orders.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} code Order GUID (Globally Unique Identifier) or order
     * CODE
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/Order}
     */
    getOrder(userId, code, opts) {
        return this.usersOrdersByUserIdAndCodeWithHttpInfo(userId, code, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * putPassword Changes customer's password.  Security: Permitted for
     * trusted clients, customers and customer managers. Trusted client or
     * customer manager may change someone's else password without knowing
     * the old one.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts._new New password
     * @param {String} opts.old Old password. Required only for
     * ROLE_CUSTOMERGROUP
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersPasswordByUserIdWithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putPassword')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
            new: opts._new,
            old: opts.old
        }

        const authNames = ['auth']
        const contentTypes = ['application/x-www-form-urlencoded']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/password', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * putPassword Changes customer's password.  Security: Permitted for
     * trusted clients, customers and customer managers. Trusted client or
     * customer manager may change someone's else password without knowing
     * the old one.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts._new New password
     * @param {String} opts.old Old password. Required only for
     * ROLE_CUSTOMERGROUP
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putPassword(userId, opts) {
        return this.usersPasswordByUserIdWithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getPaymentDetail Returns customer's credit card payment details for a
     * given id.  Security: Permitted for customers, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type {@link module:models/PaymentDetails}
     * and HTTP response
     */
    usersPaymentdetailsByUserIdWithHttpInfo(userId, paymentDetailsId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getPaymentDetail')
        }

        // verify the required parameter 'paymentDetailsId' is set
        if (paymentDetailsId === undefined || paymentDetailsId === null) {
            throw new Error('Missing the required parameter \'paymentDetailsId\' when calling getPaymentDetail')
        }

        const pathParams = {
            userId,
            paymentDetailsId
        }
        const queryParams = {
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = PaymentDetails

        return this.apiClient.callApi(
            '/users/{userId}/paymentdetails/{paymentDetailsId}', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getPaymentDetail Returns customer's credit card payment details for a
     * given id.  Security: Permitted for customers, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {Object} opts Optional parameters
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/PaymentDetails}
     */
    getPaymentDetail(userId, paymentDetailsId, opts) {
        return this.usersPaymentdetailsByUserIdWithHttpInfo(userId, paymentDetailsId, opts)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getPaymentDetail Updates existing customer's credit card payment info
     * based on the payment info ID. Attributes not given in request will be
     * defined again (set to null or default).  Security: Permitted for
     * customers, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {module:models/PaymentDetailsOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersPaymentdetailsByUserId1WithHttpInfo(userId, paymentDetailsId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling putPaymentDetail')
        }

        // verify the required parameter 'paymentDetailsId' is set
        if (paymentDetailsId === undefined || paymentDetailsId === null) {
            throw new Error('Missing the required parameter \'paymentDetailsId\' when calling putPaymentDetail')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling putPaymentDetail')
        }

        const pathParams = {
            userId,
            paymentDetailsId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/paymentdetails/{paymentDetailsId}', 'PUT',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getPaymentDetail Updates existing customer's credit card payment info
     * based on the payment info ID. Attributes not given in request will be
     * defined again (set to null or default).  Security: Permitted for
     * customers, customer managers or trusted client. Trusted client or
     * customer manager is able to impersonate as any other user and access data
     * on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {module:models/PaymentDetailsOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    putPaymentDetail(userId, paymentDetailsId, body) {
        return this.usersPaymentdetailsByUserId1WithHttpInfo(userId, paymentDetailsId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getPaymentDetail Updates existing customer's credit card payment
     * details based on its ID. Only attributes given in request will be
     * changed.  Security: Permitted for customers, customer managers or trusted
     * client. Trusted client or customer manager is able to impersonate as any
     * other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {module:models/PaymentDetailsOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersPaymentdetailsByUserId2WithHttpInfo(userId, paymentDetailsId, body) {
        const postBody = body

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling patchPaymentDetail')
        }

        // verify the required parameter 'paymentDetailsId' is set
        if (paymentDetailsId === undefined || paymentDetailsId === null) {
            throw new Error('Missing the required parameter \'paymentDetailsId\' when calling patchPaymentDetail')
        }

        // verify the required parameter 'body' is set
        if (body === undefined || body === null) {
            throw new Error('Missing the required parameter \'body\' when calling patchPaymentDetail')
        }

        const pathParams = {
            userId,
            paymentDetailsId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/paymentdetails/{paymentDetailsId}', 'PATCH',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getPaymentDetail Updates existing customer's credit card payment
     * details based on its ID. Only attributes given in request will be
     * changed.  Security: Permitted for customers, customer managers or trusted
     * client. Trusted client or customer manager is able to impersonate as any
     * other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @param {module:models/PaymentDetailsOCC} body
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    patchPaymentDetail(userId, paymentDetailsId, body) {
        return this.usersPaymentdetailsByUserId2WithHttpInfo(userId, paymentDetailsId, body)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getPaymentDetail Removes customer's credit card payment details based
     * on its ID.  Security: Permitted for customers, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing HTTP response
     */
    usersPaymentdetailsByUserId3WithHttpInfo(userId, paymentDetailsId) {
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling deletePaymentDetail')
        }

        // verify the required parameter 'paymentDetailsId' is set
        if (paymentDetailsId === undefined || paymentDetailsId === null) {
            throw new Error('Missing the required parameter \'paymentDetailsId\' when calling deletePaymentDetail')
        }

        const pathParams = {
            userId,
            paymentDetailsId
        }
        const queryParams = {
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = null

        return this.apiClient.callApi(
            '/users/{userId}/paymentdetails/{paymentDetailsId}', 'DELETE',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getPaymentDetail Removes customer's credit card payment details based
     * on its ID.  Security: Permitted for customers, customer managers or
     * trusted client. Trusted client or customer manager is able to impersonate
     * as any other user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {String} paymentDetailsId - Payment details identifier
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}
     */
    deletePaymentDetail(userId, paymentDetailsId) {
        return this.usersPaymentdetailsByUserId3WithHttpInfo(userId, paymentDetailsId)
            .then((response) => {
                return response.data
            })
    }

    /**
     * getPaymentDetail Return customer's credit card payment details list.
     * Security: Permitted for customers, customer managers or trusted client.
     * Trusted client or customer manager is able to impersonate as any other
     * user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.saved Type of payment details
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an
     * object containing data of type
     * {@link module:models/PaymentDetailsList} and HTTP response
     */
    usersPaymentdetailsByUserId4WithHttpInfo(userId, opts) {
        opts = opts || {}
        const postBody = null

        // verify the required parameter 'userId' is set
        if (userId === undefined || userId === null) {
            throw new Error('Missing the required parameter \'userId\' when calling getPaymentDetails')
        }

        const pathParams = {
            userId
        }
        const queryParams = {
            saved: opts.saved,
            fields: opts.fields
        }
        const headerParams = {
        }
        const formParams = {
        }

        const authNames = ['auth']
        const contentTypes = ['application/json']
        const accepts = ['application/json']
        const returnType = PaymentDetailsList

        return this.apiClient.callApi(
            '/users/{userId}/paymentdetails', 'GET',
            pathParams, queryParams, headerParams, formParams, postBody,
            authNames, contentTypes, accepts, returnType
        )
    }

    /**
     * getPaymentDetail Return customer's credit card payment details list.
     * Security: Permitted for customers, customer managers or trusted client.
     * Trusted client or customer manager is able to impersonate as any other
     * user and access data on their behalf.
     * @param {String} userId User identifier or one of the literals below :
     * <ul> <li>'current' for currently authenticated
     * user</li> <li>'anonymous' for anonymous
     * user</li> </ul>
     * @param {Object} opts Optional parameters
     * @param {String} opts.saved Type of payment details
     * @param {String} opts.fields Response configuration (list of fields, which
     * should be returned in the response)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data
     * of type {@link module:models/PaymentDetailsList}
     */
    getPaymentDetails(userId, opts) {
        return this.usersPaymentdetailsByUserId4WithHttpInfo(userId, opts)
            .then((response) => {
                return response.data
            })
    }

}