forked from jeffersoncleyson/totem-food-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
totem-food-service.yaml
941 lines (913 loc) · 24.9 KB
/
totem-food-service.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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
openapi: 3.0.3
info:
title: Totem Food Service - OpenAPI 3.0
description: |-
API utilizada pelo Administrativo e aplicação hospedada no Totem da Food Service
termsOfService: http://swagger.io/terms/
contact:
email: apiteam@swagger.io
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.11
externalDocs:
description: Find out more about Swagger
url: http://swagger.io
servers:
- url: http://localhost:8080
tags:
- name: Customers
description: Access to customers
- name: Order
description: Access to orders
- name: Payment Gateway
description: Access to payment
- name: Category
description: Access to categories
- name: Products
description: Access to product
paths:
/totem/customer:
post:
tags:
- Customers
summary: Create a new customer
description: Create a new customer
operationId: createCustomer
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerCreateDto'
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerDto'
'405':
description: Invalid input
/totem/customer/{customerId}:
delete:
tags:
- Customers
summary: Remove a Customer by ID
description: Remove Customer
operationId: deleteById
parameters:
- name: customerId
in: path
description: Delete customer by id
required: true
schema:
type: string
responses:
'204':
description: No content
'404':
description: Not found
/totem/login:
get:
tags:
- Customers
summary: Login totem
description: Login customer in totem
operationId: loginCustomer
parameters:
- name: cpf
in: header
description: Document consumer (CPF)
required: true
schema:
type: string
- name: password
in: header
description: Password to login consumer
required: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/CustomerDto'
'405':
description: Invalid input
/administrative/customer:
get:
tags:
- Customers
summary: List all clients
description: List all clients
operationId: listAllCustomers
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CustomerDto'
'405':
description: Invalid input
/administrative/category:
post:
tags:
- Category
summary: Create a new category
description: Create a new category
operationId: createCategory
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryCreateDto'
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryDto'
'405':
description: Invalid input
get:
tags:
- Category
summary: List all categories
description: Search all categories
operationId: listAllCategories
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/CategoryDto'
'405':
description: Invalid input
/administrative/category/{categoryId}:
get:
tags:
- Category
summary: Get a category
description: search for a category
operationId: getCategoryByID
parameters:
- name: categoryId
in: path
description: ID of category to return
required: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryDto'
'405':
description: Invalid input
put:
tags:
- Category
summary: Update category
description: Update category
operationId: updateCategory
parameters:
- name: categoryId
in: path
description: ID of category to return
required: true
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryCreateDto'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/CategoryDto'
'405':
description: Invalid input
delete:
tags:
- Category
summary: Remove category
description: Remove category
operationId: deleteCategoryByID
parameters:
- name: categoryId
in: path
description: ID of category to return
required: true
schema:
type: string
responses:
'204':
description: No content
'404':
description: Not found
/administrative/product:
post:
tags:
- Products
summary: Create a new product
description: Create a new product
operationId: createProduct
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProductCreateDto'
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/ProductDto'
'405':
description: Invalid input
get:
tags:
- Products
summary: List all product
description: List all product
operationId: listAllProducts
parameters:
- name: categoryId
in: query
description: ID of order to return
required: false
schema:
type: array
items:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ProductDto'
'405':
description: Invalid input
/administrative/product/{productId}:
get:
tags:
- Products
summary: Get product
description: Get product
operationId: getProductByID
parameters:
- name: productId
in: path
description: ID of product to return
required: true
schema:
type: integer
format: int64
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/ProductDto'
'405':
description: Invalid input
put:
tags:
- Products
summary: Update product
description: Update product
operationId: updateProduct
parameters:
- name: productId
in: path
description: ID of product to return
required: true
schema:
type: integer
format: int64
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProductCreateDto'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/ProductDto'
'405':
description: Invalid input
delete:
tags:
- Products
summary: Remove product
description: Remove product
operationId: deleteProductByID
parameters:
- name: productId
in: path
description: ID of product to return
required: true
schema:
type: integer
format: int64
responses:
'204':
description: No content
'404':
description: Not found
/totem/order:
post:
tags:
- Order
summary: Create a new order
description: Create a new order
operationId: createOrder
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderCreateDto'
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/OrderDto'
'405':
description: Invalid input
get:
tags:
- Order
summary: Get orders
description: "Get orders. Attention! use only one of the following filters customerId, orderId or status[]"
operationId: orderGetFilter
parameters:
- name: orderId
in: query
description: ID of order to return
required: false
schema:
type: string
- name: customerId
in: query
description: ID of customer to return
required: false
schema:
type: string
- name: status
in: query
description: ID of order to return
required: false
schema:
type: array
items:
$ref: '#/components/schemas/OrderStatusEnum'
- name: onlyTreadmill
in: query
description: Only orders with status RECEIVED, IN_PREPARATION and READY
required: false
schema:
type: boolean
responses:
'202':
description: Accepted
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderDto'
'204':
description: No results found or input filters are incorrect
'405':
description: Invalid input
/totem/order/{orderId}:
put:
tags:
- Order
summary: Update order
description: Update order
operationId: orderUpdate
parameters:
- name: orderId
in: path
description: ID of order to return
required: true
schema:
type: integer
format: int64
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/OrderCreateDto'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/OrderDto'
'405':
description: Invalid input
/totem/order/{orderId}/status/{statusName}:
put:
tags:
- Order
summary: Update order
description: Update order
operationId: orderStatus
parameters:
- name: orderId
in: path
description: ID of order to return
required: true
schema:
type: integer
format: int64
- name: statusName
in: path
description: ID of order to return
required: true
schema:
$ref: '#/components/schemas/OrderStatusEnum'
responses:
'202':
description: Accepted
content:
application/json:
schema:
$ref: '#/components/schemas/OrderDto'
'405':
description: Invalid input
/administrative/orders:
get:
tags:
- Order
summary: List all orders
description: List all orders
operationId: listAllOrders
parameters:
- name: status
in: query
description: Order token
required: false
schema:
type: array
items:
$ref: '#/components/schemas/OrderStatusEnum'
- name: onlyTreadmill
in: query
description: Only orders with status RECEIVED, IN_PREPARATION and READY
required: false
schema:
type: boolean
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/OrderAdminDto'
'405':
description: Invalid input
/totem/payment:
post:
tags:
- Payment Gateway
summary: Create payment
description: Create payment
operationId: paymentQrCode
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentCreateDto'
responses:
'201':
description: created operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentQRCodeDto'
'405':
description: Invalid input
/totem/payment/{paymentId}:
get:
tags:
- Payment Gateway
summary: Get payment the order
description: Get payment
operationId: getPaymentByID
parameters:
- name: paymentId
in: path
description: ID of product to return
required: true
schema:
type: string
- name: x-with-image-qrcode
in: header
description: If true, Generate QR Code image, else show information.
required: false
schema:
type: boolean
default: true
responses:
'200':
description: success operation
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentDto'
'405':
description: Invalid input
/totem/payment/callback:
post:
tags:
- Payment Gateway
summary: Update order
description: Update order
operationId: orderCallbackStatus
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentCallbackDto'
responses:
'200':
description: "Ok"
'204':
description: "No Content"
components:
schemas:
CustomerCreateDto:
type: object
required:
- name
- email
- cpf
properties:
name:
type: string
description: Customer name
example: 'Joe'
email:
type: string
description: E-mail
example: 'joe@email.com'
cpf:
type: string
description: CPF
example: '14315476579'
mobile:
type: string
description: Mobile number
example: '5535989483811'
password:
type: string
description: Password
example: 'x!iu#112'
CustomerDto:
type: object
properties:
id:
type: string
example: '64826bb3554280604d93d7b6'
name:
type: string
description: Customer name
example: 'Joe'
email:
type: string
description: E-mail
example: 'joe@email.com'
cpf:
type: string
description: CPF
example: '14315476579'
mobile:
type: string
description: Mobile number
example: '5535989483811'
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of creation
CategoryDto:
type: object
properties:
id:
type: string
example: '64826bb3554280604d93d7b6'
name:
type: string
description: Category name
example: 'refrigerantes'
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of creation
CategoryCreateDto:
type: object
properties:
name:
type: string
description: Category name
example: 'refrigerantes'
OrderCreateDto:
type: object
properties:
customerId:
type: string
example: 11934bb3554280604d93d7b6
product:
type: array
items:
$ref: '#/components/schemas/ItemQuantityDto'
OrderDto:
type: object
properties:
id:
type: string
example: '64826bb3554280604d93d7b6'
customerId:
type: string
example: '4d93d7b6'
product:
type: array
items:
$ref: '#/components/schemas/ProductDto'
status:
$ref: '#/components/schemas/OrderStatusEnum'
price:
type: number
description: price
example: '53.89'
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of creation
ItemQuantityDto:
type: object
properties:
id:
type: string
description: Product id
example: '64826bb3554280604d93d7b6'
qtd:
type: number
example: 2
OrderAdminDto:
type: object
properties:
id:
type: string
description: Order id
example: '1'
price:
type: number
description: price
example: '53.89'
customer:
$ref: '#/components/schemas/CustomerDto'
status:
$ref: '#/components/schemas/OrderStatusEnum'
waitTime:
type: number
description: Time waiting for order to be ready
example: '53.89'
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of order creation
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
receivedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
OrderStatusEnum:
type: string
description: Status order
enum:
- NEW
- WAITING_PAYMENT
- RECEIVED
- IN_PREPARATION
- READY
- FINALIZED # Take the order on the counter
- CANCELED
example: NEW
ProductCreateDto:
type: object
properties:
name:
type: string
description: Product name
example: 'Coca-cola'
description:
type: string
description: Product description
example: 'Refrigerante sabor cola'
image:
type: string
description: Product image URL
example: 'https://product-image.s3.east-1.amazonaws.com/coca-cola.png'
price:
type: number
description: Price
example: '5.90'
category:
type: string
description: category identification
example: '64826bb3554280604d93d7b6'
ProductDto:
type: object
properties:
id:
type: string
description: Order id
example: '1'
name:
type: string
description: Product name
example: 'Coca-cola'
description:
type: string
description: Product description
example: 'Refrigerante sabor cola'
image:
type: string
description: Product image URL
example: 'https://product-image.s3.east-1.amazonaws.com/coca-cola.png'
price:
type: number
description: Price
example: '5.90'
category:
$ref: '#/components/schemas/CategoryDto'
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of creation
PaymentCreateDto:
type: object
properties:
orderId:
type: string
description: order identification
example: '11826bb3554280604d93d7b6'
customerId:
type: string
description: customer identification
example: '11826bb3554280604d93d7b6'
PaymentQRCodeDto:
type: object
properties:
qrcodeBase64:
type: string
description: base64
example: 'iVBORw0KGgoAAAANSUhEUgAABRQAAAUUCAYAAACu5p7oAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAIABJREFUeJzs2luO3LiWQNFmI+Y/Zd6vRt36KGNXi7ZOBtcagHD4kNLeiLX33v8DAAAAABD879sDAAAAAAA/h6AIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCAAAAAJmgCAAAAABkgiIAAAAAkAmKAAAAAEAmKAIAAAAAmaAIAAAAAGSCIgAAAACQCYoAAAAAQCYoAgAAAACZoAgAAAAAZIIiAAAAAJAJigAAAABAJigCA...'
storeOrderId:
type: string
description: order store identification
example: 'cb87fb30-db28-46d6-8878-46bd6847624e'
paymentId:
type: string
description: order identification
example: '11826bb3554280604d93d7b6'
status:
$ref: '#/components/schemas/PaymentStatusEnum'
PaymentStatusEnum:
type: string
description: Status payment
enum:
- PENDING
- COMPLETED
example: PENDING
PaymentDto:
type: object
properties:
id:
type: string
description: Order id
example: '1'
price:
type: number
description: Price
example: '5.90'
status:
$ref: '#/components/schemas/PaymentStatusEnum'
qrcodeBase64:
type: string
description: base64 to generate qr code
example: '00020101021243650016COM.MERCADOLIBRE020130636cb87fb30-db28-46d6-8878-46bd6847624e5204000053039865802BR5909Test Test6009SAO PAULO62070503***6304535B'
modifiedAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of last update
createAt:
type: string
format: date-time
example: '2023-06-09T00:00:51.623596531Z'
description: Date of creation
PaymentCallbackDto:
type: object
description: "https://www.mercadopago.com.br/developers/pt/docs/your-integrations/notifications/webhooks"
properties:
action:
type: string
description: Type of notification received, if payment.created or payment.updated
example: 'payment.updated'
apiVersion:
type: string
description: Indicates whether it is a duplicate notification or not
example: 'v1'
dateCreated:
type: string
format: date-time
description: Resource creation date (payments)
example: '2015-03-25T10:04:58.396-04:00'
paymentId:
type: string
description: Notification ID
example: 'cb87fb30-46d6-8878-46bd6847624e'
liveMode:
type: string
description: Indicates whether the URL entered is valid
example: '/v1/totem/payment/callback'
type:
type: string
description: Type of notification received (payments)
example: 'payments'
sellerId:
type: string
description: Seller UserID
example: '12345'
data:
$ref: '#/components/schemas/PaymentDataDto'
PaymentDataDto:
type: object
description: ID do payment ou merchant_order
properties:
id:
type: string
description: ID do payment ou merchant_order
example: '652d74dff3fc61160d792436'