Skip to main content

Discount Definition

GET /discount-definition/current

GET /discount-definition/list

GET /discount-definition/document/<_id>

POST /discount-definition

POST /discount-definition/entity/<entity_id>

DELETE

POST /discount-definition/updateEntitiesWithDependencies

PATCH /discount-definition/document/<_id>

Data Models

Endpoints

GET /discount-definition/current

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

header

X-Site-IDs

[ csv of string ]

No

The unique identifiers (UIDs) of the site to manage data for

query

$filter

string

No

A filter expression in OData v4 format

query

$top

int32

No

The maximum documents to return

query

$skip

int32

No

The documents to skip before returning

query

$orderby

string

No

An order by expression in OData v4 format

query

effective_date

string

Yes

The date and time to query against

query

entity_ids

[ string ]

No

An array of entity identifiers

query

include_audit

boolean

No

Adds audit fields to each document when returning a result (is_active, is_master, created_at, created_by, updated_at, updated_by)

query

include_inactive

boolean

No

Includes the documents that are inactive for the current sites

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

GET /discount-definition/list

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

header

X-Site-IDs

[ csv of string ]

No

The unique identifiers (UIDs) of the site to manage data for

query

$filter

string

No

A filter expression in OData v4 format

query

$top

int32

No

The maximum documents to return

query

$skip

int32

No

The documents to skip before returning

query

$orderby

string

No

An order by expression in OData v4 format

query

effective_date

string

Yes

The date and time to query against

query

entity_ids

[ string ]

No

An array of entity identifiers

query

include_audit

boolean

No

Adds audit fields to each document when returning a result (is_active, is_master, created_at, created_by, updated_at, updated_by)

query

include_inactive

boolean

No

Includes the documents that are inactive for the current sites

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

GET /discount-definition/document/<_id>

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

path

_id

string

Yes

The identifier of the document

query

include_entities

[ csv of string ]

No

Specifies entity_types to be populated by nesting mechanism (For example, include_entities=['menu-category'] for menu call - populate a menu with menu categories)

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

POST /discount-definition

Adds a new discount definition.

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

query

include_nested

boolean

No

Hydrates-related nested objects when returning a result (For example, populate a Menu with menu categories and menu groups)

query

include_entities

[ string ]

No

Specifies entity_types to be populated by nesting mechanism (For example, include_entities=['menu-category'] for menu call - populate a menu with menu categories)

body

body

Yes

The JSON of the category being patched

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

POST /discount-definition/entity/<entity_id>

Creates/Updates discount definitions.

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

path

entity_id

string

Yes

The identifier of the entity

body

body

Yes

The JSON formatted request

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

DELETE

Summary

Deletes an entity and all versions of it.

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

path

entity_id

string

Yes

The identifier of the entity

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

POST /discount-definition/updateEntitiesWithDependencies

Creates/Updates discount definitions with the mappings.

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

header

X-Site-IDs

[ string ]

No

The identifiers of the site to manage data for

body

body

Yes

Supports the mappings field (array/boolean) for each document. With mappings: True mappings are created for the current date and sites from the X-Site-IDs header.

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

PATCH /discount-definition/document/<_id>

Partially updates a discount definition.

Request Parameters

In

Field Name

Type

Required

Description

header

X-Company-ID

string

Yes

The identifier of the company to manage data for

path

_id

string

Yes

The identifier of the document

query

include_nested

boolean

No

Hydrates-related nested objects when returning a result (For example, populate a Menu with menu categories and menu groups)

query

include_entities

[ string ]

No

Specifies entity_types to be populated by nesting mechanism (For example, include_entities=['menu-category'] for menu call - populate a menu with menu categories)

body

body

Yes

The JSON of the category being patched

Response Codes

Response

Description

200 OK

Success

400 Bad Request

Bad request, for more information look at body error

403 Forbidden

Invalid token

404 Not Found

Not found

422 Unprocessable Entity

Unprocessable error

Default

Unexpected error

Data Models

discount_definition

discount_definition_create

discount_definition_edit

discount_definition_list

name

_id

company_id

entity_id

is_master

is_active

external_id

created_by

updated_by

created_at

updated_at

discount_definition

Field Name

Type

Required

Description

name

string

Yes

The name of the discount

active

boolean

No

The discount is active or not

type

string

Yes

The type of the discount (discount, comp, promo, coupon, loyalty)

code

string

Yes

The user-friendly and memorable discount code

use_loyalty

boolean

No

This flag is used by the Mobile API and other integrating systems to indicate that this specific discount needs to be processed through the loyalty engine

calc

object

Yes

distribute_across_scope

boolean

No

When enabled, the discount amount is distributed evenly across all items available to be discounted. When disabled, the discount amount is applied to each item available to be discounted.

apply_type

string

Yes

The type of the discount (manual or automatic).

The possible values are "manual" or "automatic."

apply_to_liability_items

boolean

No

The flag that indicates whether to apply to liability items or not

alternate_plu_codes

