Repository navigation
Expand file tree
/
Copy pathfsp-onboarding-api.yaml
More file actions
314 lines (292 loc) · 9.24 KB
/
Copy pathfsp-onboarding-api.yaml
File metadata and controls
314 lines (292 loc) · 9.24 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
openapi: 3.0.3
info:
title: FSP Onboarding API
version: 0.1.0
description: |
The **FSP Onboarding API** is the API an FSP (the ASE that holds the
merchant's account) exposes for terminal onboarding. The Merchant API calls
it; POS terminals never do.
- `GET` returns the fields the merchant fills in on the terminal. The
Merchant API serves them to the terminal through
`GET /v1/terminals/onboard` in `merchant-pos-api.yaml`.
- `POST` validates the values the merchant entered. The Merchant API sends
them from `POST /v1/terminals/onboard`, with the terminal's `merchantId`
added.
The FSP owns the fields and the validation rules.
## One URL
Both operations are served on one URL. The Merchant API holds that full
URL in its `fsp.onboarding_api` setting and calls it as is: `GET` for the
fields, `POST` for validation. The path below is where the testnet wallet
backend serves it.
## Authentication
Neither operation is authenticated.
tags:
- name: onboarding
description: Terminal onboarding fields and validation.
paths:
/terminals/onboarding:
get:
operationId: getOnboardingFields
summary: Get the onboarding fields
description: >
Returns the fields the merchant fills in on the terminal, with their
metadata and validation rules.
tags:
- onboarding
security: []
responses:
'200':
description: The onboarding fields.
content:
application/json:
schema:
$ref: '#/components/schemas/FieldDefinitionsResponse'
examples:
default:
$ref: '#/components/examples/FieldDefinitionsResponseExample'
post:
operationId: validateOnboardingData
summary: Validate onboarding data
description: >
Validates the values the merchant entered on the terminal against the
onboarding fields. The FSP strips properties it does not know.
tags:
- onboarding
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/OnboardingValues'
examples:
default:
$ref: '#/components/examples/OnboardingValuesExample'
responses:
'200':
description: The values pass validation.
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationResult'
examples:
valid:
$ref: '#/components/examples/ValidationResultExample'
'400':
description: |
The values fail validation. The body has one of two shapes:
- `{"valid": false, "error": {"field", "message"}}` when the wallet
address field names a wallet that does not exist.
- `{"success": false, "message", "errors": {"<key>": "<message>"}}`
when a field breaks its rules.
content:
application/json:
schema:
$ref: '#/components/schemas/ValidationRejection'
examples:
walletAddressNotFound:
$ref: '#/components/examples/WalletAddressRejectionExample'
invalidInput:
$ref: '#/components/examples/InvalidInputRejectionExample'
components:
examples:
FieldDefinitionsResponseExample:
summary: Onboarding fields
value:
success: true
message: SUCCESS
result:
- key: merchantCategoryCode
label: Merchant category
type: select
required: true
order: 1
options:
- value: "5411"
label: Grocery stores / supermarkets
- value: "5812"
label: Eating places / restaurants
- key: contactEmail
label: Contact email
description: We use this to send onboarding confirmation.
type: email
required: true
placeholder: me@interledger.org
order: 2
validation:
format: email
maxLength: 255
OnboardingValuesExample:
summary: Values entered on the terminal
value:
merchantId: 7c1f4f9a-4b8e-4c7e-9c2a-2c5d4f2a1b3e
terminalSerialNumber: SN-AB12-9931
merchantCategoryCode: "5411"
contactEmail: me@interledger.org
ValidationResultExample:
summary: Values are valid
value:
valid: true
response:
merchantCategoryCode: "5411"
contactEmail: me@interledger.org
WalletAddressRejectionExample:
summary: Wallet address not found
value:
valid: false
error:
field: walletAddress
message: Wallet Address not found!
InvalidInputRejectionExample:
summary: A field breaks its rules
value:
success: false
message: Invalid input
errors:
contactEmail: Invalid email
schemas:
FieldDefinitionsResponse:
type: object
required: [success, result]
properties:
success:
type: boolean
example: true
message:
type: string
example: SUCCESS
result:
type: array
description: The onboarding fields.
items:
$ref: '#/components/schemas/FieldDefinition'
FieldDefinition:
type: object
required: [key, label, type, required, order]
properties:
key:
type: string
description: Identifier of the field, camelCase. The property name of its value in the POST body.
example: contactEmail
label:
type: string
example: Contact email
description:
type: string
description: Help text shown with the field.
type:
type: string
enum: [text, email, tel, number, select, checkbox, date]
example: email
required:
type: boolean
example: true
placeholder:
type: string
example: me@interledger.org
order:
type: integer
description: Ascending render order.
example: 2
options:
type: array
description: Allowed choices; present when type = select.
items:
$ref: '#/components/schemas/FieldOption'
validation:
$ref: '#/components/schemas/FieldValidation'
FieldOption:
type: object
required: [value, label]
properties:
value:
type: string
example: "5411"
label:
type: string
example: Grocery stores / supermarkets
FieldValidation:
type: object
description: Declarative constraints. Clients ignore unknown keys.
properties:
minLength:
type: integer
example: 2
maxLength:
type: integer
example: 255
pattern:
type: string
description: ECMA-262 regular expression.
example: "^[0-9]+$"
min:
type: number
format: double
description: Minimum value of a number field. Always a JSON number.
max:
type: number
format: double
description: Maximum value of a number field. Always a JSON number.
format:
type: string
description: Semantic format hint (e.g. email, iso-country, payment-pointer).
example: email
mustEqual:
type: boolean
description: For checkbox consent fields, the value must equal this.
OnboardingValues:
type: object
x-oapi-codegen-extra-tags:
sensitive: dynamic
description: >
The values entered on the terminal, keyed by `FieldDefinition.key`,
plus `merchantId`.
properties:
merchantId:
type: string
description: The terminal's merchant in the Merchant API. The Merchant API adds it.
example: 7c1f4f9a-4b8e-4c7e-9c2a-2c5d4f2a1b3e
additionalProperties: true
ValidationResult:
type: object
required: [valid]
properties:
valid:
type: boolean
example: true
response:
type: object
x-oapi-codegen-extra-tags:
sensitive: dynamic
description: The validated values.
additionalProperties: true
ValidationRejection:
type: object
description: Either shape of a failed validation. Every property is optional.
properties:
valid:
type: boolean
example: false
error:
$ref: '#/components/schemas/ValidationRejectionError'
success:
type: boolean
example: false
message:
type: string
example: Invalid input
errors:
type: object
description: Message per field key.
additionalProperties:
type: string
ValidationRejectionError:
type: object
required: [field, message]
properties:
field:
type: string
example: walletAddress
message:
type: string
example: Wallet Address not found!