-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
469 lines (469 loc) · 17 KB
/
openapi.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
openapi: 3.0.0
info:
title: Payment Connector
version: 1.0.0
description: 'Specification for payment connector, an application to allow the reuse of communications from our products with other payment platforms'
contact:
name: Aftersale
url: 'https://after.sale'
servers:
- url: https
tags:
- name: settings
description: Everything about this connector
- name: voucher
description: Access to voucher creation
- name: credit-card
description: Access to credit card refund
paths:
/settings:
get:
summary: Configuration
tags:
- settings
operationId: get-settings
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SettingsGet200Response'
examples:
get-response-settings-example:
value:
success: true
data:
name: PayPearl
description: Clam up and give my money
image_url: 'http://www.notarealsite.domain.com/paypearl_logo.png'
auth_fields:
- key: username
label: Username
- key: password
label: Password
custom_fields:
- key: cpf
label: Cadastro de Pessoa Física
default_value: null
required: true
services:
- refunds.voucher
- refunds.credit-card
- key: rg
label: Registro Geral
default_value: null
required: false
services:
- refunds.credit-card
service_queue:
service_name: service_bus
queue_name: queue-payment-paypearl
services:
- refunds.voucher
services:
- id: refunds.voucher
params:
compatible_fields:
- key: cpf
validation:
required: true
- id: refunds.credit-card
params:
compatible_fields:
- key: cpf
validation:
required: true
- key: rg
validation:
required: false
description: This allows understand what this connector is and what it can do
/refunds/credit-card:
post:
summary: Credit card refund creation
tags:
- credit-card
operationId: post-refunds-credit-card
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RefundCreditCardPost200Response'
examples:
post-response-refunds-credit-card-example:
value:
success: true
data:
transaction_id: 1A2B3C4D5E
'422':
$ref: '#/components/responses/Default422Response'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RefundCreditCardPostBody'
examples:
post-body-refunds-credit-card-example:
value:
amount: 2.6
email: email@email.com
refund_items:
- quantity: 2
sku: 123456ABCDEF
unitary_value: 1.3
free_shipping: true
free_shipping_amount: 1.1
custom_fields:
cpf: '11111111111'
rg: '2222222'
description: This allows credit card refund on an integration
/refunds/voucher:
post:
summary: Voucher creation
tags:
- voucher
operationId: post-refunds-voucher
responses:
'201':
description: Created
content:
application/json:
schema:
$ref: '#/components/schemas/RefundVoucherPost201Response'
examples:
post-response-refunds-voucher-example:
value:
success: true
data:
voucher_code: A1B2C3D4E5
'422':
$ref: '#/components/responses/Default422Response'
description: This allows voucher creation on an integration
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/RefundVoucherPostBody'
examples:
post-body-refunds-voucher-example:
value:
amount: 1.5
type: credit
order_id: '1234567890'
refund_items:
- quantity: 1
sku: ABCDEF123456
unitary_value: 1.5
free_shipping: false
expiring_days: 60
custom_fields:
cpf: '11111111111'
components:
schemas:
RefundItemArrayOfObjects:
title: RefundItemArrayOfObjects
type: array
description: Item(s) to be refunded
items:
type: object
description: A object containing information of the item to be refunded
properties:
quantity:
type: integer
description: Quantity of items to be refunded
sku:
type: string
description: Code of the item to be refunded
unitary_value:
type: number
description: Value of a single item
required:
- quantity
- sku
- unitary_value
RefundCreditCardPostBody:
title: RefundCreditCardPostBody
type: object
description: All parameters that can be sent within the JSON payload POST request
properties:
amount:
type: number
description: Balance to be refunded
email:
type: string
description: Customer email on ecommerce platform
refund_items:
$ref: '#/components/schemas/RefundItemArrayOfObjects'
free_shipping:
type: boolean
description: If there was free shipping at the time of purchase
free_shipping_amount:
type: number
description: 'Value of free shipping, if was available'
customer_document:
type: string
description: 'Customer document on ecommerce platform, without mask'
custom_fields:
description: 'If there are any custom_field previously declared, they will be inserted inside this object'
type: object
required:
- amount
RefundCreditCardPost200Response:
title: RefundCreditCardPost200Response
type: object
description: 200 response for POST method
properties:
success:
type: boolean
default: true
description: If the operation was successful
data:
type: object
required:
- transaction_id
description: Object that holds a successful response data
properties:
transaction_id:
type: string
description: Credit card refund transaction code
required:
- success
- data
RefundVoucherPostBody:
title: RefundVoucherPostBody
type: object
description: All parameters that can be sent within the JSON payload POST request
properties:
amount:
type: number
description: Balance of the voucher that will be created
type:
type: string
enum:
- credit
- voucher
description: Type of voucher that will be created
order_id:
type: string
description: Order identification in ecommerce platform
refund_items:
$ref: '#/components/schemas/RefundItemArrayOfObjects'
free_shipping:
type: boolean
description: If there was free shipping at the time of purchase
free_shipping_amount:
description: 'Value of free shipping, if was available'
type: number
customer_document:
type: string
description: 'Customer document on ecommerce platform, without mask'
expiring_days:
type: integer
description: Number of days until the voucher expiration date
custom_fields:
type: object
description: 'If there are any custom_field previously declared, they will be inserted inside this object'
required:
- amount
- type
RefundVoucherPost201Response:
title: RefundVoucherPost201Response
type: object
description: 201 response for POST method
properties:
success:
type: boolean
description: If the operation was successful
data:
type: object
description: Object that holds a successful response data
required:
- voucher_code
properties:
voucher_code:
type: string
description: Voucher code created in ecommerce platform
required:
- success
- data
SettingsGet200Response:
title: SettingsGetResponse
type: object
description: 200 response for GET method
properties:
success:
type: boolean
default: true
description: If the operation was successful
data:
type: object
description: Object that holds a successful response data
required:
- name
- services
properties:
name:
type: string
description: Connector name
description:
type: string
description: Short description about connector
image_url:
type: string
description: Connector logo url
auth_fields:
type: array
description: |-
Any field that the ecommerce uses for authentication
E.g.: Tokens, logins, passwords and etc.
items:
type: object
description: Extra field(s) that can be configured. Will be added to requests who require authentication
properties:
key:
type: string
description: Field identifier
label:
type: string
description: 'Field name to be displayed in an interface, expressing what the key means'
required:
- key
custom_fields:
type: array
description: 'Any field not mapped by this connector, that can be configured. Will be added to the body of requests to the defined `services`'
items:
type: object
description: Extra field(s) that can be configured. Will be added to the body of requests to the defined services
properties:
key:
type: string
pattern: '^[a-z_]+$'
description: |-
Field identifier/attribute name. Strings are separated by underlines, `snake_case` like.
E.g.: "field_name"
label:
type: string
description: 'Field name to be displayed in an interface, expressing what the key means'
default_value:
description: 'Value for a field in case a value is not defined. Can be any value - string, number, boolean, array, object or null.'
required:
type: boolean
description: Indicates whether filling this field is mandatory
services:
type: array
description: In which services this field can be used
items:
type: string
pattern: '^[a-z-._]+$'
required:
- key
- required
- services
service_queue:
type: object
description: 'Information about queuing service, only if this connector uses'
properties:
service_name:
type: string
description: An identification/name for the queue service
queue_name:
type: string
description: The name of the queue within the queuing service
services:
type: array
description: In which services the queue will be used
items:
type: string
pattern: '^[a-z-._]+$'
required:
- service_name
- queue_name
- services
services:
type: array
description: Services avaiable for this connector. This is where the provided `custom_fields` (if there is any) will be declared and used
items:
type: object
description: Object that holds the services and their params
properties:
id:
type: string
description: |-
Service identifier, which indicates which parameters belong to the endpoint. A url directory path is a dot and strings are separated by dash `slug-case` like.
E.g.: /something/another-thing will be "something.another-thing"
pattern: '^[a-z-._]+$'
params:
type: object
description: Parameters that belong to this service
properties:
compatible_fields:
type: array
description: Indicates which attributes of a given field is compatible
items:
type: object
description: Object that holds compatible fields attributes
properties:
key:
type: string
pattern: '^[a-z_]+$'
description: |-
Field identifier/attribute name. Strings are separated by underlines, `snake_case` like.
E.g.: "field_name"
validation:
type: object
description: Types of validation for the value of a given attribute
properties:
required:
type: boolean
description: Indicates if the field must have a value or not
required:
- required
required:
- key
required:
- id
required:
- success
- data
responses:
Default422Response:
description: Unprocessable Entity
content:
application/json:
schema:
type: object
description: Object that holds an error response
properties:
success:
type: boolean
default: false
description: If the operation was successful
error:
type: object
description: Object that holds a unsuccessful response error
required:
- message
- debug_data
properties:
code:
type: integer
description: Code associated with the operation error
message:
type: string
description: Message associated with the operation error
debug_data:
type: object
description: Debugging information associated with the operation error
required:
- success
- error
examples:
error-response-example:
value:
success: false
error:
code: 1
message: Some error message
debug_data: {}