-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpAPI-swagger.yaml
452 lines (452 loc) · 13.8 KB
/
pAPI-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
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
basePath: /v1
consumes: [application/vnd.api+json]
definitions:
AccountNumber:
description: Account number
example: "71268996"
type: string
Amount:
description: Amount of money. Requires 1 to 2 decimal places.
example: "10.00"
pattern: ^[0-9.]{0,20}$
type: string
ApiError:
properties:
error_code: { format: uuid, type: string }
error_message: { type: string }
type: object
BankId:
description: Financial institution identification
example: "333333"
type: string
BankIdCode:
description:
The type of identification provided at `bank_id` attribute. Must
be ISO code as listed in the [External Code Sets spreadsheet](https://www.iso20022.org/external_code_list.page)
enum:
[SWBIC, GBDSC, BE, FR, DEBLZ, GRBIC, ITNCC, PLKNR, PTNCC, ESNCC, CHBCC]
example: GBDSC
type: string
ChargesInformation:
properties:
bearer_code:
description:
Specifies which party/parties will bear the charges associated
with the processing of the payment transaction.
enum: [DEBT, CRED, SHAR, SLEV]
example: SLEV
type: string
receiver_charges_amount:
description: Transaction charges due to the receiver of the transaction.
$ref: "#/definitions/Amount"
receiver_charges_currency:
$ref: "#/definitions/Currency"
sender_charges:
items:
description: List of transaction charges due to the sender of the transaction
properties:
amount:
description:
Amount of each transaction charge due to the sender of
the transaction.
$ref: "#/definitions/Amount"
currency:
$ref: "#/definitions/Currency"
type: object
type: array
type: object
Currency:
description: Currency code as defined in [ISO 4217](http://www.iso.org/iso/home/standards/currency_codes.htm).
example: EUR
pattern: "^[A-Z]{3}$"
type: string
Links:
properties:
first:
description: Link to the first resource in the list
example: "https://api.test.example.com/v1/api_name/resource_type"
type: string
last:
description: Link to the last resource in the list
example: "https://api.test.example.com/v1/api_name/resource_type"
type: string
next:
description: Link to the next resource in the list
example: "https://api.test.example.com/v1/api_name/resource_type"
type: string
prev:
description: Link to the previous resource in the list
example: "https://api.test.example.com/v1/api_name/resource_type"
type: string
self:
description: Link to this resource type
example: "https://api.test.example.com/v1/api_name/resource_type"
type: string
type: object
Payment:
properties:
attributes:
properties:
amount:
description:
Amount of money moved between the instructing agent and instructed
agent
$ref: "#/definitions/Amount"
beneficiary_party:
$ref: "#/definitions/PaymentParty"
charges_information:
$ref: "#/definitions/ChargesInformation"
currency:
$ref: "#/definitions/Currency"
debtor_party:
$ref: "#/definitions/PaymentParty"
end_to_end_reference:
description:
Unique identification, as assigned by the initiating party,
to unambiguously identify the transaction. This identification is passed
on, unchanged, throughout the entire end-to-end chain.
example: "PAYMENT REF: 20094"
type: string
fx:
properties:
contract_reference:
description:
Reference to the foreign exchange contract associated
with the transaction
example: FXCONTRACT/REF/123567
type: string
exchange_rate:
description:
Factor used to convert an amount from the instructed currency
into the transaction currency. Decimal value, represented as
a string, maximum length 12. Must be > 0.
example: "0.13343"
type: string
original_amount:
description:
Amount of money to be moved between the debtor and creditor,
before deduction of charges, expressed in the currency as instructed
by the initiating party. Decimal value. Must be > 0.
$ref: "#/definitions/Amount"
original_currency:
description: Currency of `orginal_amount`.
$ref: "#/definitions/Currency"
type: object
numeric_reference:
description:
Numeric reference field, see scheme specific descriptions
for usage
example: "0001"
type: string
payment_id:
description: Payment identification (legacy?)
example: "123456789012345678"
type: string
payment_purpose:
description: Purpose of the payment in a proprietary form
example: "Paying for goods/services"
type: string
payment_scheme:
description:
Clearing infrastructure through which the payment instruction
is to be processed. Default for given organisation ID is used if left
empty. Currently only FPS is supported.
enum: [FPS]
example: FPS
type: string
payment_type:
enum: [Credit]
type: string
processing_date:
description:
Date on which the payment is to be debited from the debtor
account. Formatted according to ISO 8601 format YYYY-MM-DD.
example: "2015-02-12"
format: date
type: string
reference:
description: Payment reference for beneficiary use
example: rent for oct
type: string
scheme_payment_sub_type:
description: The scheme specific payment sub type
enum:
[
TelephoneBanking,
InternetBanking,
BranchInstruction,
Letter,
Email,
MobilePaymentsService,
]
example: TelephoneBanking
type: string
scheme_payment_type:
description: The scheme-specific payment type
enum: [ImmediatePayment, ForwardDatedPayment, StandingOrder]
example: ImmediatePayment
type: string
sponsor_party:
description: Sponsor party
properties:
account_number:
$ref: "#/definitions/AccountNumber"
bank_id:
$ref: "#/definitions/BankId"
bank_id_code:
$ref: "#/definitions/BankIdCode"
type: object
type: object
id:
description: Unique resource ID
example: 4ee3a8d8-ca7b-4290-a52c-dd5b6165ec43
format: uuid
type: string
organisation_id:
description: Unique ID of the organisation this resource is created by
example: 743d5b63-8e6f-432e-a8fa-c5d8d2ee5fcb
format: uuid
type: string
type:
description: Name of the resource type
example: Payment
pattern: "^[A-Za-z_]*$"
type: string
version:
description: Version number
example: 0
minimum: 0
type: integer
required: [id, organisation_id, attributes]
type: object
PaymentCreationRequest:
properties:
data:
$ref: "#/definitions/Payment"
required:
- data
type: object
PaymentCreationResponse:
properties:
data:
$ref: "#/definitions/Payment"
links:
$ref: "#/definitions/Links"
required:
- data
type: object
PaymentDetailsListResponse:
properties:
data:
items:
$ref: "#/definitions/Payment"
type: array
links:
$ref: "#/definitions/Links"
type: object
PaymentDetailsResponse:
properties:
data:
$ref: "#/definitions/Payment"
links:
$ref: "#/definitions/Links"
type: object
PaymentParty:
properties:
account_name:
description: Name of beneficiary/debtor as given with account
example: James Bond
type: string
account_number:
$ref: "#/definitions/AccountNumber"
account_number_code:
description: The type of identification given at `account_number` attribute
enum: [IBAN, BBAN]
example: IBAN
type: string
account_type:
description: The type of the account given with account_number. Single
digit number. Only required if requested by the beneficiary
party. Defaults to 0.
example: 0
type: integer
address:
description: Beneficiary/debtor address
example: 1 Clarence Mew, Horsforth, Leeds Ls18 4EP
type: string
bank_id:
$ref: "#/definitions/BankId"
bank_id_code:
$ref: "#/definitions/BankIdCode"
name:
description: Beneficiary/debtor name
example: Norman Smith
type: string
type: object
PaymentUpdateRequest:
properties:
data:
$ref: "#/definitions/Payment"
required:
- data
type: object
PaymentUpdateResponse:
properties:
data:
$ref: "#/definitions/Payment"
links:
$ref: "#/definitions/Links"
required:
- data
type: object
host: api.example.com
info:
description: Payments API as specified in Form3 take home test
title: Payments API
version: "1"
paths:
/payments:
get:
operationId: listPayments
parameters:
- description: Which page to select
in: query
minimum: 0
default: 0
name: "page[number]"
required: false
type: integer
- description: Number of items per page
in: query
maximum: 100
minimum: 1
default: 10
name: "page[size]"
required: false
type: integer
responses:
200:
description: List of payment details
schema:
$ref: "#/definitions/PaymentDetailsListResponse"
404:
description: The query returned no payments
schema:
$ref: "#/definitions/ApiError"
429:
description: Too Many Requests
500:
description: Internal Server Error
schema:
$ref: "#/definitions/ApiError"
summary: List payments
tags: [Payments]
post:
operationId: createPayment
parameters:
- in: body
name: Payment creation request
schema:
$ref: "#/definitions/PaymentCreationRequest"
responses:
201:
description: Payment created successfully
schema:
$ref: "#/definitions/PaymentCreationResponse"
409:
description: A payment with the given ID already exists
schema:
$ref: "#/definitions/ApiError"
429:
description: Too Many Requests
500:
description: Internal Server Error
schema:
$ref: "#/definitions/ApiError"
summary: Create payment
tags: [Payments]
/payments/{id}:
delete:
operationId: deletePayment
parameters:
- description: ID of payment to delete
format: uuid
in: path
name: id
required: true
type: string
responses:
204:
description: Payment deleted OK. No body content will be returned
404:
description: Payment Not Found
schema:
$ref: "#/definitions/ApiError"
429:
description: Too Many Requests
500:
description: Internal Server Error
schema:
$ref: "#/definitions/ApiError"
summary: Deletes a payment resource
tags: [Payments]
get:
operationId: getPayment
parameters:
- description: ID of payment to fetch
format: uuid
in: path
name: id
required: true
type: string
responses:
200:
description: Payment details
schema:
$ref: "#/definitions/PaymentDetailsResponse"
404:
description: Payment Not Found
schema:
$ref: "#/definitions/ApiError"
429:
description: Too Many Requests
500:
description: Internal Server Error
schema:
$ref: "#/definitions/ApiError"
summary: Fetch payment
tags: [Payments]
put:
operationId: updatePayment
parameters:
- description: ID of payment to update
format: uuid
in: path
name: id
required: true
type: string
- description: New payment details
in: body
name: Payment update request
schema:
$ref: "#/definitions/PaymentUpdateRequest"
responses:
200:
description: Payment details
schema:
$ref: "#/definitions/PaymentUpdateResponse"
404:
description: Payment Not Found
schema:
$ref: "#/definitions/ApiError"
429:
description: Too Many Requests
500:
description: Internal Server Error
schema:
$ref: "#/definitions/ApiError"
summary: Update payment details
tags: [Payments]
produces: [application/vnd.api+json]
schemes: [http]
swagger: "2.0"