diff --git a/Changelog.md b/Changelog.md index 34e79d007..4906955b6 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,65 @@ # Changelog +## 20231123 - Campaigns API + +**Added schemas** +- CampaignResponse +- CampaignVoucher +- CodeConfig +- CodeConfigResponse +- CampaignsImportVoucherLoyaltyCard +- CampaignLoyaltyCardResponse +- CampaignLoyaltyCardResponse +- CampaignLoyaltyCardRequestBody +- LuckyDraw +- CampaignsCreateBase +- CampaignsUpdateBase +- CampaignsUpdateCouponCampaignBase +- CampaignsUpdateDiscountCouponsCampaign +- CampaignsUpdateGiftCampaign +- CampaignsUpdateReferralCampaign +- CampaignsUpdateLoyaltyCampaign +- CampaignsUpdateGiveawayCampaign +- CampaignsUpdatePromotionCampaign +- CampaignsCreateRequestBody +- CampaignsUpdateRequestBody +- CampaignsCreateDiscountCouponsCampaign +- CampaignsCreateReferralCampaign +- CampaignsCreateGiftCampaign +- CampaignsCreateLoyaltyCampaign +- CampaignsCreatePromotionCampaign +- CampaignsCreateGiveawayCampaign +- CampaignsCreateCampaignVoucherWithCodeRequestBody +- CampaignsCreateCampaignVoucherRequestBody +- CampaignsImportVoucherRequestBody +- CampaignsImportVoucherItem +- CampaignsListResponseBody +- DiscountCouponsCampaignVoucher +- ReferralCampaignVoucher +- GiveawayCampaignVoucher +- GiftCampaignVoucher +- LoyaltyCampaignVoucher +- PromotionTierCreateParams +- PromotionTiersList +- LoyaltyTiersExpirationAll + +**Deleted schemas** +- 2_obj_campaign_object +- 2_req_create_campaign +- 2_req_create_campaign_discount_voucher +- 2_req_create_campaign_loyalty +- 2_req_create_campaign_gift +- 2_req_create_campaign_referral +- 2_req_create_campaign_promotion +- 2_req_update_campaign +- 2_req_add_vouchers_to_campaign +- 2_req_import_vouchers_to_campaign +- 2_obj_import_vouchers_to_campaign_object +- 2_res_list_campaigns +- 3_res_list_promotion_tiers_from_campaign +- 20_obj_category_object +- e_409_duplicate_found + ## 20231117 - Quality Fixes **Changed schemas** diff --git a/README.md b/README.md index 8d21448f4..67bdd8400 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,4 @@ Please refer to the following guides: - [Guides](https://docs.voucherify.io/docs) - [Recipes](https://docs.voucherify.io/recipes) - [API Reference](https://docs.voucherify.io/reference/introduction-1) -- [Support Documentation](https://support.voucherify.io/) \ No newline at end of file +- [Support Documentation](https://support.voucherify.io/) diff --git a/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md b/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md index ef0b21ec5..53dc5b3d3 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md +++ b/docs/reference-docs/CAMPAIGNS-API-Add-Vouchers-To-Campaign.md @@ -1,5 +1,5 @@ --- -title: Add Vouchers to Campaign +title: Add Voucher to Campaign type: endpoint categorySlug: voucherify-api slug: add-vouchers-to-campaign diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index a8a07728c..936535fe9 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -8,7 +8,13 @@ hidden: false order: 1 --- -## Campaign Object +## Campaign Response +All of: + +1. [Campaign](#campaign) +2.

Campaign Additional Data

AttributesDescription
promotionSee: Promotion Tiers
validation_rules_assignmentsSee: Validation Rules Assignments List
+ +## Campaign | Attributes | Description | |:-----|:--------| | id
`string` |

Unique campaign ID, assigned by Voucherify.

**Example:**

camp_f7fBbQxUuTN7dI7tGOo5XMDA

| @@ -16,7 +22,7 @@ order: 1 | description
`string` |

An optional field to keep any extra textual information about the campaign such as a campaign description and details.

| | campaign_type
`string` |

Type of campaign.

Available values: `LOYALTY_PROGRAM`, `GIFT_VOUCHERS`, `DISCOUNT_COUPONS`, `PROMOTION`, `REFERRAL_PROGRAM`, `LUCKY_DRAW` | | type
`string` |

Defines whether the campaign can be updated with new vouchers after campaign creation.

