@fleetless/contracts 7.1.0 → 8.1.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -201,7 +201,11 @@
201
201
  "enum": [
202
202
  "legacy_usd_invoice",
203
203
  "legacy_payer_unresolved",
204
- "mandate_policy_unresolved"
204
+ "mandate_policy_unresolved",
205
+ "lexware_contact_pending",
206
+ "lexware_contact_changed",
207
+ "issuer_cutover_in_progress",
208
+ "lexware_issuance_paused"
205
209
  ]
206
210
  },
207
211
  "original_amount": {
@@ -983,7 +987,7 @@
983
987
  "type": "string",
984
988
  "format": "uuid",
985
989
  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
986
- "description": "The open invoice dunning is chasing — or, while the payer's VAT ID is unsettled, the due charge that becomes one: it has no number yet and is not in `invoices`. `POST /api/billing/invoices/:id/pay` takes either."
990
+ "description": "What dunning is chasing: a historical open `FL-…` invoice, or a due charge. Before the issuer cutover a due charge appears here only while the payer's VAT ID is unsettled; it has no number yet, is not in `invoices`, and `POST /api/billing/invoices/:id/pay` takes either. After the cutover this is always a due charge (in `charges`): pay it with `POST /api/billing/charges/:id/pay`."
987
991
  },
988
992
  "gross_cents": {
989
993
  "type": "integer",
@@ -1186,6 +1190,14 @@
1186
1190
  },
1187
1191
  "description": "What a payment-method change may offer right now, so a client offers exactly what the cloud accepts. `applepay` is absent when it needs an open invoice and none is open; `[]` when the org has no billing account."
1188
1192
  },
1193
+ "issuer": {
1194
+ "type": "string",
1195
+ "enum": [
1196
+ "cloud",
1197
+ "lexware"
1198
+ ],
1199
+ "description": "Which system issues this org's charges: `cloud` before the issuer cutover, or `lexware` after it."
1200
+ },
1189
1201
  "invoices": {
1190
1202
  "type": "array",
1191
1203
  "items": {
@@ -1263,7 +1275,226 @@
1263
1275
  ],
1264
1276
  "additionalProperties": false
1265
1277
  },
