/**
* ClientSide service.
* @module api/ClientSideApi
*/
export default class ClientSideApi {
/**
* Constructs a new ClientSideApi.
* @alias ClientSideApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient?: any);
apiClient: any;
/**
* Callback function to receive the result of the checkEligibilityClientSide operation.
* @callback checkEligibilityClientSideCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {ClientQualificationsCheckEligibilityResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Check Eligibility (client-side)
* Generate a list of redeemables that are applicable in the context of the customer and order. The new qualifications method is an improved version of [Campaign Qualifications](/api-reference/campaigns/examine-campaign-qualification), [Voucher Qualifications](/api-reference/vouchers/examine-voucher-qualification) API requests. The new qualification method introduces the following improvements: - Qualification results are returned faster - No limit on the number of returned redeemables - Introduces new qualification scenarios, not available in the previous version Scenario Guide Read our dedicated guide to learn about some use cases this endpoint can cover [here](/guides/checking-eligibility). # Paging The Voucherify Qualifications API request will return to you all of the redeemables available for the customer in batches of up to 50 redeemables per page. To get the next batch of redeemables, you need to use the starting_after cursor. To process of paging the redeemables works in the following manner: - You send the first API request for Qualifications without the starting_after parameter. - The response will contain a parameter named has_more. If the parameters value is set to true, then more redeemables are available. - Get the value of the created_at parameter of the last returned redeemable. The value of this parameter will be used as a cursor to retrieve the next page of redeemables. - Send another API request for Qualification with the starting_after parameter set to the value taken from the created_at parameter from the last returned redeemable. - Voucherify will return the next page of redeemables. - If the has_more parameter is set to true, apply steps 3-5 to get the next page of redeemables. # Caching Qualification has a 5-minute cache for the returned results. If you change your campaign settings or validation rules, the changes will apply to qualification results after the cache refreshes.
* @param {ClientQualificationsCheckEligibilityRequestBody} clientQualificationsCheckEligibilityRequestBody Define order and customer context.
* @param {checkEligibilityClientSideCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link ClientQualificationsCheckEligibilityResponseBody}
* @returns {Promise<(ClientQualificationsCheckEligibilityResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `ClientQualificationsCheckEligibilityResponseBody` object or with `undefined`.
*/
checkEligibilityClientSide(clientQualificationsCheckEligibilityRequestBody: ClientQualificationsCheckEligibilityRequestBody, callback?: (error: Error | null, data?: ClientQualificationsCheckEligibilityResponseBody, response?: any) => any): Promise<(ClientQualificationsCheckEligibilityResponseBody | undefined)>;
/**
* Callback function to receive the result of the listPromotionTiersClientSide operation.
* @callback listPromotionTiersClientSideCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {ClientPromotionsTiersListResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* List Promotion Tiers (client-side)
* This method enables you to list promotion tiers.
* @param {String} origin Indicates the origin (scheme, hostname, and port).
* @param {{
isAvailable?: Boolean,
limit?: Number,
page?: Number,
order?: Exclude,
}} [opts] Optional parameters
* @param {listPromotionTiersClientSideCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link ClientPromotionsTiersListResponseBody}
* @returns {Promise<(ClientPromotionsTiersListResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `ClientPromotionsTiersListResponseBody` object or with `undefined`.
*/
listPromotionTiersClientSide(origin: string, opts?: {
isAvailable?: boolean;
limit?: number;
page?: number;
order?: Exclude;
}, callback?: (error: Error | null, data?: ClientPromotionsTiersListResponseBody, response?: any) => any): Promise<(ClientPromotionsTiersListResponseBody | undefined)>;
/**
* Callback function to receive the result of the redeemStackedDiscountsClientSide operation.
* @callback redeemStackedDiscountsClientSideCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {ClientRedemptionsRedeemResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Redeem Stackable Discounts (client-side)
* This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications. # How API returns calculated discounts and order amounts in the response In the table below, you can see the logic the API follows to calculate discounts and amounts: Rollbacks You cant roll back a child redemption. When you call rollback on a stacked redemption, all child redemptions will be rolled back. You need to refer to a parent redemption ID in your [rollback request](/api-reference/redemptions/rollback-stackable-redemptions).
* @param {String} origin Indicates the origin (scheme, hostname, and port).
* @param {ClientRedemptionsRedeemRequestBody} clientRedemptionsRedeemRequestBody
* @param {redeemStackedDiscountsClientSideCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link ClientRedemptionsRedeemResponseBody}
* @returns {Promise<(ClientRedemptionsRedeemResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `ClientRedemptionsRedeemResponseBody` object or with `undefined`.
*/
redeemStackedDiscountsClientSide(origin: string, clientRedemptionsRedeemRequestBody: ClientRedemptionsRedeemRequestBody, callback?: (error: Error | null, data?: ClientRedemptionsRedeemResponseBody, response?: any) => any): Promise<(ClientRedemptionsRedeemResponseBody | undefined)>;
/**
* Callback function to receive the result of the trackCustomEventClientSide operation.
* @callback trackCustomEventClientSideCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {ClientEventsCreateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Track Custom Event (client-side)
* To track a custom event, you create an event object. The event object must be linked to the customer who performs the action. If a customer doesnt exist in Voucherify, the customer will be created.
* @param {String} origin Indicates the origin (scheme, hostname, and port).
* @param {ClientEventsCreateRequestBody} clientEventsCreateRequestBody Specify the details of the custom event.
* @param {trackCustomEventClientSideCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link ClientEventsCreateResponseBody}
* @returns {Promise<(ClientEventsCreateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `ClientEventsCreateResponseBody` object or with `undefined`.
*/
trackCustomEventClientSide(origin: string, clientEventsCreateRequestBody: ClientEventsCreateRequestBody, callback?: (error: Error | null, data?: ClientEventsCreateResponseBody, response?: any) => any): Promise<(ClientEventsCreateResponseBody | undefined)>;
/**
* Callback function to receive the result of the validateStackedDiscountsClientSide operation.
* @callback validateStackedDiscountsClientSideCallback
* @param {Error|null} error Error object if failed, null otherwise.
* @param {ClientValidationsValidateResponseBody} [data] The data returned by the service call.
* @param {Object} [response] Full response object if successful.
*/
/**
* Validate Stackable Discounts (client-side)
* Verify redeemables provided in the request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.
* @param {String} origin Indicates the origin (scheme, hostname, and port).
* @param {ClientValidationsValidateRequestBody} clientValidationsValidateRequestBody
* @param {validateStackedDiscountsClientSideCallback} [callback] The callback function, accepting three arguments: error, data, response
* data is of type: {@link ClientValidationsValidateResponseBody}
* @returns {Promise<(ClientValidationsValidateResponseBody | undefined)>} Depending on whether the `callback` parameter is provided, the promise will resolve with a `ClientValidationsValidateResponseBody` object or with `undefined`.
*/
validateStackedDiscountsClientSide(origin: string, clientValidationsValidateRequestBody: ClientValidationsValidateRequestBody, callback?: (error: Error | null, data?: ClientValidationsValidateResponseBody, response?: any) => any): Promise<(ClientValidationsValidateResponseBody | undefined)>;
}
import ClientQualificationsCheckEligibilityRequestBody from '../model/ClientQualificationsCheckEligibilityRequestBody';
import ClientQualificationsCheckEligibilityResponseBody from '../model/ClientQualificationsCheckEligibilityResponseBody';
import ParameterOrderListPromotionTiersClientSide from '../model/ParameterOrderListPromotionTiersClientSide';
import ClientPromotionsTiersListResponseBody from '../model/ClientPromotionsTiersListResponseBody';
import ClientRedemptionsRedeemRequestBody from '../model/ClientRedemptionsRedeemRequestBody';
import ClientRedemptionsRedeemResponseBody from '../model/ClientRedemptionsRedeemResponseBody';
import ClientEventsCreateRequestBody from '../model/ClientEventsCreateRequestBody';
import ClientEventsCreateResponseBody from '../model/ClientEventsCreateResponseBody';
import ClientValidationsValidateRequestBody from '../model/ClientValidationsValidateRequestBody';
import ClientValidationsValidateResponseBody from '../model/ClientValidationsValidateResponseBody';