Schema
Calculation
Defines the type of calculation that is performed by a discount, surcharge or tax.
Overview
Properties
type
string
Required
The type of calculation to perform.
Allowed values
fixedpercentageprice_overridefixed_value
oneOf
The fixed value to apply. This property will always be `null` if `type` is `percentage` or `price_override`.
Nullable
Yes
One of
One of 1
null
One of 2
reference
References Money.
percentage
string | null
The percentage to apply. This field will always be `null` if `type` is `fixed` or `price_override`.
Example
7.5
Pattern
^((0\.[1-9])|([1-9]([0-9])?(\.[0-9])?)|100)$
Nullable
Yes
percentage_cap
oneOf
Caps the total value of `percentage` when applied. This field will always be `null` if `type` is `fixed` or `price_override`.
Nullable
Yes
One of
One of 1
null
One of 2
reference
References Money.
price_override
oneOf
The base unit price that matching items should be reduced to. This field will always be `null` if `type` is `fixed` or `percentage`.
Nullable
Yes
One of
One of 1
null
One of 2
reference
References Money.
Used by
Raw YAML
Download source
title: Calculation
type: object
description: 'Defines the type of calculation that is performed by a discount, surcharge or tax.'
properties:
type:
type: string
enum:
- fixed
- percentage
- price_override
description: The type of calculation to perform.
fixed_value:
description: |-
The fixed value to apply.
This property will always be `null` if `type` is `percentage` or `price_override`.
oneOf:
- type: 'null'
- $ref: ./Money.yaml
percentage:
type:
- string
- 'null'
example: '7.5'
pattern: '^((0\.[1-9])|([1-9]([0-9])?(\.[0-9])?)|100)$'
description: |-
The percentage to apply.
This field will always be `null` if `type` is `fixed` or `price_override`.
percentage_cap:
description: |-
Caps the total value of `percentage` when applied.
This field will always be `null` if `type` is `fixed` or `price_override`.
oneOf:
- type: 'null'
- $ref: ./Money.yaml
price_override:
description: |-
The base unit price that matching items should be reduced to.
This field will always be `null` if `type` is `fixed` or `percentage`.
oneOf:
- type: 'null'
- $ref: ./Money.yaml
required:
- type
x-tags:
- Foundation