1266
- "description": "Newest first, at most 24."
1278
+ "description": "Cloud-issued invoices from before the issuer cutover; read-only, never grows after it. Newest first, at most 24."
1279
+ },
1280
+ "charges": {
1281
+ "type": "array",
1282
+ "items": {
1283
+ "type": "object",
1284
+ "properties": {
1285
+ "id": {
1286
+ "type": "string",
1287
+ "format": "uuid",
1288
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1289
+ "description": "The due charge's id — never a Cloud invoice number. Pay it with `POST /api/billing/charges/:id/pay`."
1290
+ },
1291
+ "kind": {
1292
+ "type": "string",
1293
+ "enum": [
1294
+ "first",
1295
+ "renewal",
1296
+ "change"
1297
+ ],
1298
+ "description": "What caused the charge: the first charge after checkout, a scheduled renewal, or a mid-period plan change."
1299
+ },
1300
+ "status": {
1301
+ "type": "string",
1302
+ "enum": [
1303
+ "due",
1304
+ "paid",
1305
+ "uncollectible",
1306
+ "cancelled"
1307
+ ],
1308
+ "description": "The charge's own status. A charged back or manually refunded charge stays `paid` — refunds and chargebacks are handled in Mollie or Lexware by hand; this status and the invoice it names are unchanged, and the resulting Lexware credit note appears under `GET /api/billing/documents` instead."
1309
+ },
1310
+ "currency": {
1311
+ "type": "string",
1312
+ "const": "eur",
1313
+ "description": "Every charge billed through Lexware is EUR."
1314
+ },
1315
+ "net_cents": {
1316
+ "type": "integer",
1317
+ "minimum": 0,
1318
+ "maximum": 9007199254740991,
1319
+ "description": "The charge, excluding VAT, in integer cents."
1320
+ },
1321
+ "vat_rate_percent": {
1322
+ "type": "integer",
1323
+ "minimum": 0,
1324
+ "maximum": 100,
1325
+ "description": "The VAT rate applied, in whole percent."
1326
+ },
1327
+ "vat_cents": {
1328
+ "type": "integer",
1329
+ "minimum": 0,
1330
+ "maximum": 9007199254740991,
1331
+ "description": "VAT, in integer cents (`vatCents`)."
1332
+ },
1333
+ "gross_cents": {
1334
+ "type": "integer",
1335
+ "minimum": 0,
1336
+ "maximum": 9007199254740991,
1337
+ "description": "Net plus VAT, in integer cents."
1338
+ },
1339
+ "period_start": {
1340
+ "type": "string",
1341
+ "format": "date-time",
1342
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1343
+ "description": "The covered period's start."
1344
+ },
1345
+ "period_end": {
1346
+ "type": "string",
1347
+ "format": "date-time",
1348
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1349
+ "description": "The covered period's end."
1350
+ },
1351
+ "due_at": {
1352
+ "type": "string",
1353
+ "format": "date-time",
1354
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
1355
+ "description": "When this charge is due."
1356
+ },
1357
+ "paid_at": {
1358
+ "anyOf": [
1359
+ {
1360
+ "type": "string",
1361
+ "format": "date-time",
1362
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
1363
+ },
1364
+ {
1365
+ "type": "null"
1366
+ }
1367
+ ],
1368
+ "description": "When this charge was paid, or `null` while unpaid."
1369
+ },
1370
+ "invoice": {
1371
+ "oneOf": [
1372
+ {
1373
+ "type": "object",
1374
+ "properties": {
1375
+ "state": {
1376
+ "type": "string",
1377
+ "const": "not_issued",
1378
+ "description": "Not collected (due, a failed retry, or uncollectible): no invoice exists."
1379
+ }
1380
+ },
1381
+ "required": [
1382
+ "state"
1383
+ ],
1384
+ "additionalProperties": false
1385
+ },
1386
+ {
1387
+ "type": "object",
1388
+ "properties": {
1389
+ "state": {
1390
+ "type": "string",
1391
+ "const": "pending",
1392
+ "description": "Collected; the Lexware invoice is not yet confirmed."
1393
+ }
1394
+ },
1395
+ "required": [
1396
+ "state"
1397
+ ],
1398
+ "additionalProperties": false
1399
+ },
1400
+ {
1401
+ "type": "object",
1402
+ "properties": {
1403
+ "state": {
1404
+ "type": "string",
1405
+ "const": "issued",
1406
+ "description": "Lexware has confirmed the invoice."
1407
+ },
1408
+ "document_id": {
1409
+ "type": "string",
1410
+ "format": "uuid",
1411
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
1412
+ "description": "The Lexware document's id — read it with `GET /api/billing/documents/:id`."
1413
+ }
1414
+ },
1415
+ "required": [
1416
+ "state",
1417
+ "document_id"
1418
+ ],
1419
+ "additionalProperties": false
1420
+ }
1421
+ ],
1422
+ "description": "Whether a Lexware invoice exists for this charge yet, and which document it names once it does."
1423
+ }
1424
+ },
1425
+ "required": [
1426
+ "id",
1427
+ "kind",
1428
+ "status",
1429
+ "currency",
1430
+ "net_cents",
1431
+ "vat_rate_percent",
1432
+ "vat_cents",
1433
+ "gross_cents",
1434
+ "period_start",
1435
+ "period_end",
1436
+ "due_at",
1437
+ "paid_at",
1438
+ "invoice"
1439
+ ],
1440
+ "additionalProperties": false,
1441
+ "allOf": [
1442
+ {
1443
+ "if": {
1444
+ "properties": {
1445
+ "status": {
1446
+ "const": "paid"
1447
+ }
1448
+ },
1449
+ "required": [
1450
+ "status"
1451
+ ]
1452
+ },
1453
+ "then": {
1454
+ "properties": {
1455
+ "invoice": {
1456
+ "properties": {
1457
+ "state": {
1458
+ "enum": [
1459
+ "pending",
1460
+ "issued"
1461
+ ]
1462
+ }
1463
+ }
1464
+ }
1465
+ }
1466
+ }
1467
+ },
1468
+ {
1469
+ "if": {
1470
+ "properties": {
1471
+ "status": {
1472
+ "enum": [
1473
+ "due",
1474
+ "uncollectible",
1475
+ "cancelled"
1476
+ ]
1477
+ }
1478
+ },
1479
+ "required": [
1480
+ "status"
1481
+ ]
1482
+ },
1483
+ "then": {
1484
+ "properties": {
1485
+ "invoice": {
1486
+ "properties": {
1487
+ "state": {
1488
+ "const": "not_issued"
1489
+ }
1490
+ }
1491
+ }
1492
+ }
1493
+ }
1494
+ }
1495
+ ]
1496
+ },
1497
+ "description": "Newest first, at most 24. Lists only due charges with issuer `lexware` — never a pre-cutover charge, a legacy payment (legacy_issued/legacy_held/legacy_person/legacy_usd) or a late USD collection: none of those carry a Lexware intent, and they stay in `invoices` or nowhere. `[]` while `issuer` is `cloud`."
1267
1498
  }
1268
1499
  },
1269
1500
  "required": [
@@ -1271,7 +1502,9 @@
1271
1502
  "account",
1272
1503
  "payment_method",
1273
1504
  "payment_method_options",
1274
- "invoices"
1505
+ "issuer",
1506
+ "invoices",
1507
+ "charges"
1275
1508
  ],