Available values: `AUTO_UPDATE`, `STATIC` | -| voucher | Any of: [Discount Voucher](#discount-voucher), [Gift Card](#gift-card), [Loyalty Card](#loyalty-card) | +| voucher | See: [Campaign Discount Voucher](#campaign-discount-voucher) | | auto_join
`boolean` |

Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled.

| | join_once
`boolean` |

If this value is set to true, customers will be able to join the campaign only once.

| | use_voucher_metadata_schema
`boolean` |

Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema.

| @@ -32,126 +38,70 @@ order: 1 | updated_at
`string` |

Timestamp representing the date and time when the voucher was updated in ISO 8601 format.

**Example:**

2022-09-20T09:18:19.623Z

| | category
`string` |

Unique category name.

| | creation_status
`string` |

Indicates the status of the campaign creation.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | -| vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT` | +| vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT`, `MODIFYING` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| -| category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| -| categories | See: [Category Object](#category-object) | +| category_id
`string,null` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| +| categories
`array` |

Contains details about the category.

Array of [Category](#category) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| -| referral_program
`object` |

Defines the referee reward and the way a referral is triggered. Context: REFERRAL_PROGRAM.

AttributesDescription
conversion_event_type
string

How a referral is triggered.

Available values: redemption, custom_event
custom_event
object

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_fi47Dcu5T0m3v3nT5ch3ma

name
string

Custom event name.

referee_reward
object

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

The number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| -| promotion | See: [Promotion Tiers](#promotion-tiers) | -| loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

Any of: [Balance](#balance), [Points in Period](#points-in-period) | +| referral_program | See: [Referral Program](#referral-program) | +| loyalty_tiers_expiration | See: [Loyalty Tiers Expiration](#loyalty-tiers-expiration) | -## Discount Voucher +## Promotion Tiers | Attributes | Description | |:-----|:--------| -| type
`string` |

Type of voucher.

| -| discount |

Defines the voucher discount type and details.

One of: [Amount](#amount), [Percentage](#percentage), [Fixed](#fixed), [Unit, single item](#unit-single-item), [Unit, multiple items](#unit-multiple-items), [Shipping](#shipping) | -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| -| is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| +| object
`string` |

The type of object represented by JSON. This object stores information about promotion tiers in a dictionary.

| +| data_ref
`string` |

Identifies the name of the attribute that contains the array of promotion tier objects.

| +| tiers
`array` |

Contains array of promotion tier objects.

Array of [Promotion Tier](#promotion-tier) | +| total
`integer` |

Total number of promotion tiers.

| +| has_more
`boolean` |

As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results.

| -## Gift Card +## Validation Rules Assignments List | Attributes | Description | |:-----|:--------| -| type
`string` |

Type of voucher.

| -| gift
`object` |

Defines the gift card details.

AttributesDescription
amount
integer

Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

effect
string

Defines how the credits are applied to the customer's order.

Available values: APPLY_TO_ORDER, APPLY_TO_ITEMS
| -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| -| is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| +| object
`string` |

The type of object represented by JSON. This object stores information about validation rules assignments.

Available values: `list` | +| data_ref
`string` |

Identifies the name of the attribute that contains the array of validation rules assignments.

Available values: `data` | +| data
`array` |

Contains array of validation rules assignments.

Array of [Business Validation Rule Assignment](#business-validation-rule-assignment) | +| total
`integer` |

Total number of validation rules assignments.

| -## Loyalty Card +## Campaign Discount Voucher | Attributes | Description | |:-----|:--------| | type
`string` |

Type of voucher.

| -| loyalty_card
`object` |

Defines the loyalty card details.

AttributesDescription
points
integer

Initial loyalty card income in points to be applied to the loyalty card at voucher generation.

expiration_rules
object

Defines point expiration rules.

AttributesDescription
period_type
string

The expiration period.

Available values: MONTH
period_value
integer

How many periods should pass before the expiration occurs.

rounding_type
string

Round up expiration till the end of the given period type.

Available values: END_OF_MONTH, END_OF_QUARTER, END_OF_HALF_YEAR, END_OF_YEAR, PARTICULAR_MONTH
| -| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer

How many times a voucher can be redeemed. A null value means unlimited.

| -| code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| +| discount |

Defines the voucher discount type and details.

See: [Discount](#discount) | +| gift |

Defines the voucher gift details.

See: [Gift](#gift) | +| loyalty_card |

Defines the voucher loyalty card details.

See: [Campaign Loyalty Card](#campaign-loyalty-card) | +| redemption
`object` |

Defines the redemption limits on vouchers.

AttributesDescription
quantity
integer,null

How many times a voucher can be redeemed. A null value means unlimited.

| +| code_config | See: [Code Config Response](#code-config-response) | | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| +| start_date
`string` |

Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is inactive before this date.

**Example:**

2022-09-20T00:00:00.000Z

| +| expiration_date
`string` |

Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is inactive after this date.

**Example:**

2022-09-30T00:00:00.000Z

| +| validity_timeframe
`object` |

Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.

AttributesDescription
interval
string

Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an interval of P2D will be active every other day.

duration
string

Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a duration of P1D will be valid for a duration of one day.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| - -## Promotion Tiers -| Attributes | Description | -|:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about promotion tiers in a dictionary.

| -| data_ref
`string` |

Identifies the name of the attribute that contains the array of promotion tier objects.

| -| tiers
`array` |

Contains array of promotion tier objects.

Array of [Promotion Tier](#promotion-tier) | -| total
`integer` |

Total number of promotion tiers.

| -| has_more
`boolean` |

As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | -## Balance +## Referral Program | Attributes | Description | |:-----|:--------| -| qualification_type
`string` |

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.

Available values: `BALANCE` | -| start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.

Available values: IMMEDIATE
| -| expiration_date |

Defines the conditions for the expiration date of a tier.

Any of: [Balance Drop](#balance-drop), [Custom](#custom) | +| conversion_event_type
`string` |

Define how a referral is triggered.

Available values: `redemption`, `custom_event` | +| custom_event
`object` |

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_Ll9enAm2BCN0M1s4VxWobLFM

name
string

Custom event name.

| +| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: DISCOUNT_VOUCHER, LOYALTY_CARD, GIFT_VOUCHER, LUCKY_DRAW_CODE
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| -## Points in Period +## Loyalty Tiers Expiration | Attributes | Description | |:-----|:--------| -| qualification_type
`string` |

Tier qualification.

POINTS_IN_PERIOD: A customer qualifies for the tier only if the sum of the accumulated points in a defined time interval reaches the tier threshold.

Available values: `POINTS_IN_PERIOD` | +| qualification_type
`string` |

Tier qualification.

BALANCE: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier.
POINTS_IN_PERIOD: A customer qualifies for the tier only if the sum of the accumulated points in a defined time interval reaches the tier threshold.

Available values: `BALANCE`, `POINTS_IN_PERIOD` | | qualification_period
`string` |

Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period.

PeriodDefinition
Calendar MonthPoints collected in one calendar month
January, February, March, etc.
Calendar QuarterPoints collected in the quarter
- January - March
- April - June
- July - September
- October - December
Calendar Half-yearPoints collected in the half-year
- January - June
- July - December
Calendar YearPoints collected in one calendar year
January - December
Available values: `MONTH`, `QUARTER`, `HALF_YEAR`, `YEAR` | | start_date
`object` |

Defines the conditions for the start date of the tier.

AttributesDescription
type
string

What triggers the tier to be valid for a customer.
IMMEDIATE: After reaching the minimum required points.
NEXT_PERIOD: When the next qualification period starts.

Available values: IMMEDIATE, NEXT_PERIOD
| -| expiration_date
`object` |

Defines the conditions for the expiration date of a tier.

AttributesDescription
type
string

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD
extend
string

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

| - -## Amount -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies an amount discount.

| -| amount_off
`integer` |

Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the amount being calculated by the formula, i.e. the amount_off_formula parameter is present in the amount definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the amount off.

**Example:**

100

| -| amount_off_formula
`string` |

Formula used to calculate the discount.

| -| aggregated_amount_limit
`integer` |

Maximum discount amount per order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600. This value is definable for the following discount effects:

| -| effect
`string` |

Defines how the discount is applied to the customer's order. The discount effects are defined as follows:

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS`, `APPLY_TO_ITEMS_PROPORTIONALLY`, `APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY`, `APPLY_TO_ITEMS_BY_QUANTITY` | - -## Percentage -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a percentage discount.

| -| amount_limit
`string` |

Upper limit allowed to be applied as a discount per order line item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600.

| -| aggregated_amount_limit
`integer` |

Maximum discount amount per order. This value is definable for the APPLY_TO_ITEMS discount effect. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount on the entire order is written as 600.

| -| percent_off
`integer` |

Percent taken off the subtotal amount. In case of the percent being calculated by the formula, i.e. the percent_off_formula parameter is present in the percent definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the percent off.

| -| percent_off_formula
`string` |

Formula used to calculate the discount.

| -| effect
`string` |

Defines how the discount is applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | - -## Fixed -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Sets a fixed total on cart or item(s) and then calculates the discount to apply.

| -| fixed_amount
`integer` |

Sets a fixed value for an order total or the item price. The value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. If the fixed amount is calculated by the formula, i.e. the fixed_amount_formula parameter is present in the fixed amount definition, this value becomes the fallback value. As a result, if the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value.

**Example:**

1000

| -| fixed_amount_formula
`string` |

Formula used to calculate the discounted price of an item or a new order total.

| -| effect
`string` |
EffectDefinition
APPLY_TO_ORDERSets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15.
APPLY_TO_ITEMSSets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price.
Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | - -## Unit, single item -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| unit_off
`number` |

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

**Example:**

1

| -| unit_off_formula
`string` |

Formula used to calculate the number of units.

| -| unit_type
`string` |

The product deemed as free, chosen from the product inventory (e.g. time, items).

**Example:**

prod_f1r5Tpr0DuC7

| -| effect
`string` |

Defines how the unit is added to the customer's order.

Available values: `ADD_NEW_ITEMS`, `ADD_MISSING_ITEMS` | - -## Unit, multiple items -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| effect
`string` |

Defines the effect for adding multiple item types.

| -| units
`array` |

Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.

Array of:
AttributesDescription
unit_off
integer

Number of units to be granted a full value discount. In case of the unit being calculated by the formula, i.e. the unit_off_formula parameter is present in the unit definition, this value becomes the fallback value. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the unit value.

Example:

1

unit_off_formula
string

Formula used to calculate the number of units.

unit_type
string

The product deemed as free, chosen from the product inventory (e.g. time, items).

Example:

prod_f1r5Tpr0DuC7

effect
string

Defines how the unit is added to the customer's order.

Available values: ADD_NEW_ITEMS, ADD_MISSING_ITEMS
| - -## Shipping -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Applies a full value discount to item(s).

| -| unit_off
`number` |

Subtracts 1 shipping item from the subtotal.

| -| unit_type
`string` |

The shipping product deemed as free.

| -| effect
`string` |

Defines how the unit is added to the customer's order.

| +| expiration_date
`object` |

Defines the conditions for the expiration date of a tier.

AttributesDescription
type
string

What triggers the tier to expire for a customer.
END_OF_PERIOD: Expire tier at the end of the period.
END_OF_NEXT_PERIOD: Expire tier at the end of the next period.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: END_OF_PERIOD, END_OF_NEXT_PERIOD, BALANCE_DROP, CUSTOM
extend
string

Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of P3M will be valid for an additional duration of 3 months and a tier with a duration of P1D will be valid for an additional duration of 1 day.

rounding

Defines the rounding mechanism for tier expiration.

| ## Promotion Tier | Attributes | Description | @@ -178,17 +128,18 @@ order: 1 | category_id
`string` |

Promotion tier category ID.

**Example:**

cat_0c9da30e7116ba6bba

| | categories
`array` | Array of [Category](#category) | -## Balance Drop +## Business Validation Rule Assignment | Attributes | Description | |:-----|:--------| -| type
`string` |

What triggers the tier to expire for a customer.
BALANCE_DROP: Tier expires when the points balance drops below the required range of the tier.

Available values: `BALANCE_DROP` | - -## Custom -| Attributes | Description | -|:-----|:--------| -| type
`string` |

What triggers the tier to expire for a customer.
CUSTOM: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier.

Available values: `CUSTOM` | -| extend
`string` |

Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months.

| -| rounding |

Defines the rounding mechanism for tier expiration.

Any of: [Calendar Periods](#calendar-periods), [Specific Month](#specific-month) | +| id
`string` |

The unique identifier for a assignment

| +| rule_id
`string` |

The unique identifier for a rule

| +| related_object_id
`string` |

The unique identifier for a related object

| +| related_object_type
`string` |

The type of related object

| +| created_at
`string` |

Timestamp representing the date and time when the object was created in ISO 8601 format.

**Example:**

2022-03-09T11:19:04.819Z

| +| updated_at
`string` |

Timestamp representing the date and time when the object was last updated in ISO 8601 format.

**Example:**

2022-03-09T11:19:04.819Z

| +| object
`string` |

The type of object represented by JSON.

Available values: `validation_rules_assignment` | +| validation_status
`string` |

The validation status of the assignment

Available values: `VALID`, `PARTIALLY_VALID`, `INVALID` | +| validation_omitted_rules
`array` |

The list of omitted rules

| ## Discount

Contains information about discount.

@@ -197,38 +148,31 @@ Any of: [Amount](#amount), [Unit](#unit), [Unit Multiple](#unit-multiple), [Percent](#percent), [Fixed](#fixed) -## Validation Rule Assignments +## Gift | Attributes | Description | |:-----|:--------| -| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| -| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| -| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | -| total
`integer` |

Total number of validation rule assignments.

| +| amount
`number` |

Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| balance
`number` |

Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| effect
`string` |

Defines how the credits are applied to the customer's order.

Available values: `APPLY_TO_ORDER`, `APPLY_TO_ITEMS` | -## Category +## Campaign Loyalty Card | Attributes | Description | |:-----|:--------| -| id
`string` |

Unique category ID assigned by Voucherify.

| -| name
`string` |

Category name.

| -| hierarchy
`integer` |

Category hierarchy.

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | -| created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| -| updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | +| points
`integer` |

The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card.

| +| expiration_rules
`object` |
AttributesDescription
period_type
string

Type of period

period_value
integer

Value of the period

rounding_type
string

Type of rounding

rounding_value
integer

Value of rounding

| -## Calendar Periods -| Attributes | Description | -|:-----|:--------| -| type
`string` |

Period to which the expiration will be rounded to.

Available values: `MONTH`, `QUARTER`, `HALF_YEAR`, `YEAR` | -| strategy
`string` |

Which portion of the given period should the rounding be applied to.

Available values: `END` | +## Code Config Response +All of: -## Specific Month +1. [Code Config](#code-config) + +## Validation Rule Assignments | Attributes | Description | |:-----|:--------| -| type
`string` |

This mechanism describes a custom rounding for the expiration date.

Available values: `CUSTOM` | -| strategy
`string` |

Which portion of the given period should the rounding be applied to.

Available values: `END` | -| unit
`string` |

Defines the type of unit of time in which the rounding period is counted.

Available values: `MONTH` | -| value
`integer` |

Value for the unit of time that the rounding applies to. Units for this parameter are defined by the rounding.unit parameter.

| +| object
`string` |

The type of object represented by JSON. This object stores information about validation rule assignments.

| +| data_ref
`string` |

Identifies the name of the JSON property that contains the array of validation rule assignments.

| +| data
`array` |

A dictionary that contains an array of validation rule assignments.

Array of [Validation Rule Assignment](#validation-rule-assignment) | +| total
`integer` |

Total number of validation rule assignments.

| ## Amount | Attributes | Description | @@ -279,6 +223,16 @@ Any of: | effect |

Defines how the discount is applied to the customer's order.

See: [Discount Fixed Vouchers Effect Types](#discount-fixed-vouchers-effect-types) | | is_dynamic
`boolean` |

Flag indicating whether the discount was calculated using a formula.

| +## Code Config +| Attributes | Description | +|:-----|:--------| +| length
`string` |

Number of characters in a generated code (excluding prefix and postfix).

| +| charset
`string` |

Characters that can appear in the code.

Examples:

| +| prefix
`string` |

A text appended before the code.

| +| postfix
`string` |

A text appended after the code.

| +| pattern
`string` |

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| +| initial_count
`integer` |

The initial count

| + ## Validation Rule Assignment | Attributes | Description | |:-----|:--------| diff --git a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md index 70e45e433..b3cdeebbc 100644 --- a/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md +++ b/docs/reference-docs/CUSTOMERS-API-Customer-Activity-Object.md @@ -816,7 +816,7 @@ All of: |:-----|:--------| | conversion_event_type
`string` |

Define how a referral is triggered.

Available values: `redemption`, `custom_event` | | custom_event
`object` |

Contains details about the custom event.

AttributesDescription
id
string

Unique custom event ID.

Example:

ms_Ll9enAm2BCN0M1s4VxWobLFM

name
string

Custom event name.

| -| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: LOYALTY_CARD, GIFT_VOUCHER
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| +| referee_reward
`object` |

Defines the referee reward.

AttributesDescription
related_object_parent
object

Details of the resource from which the reward originates.

AttributesDescription
id
string

Unique ID of the reward source.

Example:

camp_kdxp3vf1clQ9CFs1jpqv3tZe

name
string

Name of the reward source.

object
string

Type of resource represented by the source of the reward.

Available values: CAMPAIGN
type
string

Type of reward.

Available values: DISCOUNT_VOUCHER, LOYALTY_CARD, GIFT_VOUCHER, LUCKY_DRAW_CODE
amount
string

Define the number of points to add to a loyalty card or credits to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000.

| ## Gift | Attributes | Description | diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md index 50d55cb9f..5c75f492e 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Campaign-Object.md @@ -34,7 +34,7 @@ order: 1 | vouchers_generation_status
`string` |

Indicates the status of the campaign's vouchers.

Available values: `DONE`, `IN_PROGRESS`, `FAILED`, `DRAFT` | | protected
`boolean` |

Indicates whether the resource can be deleted.

| | category_id
`string` |

Unique category ID that this campaign belongs to.

**Example:**

cat_0b688929a2476386a7

| -| categories | See: [Category Object](#category-object) | +| categories | See: [Category](#category) | | loyalty_tiers_expiration
`object` |

Defines the expiration mechanism for loyalty tiers.

Any of: [Balance](#balance), [Points in Period](#points-in-period) | | object
`string` |

The type of object represented by JSON. This object stores information about the campaign.

| @@ -47,15 +47,16 @@ order: 1 | code_config
`object` |

Defines code's pattern (prefix, suffix, length, charset, etc).

AttributesDescription
length
string

Number of characters in a generated code (excluding prefix and postfix).

charset
string

Characters that can appear in the code.

Examples:

  • Alphanumeric: 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic: abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Alphabetic Lowercase: abcdefghijklmnopqrstuvwxyz
  • Alphabetic Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ
  • Numbers: 0123456789
  • Custom: a custom character set
prefix
string

A text appended before the code.

postfix
string

A text appended after the code.

pattern
string

A pattern for codes where hashes (#) will be replaced with random characters. Overrides length.

| | is_referral_code
`boolean` |

Indicates whether the voucher is a referral code; this is true for campaign type REFERRAL_PROGRAM.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | ## Balance | Attributes | Description | diff --git a/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md b/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md index 37eae7f9b..32f1ca1e1 100644 --- a/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md +++ b/docs/reference-docs/LOYALTIES-API-Loyalty-Card-Object.md @@ -17,7 +17,7 @@ order: 2 | campaign_id
`string` |

Assigned by the Voucherify API, identifies the voucher's parent campaign.

**Example:**

camp_FNYR4jhqZBM9xTptxDGgeNBV

| | category
`string` |

Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint.

| | category_id
`string` |

Unique category ID assigned by Voucherify.

**Example:**

cat_0bb343dee3cdb5ec0c

| -| categories
`array` |

Contains details about the category.

Array of [Category Object](#category-object) | +| categories
`array` |

Contains details about the category.

Array of [Category](#category) | | type
`string` |

Defines the type of the voucher.

Available values: `LOYALTY_CARD` | | discount
`null` |

Object representing discount parameters. Child attributes are present only if type is DISCOUNT_VOUCHER. Defaults to null.

| | gift
`null` |

Object representing gift parameters. Child attributes are present only if type is GIFT_VOUCHER. Defaults to null.

| @@ -38,15 +38,16 @@ order: 2 | publish
`object` |

This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.

RequiredOptional
type:LOYALTY_CARDtype:DISCOUNT_VOUCHER
is_referral_code:truetype:GIFT_VOUCHER
AttributesDescription
object
string

The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute.

count
integer

Publication events counter.

Example:

0

url
string

The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications

Example:

/v1/vouchers/WVPblOYX/publications?page=1&limit=10

| | object
`string` |

The type of object represented by JSON. Default is voucher.

| -## Category Object +## Category | Attributes | Description | |:-----|:--------| | id
`string` |

Unique category ID assigned by Voucherify.

| | name
`string` |

Category name.

| | hierarchy
`integer` |

Category hierarchy.

| +| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

Available values: `category` | | created_at
`string` |

Timestamp representing the date and time when the category was created in ISO 8601 format.

**Example:**

2022-07-14T10:45:13.156Z

| | updated_at
`string` |

Timestamp representing the date and time when the category was updated in ISO 8601 format.

**Example:**

2022-08-16T10:52:08.094Z

| -| object
`string` |

The type of object represented by the JSON. This object stores information about the category.

| +| stacking_rules_type
`string` |

The type of the stacking rule eligibility.

Available values: `JOINT`, `EXCLUSIVE` | [block:html] { diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 3d9daba99..be9a16adc 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3841,7 +3841,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -7368,9 +7368,9 @@ {} ] }, - "2_obj_campaign_object": { + "CampaignResponseBase": { "type": "object", - "title": "Campaign Object", + "title": "Campaign", "description": "This is an object representing a campaign.", "x-tags": [ "CAMPAIGNS API" @@ -7410,17 +7410,7 @@ ] }, "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] + "$ref": "#/components/schemas/CampaignVoucher" }, "auto_join": { "type": "boolean", @@ -7517,7 +7507,8 @@ "DONE", "IN_PROGRESS", "FAILED", - "DRAFT" + "DRAFT", + "MODIFYING" ] }, "protected": { @@ -7525,12 +7516,16 @@ "description": "Indicates whether the resource can be deleted." }, "category_id": { - "type": "string", + "type": [ "string", "null" ], "description": "Unique category ID that this campaign belongs to.", "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/Category" + } }, "object": { "type": "string", @@ -7538,83 +7533,262 @@ "description": "The type of object represented by JSON. This object stores information about the campaign." }, "referral_program": { + "$ref": "#/components/schemas/ReferralProgram" + }, + "loyalty_tiers_expiration": { + "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" + } + }, + "required": [ + "id", + "name", + "campaign_type", + "type", + "auto_join", + "join_once", + "use_voucher_metadata_schema", + "created_at", + "creation_status", + "vouchers_generation_status", + "protected", + "category_id", + "categories", + "object", + "metadata" + ] + }, + "CampaignResponse": { + "title": "Campaign Response", + "x-tags": [ + "CAMPAIGNS API" + ], + "allOf": [ + { + "$ref": "#/components/schemas/CampaignResponseBase" + }, + { + "title": "Campaign Additional Data", "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." + "promotion": { + "$ref": "#/components/schemas/PromotionTiersList" }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } + "validation_rules_assignments": { + "$ref": "#/components/schemas/ValidationRulesAssignmentsList" + } + } + } + ] + }, + "CampaignVoucher": { + "type": "object", + "description": "Schema model for a campaign voucher.", + "title": "Campaign Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher." + }, + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." + }, + "gift": { + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaignLoyaltyCardResponse", + "description": "Defines the voucher loyalty card details." + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + }, + "required": [ + "quantity" + ] + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfigResponse" + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - } + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } } + } + }, + "required": [ + "type", + "redemption", + "code_config", + "is_referral_code" + ] + }, + "CodeConfig": { + "title": "Code Config", + "type": "object", + "description": "Schema containing information about config used for voucher. Defines code's pattern (prefix, suffix, length, charset, etc).", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." }, - "promotion": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" }, - "loyalty_tiers_expiration": { + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + }, + "initial_count": { + "type": "integer", + "description": "The initial count" + } + } + }, + "CodeConfigResponse": { + "title": "Code Config Response", + "allOf": [ + { + "$ref": "#/components/schemas/CodeConfig" + } + ], + "required": [ + "length", + "charset", + "pattern" + ] + }, + "CampaignsImportVoucherLoyaltyCard": { + "type": "object", + "description": "Schema model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + } + }, + "required": [ + "points" + ] + }, + "CampaignLoyaltyCardResponse": { + "type": "object", + "description": "Schema model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + }, + "expiration_rules": { "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + "properties": { + "period_type": { + "type": "string", + "description": "Type of period" }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + "period_value": { + "type": "integer", + "description": "Value of the period" + }, + "rounding_type": { + "type": "string", + "description": "Type of rounding" + }, + "rounding_value": { + "type": "integer", + "description": "Value of rounding" + } + }, + "required": [ + "period_type", + "period_value", + "rounding_type", + "rounding_value" + ] + } + }, + "required": [ + "points" + ] + }, + "CampaignLoyaltyCardRequestBody": { + "type": "object", + "description": "Schema representing request body model for a campaign loyalty card.", + "title": "Campaign Loyalty Card", + "properties": { + "points": { + "type": ["integer", "null" ], + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + }, + "expiration_rules": { + "type": "object", + "properties": { + "period_type": { + "type": "string", + "description": "Type of period" + }, + "period_value": { + "type": "integer", + "description": "Value of the period" + }, + "rounding_type": { + "type": "string", + "description": "Type of rounding" + }, + "rounding_value": { + "type": "integer", + "description": "Value of rounding" } + }, + "required": [ + "period_type", + "period_value", + "rounding_type", + "rounding_value" ] } } @@ -7812,31 +7986,30 @@ } } }, - "2_req_create_campaign": { - "title": "Create Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns`.", - "oneOf": [ - { - "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_loyalty" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_gift" + "LuckyDraw": { + "type": "object", + "title": "Lucky Draw", + "description": "Object for defining detailed information about lucky draw should be applied", + "properties": { + "winners_count": { + "description": "It represents the total number of winners in a lucky draw.", + "minimum": 1, + "type": ["string", "integer"] }, - { - "$ref": "#/components/schemas/2_req_create_campaign_promotion" + "unique_winners_per_draw" : { + "description": "It indicates whether each winner in a draw is unique or not.", + "type": ["string", "boolean"] }, - { - "$ref": "#/components/schemas/2_req_create_campaign_referral" + "unique_winners": { + "description": "Specifies whether each participant can win only once across multiple draws.", + "type": ["string", "boolean"] } - ] + } }, - "2_req_create_campaign_discount_voucher": { + "CampaignsCreateBase": { "type": "object", - "title": "Discount Campaign", - "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", + "title": "Campaign Create Schema Base", + "description": "Base body schema for creating a campaign using **POST** `/campaigns`.", "properties": { "name": { "type": "string", @@ -7863,6 +8036,10 @@ "type": "boolean", "description": "If this value is set to `true`, customers will be able to join the campaign only once." }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, "use_voucher_metadata_schema": { "type": "boolean", "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." @@ -7908,6 +8085,17 @@ "type": "string", "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." }, + "referral_program": { + "$ref": "#/components/schemas/ReferralProgram" + }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + }, + "maxItems": 1 + }, "category_id": { "type": "string", "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", @@ -7920,54 +8108,14 @@ "metadata": { "type": "object", "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" } } }, - "2_req_create_campaign_loyalty": { + "CampaignsUpdateBase": { "type": "object", - "title": "Loyalty Campaign", - "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", + "title": "Campaign Update Schema Base", + "description": "Base body schema for creating a campaign using **PUT** `/campaigns`.", "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "LOYALTY_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, "start_date": { "type": "string", "format": "date-time", @@ -8001,14 +8149,9 @@ "type": "integer" } }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { + "description": { "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." }, "category": { "type": "string", @@ -8018,480 +8161,361 @@ "type": "object", "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - } - }, - "2_req_create_campaign_gift": { - "type": "object", - "title": "Gift Card campaign", - "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "GIFT_VOUCHERS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "unset_metadata_fields": { + "type": [ "array", "null" ], + "description": "Determine which metadata should be removed from campaign.", "items": { - "type": "integer" + "type": "string" } }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, "category_id": { "type": "string", "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" } } }, - "2_req_create_campaign_referral": { + "CampaignsUpdateCouponCampaignBase": { "type": "object", - "title": "Referral Campaign", - "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "REFERRAL_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" + "title": "Update Coupon Campaign Schema Base", + "description": "Base body schema for updating a campaign which contains coupon codes using **PUT** `/campaigns`.", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateBase" }, - "validity_timeframe": { + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "", "properties": { - "interval": { + "activity_duration_after_publishing": { "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." }, - "duration": { + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "type": { "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] } } + } + ] + }, + "CampaignsUpdateDiscountCouponsCampaign": { + "type": "object", + "title": "Update Discount Coupons Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + { + "type": "object", + "title": "Properties For Discount Coupons Campaign", + "description": "Body schema for update a campaign of discount coupons type using **PUT** `/campaigns`.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." + } } + } + ] + }, + "CampaignsUpdateGiftCampaign": { + "type": "object", + "title": "Update Gift Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { + { "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + "title": "Properties For Gift Campaign", + "description": "Body schema for update a campaign of give type using **PUT** `/campaigns`.", + "properties": { + "gift": { + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + } + } + } + ] + }, + "CampaignsUpdateReferralCampaign": { + "type": "object", + "title": "Update Referral Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + { + "type": "object", + "title": "Properties For Referral Campaign", + "description": "Body schema for update a campaign of referral type using **PUT** `/campaigns`.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." }, - { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + "referral_program": { + "$ref": "#/components/schemas/ReferralProgram" } - ] + } + } + ] + }, + "CampaignsUpdateLoyaltyCampaign": { + "type": "object", + "title": "Update Loyalty Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" }, - "referral_program": { - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + { "type": "object", + "title": "Properties For Loyalty Campaign", + "description": "Body schema for update a campaign of loyalty type using **PUT** `/campaigns`.", "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "Define how a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } + "loyalty_tiers_expiration": { + "$ref": "#/components/schemas/LoyaltyTiersExpirationAll" }, - "referee_reward": { + "options": { "type": "object", - "description": "Defines the referee reward.", "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "Type of reward." - }, - "amount": { - "type": "string", - "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "recalculate_tiers" : { + "type": "boolean", + "description" : "Determine if tiers should be recalculated or no." } } } } } - } + ] }, - "2_req_create_campaign_promotion": { + "CampaignsUpdateGiveawayCampaign": { "type": "object", - "title": "Promotion", - "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." + "title": "Update Giveaway Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateCouponCampaignBase" }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + { + "type": "object", + "title": "Properties For Giveaway Campaign", + "description": "Body schema for update a campaign of giveaway type using **PUT** `/campaigns`.", + "$ref": "#/components/schemas/LuckyDraw" + } + ] + }, + "CampaignsUpdatePromotionCampaign": { + "type": "object", + "title": "Update Promotion Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateBase" + } + ] + }, + "CampaignsCreateRequestBody": { + "type": "object", + "title": "Create Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns`.", + "oneOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateDiscountCouponsCampaign" }, - "campaign_type": { - "type": "string", - "default": "PROMOTION", - "description": "Type of campaign." + { + "$ref": "#/components/schemas/CampaignsCreateReferralCampaign" }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] + { + "$ref": "#/components/schemas/CampaignsCreateGiftCampaign" }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." + { + "$ref": "#/components/schemas/CampaignsCreateLoyaltyCampaign" }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + { + "$ref": "#/components/schemas/CampaignsCreatePromotionCampaign" }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." + { + "$ref": "#/components/schemas/CampaignsCreateGiveawayCampaign" + } + ] + }, + "CampaignsUpdateRequestBody": { + "type": "object", + "title": "Update Campaign Request Body", + "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", + "oneOf": [ + { + "$ref": "#/components/schemas/CampaignsUpdateDiscountCouponsCampaign" }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" + { + "$ref": "#/components/schemas/CampaignsUpdateReferralCampaign" }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" + { + "$ref": "#/components/schemas/CampaignsUpdateGiftCampaign" }, - "validity_timeframe": { + { + "$ref": "#/components/schemas/CampaignsUpdateLoyaltyCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdatePromotionCampaign" + }, + { + "$ref": "#/components/schemas/CampaignsUpdateGiveawayCampaign" + } + ] + }, + "CampaignsCreateDiscountCouponsCampaign": { + "title": "Create Discount Coupons Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" + }, + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "Schema that contains unique properties for Discount Coupons Campaign", + "description": "Body schema for creating a campaign of discount coupons type using **POST** `/campaigns`.", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "voucher": { + "$ref": "#/components/schemas/DiscountCouponsCampaignVoucher" } } + } + ] + }, + "CampaignsCreateReferralCampaign": { + "title": "Create Referral Program", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + { + "type": "object", + "title": "Schema that contains unique properties for Referral Program", + "description": "Body schema for creating a campaign of referral type using **POST** `/campaigns`.", + "properties": { + "voucher": { + "$ref": "#/components/schemas/ReferralCampaignVoucher" + } } + } + ] + }, + "CampaignsCreateGiftCampaign": { + "title": "Create Gift Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + { + "type": "object", + "title": "Schema that contains unique properties for Gift Campaign", + "description": "Body schema for creating a campaign of gift type using **POST** `/campaigns`.", + "properties": { + "voucher": { + "$ref": "#/components/schemas/GiftCampaignVoucher" + } + } + } + ] + }, + "CampaignsCreateLoyaltyCampaign": { + "title": "Create Loyalty Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "metadata": { + { "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + "title": "Schema that contains unique properties for Loyalty Campaign", + "description": "Body schema for creating a campaign of loyalty type using **POST** `/campaigns`.", + "properties": { + "voucher": { + "$ref": "#/components/schemas/LoyaltyCampaignVoucher" + } + } + } + ] + }, + "CampaignsCreatePromotionCampaign": { + "title": "Create Promotion Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "promotion": { + { "type": "object", - "description": "Define the promotion tiers within the campaign.", + "title": "Schema that contains unique properties for Promotion Campaign", + "description": "Body schema for creating a campaign of promotion type using **POST** `/campaigns`.", "properties": { - "tiers": { - "type": "array", + "promotion": { + "type": [ "array", "null" ], "items": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" + "$ref": "#/components/schemas/PromotionTierCreateParams" } } } } - } + ] }, - "2_req_update_campaign": { - "type": "object", - "title": "Update Campaign Request Body", - "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", - "properties": { - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." + "CampaignsCreateGiveawayCampaign": { + "title": "Create Giveaway Campaign", + "allOf": [ + { + "$ref": "#/components/schemas/CampaignsCreateBase" }, - "validity_timeframe": { + { "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "title": "Schema that contains unique properties for Giveaway Campaign", + "description": "Body schema for creating a campaign of giveaway type using **POST** `/campaigns`.", "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + "voucher": { + "$ref": "#/components/schemas/GiveawayCampaignVoucher" }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + "lucky_draw": { + "$ref": "#/components/schemas/LuckyDraw" } } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "metadata": { + } + ] + }, + "CampaignsCreateCampaignVoucherWithCodeRequestBody": { + "type": "object", + "title": "Add Voucher With Code To Campaign Request Body", + "allOf": [ + { "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", - "example": "cat_0b688929a2476386a7" + "properties": { + "code": { + "type": "string", + "description": "Unique custom voucher code." + } + } }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." + { + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherRequestBody" } - } + ] }, - "2_req_add_vouchers_to_campaign": { + "CampaignsCreateCampaignVoucherRequestBody": { "type": "object", - "title": "Add Vouchers to Campaign Request Body", + "title": "Add Voucher To Campaign Request Body", "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { + "category": { "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." }, "metadata": { "type": "object", @@ -8507,35 +8531,24 @@ } } }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, "additional_info": { "type": "string", "description": "An optional field to keep any extra textual information about the code such as a code description and details." }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" } } }, @@ -8585,15 +8598,15 @@ } } }, - "2_req_import_vouchers_to_campaign": { + "CampaignsImportVoucherRequestBody": { "type": "array", "title": "Import Vouchers to Campaign Request Body", "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", "items": { - "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" + "$ref": "#/components/schemas/CampaignsImportVoucherItem" } }, - "2_obj_import_vouchers_to_campaign_object": { + "CampaignsImportVoucherItem": { "type": "object", "title": "Import Vouchers to Campaign", "description": "Import Vouchers to Campaign", @@ -8602,14 +8615,25 @@ "type": "string", "description": "Unique custom voucher code." }, - "category_id": { + "type": { "type": "string", - "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER", + "GIFT_VOUCHER", + "LOYALTY_CARD", + "LUCKY_DRAW_CODE" + ] }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } }, "active": { "type": "boolean", @@ -8619,39 +8643,52 @@ "type": "object", "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." }, - "redemption": { + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "validity_timeframe": { "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } } }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, "additional_info": { "type": "string", "description": "An optional field to keep any extra textual information about the code such as a code description and details." }, - "loyalty_card": { - "type": "object", - "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", - "properties": { - "points": { - "type": "integer", - "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." - } - } + "discount": { + "$ref": "#/components/schemas/Discount", + "description": "Defines the voucher discount type and details." }, "gift": { - "type": "object", - "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", - "properties": { - "amount": { - "type": "integer", - "description": "The cash balance to assign to the gift card. This is the current gift card balance." - } - } + "$ref": "#/components/schemas/Gift", + "description": "Defines the voucher gift details." + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaignsImportVoucherLoyaltyCard", + "description": "Defines the voucher loyalty card details." } }, "required": [ @@ -8957,7 +8994,7 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -9031,7 +9068,7 @@ } } }, - "2_res_list_campaigns": { + "CampaignsListResponseBody": { "type": "object", "description": "Schema model for **GET** `/campaigns`.", "title": "List Campaigns Response Body", @@ -9050,7 +9087,7 @@ "type": "array", "description": "Contains array of campaign objects.", "items": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponseBase" } }, "total": { @@ -9059,6 +9096,184 @@ } } }, + "DiscountCouponsCampaignVoucher": { + "title": "Object representing voucher property for Discount Coupons Campaign", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + } + }, + "required": [ + "type", + "discount" + ] + }, + "ReferralCampaignVoucher": { + "title": "Object representing voucher property for Referal Program", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + }, + "required": [ + "type", + "discount", + "is_referral_code" + ] + }, + "GiveawayCampaignVoucher": { + "title": "Object representing voucher property for Giveaway Campaign", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "discount": { + "$ref": "#/components/schemas/Discount" + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + }, + "required": [ + "type", + "discount" + ] + }, + "GiftCampaignVoucher": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "GIFT_VOUCHER", + "description": "Type of voucher.", + "enum": [ + "GIFT_VOUCHER" + ] + }, + "gift": { + "$ref": "#/components/schemas/Gift" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + } + }, + "required": [ + "type", + "gift" + ] + }, + "LoyaltyCampaignVoucher": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher.", + "enum": [ + "LOYALTY_CARD" + ] + }, + "loyalty_card": { + "$ref": "#/components/schemas/CampaignLoyaltyCardRequestBody" + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": [ "integer", "null" ], + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "$ref": "#/components/schemas/CodeConfig" + } + }, + "required": [ + "type", + "loyalty_card" + ] + }, "2_obj_campaign_object_voucher_object_DISCOUNT": { "type": "object", "description": "Schema model for a discount voucher.", @@ -9418,7 +9633,8 @@ "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", "title": "Promotion Tier", "x-tags": [ - "PROMOTIONS API" + "PROMOTIONS API", + "CAMPAIGNS API" ], "properties": { "id": { @@ -9616,6 +9832,98 @@ } } }, + "PromotionTierCreateParams": { + "type": "object", + "description": "This is an object representing a promotion tier create params. Promotion tiers are always assigned to a campaign and cannot be used standalone.", + "title": "Promotion Tier", + "x-tags": [ + "PROMOTIONS API", + "CAMPAIGNS API" + ], + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "$ref": "#/components/schemas/Discount" + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "category": { + "type": "string", + "description": "Assign category to the promotion tier." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } + }, + "required": [ + "name" + ] + }, "3_req_add_promotion_tier_to_campaign": { "type": "object", "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", @@ -9839,7 +10147,7 @@ } } }, - "3_res_list_promotion_tiers_from_campaign": { + "PromotionTiersList": { "type": "object", "description": "Promotion Tiers", "title": "Promotion Tiers", @@ -13389,7 +13697,7 @@ "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -13425,7 +13733,7 @@ "example": "cat_0c9da30e7116ba6bba" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object", + "$ref": "#/components/schemas/Category", "description": "Details about the category assigned to the promotion tier." } } @@ -13577,7 +13885,7 @@ "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "object": { "type": "string", @@ -21029,7 +21337,7 @@ "example": "cat_0b688929a2476386a7" }, "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" }, "loyalty_tiers_expiration": { "type": "object", @@ -21193,7 +21501,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "loyalty_tiers_expiration": { @@ -21321,7 +21629,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -21686,7 +21994,7 @@ "type": "array", "description": "Contains details about the category.", "items": { - "$ref": "#/components/schemas/20_obj_category_object" + "$ref": "#/components/schemas/Category" } }, "type": { @@ -24111,6 +24419,112 @@ } } }, + "LoyaltyTiersExpirationAll": { + "title": "Loyalty Tiers Expiration", + "type": "object", + "description": "Defines the Loyalty Tiers Expiration.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "BALANCE", + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier. \n `POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + } + }, + "required": [ + "type" + ] + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD", + "BALANCE_DROP", + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period. \n `BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier. \n `CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR", + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "strategy": { + "type": "string", + "enum": [ + "START", + "END" + ], + "description": "This mechanism describes a rounding strategy for the expiration date." + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + } + } + } + }, + "required": [ + "type", + "extend" + ] + } + }, + "required": [ + "qualification_type", + "start_date", + "expiration_date" + ] + }, "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { "title": "Balance Drop", "type": "object", @@ -25268,8 +25682,10 @@ "type": { "type": "string", "enum": [ + "DISCOUNT_VOUCHER", "LOYALTY_CARD", - "GIFT_VOUCHER" + "GIFT_VOUCHER", + "LUCKY_DRAW_CODE" ], "description": "Type of reward." }, @@ -31661,55 +32077,6 @@ } } }, - "20_obj_category_object": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a category.", - "x-tags": [ - "CATEGORIES API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-16T10:52:08.094Z", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } - }, - "examples": [ - { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" - } - ] - }, "21_obj_metadata_schema_object": { "type": "object", "title": "Metadata Schema Object", @@ -39124,45 +39491,6 @@ } } }, - "e_409_duplicate_found": { - "title": "Duplicated Resource", - "type": "object", - "description": "Error: Conflict → Duplicated resource found", - "properties": { - "code": { - "type": "integer", - "default": 409, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicated resource found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that already exists." - }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that already exists." - } - } - }, "e_400_duplicate_key": { "title": "Duplicated Key", "type": "object", @@ -41988,7 +42316,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate Code": { @@ -43865,7 +44193,7 @@ "PROMOTIONS API" ], "summary": "Create Campaign", - "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", + "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", "parameters": [], "security": [ { @@ -43878,7 +44206,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_create_campaign" + "$ref": "#/components/schemas/CampaignsCreateRequestBody" }, "examples": { "Discount Campaign": { @@ -44147,7 +44475,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Discount Campaign": { @@ -44699,7 +45027,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Example": { @@ -44739,7 +45067,7 @@ { "schema": { "type": "string", - "default": "category" + "enum": ["category"] }, "in": "query", "name": "expand", @@ -44772,7 +45100,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_res_list_campaigns" + "$ref": "#/components/schemas/CampaignsListResponseBody" }, "examples": { "Example": { @@ -45071,7 +45399,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Example": { @@ -45166,7 +45494,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_update_campaign" + "$ref": "#/components/schemas/CampaignsUpdateRequestBody" }, "examples": { "Example": { @@ -45184,7 +45512,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + "$ref": "#/components/schemas/CampaignResponse" }, "examples": { "Example": { @@ -45354,7 +45682,7 @@ "tags": [ "CAMPAIGNS API" ], - "summary": "Add Vouchers to Campaign", + "summary": "Add Voucher to Campaign", "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", "parameters": [ { @@ -45377,12 +45705,11 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherWithCodeRequestBody" }, "examples": { "Example": { "value": { - "category_id": "cat_0bb81a481615a37b5e", "start_date": "2022-09-24T00:00:00Z", "expiration_date": "2022-09-25T23:59:59Z", "active": false, @@ -45478,7 +45805,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" + "$ref": "#/components/schemas/CampaignsCreateCampaignVoucherRequestBody" }, "examples": { "Example": { @@ -45513,7 +45840,7 @@ "value": { "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", "code": "Code3", - "campaign": "Add Vouchers to Campaign", + "campaign": "Add Voucher to Campaign", "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", "category": null, "category_id": "cat_0bb81a481615a37b5e", @@ -45583,7 +45910,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate": { @@ -45632,11 +45959,11 @@ } ], "requestBody": { - "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", + "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" + "$ref": "#/components/schemas/CampaignsImportVoucherRequestBody" }, "examples": { "Example": { @@ -45859,7 +46186,7 @@ "CAMPAIGNS API" ], "summary": "Import Vouchers to Campaign by CSV", - "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn case of small jobs (like bulk update) the request is put into a queue and processed once every other bulk request placed in the queue prior to this request is finished. However, when the job takes a longer time (like vouchers generation) then it is processed in small portions in a round-robin fashion. When there is a list of vouchers generation scheduled, then they will all have the `IN_PROGRESS` status shortly. This way, small jobs added just after scheduling big jobs of the same type will be processed in a short time window. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", "parameters": [], "security": [ { @@ -46688,7 +47015,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + "$ref": "#/components/schemas/PromotionTiersList" }, "examples": { "Example": { @@ -48841,7 +49168,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate Found": { @@ -66990,7 +67317,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Example": { @@ -76423,7 +76750,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "$ref": "#/components/schemas/Error" }, "examples": { "Duplicate": { diff --git a/scripts/manage-project.ts b/scripts/manage-project.ts index 60ec95deb..9e2db1ad4 100644 --- a/scripts/manage-project.ts +++ b/scripts/manage-project.ts @@ -49,7 +49,7 @@ const main = async ({ await updateMdTablesInDocs(); await uploadImagesUsedInMdFiles(); await uploadGuideFiles(version); - await uploadReferenceDocsWithMaxNumberOfAttempts(version, 4); + await uploadReferenceDocsWithMaxNumberOfAttempts(version, 2); console.log( colors.green(`\n\nDONE!\nVisit: https://docs.voucherify.io/${version}/`) ); @@ -117,8 +117,8 @@ const uploadReferenceDocsWithMaxNumberOfAttempts = async ( maxNumberOfUploadingAttempts = 3 ) => { console.log(colors.green("UPLOADING REFERENCE DOC FILES...")); + await new Promise((r) => setTimeout(r, 60000)); for (let i = 1; i <= maxNumberOfUploadingAttempts; i++) { - await new Promise((r) => setTimeout(r, 10000)); const { success, error } = await runCliProcess({ command: `rdme docs ./docs/reference-docs --version=${version}`, stdoutIncludes: "successfully created", @@ -132,6 +132,7 @@ const uploadReferenceDocsWithMaxNumberOfAttempts = async ( console.log(error); throw new Error("REFERENCE DOC FILES WERE NOT UPLOADED!"); } + await new Promise((r) => setTimeout(r, 10000)); } return; }; diff --git a/scripts/md-tables.ts b/scripts/md-tables.ts index 8beea034e..6f4df6bc9 100644 --- a/scripts/md-tables.ts +++ b/scripts/md-tables.ts @@ -1,6 +1,6 @@ export const mdTables: [string, string?][] = [ ["Voucher", "VOUCHERS-API-Voucher-Object.md"], - ["2_obj_campaign_object", "CAMPAIGNS-API-Campaign-Object.md"], + ["CampaignResponse", "CAMPAIGNS-API-Campaign-Object.md"], ["PromotionTier", "PROMOTIONS-API-Promotion-Tier-Object.md"], ["reward", "REWARDS-API-Reward-Object.md"], ["RewardAssignment", "REWARDS-API-Reward-Assignment-Object.md"],