-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapispec.yaml
381 lines (380 loc) · 10.7 KB
/
apispec.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
openapi: 3.0.0
# Added by API Auto Mocking Plugin
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/pacharrin/OpenPaymentsService/1.0.0
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/pacharrin/PaymentsHub/v1.0
- description: production
url: https://payments.aurohub.com/v1.0
- description: sandbox
url: https://payments.aurosandbox.com/v1.0
info:
description: The OpenPaymentsService API is an unified interface between banking institutions and service integrators so that the end costumer can pay any service or bill.
version: "1.0.0"
title: OpenPaymentsService API
contact:
email: [email protected]
name: Alexis Cervantes
url: https://github.com/Aurotek/open-payments-service-spec
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
tags:
- name: services
description: Get info about available services
- name: payments
description: Manage payments
paths:
/services:
get:
tags:
- services
summary: Collection of available services
operationId: listServices
description: |
Return a collection of all the services available for the user who made the petition
This requests accept parameters for pagination
parameters:
- in: query
name: skip
description: number of records to skip for pagination
schema:
type: integer
format: int32
minimum: 0
- in: query
name: limit
description: maximum number of records to return
schema:
type: integer
format: int32
minimum: 0
maximum: 50
responses:
'200':
description: Return collection of all available services
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Service'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Unexpected'
/services/{serviceId}:
get:
tags:
- services
operationId: getService
summary: Get details of the specified service.
description: |
Return an object with all the details of the service with id ```{ServiceId}```
parameters:
- $ref: '#/components/parameters/ServiceId'
responses:
'200':
description: A service object
content:
application/json:
schema:
$ref: '#/components/schemas/Service'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Unexpected'
/services/{serviceId}/balance:
get:
tags:
- payments
operationId: getBalance
summary: Get amount due of the specified service for the referenced client.
description: |
Some services allow to request the current balance, this request must be done before the payment
parameters:
- $ref: '#/components/parameters/ServiceId'
- $ref: '#/components/parameters/Reference'
- $ref: '#/components/parameters/Extra'
responses:
'200':
description: a balance object
content:
application/json:
schema:
$ref: '#/components/schemas/Balance'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Unexpected'
/services/{serviceId}/payment:
post:
tags:
- payments
operationId: createPayment
summary: Creates a payment instruction for the specified service
description: |
This petition is used to process a payment of the specified service.
parameters:
- $ref: '#/components/parameters/ServiceId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentRequest'
description: Payment item to process
responses:
'201':
description: payment created
content:
application/json:
schema:
$ref: '#/components/schemas/Payment'
'400':
description: 'invalid input, object invalid'
'409':
description: an existing payment already exists with the exact same values
/payments/{paymentId}:
get:
tags:
- payments
operationId: getPayment
summary: gets the details of a payment
description: |
you can use this petition to get the latest status of a previous response
parameters:
- $ref: '#/components/parameters/PaymentId'
responses:
'200':
description: a payment object
content:
application/json:
schema:
$ref: '#/components/schemas/Payment'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
default:
$ref: '#/components/responses/Unexpected'
components:
parameters:
ServiceId:
in: path
name: serviceId
description: Identifies the service.
required: true
schema:
type: string
PaymentId:
in: path
name: paymentId
description: UUID of the payment.
required: true
schema:
type: string
format: uuid
Reference:
in: query
name: reference
description: primary Reference for a service
required: true
schema:
type: string
Extra:
in: query
name: extra
description: extra fields to reference a service
required: false
schema:
type: array
items:
type: string
style: deepObject
explode: true
responses:
BadRequest:
description: Bad request.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Forbidden:
description: Forbidden, you are not authorized to retrieve this resource.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unauthorized:
description: Unauthorized, Authorization information is missing or invalid.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
NotFound:
description: The specified resource was not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
Unexpected:
description: Unexpected error
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
PaymentResponse:
description: Payment reponse
content:
application/json:
schema:
$ref: '#/components/schemas/Payment'
schemas:
Service:
type: object
additionalProperties: true
required:
- id
- name
- description
- offer_consultation
- partial_payments
- overdue_payments
- inputs
properties:
id:
type: integer
example: 15
name:
type: string
example: ACN
description:
type: string
example: 'pago de cuenta de ACN'
offer_consultation:
type: boolean
partial_payments:
type: boolean
overdue_payments:
type: boolean
aplication:
type: string
example: '24 - 48 hrs'
clarifications:
type: string
example: '1 a 5 días hábiles'
params:
type: array
items:
$ref: '#/components/schemas/Param'
Balance:
type: object
additionalProperties: true
properties:
code:
type: string
message:
type: string
amount_due:
type: integer
description: amount due in cents
due_date:
type: string
format: date-time
description: due Date in format defined by RFC 3339, section 5.6. for example 2017-07-21T17:32:28Z
PaymentRequest:
required:
- reference
- amount
properties:
reference:
type: string
example: 555512272507
description: primary refence of the client, any other field required defined should be send inside the extra field
amount:
type: integer
description: ammount to pay in cents
example: 18990
extra:
type: object
additionalProperties: true
example:
sucursal: miramontes
Payment:
properties:
payment_id:
type: string
format: uuid
description: unique identifier of the payment
reference:
type: string
example: 555512272507
description: reference
amount:
type: integer
example: 109000
description: ammount paid in cents
status:
type: string
enum: [pending, approved, rejected, cancelled, error]
Error:
type: object
properties:
code:
type: string
message:
type: string
required:
- code
- message
Param:
required:
- name
- description
- param_type
- data_type
- required
properties:
name:
type: string
example: monto
description:
type: string
example: Monto de la transacción
input_type:
type: string
enum: [input, output]
data_type:
type: string
enum:
- string
- integer
- boolean
- array
- object
required:
type: boolean