[ string ]

No

Allows the user to add the discount to an order using the added price look ups (PLUs)

where_available

[ string ]

No

Where the discount is available to apply. For example, at the order entry screen only, at the tender screen only or available both at the order entry screen and the tender screen.

The possible values are "order_entry" or "tender."

exclusive

[ string ]

No

Exclusive to other discounts.

The possible values are "after" or "before."

  • after = no discount is allowed after the discount

  • before = discount is not allowed if the item or order has discount(s)

max_discount_amount

number (currency)

No

The maximum discount amount limit for the discount

amount_application_rule

string

No

Defines if the discount will apply to the amount of the original item or the remaining amount after all higher priority discounts have been applied.

The possible values are"gross_item_amount" or  "net_item_amount."

minimum_order_subtotal

number (currency)

No

Configures the minimum order subtotal required for the discount to be applied

sort_price

string

No

"Lowest" = The discount lowest-priced item if more than one item qualifies for the discount. 'Highest' = discount highest priced item if more than one item qualifies for the discount.

"Next_highest" = The discount the second-highest or one of the multiple highest-priced items from the order if more than one item qualifies for the discount.

The possible values are"lowest," "highest," or "next_highest."

customer_info_prompts

[ object ]

Yes

The customer information prompts for specific discount types such as a student's or firefighter's badge number

available

object

No

Defines the availability of the discount

priority

integer

No

The priority of the discount rule

exclude_children

boolean

No

Excludes child item prices in the discount calculation if the parent item qualifies for the discounts

apply_post_tax

boolean

No

This discount should be applied after all applicable taxes have been applied to the subtotal.

exclude_modifiers

boolean

No

Excludes modifier prices in the discount calculation if the parent item qualifies for the discount

eval_criteria

object

No

The discount evaluation criteria

apply_criteria

object

No

Applies criteria for the discount when the discount evaluation criteria is met

print_options

object

No

The discount print options

permissions

object

No

This property contains access control definitions

allowed_order_source_entity_ids

[ string,object ]

No

An array of allowed Order Source entity identifiers

allowed_order_source_ids

[ string ]

No

An array of allowed Order Source identifiers

exclusive_criteria_tags_entity_ids

[ string,object ]

No

_id

_id

No

company_id

company_id

No

entity_id

entity_id

No

is_master

is_master

No

is_active

is_active

No

external_id

external_id

No

created_by

created_by

No

updated_by

updated_by

No

created_at

created_at

No

updated_at

updated_at

No

discount_definition_create

Field Name

Type

Required

Description

name

string

Yes

The name of the discount

active

boolean

No

The flag that indicates if the discount is active or not

type

string

Yes

The type of the discount (discount, comp, promo, coupon, loyalty)

code

string

Yes

The user-friendly and memorable discount code

use_loyalty

boolean

No

This flag is used by the Mobile API and other integrating systems to let them know that this specific discount needs to be processed through the loyalty engine

calc

object

Yes

distribute_across_scope

boolean

No

When enabled, the discount amount is distributed evenly across all items available to be discounted. When disabled, the discount amount is applied to each item available to be discounted.

apply_type

string

Yes

The type of the discount (manual or automatic).

The possible values are "manual" or "automatic."

apply_to_liability_items

boolean

No

The flag that indicates whether to apply to liability items or not

alternate_plu_codes

[ string ]

No

Allows the user to add the discount to an order using the added price look ups (PLUs)

where_available

[ string ]

No

Where the discount is available to apply. For example, at the order entry screen only, at the tender screen only, or available both at the order entry screen and tender screen.

The possible values are "order_entry" or "tender."

exclusive

[ string ]

No

Exclusive to other discounts.

The possible values are "after" or "before."

  • after = No discount is allowed after the discount

  • before = The discount is not allowed if the item or order has discount(s)

max_discount_amount

number (currency)

No

The maximum discount amount limit for the discount

amount_application_rule

string

No

Defines if the discount applies to the amount of the original item or the remaining amount after all higher priority discounts have been applied.

The possible values are"gross_item_amount" or "net_item_amount."

minimum_order_subtotal

number (currency)

No

Configures the minimum order subtotal required for the discount to be applied

sort_price

string

No

The possible values are "lowest," "highest," or "next_highest."

"Lowest" = The discount lowest-priced item if more than one item qualifies for the discount.

"Highest" = The discount highest priced item if more than one item qualifies for the discount.

"Next_highest" = The discount the second-highest or one of the multiple highest-priced items from the order if more than one item qualifies for the discount.

customer_info_prompts

[ object ]

Yes

The customer information prompts for specific discount types such as a student's or firefighter's badge number

available

object

No

Defines the availability of the discount

priority

integer

No

The priority of the discount rule

exclude_children

boolean

No

Excludes child item prices in the discount calculation if the parent item qualifies for the discounts

apply_post_tax

boolean

No

This discount should be applied after all applicable taxes have been applied to the subtotal

exclude_modifiers

boolean

No

