ordercloud-javascript-sdk
    Preparing search index...

    Class Discounts

    Index
    • Returns this

      enables impersonation by calling the subsequent method with the stored impersonation token

      Discounts.As().List() // lists Discounts using the impersonated users' token
      
    • Delete a discount Check out the docs for more info

      Parameters

      • discountID: string

        ID of the discount.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>

    • Delete a discount assignment Check out the docs for more info

      Parameters

      • discountID: string

        ID of the discount.

      • listOptions: { buyerGroupID?: string; buyerID?: string; userGroupID?: string } = {}
        • OptionalbuyerGroupID?: string

          ID of the buyer group.

        • OptionalbuyerID?: string

          ID of the buyer.

        • OptionaluserGroupID?: string

          ID of the user group.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>

    • Retrieve a discount Check out the docs for more info

      Type Parameters

      Parameters

      • discountID: string

        ID of the discount.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredDeep<TDiscount>>

    • List discounts Check out the docs for more info

      Type Parameters

      Parameters

      • listOptions: {
            filters?: Filters;
            page?: number;
            pageSize?: number;
            sortBy?: (
                | "ID"
                | "ProductID"
                | "!ID"
                | "Priority"
                | "!Priority"
                | "!ProductID"
                | "CatalogID"
                | "CategoryID"
                | "!CatalogID"
                | "!CategoryID"
            )[];
        } = {}
        • Optionalfilters?: Filters

          An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'

        • Optionalpage?: number

          Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

        • OptionalpageSize?: number

          Number of results to return per page.

        • OptionalsortBy?: (
              | "ID"
              | "ProductID"
              | "!ID"
              | "Priority"
              | "!Priority"
              | "!ProductID"
              | "CatalogID"
              | "CategoryID"
              | "!CatalogID"
              | "!CategoryID"
          )[]

          Comma-delimited list of fields to sort by.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredObjectDeep<ListPage<TDiscount>>>

    • List discount assignments Check out the docs for more info

      Type Parameters

      Parameters

      • listOptions: {
            buyerGroupID?: string;
            buyerID?: string;
            discountID?: string;
            level?: "Group" | "Company";
            page?: number;
            pageSize?: number;
            userGroupID?: string;
        } = {}
        • OptionalbuyerGroupID?: string

          ID of the buyer group.

        • OptionalbuyerID?: string

          ID of the buyer.

        • OptionaldiscountID?: string

          ID of the discount.

        • Optionallevel?: "Group" | "Company"

          Level of the discount assignment. Possible values: Group, Company, BuyerGroup.

        • Optionalpage?: number

          Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.

        • OptionalpageSize?: number

          Number of results to return per page.

        • OptionaluserGroupID?: string

          ID of the user group.

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredObjectDeep<ListPage<TDiscountAssignment>>>

    • Create or update a discount If an object with the same ID already exists, it will be overwritten. Check out the docs for more info

      Type Parameters

      Parameters

      • discountID: string

        ID of the discount.

      • discount: Discount

        Required fields: DiscountBreaks

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<RequiredDeep<TDiscount>>

    • Create or update a discount assignment Check out the docs for more info

      Parameters

      • discountAssignment: DiscountAssignment

        Required fields: DiscountID

      • requestOptions: RequestOptions = {}
        • OptionalaccessToken?: string

          Alternative token to the one stored in the sdk instance (useful for impersonation).

        • OptionalcancelToken?: CancelToken

          Axios cancelToken that can be used to cancel the request.

        • OptionalrequestType?: string

          Identify the type of request. Useful for error logs.

      Returns Promise<void>