forked from pedromazala/vagas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swagger.yaml
197 lines (194 loc) · 6.22 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
openapi: 3.0.3
info:
title: Pagar.me
version: 0.2.4
description: Backend challenge
contact:
email: [email protected]
servers:
- url: "http://localhost:9999"
description: Local API
tags:
- name: General
description: Test to see if the API is up
- name: Transactions
description: Transactions operations.
paths:
/hello:
get:
tags:
- General
summary: Test to see if the API is up
description: Test to see if the API is up
responses:
"200":
description: Succesful operation.
/tx/create:
post:
tags:
- Transactions
summary: Creates a transaction.
description: Creates a transaction.
requestBody:
content:
application/json:
schema:
type: object
properties:
id_client:
description: Client ID.
type: number
example: 2
value:
description: Tx value.
type: string
example: "10"
payment_method:
description: Payment method.
type: string
example: "debit"
card_number:
description: Card number.
type: string
example: "1122113311221133"
card_holder:
description: Card holder.
type: string
example: "Juan Cito"
expire_date:
description: Card expire date.
type: string
example: "2023-01-02"
cvv:
description: Card security code.
type: string
example: "123"
description:
description: Tx description.
type: string
example: "A very crazy yet no suspicious tx"
required:
- id_client
- value
- payment_method
- card_number
- card_holder
- expire_date
- cvv
responses:
"200":
description: Succesful operation.
content:
application/json:
schema:
type: object
properties:
message:
description: Operation status message.
type: string
example: "OK. Transaction created."
data:
description: Response data.
type: object
example:
{
"id_tx": 5,
"id_card": 1,
"card_type": "debit",
"card_number": "************1133",
"card_holder": "Juan Cito",
"id_client": 2,
"description": "A very crazy yet no suspicious tx",
"date": "2023-01-12 20:59:09.000000",
"value": "10.00",
"fee": "0.30",
"status": "P",
}
"400":
description: Bad request.
content:
application/json:
schema:
type: object
properties:
message:
description: Operation status message.
type: string
example: "ERR. Invalid client id."
"500":
description: Internal server error.
content:
application/json:
schema:
type: object
properties:
message:
description: Operation status message.
type: string
example: "ERR. Binding parameters."
/tx/list:
get:
tags:
- Transactions
summary: Creates a transaction.
description: Creates a transaction.
parameters:
- in: query
name: id_client
description: Client ID
schema:
type: number
example: 2
responses:
"200":
description: Succesful operation.
content:
application/json:
schema:
type: object
properties:
message:
description: Operation status message.
type: string
example: "OK. Transaction created."
data:
description: Response data.
type: object
example:
[
{
"id_tx": 7,
"card_type": "debit",
"card_number": "************1133",
"card_holder": "Juan Cito",
"id_client": 3,
"description": "A very crazy yet no suspicious tx",
"date": "2023-01-13 18:33:04.000000",
"value": "10.00",
"fee": "0.30",
"status": "P",
},
{
"id_tx": 8,
"card_type": "credit",
"card_number": "************5566",
"card_holder": "Juan Cito",
"id_client": 3,
"description": "A very crazy yet no suspicious tx 2",
"date": "2023-02-12 18:33:51.000000",
"value": "10.00",
"fee": "0.50",
"status": "W",
},
]
"500":
description: Internal server error.
content:
application/json:
schema:
type: object
properties:
message:
description: Operation status message.
type: string
example: "ERR. Binding parameters."