Skip to content

Commit 259a756

Browse files
committed
Discount codes
1 parent e172d1b commit 259a756

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
displayName: Discount Codes
2+
/{cartIdentifier}/apply
3+
post:
4+
displayName: Apply discount to cart
5+
description: Applies a discount associated with given discount code
6+
headers:
7+
Accept:
8+
description: Specifies the expected response type. If set, the list is returned in XML or JSON format.
9+
example: |
10+
application/vnd.ibexa.api.DiscountCode+json
11+
Content-Type:
12+
description: Specifies the input type.
13+
example: |
14+
application/vnd.ibexa.api.DiscountCode+json
15+
body:
16+
application/vnd.ibexa.api.DiscountCode+json:
17+
type: DiscountCode
18+
example: !include examples/discount_codes/apply/POST/DiscountCode.json.example
19+
responses:
20+
200:
21+
description: Action executed successfuly.
22+
body:
23+
application/vnd.ibexa.api.DiscountCode+json:
24+
type: DiscountCode
25+
example: !include examples/discount_codes/apply/POST/DiscountCode.json.example
26+
400:
27+
description: Error - the request is invalid.
28+
404:
29+
description: Error - the given cart identifier was not found, or the discount code does not exist.
30+
429:
31+
description: Error - the request was throttled due to too many requests in a short time.
32+
33+
/{cartIdentifier}/drop
34+
post:
35+
displayName: Remove discount from cart
36+
description: Removes the discount associated with given discount code from the cart
37+
headers:
38+
Accept:
39+
description: Specifies the expected response type. Only JSON is supported.
40+
example: |
41+
application/vnd.ibexa.api.DiscountCode+json
42+
Content-Type:
43+
description: Specifies the input type. Only JSON is supported.
44+
example: |
45+
application/vnd.ibexa.api.DiscountCode+json
46+
body:
47+
application/vnd.ibexa.api.DiscountCode+json:
48+
type: DiscountCode
49+
example: !include examples/discount_codes/apply/POST/DiscountCode.json.example
50+
responses:
51+
204:
52+
description: Discount code with given discount code was removed from the cart.
53+
400:
54+
description: Error - the request is invalid.
55+
404:
56+
description: Error - the given cart identifier was not found

docs/api/rest_api/rest_api_reference/input/ibexa.raml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,8 @@ baseUri: ../rest_api_usage/rest_api_usage/
8181

8282
/ai: !include ibexa-ai.raml
8383

84+
/discounts: !include ibexa-discounts.raml
85+
86+
/discounts_codes: !include ibexa-discounts-codes.raml
87+
8488
types: !include ibexa-types.raml
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"DiscountCode": {
3+
"code": "summer10"
4+
}
5+
}

0 commit comments

Comments
 (0)