-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopenapi.yaml
158 lines (158 loc) · 4.05 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
openapi: 3.0.0
info:
title: API de Pagamentos e Conversão de Moeda
description: Esta API simula processar pagamentos pelo PayPal e utiliza uma API externa (https://openexchangerates.org/) para conversão de moedas.
version: 1.0.0
servers:
- url: http://localhost:8080
paths:
/process-payment:
post:
summary: Processa um pagamento
requestBody:
description: Dados da solicitação de pagamento
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentRequest'
responses:
'200':
description: Resposta de sucesso do processamento do pagamento
content:
application/json:
schema:
$ref: '#/components/schemas/PaymentResponse'
'400':
description: Solicitação inválida
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/payment-status:
get:
summary: Obtém o status de um pagamento
parameters:
- name: transaction_id
in: query
required: true
schema:
type: string
- name: gateway
in: query
required: true
schema:
type: string
responses:
'200':
description: Resposta de sucesso do status do pagamento
content:
application/json:
schema:
$ref: '#/components/schemas/TransactionResponse'
'400':
description: Solicitação inválida
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
/convert-currency:
post:
summary: Converte moeda
requestBody:
description: Dados da solicitação de conversão de moeda
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CurrencyConversionRequest'
responses:
'200':
description: Resposta de sucesso da conversão de moeda
content:
application/json:
schema:
$ref: '#/components/schemas/CurrencyConversionResponse'
'400':
description: Solicitação inválida
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
'500':
description: Erro no servidor
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorResponse'
components:
schemas:
PaymentRequest:
type: object
properties:
gateway:
type: string
amount:
type: number
currency:
type: string
payment_method:
type: string
card_details:
type: object
properties:
number:
type: string
expiry:
type: string
cvv:
type: string
required:
- gateway
- amount
- currency
- payment_method
- card_details
PaymentResponse:
type: object
properties:
message:
type: string
transaction_id:
type: string
TransactionResponse:
type: object
properties:
message:
type: string
status:
type: string
CurrencyConversionRequest:
type: object
properties:
amount:
type: number
from_currency:
type: string
to_currency:
type: string
required:
- amount
- from_currency
- to_currency
CurrencyConversionResponse:
type: object
properties:
converted_amount:
type: number
from_currency:
type: string
to_currency:
type: string
rate:
type: number
ErrorResponse:
type: object
properties:
error:
type: string