This repository has been archived by the owner on Feb 19, 2024. It is now read-only.
generated from peter-evans/swagger-github-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
272 lines (257 loc) · 8.08 KB
/
swagger.yaml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
openapi: "3.0.1"
tags:
- name: "payments"
description: "Payments operations"
info:
title: "Groceries API"
description: "Definition of Groceries APIs integratios between Lolamarket and Cabify"
version: "0.0.1"
servers:
- url: "https://integrations.cabify.com"
description: "Production"
- url: "https://integrations.rider-groceries-01.cabify-testing.com"
description: "Testing"
paths:
/lola/api/v1/payments/hook:
post:
tags:
- "payments"
summary: "Finish an Order and dispatch payments events"
description: "Finish an <b>Order</b> and dispatch payments events like billing or cancelling an authorization.<br><br><b>Events:</b><ul><li><b>groceries.order_delivered:</b> Dispatch a terminating event to Cabify and should be triggered when an order is marked as finished and Cabify needs to charge a previous authorized payment. <br>**This event will require the whole billing information in the `order` object `total_amount`, `currency` and `items`**</li><br><li><b>groceries.order_cancelled:</b> Should be triggered when an Order is cancelled and the payment authorization needs to be totally refund to the user.<br>**Only the `order.id` is mandatory in this case**</li></ul>"
operationId: "payments-hook"
security:
- ApiKeyAuth: [ ]
requestBody:
$ref: "#/components/requestBodies/paymentsHookMessage"
responses:
"202":
description: "message accepted and published"
"400":
description: "bad request"
content:
application/json:
schema:
$ref: "#/components/schemas/error_message"
"401":
description: "unauthorized"
/lola/api/v1/order/hook:
post:
tags:
- "order"
summary: "Dispatch order events"
description: "Dispatch changes of an <b>Order</b> like state changes.<br><br><b>Events:</b><ul><li><b>groceries.order_state_changed:</b> Dispatch an event to Cabify notifying about states changes of an Order<br>**This event will require the `order` object with the new `state` field**</li></ul>"
operationId: "order-hook"
security:
- ApiKeyAuth: [ ]
requestBody:
$ref: "#/components/requestBodies/orderHookMessage"
responses:
"202":
description: "message accepted and published"
"400":
description: "bad request"
content:
application/json:
schema:
$ref: "#/components/schemas/error_message"
"401":
description: "unauthorized"
/third-party/payments/hook:
post:
tags:
- "payments"
summary: "Lola WebHook that will listen payment and cancellation result"
description: "Since all payments operations are async all payment results will be published into this endpoint."
operationId: "result-payments-hook"
security:
- ApiKeyAuth: [ ]
requestBody:
$ref: "#/components/requestBodies/paymentsHookResult"
responses:
"202":
description: "message accepted and published"
"400":
description: "bad request"
content:
application/json:
schema:
$ref: "#/components/schemas/error_message"
"401":
description: "unauthorized"
components:
requestBodies:
paymentsHookMessage:
description: "Request body for a Payment Operation"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/payment_operation"
paymentsHookResult:
description: "Request body for a Payment Operation Result"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/payment_operation_result"
orderHookMessage:
description: "Request body for a Order Operation"
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/order_operation"
schemas:
payment_operation:
type: "object"
required:
- caller
- event
- data
properties:
caller:
type: "string"
description: "Caller's ID"
example: "26345b2f-3125-11eb-87d8-801234232f4e"
event:
type: "string"
description: "Define the type of Payment Event that needs to be processed"
enum: [
"groceries.order_delivered",
"groceries.order_cancelled"
]
data:
type: "object"
required:
- order
properties:
order:
$ref: "#/components/schemas/order"
order_operation:
type: "object"
required:
- caller
- event
- data
properties:
caller:
type: "string"
description: "Caller's ID"
example: "26345b2f-3125-11eb-87d8-801234232f4e"
event:
type: "string"
description: "Define the type of Order Event that needs to be processed"
enum: [
"groceries.order_state_changed"
]
data:
type: "object"
required:
- order
properties:
order:
$ref: "#/components/schemas/order"
payment_operation_result:
type: "object"
required:
- result
- data
properties:
event:
type: "string"
description: "Define the type of Payment Event that needs to be processed"
enum: [
"groceries.order_delivered",
"groceries.order_cancelled"
]
result:
type: "string"
description: "An Enum describing the result of the operation"
enum:
- "success"
- "error"
message:
type: "string"
description: "Message describing the error if applicable"
data:
type: "object"
properties:
order:
$ref: "#/components/schemas/order"
order:
type: "object"
required:
- id
properties:
id:
type: "string"
description: "Order ID"
example: "XXXXX-XXXXX-XXXXX-XXXXX"
currency:
type: "string"
description: "Order's currency, three letters ISO"
example: "eur"
total_amount:
type: "integer"
description: "Order's total amount, decimal value multipled by 100"
example: "10000"
state:
type: "string"
description: "Current order state"
example: "delivered"
enum:
- "confirmed"
- "shopping"
- "delivering"
- "delivered"
items:
type: "array"
items:
$ref: "#/components/schemas/order_item"
order_item:
type: "object"
required:
- quantity
- price
- total_price
- discount
- tax_rate
- description
properties:
quantity:
type: "integer"
description: "Quantity of the product"
example: "5"
price:
type: "integer"
description: "Unit price, decimal multipled by 100"
example: "100"
total_price:
type: "integer"
description: "Total price (quantity * price) - (quantity * discount), decimal multipled by 100"
example: "500"
discount:
type: "integer"
description: "Unit discount value, decimal multipled by 100"
tax_rate:
type: "number"
format: "float"
description: "Percentage of tax rate included in the price"
example: 0.0
description:
type: "string"
description: "Name of the product"
error_message:
type: "object"
properties:
error:
type: "string"
description: "Error description"
securitySchemes:
ApiKeyAuth:
type: apiKey
in: header
name: X-API-KEY
externalDocs:
description: "Find out more about Swagger"
url: "http://swagger.io"