Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ShopperPromotions<ConfigParameters>

View details for active promotions.

Simple example:

  import { ShopperPromotions } from "commerce-sdk-isomorphic";

  const clientConfig = {
    parameters: {
      clientId: "XXXXXX",
      organizationId: "XXXX",
      shortCode: "XXX",
      siteId: "XX"
    }
  };
  const shopperPromotionsClient = new ShopperPromotions(clientConfig);
API Version: 1.0.27
Last Updated:

Type parameters

Hierarchy

  • ShopperPromotions

Index

Constructors

constructor

Properties

clientConfig

clientConfig: ClientConfig<ConfigParameters> & { baseUri: string }

Static Readonly defaultBaseUri

defaultBaseUri: "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/{version}" = "https://{shortCode}.api.commercecloud.salesforce.com/pricing/shopper-promotions/{version}"

Static Readonly paramKeys

paramKeys: { getPromotions: ["organizationId", "siteId", "ids", "locale"]; getPromotionsForCampaign: ["organizationId", "campaignId", "siteId", "startDate", "endDate", "currency"]; getPromotionsForCampaignRequired: ["organizationId", "campaignId", "siteId"]; getPromotionsRequired: ["organizationId", "siteId", "ids"] } = {getPromotions: ['organizationId','siteId','ids','locale',],getPromotionsRequired: ['organizationId','siteId','ids',],getPromotionsForCampaign: ['organizationId','campaignId','siteId','startDate','endDate','currency',],getPromotionsForCampaignRequired: ['organizationId','campaignId','siteId',],} as const

Type declaration

  • getPromotions: ["organizationId", "siteId", "ids", "locale"]
  • getPromotionsForCampaign: ["organizationId", "campaignId", "siteId", "startDate", "endDate", "currency"]
  • getPromotionsForCampaignRequired: ["organizationId", "campaignId", "siteId"]
  • getPromotionsRequired: ["organizationId", "siteId", "ids"]

Methods

getPromotions

  • Returns an array of enabled promotions for a list of specified IDs. In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.

    If you would like to get a raw Response object use the other getPromotions function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ ids: string; locale?: undefined | string; organizationId: string; siteId: string } & {}, ConfigParameters> }>

      An object containing the options for this method.

    Returns Promise<PromotionResult>

    A promise of type PromotionResult.

  • Returns an array of enabled promotions for a list of specified IDs. In the request URL, you can specify up to 50 IDs. If you specify an ID that contains either parentheses or the separator characters, you must URL encode these characters. Each request returns only enabled promotions as the server does not consider promotion qualifiers or schedules.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ ids: string; locale?: undefined | string; organizationId: string; siteId: string } & {}, ConfigParameters> }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : PromotionResult>

    A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.

getPromotionsForCampaign

  • getPromotionsForCampaign(options?: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ campaignId: string; currency?: undefined | string; endDate?: undefined | string; organizationId: string; siteId: string; startDate?: undefined | string } & {}, ConfigParameters> }>): Promise<PromotionResult>
  • getPromotionsForCampaign<T>(options?: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ campaignId: string; currency?: undefined | string; endDate?: undefined | string; organizationId: string; siteId: string; startDate?: undefined | string } & {}, ConfigParameters> }>, rawResponse?: T): Promise<T extends true ? Response : PromotionResult>
  • Handles get promotion by filter criteria. Returns an array of enabled promotions matching the specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.

    If you would like to get a raw Response object use the other getPromotionsForCampaign function.

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ campaignId: string; currency?: undefined | string; endDate?: undefined | string; organizationId: string; siteId: string; startDate?: undefined | string } & {}, ConfigParameters> }>

      An object containing the options for this method.

    Returns Promise<PromotionResult>

    A promise of type PromotionResult.

  • Handles get promotion by filter criteria. Returns an array of enabled promotions matching the specified filter criteria. In the request URL, you must provide a campaign_id parameter, and you can optionally specify a date range by providing start_date and end_date parameters. Both parameters are required to specify a date range, as omitting one causes the server to return a MissingParameterException fault. Each request returns only enabled promotions, since the server does not consider promotion qualifiers or schedules.

    Type parameters

    • T: boolean

    Parameters

    • Optional options: RequireParametersUnlessAllAreOptional<{ headers?: undefined | {}; parameters?: CompositeParameters<{ campaignId: string; currency?: undefined | string; endDate?: undefined | string; organizationId: string; siteId: string; startDate?: undefined | string } & {}, ConfigParameters> }>

      An object containing the options for this method.

    • Optional rawResponse: T

      Set to true to return entire Response object instead of DTO.

    Returns Promise<T extends true ? Response : PromotionResult>

    A promise of type Response if rawResponse is true, a promise of type PromotionResult otherwise.

Generated using TypeDoc