1276
1509
  "additionalProperties": false,
1277
1510
  "description": "The billing view after the change."
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "session_id": {
6
+ "type": "string",
7
+ "format": "uuid",
8
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
9
+ "description": "The support session this token or response describes. Stable for the life of the session."
10
+ },
11
+ "mode": {
12
+ "type": "string",
13
+ "enum": [
14
+ "read",
15
+ "edit"
16
+ ],
17
+ "description": "The session's current mode. Every support session starts `read`; an operator-admin switches one session into `edit`, never the other way, and the switch is a one-way door for the life of the session."
18
+ },
19
+ "operator_name": {
20
+ "type": "string",
21
+ "minLength": 1,
22
+ "maxLength": 200,
23
+ "description": "The name of the operator-admin holding this session, for the console banner the operator-admin sees. Only the operator-admin's own console receives it; the customer's audit names every edit as Fleetless-Support, never this name."
24
+ },
25
+ "expires_at": {
26
+ "type": "string",
27
+ "format": "date-time",
28
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
29
+ "description": "When the session stops being usable regardless of activity, as an ISO 8601 timestamp. A support session has a hard ceiling; nothing extends it past this instant."
30
+ }
31
+ },
32
+ "required": [
33
+ "session_id",
34
+ "mode",
35
+ "operator_name",
36
+ "expires_at"
37
+ ],
38
+ "additionalProperties": false
39
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "grant": {
6
+ "type": "string",
7
+ "pattern": "^[A-Za-z0-9_-]{43}$",
8
+ "description": "The one-time grant minted when the support session was started: 32 random bytes, base64url, no padding. Consumed atomically by this exchange — presenting it again answers the same refusal a forged one would."
9
+ },
10
+ "code_verifier": {
11
+ "type": "string",
12
+ "pattern": "^[A-Za-z0-9._~-]{43,128}$",
13
+ "description": "The PKCE verifier whose `S256` hash was sent as the grant's challenge when the session was started. Between 43 and 128 unreserved characters, RFC 7636 §4.1's charset — the same shape `oauthCodeTokenRequest.code_verifier` checks, compared rather than parsed."
14
+ }
15
+ },
16
+ "required": [
17
+ "grant",
18
+ "code_verifier"
19
+ ],
20
+ "additionalProperties": false
21
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "type": "object",
4
+ "properties": {
5
+ "access_token": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "description": "The token to send as `Authorization: Bearer <token>`. Short-lived: read `expires_in`, never assume a lifetime."
9
+ },
10
+ "token_type": {
11
+ "type": "string",
12
+ "const": "Bearer",
13
+ "description": "`Bearer`, the same spelling every other session token on this wire uses."
14
+ },
15
+ "expires_in": {
16
+ "type": "integer",
17
+ "minimum": 1,
18
+ "maximum": 3600,
19
+ "description": "How long the access token stays valid, in seconds from now — at most 3600 (sixty minutes), the hard ceiling of any support session. Not a timestamp, and not milliseconds."
20
+ },
21
+ "org_id": {
22
+ "type": "string",
23
+ "format": "uuid",
24
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
25
+ "description": "The organisation this session was scoped to when the grant was minted."
26
+ },
27
+ "support": {
28
+ "type": "object",
29
+ "properties": {
30
+ "session_id": {
31
+ "type": "string",
32
+ "format": "uuid",
33
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
34
+ "description": "The support session this token or response describes. Stable for the life of the session."
35
+ },
36
+ "mode": {
37
+ "type": "string",
38
+ "enum": [
39
+ "read",
40
+ "edit"
41
+ ],
42
+ "description": "The session's current mode. Every support session starts `read`; an operator-admin switches one session into `edit`, never the other way, and the switch is a one-way door for the life of the session."
43
+ },
44
+ "operator_name": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "maxLength": 200,
48
+ "description": "The name of the operator-admin holding this session, for the console banner the operator-admin sees. Only the operator-admin's own console receives it; the customer's audit names every edit as Fleetless-Support, never this name."
49
+ },
50
+ "expires_at": {
51
+ "type": "string",
52
+ "format": "date-time",
53
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$",
54
+ "description": "When the session stops being usable regardless of activity, as an ISO 8601 timestamp. A support session has a hard ceiling; nothing extends it past this instant."
55
+ }
56
+ },
57
+ "required": [
58
+ "session_id",
59
+ "mode",
60
+ "operator_name",
61
+ "expires_at"
62
+ ],
63
+ "additionalProperties": false,
64
+ "description": "The session as it stands at the moment of exchange: freshly started, in `read` mode."
65
+ }
66
+ },
67
+ "required": [
68
+ "access_token",
69
+ "token_type",
70
+ "expires_in",
71
+ "org_id",
72
+ "support"
73
+ ],
74
+ "additionalProperties": false
75
+ }