-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathorders_api.yaml
More file actions
155 lines (155 loc) · 4.54 KB
/
Copy pathorders_api.yaml
File metadata and controls
155 lines (155 loc) · 4.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
openapi: "3.0.0"
info:
title: Sample Order API
description: API to build an order for a customer
version: "2.0"
termsOfService: http://www.bypassmobile.com/terms/
paths:
/orders:
post:
summary: Creates a new order based on the body of the payload.
description: Creates a new order based on the body of the payload.
tags:
- Orders
requestBody:
required: true
content:
'application/json':
schema:
$ref: '#components/schemas/Order'
responses:
200:
description: 'The order creation was successful'
content:
'application/json':
schema:
$ref: '#components/schemas/Order'
/orders/{uuid}:
get:
summary: Returns the order for the requested uuid
description: |
retrieves the order at for the specified uuid.
tags:
- Orders
responses:
200:
description: The successful retrieval and return of a given order
content:
'application/json':
schema:
$ref: '#/components/schemas/Order'
put:
summary: Updates an order with new information
description: |
updates or changes elements of and order, including adding line items or discounts only elements that should be changed should be included in the payload.
tags:
- Orders
requestBody:
required: true
content:
'application/json':
schema:
$ref: '#/components/schemas/Order'
responses:
200:
description: The successful response for updating an order.
content:
'application/json':
schema:
$ref: '#/components/schemas/Order'
404:
description: Unable to find order
content:
'application/json':
schema:
$ref: '#/components/schemas/Error'
500:
description: An error occured
content:
'application/json':
schema:
$ref: '#/components/schemas/Error'
parameters:
- name: uuid
in: path
description: The uuid of the order that should be updated
required: true
schema:
type: string
components:
schemas:
Order:
type: object
properties:
uuid:
type: string
description: |
The globally unique uuid for the order
line_items:
type: array
description: |
The array of line items that make up this order
items:
$ref: '#/components/schemas/LineItem'
discounts:
type: array
description: |
The array of discounts that should be applied to this order
items:
$ref: '#/components/schemas/Discount'
tax_total:
type: number
description: |
The computed tax total for the order
total:
type: number
description: |
The computed total for the order
LineItem:
type: object
properties:
uuid:
type: string
description: |
A globally unique identifier for the line item.
name:
type: string
description: |
The name of the item that is part of the order.
quantity:
type: number
description: |
The number of items to
price:
type: number
description: |
The price of the item
tax_rate:
type: number
format: double
description: |
The rate that this item should be taxed. e.g. 5% would be 0.05
Discount:
type: object
properties:
uuid:
type: string
description: |
A globally unique identifier for this discounts
name:
type: string
description: |
The name of this discount, e.g. half-off, $1 off, member reward
type:
type: string
enum: ["percent", "amount"]
description: |
The type of discount to apply either percent or amount.
amount:
type: number
description: |
The amount of discount to apply, can be either a percent: 5% would be 0.05 or an amount: $1 would be 1
apply_to:
type: string
description: |
The uuid to apply the discount to. This could be for the order or a single line item.