Repository navigation
Expand file tree
/
Copy pathopenapi.json
More file actions
350 lines (350 loc) · 9.54 KB
/
Copy pathopenapi.json
File metadata and controls
350 lines (350 loc) · 9.54 KB
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
{
"openapi": "3.0.0",
"info": {
"title": "StellarSettle API",
"version": "1.0.0",
"description": "API specification for StellarSettle backend including Soroban contract interactions."
},
"servers": [
{
"url": "http://localhost:3000",
"description": "Local development server"
}
],
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
},
"schemas": {
"EscrowStatusResponse": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "escrowed"
},
"contractId": {
"type": "string",
"description": "The Soroban contract ID managing the escrow",
"example": "CA3D..."
},
"transactionXdr": {
"type": "string",
"description": "The base64 encoded transaction XDR",
"example": "AAAA..."
}
},
"required": [
"status",
"contractId"
]
},
"ErrorResponse": {
"type": "object",
"properties": {
"error": {
"type": "string"
},
"message": {
"type": "string"
}
}
},
"BatchPublishRequest": {
"type": "object",
"required": [
"invoiceIds"
],
"properties": {
"invoiceIds": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"type": "string",
"format": "uuid"
},
"description": "Ids of the draft invoices to publish."
}
}
},
"BatchPublishResponse": {
"type": "object",
"properties": {
"success": {
"type": "boolean",
"example": true
},
"data": {
"type": "object",
"properties": {
"published": {
"type": "array",
"items": {
"type": "object"
},
"description": "The invoices that were published."
},
"count": {
"type": "integer",
"example": 3
}
}
}
}
},
"RevokeKYCRequest": {
"type": "object",
"required": [
"userId",
"reviewerId"
],
"properties": {
"userId": {
"type": "string",
"description": "User whose approval is being withdrawn."
},
"reviewerId": {
"type": "string",
"description": "Admin performing the revocation."
},
"revocationReason": {
"type": "string",
"description": "Recorded in the KYC audit log."
}
}
}
}
},
"paths": {
"/api/v1/kyc/submit": {
"post": {
"summary": "Submit KYC verification",
"security": [{ "bearerAuth": [] }],
"responses": {
"201": { "description": "Verification submitted" },
"401": { "description": "Authentication required" }
}
}
},
"/api/v1/kyc/webhook": {
"post": {
"summary": "Process a KYC provider webhook",
"description": "Updates verification and user KYC state after validating the provider HMAC signature.",
"requestBody": {
"required": true,
"content": { "application/json": { "schema": { "type": "object" } } }
},
"responses": {
"204": { "description": "Webhook processed" },
"401": { "description": "Invalid webhook signature" }
}
}
},
"/api/v1/admin": {
"description": "Administrative routes are defined under this prefix."
},
"/api/v1/invoices/{id}/escrow-status": {
"get": {
"summary": "Get Soroban Escrow Status",
"description": "Retrieves the on-chain escrow status for a specific invoice via Soroban smart contracts.",
"security": [
{
"bearerAuth": []
}
],
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"description": "Invoice ID",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/EscrowStatusResponse"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"503": {
"description": "Service Unavailable",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/v1/invoices/batch-publish": {
"post": {
"summary": "Batch publish draft invoices",
"description": "Publishes several of the authenticated seller's draft invoices to the marketplace in a single atomic transaction. Every invoice is validated first; if any one of them cannot be published the whole batch is rejected and no invoice changes state. The 400 response lists every rejected invoice and why.",
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchPublishRequest"
}
}
}
},
"responses": {
"200": {
"description": "All invoices published",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/BatchPublishResponse"
}
}
}
},
"400": {
"description": "Batch rejected; no invoice was changed",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"403": {
"description": "KYC approval required",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"429": {
"description": "Rate limit exceeded",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"503": {
"description": "Service Unavailable",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/api/v1/admin/revoke-kyc": {
"post": {
"summary": "Revoke a user's KYC approval",
"description": "Withdraws a previously granted KYC approval, returning the user to the pending state so they can be reviewed again. Only an approved user can be revoked. Requires the admin API key and an allow-listed source IP.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RevokeKYCRequest"
}
}
}
},
"responses": {
"200": {
"description": "KYC revoked"
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"404": {
"description": "User not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"409": {
"description": "User is not currently approved",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
}
}
}