Excludes modifier prices in the discount calculation if the parent item qualifies for the discount

eval_criteria

object

No

The discount evaluation criteria

apply_criteria

object

No

Applies criteria for the discount when the discount evaluation criteria is met

print_options

object

No

The discount print options

permissions

object

No

This property contains access control definitions

allowed_order_source_entity_ids

[ string, object ]

No

An array of allowed Order Source entity identifiers

allowed_order_source_ids

[ string ]

No

An array of allowed Order Source identifiers

exclusive_criteria_tags_entity_ids

[ string, object ]

No

entity_id

entity_id

No

external_id

external_id

No

discount_definition_edit

Field Name

Type

Description

name

string

The name of the discount

active

boolean

The flag that indicates whether the discount is active or not

type

string

The type of the discount (discount, comp, promo, coupon, loyalty)

code

string

The user-friendly and memorable discount code

use_loyalty

boolean

This flag is used by the Mobile API and other integrating systems to let them know that this specific discount needs to be processed through the loyalty engine

calc

object

distribute_across_scope

boolean

When enabled the discount amount is distributed evenly across all items available to be discounted. When disabled the discount amount id applied to each item available to be discounted.

apply_type

string

The type of the discount (manual or automatic).

The possible values are  "manual" or "automatic."

apply_to_liability_items

boolean

The flag that indicates whether to apply to liability items or not

alternate_plu_codes

[ string ]

Allows the user to add the discount to an order using the added price look ups (PLUs)

where_available

[ string ]

Where the discount is available to apply. For example, at the order entry screen only, at the tender screen only, or available both at the order entry screen and tender screen.

Possible values: <"order_entry", "tender">

exclusive

[ string ]

Exclusive to other discounts.

The possible values are "after" or "before."

  • after = no discount is allowed after this discount

  • before = discount is not allowed if the item or order has discount(s)

max_discount_amount

number (currency)

The maximum discount amount limit for the discount

amount_application_rule

string

Defines if the discount applies to the amount of the original item or the remaining amount after all higher priority discounts have been applied.

The possible values are "gross_item_amount" or "net_item_amount."

minimum_order_subtotal

number (currency)

Configures the minimum order subtotal required for the discount to be applied

sort_price

string

The possible values are "lowest," "highest," or "next_highest."

"Lowest" = The discount lowest-priced item if more than one item qualifies for the discount.

"Highest" = The discount highest priced item if more than one item qualifies for the discount.

"Next_highest" = The discount the second-highest or one of the multiple highest-priced items from the order if more than one item qualifies for the discount.

customer_info_prompts

[ object ]

The customer information prompts for specific discount types such as a student's or a firefighter's badge number

available

object

Defines the availability of the discount

priority

integer

Priority of the discount rule

exclude_children

boolean

Excludes child item prices in the discount calculation if the parent item qualifies for the discounts

apply_post_tax

boolean

This discount should be applied after all applicable taxes have been applied to the subtotal

exclude_modifiers

boolean

Excludes modifier prices in the discount calculation if the parent item qualifies for the discount

eval_criteria

object

The discount evaluation criteria

apply_criteria

object

Applies criteria for the discount when the discount evaluation criteria is met

print_options

object

The discount print options

permissions

object

This property contains access control definitions

allowed_order_source_entity_ids

[ string,object ]

An array of allowed Order Source entity identifiers

allowed_order_source_ids

[ string ]

An array of allowed Order Source identifiers

exclusive_criteria_tags_entity_ids

[ string,object ]

external_id

external_id

discount_definition_list

FieldName

Type

Description

total

integer

No

items

discount_definition 

No

name

Field Name

Type

Description

name

string

_id

The auto-assigned system document identifier.

Field Name

Type

Description

_id

string

The auto-assigned system document identifier

company_id

The identifier of the company that owns the document.

Field Name

Type

Description

company_id

string

The identifier of the company that owns the document

entity_id

The auto-assigned unique identifier (UID) of the entity, set on creation. All future versions of the entity share the same entity_id.

Field Name

Type

Description

entity_id

string

The auto-assigned unique ID of this entity, set on creation. All future versions of this entity will share the same entity_id

is_master

Field Name

Type

Description

is_master

boolean

is_active

Marking property is the essence of active documents. Sets in true by default.

Field Name

Type

Description

is_active

boolean

Marking property is the essence of active documents. Sets in true by default.

external_id

Field Name

Type

Description

external_id

string

created_by

The identifier of the OPRA user or site that created the document.

Field Name

Type

Description

created_by

string

The identifier of the OPRA user or site that created the document

updated_by

The identifier of the OPRA user or site that last updated the document.

Field Name

Type

Description

updated_by

string

The identifier of the OPRA user or site that last updated the document

created_at

The date and time the document was created.

Field Name

Type

Description

created_at

string

The date and time (date-time) the document was created

updated_at

The last date and time the document was updated.

Field Name

Type

Description

updated_at

string

The last date and time (date-time) the document was updated