@fleetless/contracts 16.1.0-next.1 → 17.0.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.
- package/CHANGELOG.md +31 -15
- package/artifacts/openapi.json +131 -14
- package/artifacts/routes.json +10 -7
- package/artifacts/schema/billing-change-response.schema.json +24 -1
- package/artifacts/schema/billing-details-conflict-details.schema.json +78 -0
- package/artifacts/schema/checkout-response.schema.json +50 -3
- package/artifacts/schema/purchase-conflict-details.schema.json +26 -2
- package/artifacts/schema/purchase-intent-draft.schema.json +24 -1
- package/artifacts/schema/purchase-intent-payment-started.schema.json +26 -2
- package/artifacts/schema/purchase-intent-response.schema.json +50 -3
- package/dist/billing.d.ts +63 -20
- package/dist/billing.js +44 -9
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/plans.d.ts +2 -15
- package/dist/plans.js +14 -27
- package/dist/routes.js +38 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,21 +11,37 @@ version.
|
|
|
11
11
|
|
|
12
12
|
### Changed
|
|
13
13
|
|
|
14
|
-
- **
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
`
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
14
|
+
- **BREAKING: a payment-method change starts a payment**
|
|
15
|
+
(fleetless/fleetless#1185). `POST /api/billing/payment-method` answers
|
|
16
|
+
operation `mandate_setup` in `payment_started` with a hosted payment of
|
|
17
|
+
0.00: redirect to its `checkout_url`. `checkoutResponse`, `purchaseIntent`,
|
|
18
|
+
`purchaseIntentPaymentStarted` and `purchaseIntentResponse` admit
|
|
19
|
+
`mandate_setup` there, hosted only; an older schema rejects that answer. The
|
|
20
|
+
rule "`mandate_setup` if and only if `mandate_policy_unresolved`" is one-way
|
|
21
|
+
now: the hold reason still names only a mandate setup (a change stored while
|
|
22
|
+
changes were on hold), and a held mandate setup has only that reason, but a
|
|
23
|
+
new change is never held. A mandate setup is never `eligible`,
|
|
24
|
+
`awaiting_vies`, `invalid_vat_id` or `refused`: nothing is quoted and VIES is
|
|
25
|
+
not asked. The same key again answers the same payment; `502
|
|
26
|
+
payment_provider_unavailable` resumes under the same key; `409
|
|
27
|
+
target_state_conflict` with `{ field: billing, rule: checkout_not_open }`
|
|
28
|
+
means the key's payment is finished.
|
|
29
|
+
- **`PATCH /api/billing/details` saves only what a purchase would accept.** The
|
|
30
|
+
route lists `409 target_state_conflict`; its notes name the refusals, when
|
|
31
|
+
VIES is asked and what a saved edit does.
|
|
32
|
+
- **`GET /api/billing/intents` lists `409 target_state_conflict` and `502
|
|
33
|
+
payment_provider_unavailable`**, which it has answered for a hosted payment
|
|
34
|
+
read at the provider. A mandate setup the provider never answered reads as
|
|
35
|
+
that `502`.
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- **`billingDetailsConflictDetails`**: the `409` details of
|
|
40
|
+
`PATCH /api/billing/details`. `{ field, rule }` with a
|
|
41
|
+
`purchaseRefusalRule` for a field a purchase would refuse,
|
|
42
|
+
`viesUnavailableDetails` when VIES did not answer, and
|
|
43
|
+
`{ field: billing, rule: buyer_changed }` when the details changed
|
|
44
|
+
meanwhile. Nothing is saved in any of them.
|
|
29
45
|
|
|
30
46
|
## [16.0.0] — 2026-11-19
|
|
31
47
|
|
package/artifacts/openapi.json
CHANGED
|
@@ -10294,7 +10294,7 @@
|
|
|
10294
10294
|
}
|
|
10295
10295
|
},
|
|
10296
10296
|
"default": {
|
|
10297
|
-
"description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`.",
|
|
10297
|
+
"description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`, `payment_provider_unavailable`.",
|
|
10298
10298
|
"content": {
|
|
10299
10299
|
"application/json": {
|
|
10300
10300
|
"schema": {
|
|
@@ -10304,7 +10304,7 @@
|
|
|
10304
10304
|
}
|
|
10305
10305
|
}
|
|
10306
10306
|
},
|
|
10307
|
-
"description": "Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click."
|
|
10307
|
+
"description": "Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click. A started hosted payment is read at the provider first: 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when it is no longer open there (paid, canceled, expired or failed), and 502 payment_provider_unavailable when the provider does not answer. A `mandate_setup` whose payment the provider never answered also answers that 502: send its `POST /api/billing/payment-method` again with the same key."
|
|
10308
10308
|
}
|
|
10309
10309
|
},
|
|
10310
10310
|
"/api/billing/intents/{id}/display": {
|
|
@@ -10522,7 +10522,7 @@
|
|
|
10522
10522
|
"/api/billing/details": {
|
|
10523
10523
|
"patch": {
|
|
10524
10524
|
"operationId": "patch_api_billing_details",
|
|
10525
|
-
"summary": "Edits company billing details
|
|
10525
|
+
"summary": "Edits the company's billing details; details a purchase would refuse are not saved.",
|
|
10526
10526
|
"tags": [
|
|
10527
10527
|
"billing"
|
|
10528
10528
|
],
|
|
@@ -10544,7 +10544,7 @@
|
|
|
10544
10544
|
}
|
|
10545
10545
|
},
|
|
10546
10546
|
"default": {
|
|
10547
|
-
"description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`.",
|
|
10547
|
+
"description": "An error envelope. Codes this route is known to answer: `unauthorized`, `token_expired`, `token_revoked`, `tier_required`, `validation_error`, `not_found`, `target_state_conflict`.",
|
|
10548
10548
|
"content": {
|
|
10549
10549
|
"application/json": {
|
|
10550
10550
|
"schema": {
|
|
@@ -10554,7 +10554,7 @@
|
|
|
10554
10554
|
}
|
|
10555
10555
|
}
|
|
10556
10556
|
},
|
|
10557
|
-
"description": "404 not_found when no billing account exists.
|
|
10557
|
+
"description": "404 not_found when no billing account exists. Send only the fields that change: company name, full address with state, Tax ID, VAT ID, invoice email. The merged company is decided as a checkout decides its buyer, and saved only when a purchase would accept it. Every refusal is 409 target_state_conflict with `billingDetailsConflictDetails` and saves nothing: `{ field, rule }` for a field a purchase refuses (`rule` a `purchaseRefusalRule`; `field` one of `billing.kind`, `billing.vat_id`, `billing.tax_id`, `billing.address.state`, `billing.invoice_email`), `vat_id_invalid` at `billing.vat_id` when VIES does not know the VAT ID; `viesUnavailableDetails` (`field: billing.vat_id`, `rule: vies_unavailable`) when VIES did not answer within its 15 seconds: send the same edit again; `{ field: billing, rule: buyer_changed }` when the details changed while the edit was decided: read `GET /api/billing` and send it again. VIES is asked only when the country or the VAT ID changes, in another EU country; any other edit keeps the recorded VIES answer and needs none. A saved edit re-prices open due charges, updates the invoicing contact and invalidates quotes made for the old details. An issued invoice keeps the details it was issued with. An edit creates no payment, activates no plan, pays no invoice, clears no dunning and lifts no lock. A person account from before company-only purchases is saved without these checks; it cannot buy.",
|
|
10558
10558
|
"requestBody": {
|
|
10559
10559
|
"required": true,
|
|
10560
10560
|
"content": {
|
|
@@ -10618,7 +10618,7 @@
|
|
|
10618
10618
|
"/api/billing/payment-method": {
|
|
10619
10619
|
"post": {
|
|
10620
10620
|
"operationId": "post_api_billing_payment_method",
|
|
10621
|
-
"summary": "
|
|
10621
|
+
"summary": "Starts a payment-method change: a hosted payment of 0.00 for a new mandate.",
|
|
10622
10622
|
"tags": [
|
|
10623
10623
|
"billing"
|
|
10624
10624
|
],
|
|
@@ -10650,7 +10650,7 @@
|
|
|
10650
10650
|
}
|
|
10651
10651
|
}
|
|
10652
10652
|
},
|
|
10653
|
-
"description": "
|
|
10653
|
+
"description": "Offer `payment_method_options`. A change is a 0.00 `first` payment on the provider's hosted page, restricted to the chosen method: the answer is operation `mandate_setup` in `payment_started` with `payment.kind` hosted at once; redirect to its `checkout_url`. Nothing is quoted, so there is no `eligible` step, no confirmation and no VIES. It pays no invoice and clears no dunning or lock: open invoices stay open. When the provider reports it paid, the new mandate is the account's and every other valid mandate of the customer is revoked; canceled, expired or failed, nothing changes. `GET /api/billing/checkout/:id` with the `checkout_id` reads the outcome (`purpose: payment_method`). Use one operation_key per method until its payment is finished. The same key again answers 200 with the same `payment_started` while the payment is open. 502 payment_provider_unavailable when the provider did not answer: the same key again resumes, and sends the same payment again under the same idempotency key. 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when the key's payment is finished or can no longer be sent: start again with a new key. Same key with another method is a typed operation_key_reused conflict. A change stored while changes were on hold reads `held` with `mandate_policy_unresolved`; start again with a new key. Apple Pay with zero-amount changes disabled pays an open invoice through operation payment_method_invoice, with the buyer/VIES gate, current-amount reconfirmation and USD legacy hold of invoices/:id/pay; without an open invoice, 400 validation_error has field method and rule applepay_needs_open_invoice. An invoice charged back is never retried automatically. 404 not_found when no billing account is active or past due.",
|
|
10654
10654
|
"requestBody": {
|
|
10655
10655
|
"required": true,
|
|
10656
10656
|
"content": {
|
|
@@ -16610,8 +16610,31 @@
|
|
|
16610
16610
|
"then": {
|
|
16611
16611
|
"properties": {
|
|
16612
16612
|
"state": {
|
|
16613
|
-
"
|
|
16613
|
+
"enum": [
|
|
16614
|
+
"held",
|
|
16615
|
+
"payment_started"
|
|
16616
|
+
]
|
|
16617
|
+
}
|
|
16618
|
+
}
|
|
16619
|
+
}
|
|
16620
|
+
},
|
|
16621
|
+
{
|
|
16622
|
+
"if": {
|
|
16623
|
+
"properties": {
|
|
16624
|
+
"operation": {
|
|
16625
|
+
"const": "mandate_setup"
|
|
16614
16626
|
},
|
|
16627
|
+
"state": {
|
|
16628
|
+
"const": "held"
|
|
16629
|
+
}
|
|
16630
|
+
},
|
|
16631
|
+
"required": [
|
|
16632
|
+
"operation",
|
|
16633
|
+
"state"
|
|
16634
|
+
]
|
|
16635
|
+
},
|
|
16636
|
+
"then": {
|
|
16637
|
+
"properties": {
|
|
16615
16638
|
"reason": {
|
|
16616
16639
|
"const": "mandate_policy_unresolved"
|
|
16617
16640
|
}
|
|
@@ -25130,8 +25153,31 @@
|
|
|
25130
25153
|
"then": {
|
|
25131
25154
|
"properties": {
|
|
25132
25155
|
"state": {
|
|
25133
|
-
"
|
|
25156
|
+
"enum": [
|
|
25157
|
+
"held",
|
|
25158
|
+
"payment_started"
|
|
25159
|
+
]
|
|
25160
|
+
}
|
|
25161
|
+
}
|
|
25162
|
+
}
|
|
25163
|
+
},
|
|
25164
|
+
{
|
|
25165
|
+
"if": {
|
|
25166
|
+
"properties": {
|
|
25167
|
+
"operation": {
|
|
25168
|
+
"const": "mandate_setup"
|
|
25134
25169
|
},
|
|
25170
|
+
"state": {
|
|
25171
|
+
"const": "held"
|
|
25172
|
+
}
|
|
25173
|
+
},
|
|
25174
|
+
"required": [
|
|
25175
|
+
"operation",
|
|
25176
|
+
"state"
|
|
25177
|
+
]
|
|
25178
|
+
},
|
|
25179
|
+
"then": {
|
|
25180
|
+
"properties": {
|
|
25135
25181
|
"reason": {
|
|
25136
25182
|
"const": "mandate_policy_unresolved"
|
|
25137
25183
|
}
|
|
@@ -25208,7 +25254,8 @@
|
|
|
25208
25254
|
"enum": [
|
|
25209
25255
|
"checkout",
|
|
25210
25256
|
"invoice_payment",
|
|
25211
|
-
"payment_method_invoice"
|
|
25257
|
+
"payment_method_invoice",
|
|
25258
|
+
"mandate_setup"
|
|
25212
25259
|
]
|
|
25213
25260
|
},
|
|
25214
25261
|
"invoice_id": {
|
|
@@ -25312,8 +25359,31 @@
|
|
|
25312
25359
|
"then": {
|
|
25313
25360
|
"properties": {
|
|
25314
25361
|
"state": {
|
|
25315
|
-
"
|
|
25362
|
+
"enum": [
|
|
25363
|
+
"held",
|
|
25364
|
+
"payment_started"
|
|
25365
|
+
]
|
|
25366
|
+
}
|
|
25367
|
+
}
|
|
25368
|
+
}
|
|
25369
|
+
},
|
|
25370
|
+
{
|
|
25371
|
+
"if": {
|
|
25372
|
+
"properties": {
|
|
25373
|
+
"operation": {
|
|
25374
|
+
"const": "mandate_setup"
|
|
25316
25375
|
},
|
|
25376
|
+
"state": {
|
|
25377
|
+
"const": "held"
|
|
25378
|
+
}
|
|
25379
|
+
},
|
|
25380
|
+
"required": [
|
|
25381
|
+
"operation",
|
|
25382
|
+
"state"
|
|
25383
|
+
]
|
|
25384
|
+
},
|
|
25385
|
+
"then": {
|
|
25386
|
+
"properties": {
|
|
25317
25387
|
"reason": {
|
|
25318
25388
|
"const": "mandate_policy_unresolved"
|
|
25319
25389
|
}
|
|
@@ -51170,8 +51240,31 @@
|
|
|
51170
51240
|
"then": {
|
|
51171
51241
|
"properties": {
|
|
51172
51242
|
"state": {
|
|
51173
|
-
"
|
|
51243
|
+
"enum": [
|
|
51244
|
+
"held",
|
|
51245
|
+
"payment_started"
|
|
51246
|
+
]
|
|
51247
|
+
}
|
|
51248
|
+
}
|
|
51249
|
+
}
|
|
51250
|
+
},
|
|
51251
|
+
{
|
|
51252
|
+
"if": {
|
|
51253
|
+
"properties": {
|
|
51254
|
+
"operation": {
|
|
51255
|
+
"const": "mandate_setup"
|
|
51174
51256
|
},
|
|
51257
|
+
"state": {
|
|
51258
|
+
"const": "held"
|
|
51259
|
+
}
|
|
51260
|
+
},
|
|
51261
|
+
"required": [
|
|
51262
|
+
"operation",
|
|
51263
|
+
"state"
|
|
51264
|
+
]
|
|
51265
|
+
},
|
|
51266
|
+
"then": {
|
|
51267
|
+
"properties": {
|
|
51175
51268
|
"reason": {
|
|
51176
51269
|
"const": "mandate_policy_unresolved"
|
|
51177
51270
|
}
|
|
@@ -51248,7 +51341,8 @@
|
|
|
51248
51341
|
"enum": [
|
|
51249
51342
|
"checkout",
|
|
51250
51343
|
"invoice_payment",
|
|
51251
|
-
"payment_method_invoice"
|
|
51344
|
+
"payment_method_invoice",
|
|
51345
|
+
"mandate_setup"
|
|
51252
51346
|
]
|
|
51253
51347
|
},
|
|
51254
51348
|
"invoice_id": {
|
|
@@ -51352,8 +51446,31 @@
|
|
|
51352
51446
|
"then": {
|
|
51353
51447
|
"properties": {
|
|
51354
51448
|
"state": {
|
|
51355
|
-
"
|
|
51449
|
+
"enum": [
|
|
51450
|
+
"held",
|
|
51451
|
+
"payment_started"
|
|
51452
|
+
]
|
|
51453
|
+
}
|
|
51454
|
+
}
|
|
51455
|
+
}
|
|
51456
|
+
},
|
|
51457
|
+
{
|
|
51458
|
+
"if": {
|
|
51459
|
+
"properties": {
|
|
51460
|
+
"operation": {
|
|
51461
|
+
"const": "mandate_setup"
|
|
51356
51462
|
},
|
|
51463
|
+
"state": {
|
|
51464
|
+
"const": "held"
|
|
51465
|
+
}
|
|
51466
|
+
},
|
|
51467
|
+
"required": [
|
|
51468
|
+
"operation",
|
|
51469
|
+
"state"
|
|
51470
|
+
]
|
|
51471
|
+
},
|
|
51472
|
+
"then": {
|
|
51473
|
+
"properties": {
|
|
51357
51474
|
"reason": {
|
|
51358
51475
|
"const": "mandate_policy_unresolved"
|
|
51359
51476
|
}
|
package/artifacts/routes.json
CHANGED
|
@@ -6915,10 +6915,12 @@
|
|
|
6915
6915
|
"token_revoked",
|
|
6916
6916
|
"tier_required",
|
|
6917
6917
|
"validation_error",
|
|
6918
|
-
"not_found"
|
|
6918
|
+
"not_found",
|
|
6919
|
+
"target_state_conflict",
|
|
6920
|
+
"payment_provider_unavailable"
|
|
6919
6921
|
],
|
|
6920
6922
|
"transport": "http",
|
|
6921
|
-
"notes": "Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click."
|
|
6923
|
+
"notes": "Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a still-eligible decision needs a fresh C.4 display and explicit Owner click. A started hosted payment is read at the provider first: 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when it is no longer open there (paid, canceled, expired or failed), and 502 payment_provider_unavailable when the provider does not answer. A `mandate_setup` whose payment the provider never answered also answers that 502: send its `POST /api/billing/payment-method` again with the same key."
|
|
6922
6924
|
},
|
|
6923
6925
|
{
|
|
6924
6926
|
"method": "POST",
|
|
@@ -7046,7 +7048,7 @@
|
|
|
7046
7048
|
"method": "PATCH",
|
|
7047
7049
|
"path": "/api/billing/details",
|
|
7048
7050
|
"section": "billing",
|
|
7049
|
-
"summary": "Edits company billing details
|
|
7051
|
+
"summary": "Edits the company's billing details; details a purchase would refuse are not saved.",
|
|
7050
7052
|
"audience": "developer",
|
|
7051
7053
|
"auth": "developer",
|
|
7052
7054
|
"rateLimited": false,
|
|
@@ -7062,10 +7064,11 @@
|
|
|
7062
7064
|
"token_revoked",
|
|
7063
7065
|
"tier_required",
|
|
7064
7066
|
"validation_error",
|
|
7065
|
-
"not_found"
|
|
7067
|
+
"not_found",
|
|
7068
|
+
"target_state_conflict"
|
|
7066
7069
|
],
|
|
7067
7070
|
"transport": "http",
|
|
7068
|
-
"notes": "404 not_found when no billing account exists.
|
|
7071
|
+
"notes": "404 not_found when no billing account exists. Send only the fields that change: company name, full address with state, Tax ID, VAT ID, invoice email. The merged company is decided as a checkout decides its buyer, and saved only when a purchase would accept it. Every refusal is 409 target_state_conflict with `billingDetailsConflictDetails` and saves nothing: `{ field, rule }` for a field a purchase refuses (`rule` a `purchaseRefusalRule`; `field` one of `billing.kind`, `billing.vat_id`, `billing.tax_id`, `billing.address.state`, `billing.invoice_email`), `vat_id_invalid` at `billing.vat_id` when VIES does not know the VAT ID; `viesUnavailableDetails` (`field: billing.vat_id`, `rule: vies_unavailable`) when VIES did not answer within its 15 seconds: send the same edit again; `{ field: billing, rule: buyer_changed }` when the details changed while the edit was decided: read `GET /api/billing` and send it again. VIES is asked only when the country or the VAT ID changes, in another EU country; any other edit keeps the recorded VIES answer and needs none. A saved edit re-prices open due charges, updates the invoicing contact and invalidates quotes made for the old details. An issued invoice keeps the details it was issued with. An edit creates no payment, activates no plan, pays no invoice, clears no dunning and lifts no lock. A person account from before company-only purchases is saved without these checks; it cannot buy."
|
|
7069
7072
|
},
|
|
7070
7073
|
{
|
|
7071
7074
|
"method": "POST",
|
|
@@ -7100,7 +7103,7 @@
|
|
|
7100
7103
|
"method": "POST",
|
|
7101
7104
|
"path": "/api/billing/payment-method",
|
|
7102
7105
|
"section": "billing",
|
|
7103
|
-
"summary": "
|
|
7106
|
+
"summary": "Starts a payment-method change: a hosted payment of 0.00 for a new mandate.",
|
|
7104
7107
|
"audience": "developer",
|
|
7105
7108
|
"auth": "developer",
|
|
7106
7109
|
"rateLimited": true,
|
|
@@ -7123,7 +7126,7 @@
|
|
|
7123
7126
|
"payment_provider_unavailable"
|
|
7124
7127
|
],
|
|
7125
7128
|
"transport": "http",
|
|
7126
|
-
"notes": "
|
|
7129
|
+
"notes": "Offer `payment_method_options`. A change is a 0.00 `first` payment on the provider's hosted page, restricted to the chosen method: the answer is operation `mandate_setup` in `payment_started` with `payment.kind` hosted at once; redirect to its `checkout_url`. Nothing is quoted, so there is no `eligible` step, no confirmation and no VIES. It pays no invoice and clears no dunning or lock: open invoices stay open. When the provider reports it paid, the new mandate is the account's and every other valid mandate of the customer is revoked; canceled, expired or failed, nothing changes. `GET /api/billing/checkout/:id` with the `checkout_id` reads the outcome (`purpose: payment_method`). Use one operation_key per method until its payment is finished. The same key again answers 200 with the same `payment_started` while the payment is open. 502 payment_provider_unavailable when the provider did not answer: the same key again resumes, and sends the same payment again under the same idempotency key. 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when the key's payment is finished or can no longer be sent: start again with a new key. Same key with another method is a typed operation_key_reused conflict. A change stored while changes were on hold reads `held` with `mandate_policy_unresolved`; start again with a new key. Apple Pay with zero-amount changes disabled pays an open invoice through operation payment_method_invoice, with the buyer/VIES gate, current-amount reconfirmation and USD legacy hold of invoices/:id/pay; without an open invoice, 400 validation_error has field method and rule applepay_needs_open_invoice. An invoice charged back is never retried automatically. 404 not_found when no billing account is active or past due."
|
|
7127
7130
|
},
|
|
7128
7131
|
{
|
|
7129
7132
|
"method": "POST",
|
|
@@ -312,8 +312,31 @@
|
|
|
312
312
|
"then": {
|
|
313
313
|
"properties": {
|
|
314
314
|
"state": {
|
|
315
|
-
"
|
|
315
|
+
"enum": [
|
|
316
|
+
"held",
|
|
317
|
+
"payment_started"
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
},
|
|
323
|
+
{
|
|
324
|
+
"if": {
|
|
325
|
+
"properties": {
|
|
326
|
+
"operation": {
|
|
327
|
+
"const": "mandate_setup"
|
|
316
328
|
},
|
|
329
|
+
"state": {
|
|
330
|
+
"const": "held"
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
"required": [
|
|
334
|
+
"operation",
|
|
335
|
+
"state"
|
|
336
|
+
]
|
|
337
|
+
},
|
|
338
|
+
"then": {
|
|
339
|
+
"properties": {
|
|
317
340
|
"reason": {
|
|
318
341
|
"const": "mandate_policy_unresolved"
|
|
319
342
|
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"anyOf": [
|
|
4
|
+
{
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"field": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"minLength": 1
|
|
10
|
+
},
|
|
11
|
+
"rule": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"company_required",
|
|
15
|
+
"vat_id_required",
|
|
16
|
+
"vat_id_invalid",
|
|
17
|
+
"tax_id_required",
|
|
18
|
+
"us_state_required",
|
|
19
|
+
"public_email_domain",
|
|
20
|
+
"invoice_not_open"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"field",
|
|
26
|
+
"rule"
|
|
27
|
+
],
|
|
28
|
+
"additionalProperties": false,
|
|
29
|
+
"description": "A field a purchase would refuse. Nothing is saved."
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"field": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"const": "billing.vat_id"
|
|
37
|
+
},
|
|
38
|
+
"rule": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"const": "vies_unavailable"
|
|
41
|
+
},
|
|
42
|
+
"reason": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"enum": [
|
|
45
|
+
"vies_unavailable",
|
|
46
|
+
"vies_unverified",
|
|
47
|
+
"vies_identifier_missing"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"required": [
|
|
52
|
+
"field",
|
|
53
|
+
"rule",
|
|
54
|
+
"reason"
|
|
55
|
+
],
|
|
56
|
+
"additionalProperties": false
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "object",
|
|
60
|
+
"properties": {
|
|
61
|
+
"field": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"const": "billing"
|
|
64
|
+
},
|
|
65
|
+
"rule": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"const": "buyer_changed"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"required": [
|
|
71
|
+
"field",
|
|
72
|
+
"rule"
|
|
73
|
+
],
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"description": "The billing details changed meanwhile. Nothing is saved."
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
@@ -383,8 +383,31 @@
|
|
|
383
383
|
"then": {
|
|
384
384
|
"properties": {
|
|
385
385
|
"state": {
|
|
386
|
-
"
|
|
386
|
+
"enum": [
|
|
387
|
+
"held",
|
|
388
|
+
"payment_started"
|
|
389
|
+
]
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"if": {
|
|
396
|
+
"properties": {
|
|
397
|
+
"operation": {
|
|
398
|
+
"const": "mandate_setup"
|
|
387
399
|
},
|
|
400
|
+
"state": {
|
|
401
|
+
"const": "held"
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
"required": [
|
|
405
|
+
"operation",
|
|
406
|
+
"state"
|
|
407
|
+
]
|
|
408
|
+
},
|
|
409
|
+
"then": {
|
|
410
|
+
"properties": {
|
|
388
411
|
"reason": {
|
|
389
412
|
"const": "mandate_policy_unresolved"
|
|
390
413
|
}
|
|
@@ -461,7 +484,8 @@
|
|
|
461
484
|
"enum": [
|
|
462
485
|
"checkout",
|
|
463
486
|
"invoice_payment",
|
|
464
|
-
"payment_method_invoice"
|
|
487
|
+
"payment_method_invoice",
|
|
488
|
+
"mandate_setup"
|
|
465
489
|
]
|
|
466
490
|
},
|
|
467
491
|
"invoice_id": {
|
|
@@ -565,8 +589,31 @@
|
|
|
565
589
|
"then": {
|
|
566
590
|
"properties": {
|
|
567
591
|
"state": {
|
|
568
|
-
"
|
|
592
|
+
"enum": [
|
|
593
|
+
"held",
|
|
594
|
+
"payment_started"
|
|
595
|
+
]
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"if": {
|
|
602
|
+
"properties": {
|
|
603
|
+
"operation": {
|
|
604
|
+
"const": "mandate_setup"
|
|
569
605
|
},
|
|
606
|
+
"state": {
|
|
607
|
+
"const": "held"
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
"required": [
|
|
611
|
+
"operation",
|
|
612
|
+
"state"
|
|
613
|
+
]
|
|
614
|
+
},
|
|
615
|
+
"then": {
|
|
616
|
+
"properties": {
|
|
570
617
|
"reason": {
|
|
571
618
|
"const": "mandate_policy_unresolved"
|
|
572
619
|
}
|
|
@@ -426,7 +426,8 @@
|
|
|
426
426
|
"checkout",
|
|
427
427
|
"paid_change",
|
|
428
428
|
"invoice_payment",
|
|
429
|
-
"payment_method_invoice"
|
|
429
|
+
"payment_method_invoice",
|
|
430
|
+
"mandate_setup"
|
|
430
431
|
]
|
|
431
432
|
},
|
|
432
433
|
"invoice_id": {
|
|
@@ -626,8 +627,31 @@
|
|
|
626
627
|
"then": {
|
|
627
628
|
"properties": {
|
|
628
629
|
"state": {
|
|
629
|
-
"
|
|
630
|
+
"enum": [
|
|
631
|
+
"held",
|
|
632
|
+
"payment_started"
|
|
633
|
+
]
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
"if": {
|
|
640
|
+
"properties": {
|
|
641
|
+
"operation": {
|
|
642
|
+
"const": "mandate_setup"
|
|
630
643
|
},
|
|
644
|
+
"state": {
|
|
645
|
+
"const": "held"
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
"required": [
|
|
649
|
+
"operation",
|
|
650
|
+
"state"
|
|
651
|
+
]
|
|
652
|
+
},
|
|
653
|
+
"then": {
|
|
654
|
+
"properties": {
|
|
631
655
|
"reason": {
|
|
632
656
|
"const": "mandate_policy_unresolved"
|
|
633
657
|
}
|
|
@@ -386,8 +386,31 @@
|
|
|
386
386
|
"then": {
|
|
387
387
|
"properties": {
|
|
388
388
|
"state": {
|
|
389
|
-
"
|
|
389
|
+
"enum": [
|
|
390
|
+
"held",
|
|
391
|
+
"payment_started"
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"if": {
|
|
399
|
+
"properties": {
|
|
400
|
+
"operation": {
|
|
401
|
+
"const": "mandate_setup"
|
|
390
402
|
},
|
|
403
|
+
"state": {
|
|
404
|
+
"const": "held"
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
"required": [
|
|
408
|
+
"operation",
|
|
409
|
+
"state"
|
|
410
|
+
]
|
|
411
|
+
},
|
|
412
|
+
"then": {
|
|
413
|
+
"properties": {
|
|
391
414
|
"reason": {
|
|
392
415
|
"const": "mandate_policy_unresolved"
|
|
393
416
|
}
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"checkout",
|
|
21
21
|
"paid_change",
|
|
22
22
|
"invoice_payment",
|
|
23
|
-
"payment_method_invoice"
|
|
23
|
+
"payment_method_invoice",
|
|
24
|
+
"mandate_setup"
|
|
24
25
|
]
|
|
25
26
|
},
|
|
26
27
|
"invoice_id": {
|
|
@@ -124,8 +125,31 @@
|
|
|
124
125
|
"then": {
|
|
125
126
|
"properties": {
|
|
126
127
|
"state": {
|
|
127
|
-
"
|
|
128
|
+
"enum": [
|
|
129
|
+
"held",
|
|
130
|
+
"payment_started"
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"if": {
|
|
138
|
+
"properties": {
|
|
139
|
+
"operation": {
|
|
140
|
+
"const": "mandate_setup"
|
|
128
141
|
},
|
|
142
|
+
"state": {
|
|
143
|
+
"const": "held"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"required": [
|
|
147
|
+
"operation",
|
|
148
|
+
"state"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
"then": {
|
|
152
|
+
"properties": {
|
|
129
153
|
"reason": {
|
|
130
154
|
"const": "mandate_policy_unresolved"
|
|
131
155
|
}
|
|
@@ -388,8 +388,31 @@
|
|
|
388
388
|
"then": {
|
|
389
389
|
"properties": {
|
|
390
390
|
"state": {
|
|
391
|
-
"
|
|
391
|
+
"enum": [
|
|
392
|
+
"held",
|
|
393
|
+
"payment_started"
|
|
394
|
+
]
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"if": {
|
|
401
|
+
"properties": {
|
|
402
|
+
"operation": {
|
|
403
|
+
"const": "mandate_setup"
|
|
392
404
|
},
|
|
405
|
+
"state": {
|
|
406
|
+
"const": "held"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
"required": [
|
|
410
|
+
"operation",
|
|
411
|
+
"state"
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
"then": {
|
|
415
|
+
"properties": {
|
|
393
416
|
"reason": {
|
|
394
417
|
"const": "mandate_policy_unresolved"
|
|
395
418
|
}
|
|
@@ -466,7 +489,8 @@
|
|
|
466
489
|
"enum": [
|
|
467
490
|
"checkout",
|
|
468
491
|
"invoice_payment",
|
|
469
|
-
"payment_method_invoice"
|
|
492
|
+
"payment_method_invoice",
|
|
493
|
+
"mandate_setup"
|
|
470
494
|
]
|
|
471
495
|
},
|
|
472
496
|
"invoice_id": {
|
|
@@ -570,8 +594,31 @@
|
|
|
570
594
|
"then": {
|
|
571
595
|
"properties": {
|
|
572
596
|
"state": {
|
|
573
|
-
"
|
|
597
|
+
"enum": [
|
|
598
|
+
"held",
|
|
599
|
+
"payment_started"
|
|
600
|
+
]
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
"if": {
|
|
607
|
+
"properties": {
|
|
608
|
+
"operation": {
|
|
609
|
+
"const": "mandate_setup"
|
|
574
610
|
},
|
|
611
|
+
"state": {
|
|
612
|
+
"const": "held"
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
"required": [
|
|
616
|
+
"operation",
|
|
617
|
+
"state"
|
|
618
|
+
]
|
|
619
|
+
},
|
|
620
|
+
"then": {
|
|
621
|
+
"properties": {
|
|
575
622
|
"reason": {
|
|
576
623
|
"const": "mandate_policy_unresolved"
|
|
577
624
|
}
|
package/dist/billing.d.ts
CHANGED
|
@@ -7375,6 +7375,8 @@ export type PlanChangePrepareResponse = z.infer<typeof planChangePrepareResponse
|
|
|
7375
7375
|
* Why an intent is held. Lexware never holds a purchase: its contact and
|
|
7376
7376
|
* invoice follow the payment. A checkout or paid change is held only while an
|
|
7377
7377
|
* issuer cutover runs (`issuer_cutover_in_progress`, minutes, then try again).
|
|
7378
|
+
* `mandate_policy_unresolved` is written no more (fleetless/fleetless#1185): it
|
|
7379
|
+
* stays for the method changes stored while they were on hold.
|
|
7378
7380
|
*/
|
|
7379
7381
|
export declare const purchaseHoldReason: z.ZodEnum<{
|
|
7380
7382
|
legacy_usd_invoice: "legacy_usd_invoice";
|
|
@@ -7490,6 +7492,13 @@ export declare const purchaseIntentDraft: z.ZodDiscriminatedUnion<readonly [z.Zo
|
|
|
7490
7492
|
}, z.core.$strict>], "state">;
|
|
7491
7493
|
export type PurchaseIntentDraft = z.infer<typeof purchaseIntentDraft>;
|
|
7492
7494
|
export declare const purchaseIntentPaymentStarted: z.ZodObject<{
|
|
7495
|
+
operation: z.ZodEnum<{
|
|
7496
|
+
checkout: "checkout";
|
|
7497
|
+
paid_change: "paid_change";
|
|
7498
|
+
invoice_payment: "invoice_payment";
|
|
7499
|
+
payment_method_invoice: "payment_method_invoice";
|
|
7500
|
+
mandate_setup: "mandate_setup";
|
|
7501
|
+
}>;
|
|
7493
7502
|
state: z.ZodLiteral<"payment_started">;
|
|
7494
7503
|
payment_id: z.ZodUUID;
|
|
7495
7504
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7501,12 +7510,6 @@ export declare const purchaseIntentPaymentStarted: z.ZodObject<{
|
|
|
7501
7510
|
}, z.core.$strict>], "kind">;
|
|
7502
7511
|
intent_id: z.ZodUUID;
|
|
7503
7512
|
operation_key: z.ZodUUID;
|
|
7504
|
-
operation: z.ZodEnum<{
|
|
7505
|
-
checkout: "checkout";
|
|
7506
|
-
paid_change: "paid_change";
|
|
7507
|
-
invoice_payment: "invoice_payment";
|
|
7508
|
-
payment_method_invoice: "payment_method_invoice";
|
|
7509
|
-
}>;
|
|
7510
7513
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7511
7514
|
}, z.core.$strict>;
|
|
7512
7515
|
export type PurchaseIntentPaymentStarted = z.infer<typeof purchaseIntentPaymentStarted>;
|
|
@@ -7625,6 +7628,13 @@ export declare const purchaseIntent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7625
7628
|
}>;
|
|
7626
7629
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7627
7630
|
}, z.core.$strict>, z.ZodObject<{
|
|
7631
|
+
operation: z.ZodEnum<{
|
|
7632
|
+
checkout: "checkout";
|
|
7633
|
+
paid_change: "paid_change";
|
|
7634
|
+
invoice_payment: "invoice_payment";
|
|
7635
|
+
payment_method_invoice: "payment_method_invoice";
|
|
7636
|
+
mandate_setup: "mandate_setup";
|
|
7637
|
+
}>;
|
|
7628
7638
|
state: z.ZodLiteral<"payment_started">;
|
|
7629
7639
|
payment_id: z.ZodUUID;
|
|
7630
7640
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -7636,12 +7646,6 @@ export declare const purchaseIntent: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7636
7646
|
}, z.core.$strict>], "kind">;
|
|
7637
7647
|
intent_id: z.ZodUUID;
|
|
7638
7648
|
operation_key: z.ZodUUID;
|
|
7639
|
-
operation: z.ZodEnum<{
|
|
7640
|
-
checkout: "checkout";
|
|
7641
|
-
paid_change: "paid_change";
|
|
7642
|
-
invoice_payment: "invoice_payment";
|
|
7643
|
-
payment_method_invoice: "payment_method_invoice";
|
|
7644
|
-
}>;
|
|
7645
7649
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
7646
7650
|
}, z.core.$strict>, z.ZodObject<{
|
|
7647
7651
|
quote: z.ZodObject<{
|
|
@@ -7768,6 +7772,7 @@ export declare const checkoutResponse: z.ZodUnion<readonly [z.ZodDiscriminatedUn
|
|
|
7768
7772
|
checkout: "checkout";
|
|
7769
7773
|
invoice_payment: "invoice_payment";
|
|
7770
7774
|
payment_method_invoice: "payment_method_invoice";
|
|
7775
|
+
mandate_setup: "mandate_setup";
|
|
7771
7776
|
}>;
|
|
7772
7777
|
}, z.core.$strict>]>;
|
|
7773
7778
|
export type CheckoutResponse = z.infer<typeof checkoutResponse>;
|
|
@@ -9514,7 +9519,7 @@ export declare const checkoutOpenDetails: z.ZodObject<{
|
|
|
9514
9519
|
checkout_url: z.ZodNullable<z.ZodURL>;
|
|
9515
9520
|
}, z.core.$strict>;
|
|
9516
9521
|
export type CheckoutOpenDetails = z.infer<typeof checkoutOpenDetails>;
|
|
9517
|
-
/** `409 target_state_conflict` details when a paid change needs VIES and VIES did not answer. Nothing is stored. */
|
|
9522
|
+
/** `409 target_state_conflict` details when a paid change or a billing-details edit needs VIES and VIES did not answer. Nothing is stored. */
|
|
9518
9523
|
export declare const viesUnavailableDetails: z.ZodObject<{
|
|
9519
9524
|
field: z.ZodLiteral<"billing.vat_id">;
|
|
9520
9525
|
rule: z.ZodLiteral<"vies_unavailable">;
|
|
@@ -9674,6 +9679,13 @@ export declare const purchaseConflictDetails: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
9674
9679
|
}>;
|
|
9675
9680
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
9676
9681
|
}, z.core.$strict>, z.ZodObject<{
|
|
9682
|
+
operation: z.ZodEnum<{
|
|
9683
|
+
checkout: "checkout";
|
|
9684
|
+
paid_change: "paid_change";
|
|
9685
|
+
invoice_payment: "invoice_payment";
|
|
9686
|
+
payment_method_invoice: "payment_method_invoice";
|
|
9687
|
+
mandate_setup: "mandate_setup";
|
|
9688
|
+
}>;
|
|
9677
9689
|
state: z.ZodLiteral<"payment_started">;
|
|
9678
9690
|
payment_id: z.ZodUUID;
|
|
9679
9691
|
payment: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -9685,12 +9697,6 @@ export declare const purchaseConflictDetails: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
9685
9697
|
}, z.core.$strict>], "kind">;
|
|
9686
9698
|
intent_id: z.ZodUUID;
|
|
9687
9699
|
operation_key: z.ZodUUID;
|
|
9688
|
-
operation: z.ZodEnum<{
|
|
9689
|
-
checkout: "checkout";
|
|
9690
|
-
paid_change: "paid_change";
|
|
9691
|
-
invoice_payment: "invoice_payment";
|
|
9692
|
-
payment_method_invoice: "payment_method_invoice";
|
|
9693
|
-
}>;
|
|
9694
9700
|
invoice_id: z.ZodOptional<z.ZodUUID>;
|
|
9695
9701
|
}, z.core.$strict>, z.ZodObject<{
|
|
9696
9702
|
quote: z.ZodObject<{
|
|
@@ -9827,6 +9833,42 @@ export declare const billingDetailsUpdate: z.ZodObject<{
|
|
|
9827
9833
|
vat_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
9828
9834
|
}, z.core.$strict>;
|
|
9829
9835
|
export type BillingDetailsUpdate = z.infer<typeof billingDetailsUpdate>;
|
|
9836
|
+
/**
|
|
9837
|
+
* `PATCH /api/billing/details`'s `409 target_state_conflict` details
|
|
9838
|
+
* (fleetless/fleetless#1185). Nothing is saved in any of them.
|
|
9839
|
+
*
|
|
9840
|
+
* - A field a purchase would refuse: `field` as the checkout names it
|
|
9841
|
+
* (`billing.kind`, `billing.vat_id`, `billing.tax_id`,
|
|
9842
|
+
* `billing.address.state`, `billing.invoice_email`), `rule` the refusal.
|
|
9843
|
+
* - `vies_unavailable` (`viesUnavailableDetails`): the country or the VAT ID
|
|
9844
|
+
* changed and VIES did not answer; check again.
|
|
9845
|
+
* - `buyer_changed`: the billing details changed while this edit was decided;
|
|
9846
|
+
* read them again.
|
|
9847
|
+
*/
|
|
9848
|
+
export declare const billingDetailsConflictDetails: z.ZodUnion<readonly [z.ZodObject<{
|
|
9849
|
+
field: z.ZodString;
|
|
9850
|
+
rule: z.ZodEnum<{
|
|
9851
|
+
company_required: "company_required";
|
|
9852
|
+
vat_id_required: "vat_id_required";
|
|
9853
|
+
vat_id_invalid: "vat_id_invalid";
|
|
9854
|
+
tax_id_required: "tax_id_required";
|
|
9855
|
+
us_state_required: "us_state_required";
|
|
9856
|
+
public_email_domain: "public_email_domain";
|
|
9857
|
+
invoice_not_open: "invoice_not_open";
|
|
9858
|
+
}>;
|
|
9859
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9860
|
+
field: z.ZodLiteral<"billing.vat_id">;
|
|
9861
|
+
rule: z.ZodLiteral<"vies_unavailable">;
|
|
9862
|
+
reason: z.ZodEnum<{
|
|
9863
|
+
vies_unavailable: "vies_unavailable";
|
|
9864
|
+
vies_unverified: "vies_unverified";
|
|
9865
|
+
vies_identifier_missing: "vies_identifier_missing";
|
|
9866
|
+
}>;
|
|
9867
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
9868
|
+
field: z.ZodLiteral<"billing">;
|
|
9869
|
+
rule: z.ZodLiteral<"buyer_changed">;
|
|
9870
|
+
}, z.core.$strict>]>;
|
|
9871
|
+
export type BillingDetailsConflictDetails = z.infer<typeof billingDetailsConflictDetails>;
|
|
9830
9872
|
/**
|
|
9831
9873
|
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
9832
9874
|
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
@@ -9837,7 +9879,7 @@ export declare const paymentMethodKind: z.ZodEnum<{
|
|
|
9837
9879
|
applepay: "applepay";
|
|
9838
9880
|
}>;
|
|
9839
9881
|
export type PaymentMethodKind = z.infer<typeof paymentMethodKind>;
|
|
9840
|
-
/** `POST /api/billing/payment-method`'s body. */
|
|
9882
|
+
/** `POST /api/billing/payment-method`'s body. One operation key names one method: keep the key until its payment is finished. */
|
|
9841
9883
|
export declare const paymentMethodChangeRequest: z.ZodObject<{
|
|
9842
9884
|
operation_key: z.ZodUUID;
|
|
9843
9885
|
method: z.ZodEnum<{
|
|
@@ -10965,6 +11007,7 @@ export declare const purchaseIntentResponse: z.ZodUnion<readonly [z.ZodDiscrimin
|
|
|
10965
11007
|
checkout: "checkout";
|
|
10966
11008
|
invoice_payment: "invoice_payment";
|
|
10967
11009
|
payment_method_invoice: "payment_method_invoice";
|
|
11010
|
+
mandate_setup: "mandate_setup";
|
|
10968
11011
|
}>;
|
|
10969
11012
|
}, z.core.$strict>, z.ZodObject<{
|
|
10970
11013
|
intent: z.ZodObject<{
|
package/dist/billing.js
CHANGED
|
@@ -670,16 +670,25 @@ const intentIdentity = {
|
|
|
670
670
|
* Why an intent is held. Lexware never holds a purchase: its contact and
|
|
671
671
|
* invoice follow the payment. A checkout or paid change is held only while an
|
|
672
672
|
* issuer cutover runs (`issuer_cutover_in_progress`, minutes, then try again).
|
|
673
|
+
* `mandate_policy_unresolved` is written no more (fleetless/fleetless#1185): it
|
|
674
|
+
* stays for the method changes stored while they were on hold.
|
|
673
675
|
*/
|
|
674
676
|
export const purchaseHoldReason = z.enum([
|
|
675
677
|
'legacy_usd_invoice', 'legacy_payer_unresolved', 'mandate_policy_unresolved', 'issuer_cutover_in_progress',
|
|
676
678
|
]);
|
|
677
679
|
export const purchaseRefusalRule = z.enum(['company_required', 'vat_id_required', 'vat_id_invalid', 'tax_id_required', 'us_state_required', 'public_email_domain', 'invoice_not_open']);
|
|
678
680
|
// Cross-field invariants also travel in JSON Schema so non-TypeScript callers
|
|
679
|
-
// cannot treat an invoice payment as an unbound checkout or a
|
|
681
|
+
// cannot treat an invoice payment as an unbound checkout or a mandate setup as a charge.
|
|
682
|
+
//
|
|
683
|
+
// A mandate setup (fleetless/fleetless#1185) is the 0.00 payment that changes the
|
|
684
|
+
// payment method: it is `payment_started` on the hosted page, never quoted, never
|
|
685
|
+
// waiting for VIES. `held` with `mandate_policy_unresolved` is only a row stored
|
|
686
|
+
// while the change was on hold (2026-10-16 to 17.0.0); the reason still names no
|
|
687
|
+
// other operation.
|
|
680
688
|
const intentRules = [
|
|
681
689
|
{ if: { properties: { operation: { enum: ['invoice_payment', 'payment_method_invoice'] } }, required: ['operation'] }, then: { required: ['invoice_id'] } },
|
|
682
|
-
{ if: { properties: { operation: { const: 'mandate_setup' } }, required: ['operation'] }, then: { properties: { state: {
|
|
690
|
+
{ if: { properties: { operation: { const: 'mandate_setup' } }, required: ['operation'] }, then: { properties: { state: { enum: ['held', 'payment_started'] } } } },
|
|
691
|
+
{ if: { properties: { operation: { const: 'mandate_setup' }, state: { const: 'held' } }, required: ['operation', 'state'] }, then: { properties: { reason: { const: 'mandate_policy_unresolved' } }, required: ['reason'] } },
|
|
683
692
|
{ if: { properties: { reason: { const: 'mandate_policy_unresolved' } }, required: ['reason'] }, then: { properties: { operation: { const: 'mandate_setup' } } } },
|
|
684
693
|
{ if: { properties: { payment: { properties: { kind: { const: 'mandate' } }, required: ['kind'] } }, required: ['payment'] }, then: { properties: { operation: { const: 'paid_change' } } } },
|
|
685
694
|
];
|
|
@@ -687,11 +696,17 @@ function validateIntent(intent, ctx) {
|
|
|
687
696
|
if (['invoice_payment', 'payment_method_invoice'].includes(intent.operation) && !intent.invoice_id) {
|
|
688
697
|
ctx.addIssue({ code: 'custom', path: ['invoice_id'], message: 'An invoice-paying intent must name the invoice or due charge.' });
|
|
689
698
|
}
|
|
690
|
-
if (
|
|
691
|
-
ctx.addIssue({ code: 'custom', path: ['
|
|
699
|
+
if (intent.operation === 'mandate_setup' && intent.state !== 'held' && intent.state !== 'payment_started') {
|
|
700
|
+
ctx.addIssue({ code: 'custom', path: ['state'], message: 'A mandate setup is a started hosted payment, or a stored hold.' });
|
|
701
|
+
}
|
|
702
|
+
if (intent.operation === 'mandate_setup' && intent.state === 'held' && intent.reason !== 'mandate_policy_unresolved') {
|
|
703
|
+
ctx.addIssue({ code: 'custom', path: ['reason'], message: 'A held mandate setup is the stored mandate_policy_unresolved hold.' });
|
|
704
|
+
}
|
|
705
|
+
if (intent.reason === 'mandate_policy_unresolved' && intent.operation !== 'mandate_setup') {
|
|
706
|
+
ctx.addIssue({ code: 'custom', path: ['reason'], message: 'Only a mandate setup was held as mandate_policy_unresolved.' });
|
|
692
707
|
}
|
|
693
708
|
if (intent.payment?.kind === 'mandate' && intent.operation !== 'paid_change') {
|
|
694
|
-
ctx.addIssue({ code: 'custom', path: ['payment'], message: 'Owner checkout
|
|
709
|
+
ctx.addIssue({ code: 'custom', path: ['payment'], message: 'Owner checkout, invoice payment and mandate setup require a hosted payment.' });
|
|
695
710
|
}
|
|
696
711
|
}
|
|
697
712
|
/** Unaccepted intents. No draft contains a provider redirect or billing decision. */
|
|
@@ -708,7 +723,7 @@ const draftVariants = [
|
|
|
708
723
|
];
|
|
709
724
|
export const purchaseIntentDraft = z.discriminatedUnion('state', draftVariants).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
710
725
|
const paymentStartedVariant = z.object({
|
|
711
|
-
...intentIdentity, state: z.literal('payment_started'), payment_id: z.uuid(),
|
|
726
|
+
...intentIdentity, operation: purchaseOperation, state: z.literal('payment_started'), payment_id: z.uuid(),
|
|
712
727
|
payment: z.discriminatedUnion('kind', [
|
|
713
728
|
z.object({ kind: z.literal('hosted'), checkout_id: z.uuid(), checkout_url: z.url() }).strict(),
|
|
714
729
|
z.object({ kind: z.literal('mandate') }).strict(),
|
|
@@ -738,8 +753,9 @@ const nonChangeDraft = z.discriminatedUnion('state', [
|
|
|
738
753
|
draftVariants[3].safeExtend({ operation: nonChangeChargeOperation }),
|
|
739
754
|
draftVariants[4].safeExtend({ operation: nonChangeChargeOperation }),
|
|
740
755
|
]).superRefine(validateIntent).meta({ allOf: intentRules });
|
|
756
|
+
// A method change starts its 0.00 hosted payment at once: `mandate_setup` is `payment_started` here, and in no draft but `held`.
|
|
741
757
|
const nonChangePaymentStarted = paymentStartedVariant
|
|
742
|
-
.safeExtend({ operation:
|
|
758
|
+
.safeExtend({ operation: nonChangeOperation })
|
|
743
759
|
.superRefine(validateIntent).meta({ allOf: intentRules });
|
|
744
760
|
const paidChangeOperation = z.literal('paid_change');
|
|
745
761
|
// A paid change is decided in its request: it never waits for VIES.
|
|
@@ -829,7 +845,7 @@ export const checkoutOpenDetails = z.object({
|
|
|
829
845
|
expires_at: z.iso.datetime().nullable().meta({ description: 'When the open payment expires at the provider, or `null` when unknown.' }),
|
|
830
846
|
checkout_url: z.url().nullable().meta({ description: 'Where the open payment continues, or `null` when the provider no longer offers it.' }),
|
|
831
847
|
}).strict();
|
|
832
|
-
/** `409 target_state_conflict` details when a paid change needs VIES and VIES did not answer. Nothing is stored. */
|
|
848
|
+
/** `409 target_state_conflict` details when a paid change or a billing-details edit needs VIES and VIES did not answer. Nothing is stored. */
|
|
833
849
|
export const viesUnavailableDetails = z.object({
|
|
834
850
|
field: vatIdField,
|
|
835
851
|
rule: z.literal('vies_unavailable'),
|
|
@@ -921,12 +937,31 @@ export const billingDetailsUpdate = z.object({
|
|
|
921
937
|
description: 'Replaces the VAT ID; `null` clears it. Omitted leaves it as it is. A new ID is re-checked through VIES.',
|
|
922
938
|
}),
|
|
923
939
|
}).strict();
|
|
940
|
+
/**
|
|
941
|
+
* `PATCH /api/billing/details`'s `409 target_state_conflict` details
|
|
942
|
+
* (fleetless/fleetless#1185). Nothing is saved in any of them.
|
|
943
|
+
*
|
|
944
|
+
* - A field a purchase would refuse: `field` as the checkout names it
|
|
945
|
+
* (`billing.kind`, `billing.vat_id`, `billing.tax_id`,
|
|
946
|
+
* `billing.address.state`, `billing.invoice_email`), `rule` the refusal.
|
|
947
|
+
* - `vies_unavailable` (`viesUnavailableDetails`): the country or the VAT ID
|
|
948
|
+
* changed and VIES did not answer; check again.
|
|
949
|
+
* - `buyer_changed`: the billing details changed while this edit was decided;
|
|
950
|
+
* read them again.
|
|
951
|
+
*/
|
|
952
|
+
export const billingDetailsConflictDetails = z.union([
|
|
953
|
+
z.object({ field: z.string().min(1), rule: purchaseRefusalRule }).strict()
|
|
954
|
+
.meta({ description: 'A field a purchase would refuse. Nothing is saved.' }),
|
|
955
|
+
viesUnavailableDetails,
|
|
956
|
+
z.object({ field: z.literal('billing'), rule: z.literal('buyer_changed') }).strict()
|
|
957
|
+
.meta({ description: 'The billing details changed meanwhile. Nothing is saved.' }),
|
|
958
|
+
]);
|
|
924
959
|
/**
|
|
925
960
|
* The payment methods Fleetless takes: card, PayPal and Apple Pay, in EUR and USD, and no others (André, 2026-10-04).
|
|
926
961
|
* Apple Pay is a Mollie method of its own at checkout and for a change, but the mandate it leaves is a card mandate.
|
|
927
962
|
*/
|
|
928
963
|
export const paymentMethodKind = z.enum(['card', 'paypal', 'applepay']);
|
|
929
|
-
/** `POST /api/billing/payment-method`'s body. */
|
|
964
|
+
/** `POST /api/billing/payment-method`'s body. One operation key names one method: keep the key until its payment is finished. */
|
|
930
965
|
export const paymentMethodChangeRequest = z.object({
|
|
931
966
|
operation_key: purchaseOperationKey,
|
|
932
967
|
method: paymentMethodKind.meta({
|
package/dist/index.d.ts
CHANGED
|
@@ -87,8 +87,8 @@ export type { PlanId, PlanLimitKey, PlanLimits, PlanFeature, PlanFeatures, PlanP
|
|
|
87
87
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
88
88
|
export type { PlanCurrency, OrgAddons, OrgPlanUsage, PlanChangeKeep, PlanChangeReason, PendingPlanChange, OrgLock, OrgPlan, PlanChangeRequest, PlanChangePrepareRequest, PlanChangeDecisionLookupQuery, PlanChangeDecisionStatusResponse, PlanOverrides, AdminPlanChangeRequest, } from './plans.js';
|
|
89
89
|
export { ianaTimeZones } from './iana-time-zones.js';
|
|
90
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse, billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery, billingIssuer, billingChargeInvoice, billingCharge, chargePayRequest, } from './billing.js';
|
|
91
|
-
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingInvoicePdfQuery, BillingAccount, BillingView, BillingChangeResponse, BillingDocumentKind, BillingDocumentStatus, BillingDocumentProfile, BillingDocumentFormat, BillingDocument, BillingDocumentList, BillingDocumentFileRole, BillingDocumentDetail, BillingDocumentFileQuery, BillingIssuer, BillingChargeInvoice, BillingCharge, ChargePayRequest, } from './billing.js';
|
|
90
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, billingDetailsConflictDetails, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse, billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery, billingIssuer, billingChargeInvoice, billingCharge, chargePayRequest, } from './billing.js';
|
|
91
|
+
export type { PayerKind, BillingCycle, VatTreatment, PayerRefusalRule, VatDecision, ChargeAmounts, BillingState, QuoteLine, CheckoutQuote, BillingAddress, BillingDetails, CheckoutRequest, CheckoutResponse, CheckoutStatus, VatIdStatus, VatIdCheckRequest, VatIdCheckResponse, BillingChangeRequest, BillingCancelRequest, BillingDetailsUpdate, BillingDetailsConflictDetails, PaymentMethodKind, PaymentMethodChangeRequest, BillingAccountStatus, PaymentMethod, InvoiceStatus, BillingInvoice, BillingInvoicePdfQuery, BillingAccount, BillingView, BillingChangeResponse, BillingDocumentKind, BillingDocumentStatus, BillingDocumentProfile, BillingDocumentFormat, BillingDocument, BillingDocumentList, BillingDocumentFileRole, BillingDocumentDetail, BillingDocumentFileQuery, BillingIssuer, BillingChargeInvoice, BillingCharge, ChargePayRequest, } from './billing.js';
|
|
92
92
|
export { controllerRegisterAddress, controllerRegisterPrivacyContact, controllerRegisterRepresentative, controllerRegisterWrite, controllerRegisterOrgRecord, controllerRegisterOrgResponse } from './controller-register.js';
|
|
93
93
|
export type { ControllerRegisterWrite, ControllerRegisterOrgResponse } from './controller-register.js';
|
|
94
94
|
export { purchaseBillingDetails, purchaseOperationKey, purchaseOperation, purchaseQuote, billingDecisionDisplayRequest, confirmationProof, billingDecisionAmounts, billingDecisionPeriod, billingDecisionSnapshot, billingDecisionDisplayResponse, planChangePrepareResponse, purchaseHoldReason, purchaseRefusalRule, purchaseIntent, purchaseIntentLookupQuery, purchaseIntentDraft, purchaseIntentPaymentStarted, purchaseIntentAcceptedWithoutPayment, purchaseIntentConfirmRequest, purchaseConflictDetails, invoicePayRequest, purchaseIntentResponse, vatDecision, viesPendingReason, formatEur, C4_ACTIONS, C4_TEXT_IDS, c4ActionOf, c4Declaration, storedBillingDecisionSnapshot, checkoutStartResponse, checkoutDraftResponse, checkoutOpenDetails, viesUnavailableDetails, } from './billing.js';
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ export { planId, PLAN_ORDER, planLimitKey, planLimits, planFeature, planFeatures
|
|
|
96
96
|
export { planCurrency, orgAddons, orgPlanUsage, planChangeKeep, planChangeReason, pendingPlanChange, orgLock, orgPlan, planChangeRequest, planChangePrepareRequest, planChangeDecisionLookupQuery, planChangeDecisionStatusResponse, planOverrides, adminPlanChangeRequest, } from './plans.js';
|
|
97
97
|
export { ianaTimeZones } from './iana-time-zones.js';
|
|
98
98
|
// 2026-10-04 — billing through Mollie (#104).
|
|
99
|
-
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse,
|
|
99
|
+
export { countryCode, EU_COUNTRIES, SELLER_COUNTRY, DE_VAT_RATE_PERCENT, isEuCountry, currencyForCountry, payerKind, billingCycle, vatTreatment, payerRefusalRule, vatFor, viesCountry, normalizeVatId, periodNetCents, prorateCents, vatCents, chargeAmounts, DAY_MS, periodDays, remainingDays, changeNetCents, checkoutQuote, BILLING_RETRY_DAYS, BILLING_LOCK_DAY, billingAddress, billingDetails, checkoutRequest, checkoutResponse, checkoutStatus, vatIdStatus, vatIdCheckRequest, vatIdCheckResponse, billingChangeRequest, billingCancelRequest, billingDetailsUpdate, billingDetailsConflictDetails, paymentMethodKind, paymentMethodChangeRequest, billingAccountStatus, paymentMethod, invoiceStatus, billingInvoice, billingInvoicePdfQuery, billingAccount, billingView, billingChangeResponse,
|
|
100
100
|
// 2026-10-19 — Lexware billing documents (fleetless/fleetless#544).
|
|
101
101
|
billingDocumentKind, billingDocumentStatus, billingDocumentProfile, billingDocumentFormat, billingDocument, billingDocumentList, billingDocumentFileRole, billingDocumentDetail, billingDocumentFileQuery,
|
|
102
102
|
// 2026-10-19 — the Lexware issuer cutover (fleetless/fleetless#327).
|
package/dist/plans.d.ts
CHANGED
|
@@ -197,21 +197,8 @@ export declare function yearlyEurCents(monthEurCents: number): number;
|
|
|
197
197
|
export declare function pricesFromEurMonth(eurMonthCents: number): PlanPrices;
|
|
198
198
|
/**
|
|
199
199
|
* The catalogue: limits, prices and features as the decision table
|
|
200
|
-
* (2026-09-30) states them,
|
|
201
|
-
*
|
|
202
|
-
* have it. And fleetless/fleetless#1175 (2026-11-19) made Pro hold a fleet
|
|
203
|
-
* (ten robots and apps, fifteen seats, 500 app users, 500 hours of live
|
|
204
|
-
* video), raised Plus to five seats and 100 app users, put a developer's
|
|
205
|
-
* own two-factor (`two_factor`) on every plan, and set the prices to 30 €
|
|
206
|
-
* and 150 € a month.
|
|
207
|
-
*
|
|
208
|
-
* **Asset storage is the same on every sold plan**, one gigabyte per robot:
|
|
209
|
-
* what a robot's meshes need depends on its CAD, not on the plan, so it is
|
|
210
|
-
* no plan differentiator. An organization that needs more gets it as an
|
|
211
|
-
* override (`planOverrides.asset_bytes_per_robot`), and no plan below
|
|
212
|
-
* Enterprise raises it — a consumer that names the way up from this limit
|
|
213
|
-
* must not read it off `nextPlanRaising`, which answers `enterprise`.
|
|
214
|
-
*
|
|
200
|
+
* (2026-09-30) states them, except that the audit export is on every plan,
|
|
201
|
+
* as the developer docs (`plans-and-limits.md`) and the cloud have it.
|
|
215
202
|
* Live video is in milliseconds, asset storage in decimal bytes per robot;
|
|
216
203
|
* Enterprise's limits and features are `null` / `true` throughout because
|
|
217
204
|
* they are set by contract, not read off this table.
|
package/dist/plans.js
CHANGED
|
@@ -138,21 +138,8 @@ export function pricesFromEurMonth(eurMonthCents) {
|
|
|
138
138
|
}
|
|
139
139
|
/**
|
|
140
140
|
* The catalogue: limits, prices and features as the decision table
|
|
141
|
-
* (2026-09-30) states them,
|
|
142
|
-
*
|
|
143
|
-
* have it. And fleetless/fleetless#1175 (2026-11-19) made Pro hold a fleet
|
|
144
|
-
* (ten robots and apps, fifteen seats, 500 app users, 500 hours of live
|
|
145
|
-
* video), raised Plus to five seats and 100 app users, put a developer's
|
|
146
|
-
* own two-factor (`two_factor`) on every plan, and set the prices to 30 €
|
|
147
|
-
* and 150 € a month.
|
|
148
|
-
*
|
|
149
|
-
* **Asset storage is the same on every sold plan**, one gigabyte per robot:
|
|
150
|
-
* what a robot's meshes need depends on its CAD, not on the plan, so it is
|
|
151
|
-
* no plan differentiator. An organization that needs more gets it as an
|
|
152
|
-
* override (`planOverrides.asset_bytes_per_robot`), and no plan below
|
|
153
|
-
* Enterprise raises it — a consumer that names the way up from this limit
|
|
154
|
-
* must not read it off `nextPlanRaising`, which answers `enterprise`.
|
|
155
|
-
*
|
|
141
|
+
* (2026-09-30) states them, except that the audit export is on every plan,
|
|
142
|
+
* as the developer docs (`plans-and-limits.md`) and the cloud have it.
|
|
156
143
|
* Live video is in milliseconds, asset storage in decimal bytes per robot;
|
|
157
144
|
* Enterprise's limits and features are `null` / `true` throughout because
|
|
158
145
|
* they are set by contract, not read off this table.
|
|
@@ -175,7 +162,7 @@ export const PLANS = {
|
|
|
175
162
|
},
|
|
176
163
|
features: {
|
|
177
164
|
app_mcp: false,
|
|
178
|
-
two_factor:
|
|
165
|
+
two_factor: false,
|
|
179
166
|
require_two_factor: false,
|
|
180
167
|
app_oidc: false,
|
|
181
168
|
hosted_logo: false,
|
|
@@ -189,12 +176,12 @@ export const PLANS = {
|
|
|
189
176
|
id: 'plus',
|
|
190
177
|
name: 'Plus',
|
|
191
178
|
limits: {
|
|
192
|
-
seats:
|
|
179
|
+
seats: 3,
|
|
193
180
|
robots: 3,
|
|
194
181
|
apps: 3,
|
|
195
|
-
app_users:
|
|
182
|
+
app_users: 25,
|
|
196
183
|
live_video_ms_per_month: 360_000_000,
|
|
197
|
-
asset_bytes_per_robot:
|
|
184
|
+
asset_bytes_per_robot: 2_000_000_000,
|
|
198
185
|
history_days: 30,
|
|
199
186
|
audit_days: 30,
|
|
200
187
|
collection_records: 250_000,
|
|
@@ -209,19 +196,19 @@ export const PLANS = {
|
|
|
209
196
|
audit_export: true,
|
|
210
197
|
addons: false,
|
|
211
198
|
},
|
|
212
|
-
prices: pricesFromEurMonth(
|
|
199
|
+
prices: pricesFromEurMonth(2900),
|
|
213
200
|
support: 'email',
|
|
214
201
|
},
|
|
215
202
|
pro: {
|
|
216
203
|
id: 'pro',
|
|
217
204
|
name: 'Pro',
|
|
218
205
|
limits: {
|
|
219
|
-
seats:
|
|
220
|
-
robots:
|
|
221
|
-
apps:
|
|
222
|
-
app_users:
|
|
223
|
-
live_video_ms_per_month:
|
|
224
|
-
asset_bytes_per_robot:
|
|
206
|
+
seats: 5,
|
|
207
|
+
robots: 5,
|
|
208
|
+
apps: 5,
|
|
209
|
+
app_users: 50,
|
|
210
|
+
live_video_ms_per_month: 900_000_000,
|
|
211
|
+
asset_bytes_per_robot: 3_000_000_000,
|
|
225
212
|
history_days: 90,
|
|
226
213
|
audit_days: 90,
|
|
227
214
|
collection_records: 1_000_000,
|
|
@@ -236,7 +223,7 @@ export const PLANS = {
|
|
|
236
223
|
audit_export: true,
|
|
237
224
|
addons: true,
|
|
238
225
|
},
|
|
239
|
-
prices: pricesFromEurMonth(
|
|
226
|
+
prices: pricesFromEurMonth(14900),
|
|
240
227
|
support: 'priority',
|
|
241
228
|
},
|
|
242
229
|
enterprise: {
|
package/dist/routes.js
CHANGED
|
@@ -3234,8 +3234,14 @@ export const ROUTES = [
|
|
|
3234
3234
|
summary: 'Recovers a purchase intent by operation key or intent ID.',
|
|
3235
3235
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3236
3236
|
params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
|
|
3237
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3238
|
-
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org;
|
|
3237
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', ...MOLLIE], transport: 'http',
|
|
3238
|
+
notes: 'Supply exactly one of operation_key or intent_id and the expected operation. Scope lookup to the authenticated owner and org; ' +
|
|
3239
|
+
'unknown, foreign-org or mismatched-operation intents return 404 without disclosure. Repeating a lookup after restart or lost ' +
|
|
3240
|
+
'response returns the same intent/payment identity and, for a paid change, its billing result. A proof is never returned here; a ' +
|
|
3241
|
+
'still-eligible decision needs a fresh C.4 display and explicit Owner click. A started hosted payment is read at the provider ' +
|
|
3242
|
+
'first: 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when it is no longer open there (paid, ' +
|
|
3243
|
+
'canceled, expired or failed), and 502 payment_provider_unavailable when the provider does not answer. A `mandate_setup` whose ' +
|
|
3244
|
+
'payment the provider never answered also answers that 502: send its `POST /api/billing/payment-method` again with the same key.',
|
|
3239
3245
|
},
|
|
3240
3246
|
{
|
|
3241
3247
|
method: 'POST', path: '/api/billing/intents/:id/display', section: 'billing',
|
|
@@ -3297,11 +3303,22 @@ export const ROUTES = [
|
|
|
3297
3303
|
},
|
|
3298
3304
|
{
|
|
3299
3305
|
method: 'PATCH', path: '/api/billing/details', section: 'billing',
|
|
3300
|
-
summary: "Edits company billing details
|
|
3306
|
+
summary: "Edits the company's billing details; details a purchase would refuse are not saved.",
|
|
3301
3307
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3302
3308
|
params: [], query: null, request: billingDetailsUpdate, response: billingView,
|
|
3303
|
-
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
|
|
3304
|
-
notes:
|
|
3309
|
+
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict'], transport: 'http',
|
|
3310
|
+
notes: '404 not_found when no billing account exists. Send only the fields that change: company name, full address with state, Tax ID, ' +
|
|
3311
|
+
'VAT ID, invoice email. The merged company is decided as a checkout decides its buyer, and saved only when a purchase would ' +
|
|
3312
|
+
'accept it. Every refusal is 409 target_state_conflict with `billingDetailsConflictDetails` and saves nothing: `{ field, rule }` ' +
|
|
3313
|
+
'for a field a purchase refuses (`rule` a `purchaseRefusalRule`; `field` one of `billing.kind`, `billing.vat_id`, ' +
|
|
3314
|
+
'`billing.tax_id`, `billing.address.state`, `billing.invoice_email`), `vat_id_invalid` at `billing.vat_id` when VIES does not ' +
|
|
3315
|
+
'know the VAT ID; `viesUnavailableDetails` (`field: billing.vat_id`, `rule: vies_unavailable`) when VIES did not answer within ' +
|
|
3316
|
+
'its 15 seconds: send the same edit again; `{ field: billing, rule: buyer_changed }` when the details changed while the edit was ' +
|
|
3317
|
+
'decided: read `GET /api/billing` and send it again. VIES is asked only when the country or the VAT ID changes, in another EU ' +
|
|
3318
|
+
'country; any other edit keeps the recorded VIES answer and needs none. A saved edit re-prices open due charges, updates the ' +
|
|
3319
|
+
'invoicing contact and invalidates quotes made for the old details. An issued invoice keeps the details it was issued with. An ' +
|
|
3320
|
+
'edit creates no payment, activates no plan, pays no invoice, clears no dunning and lifts no lock. A person account from before ' +
|
|
3321
|
+
'company-only purchases is saved without these checks; it cannot buy.',
|
|
3305
3322
|
},
|
|
3306
3323
|
{
|
|
3307
3324
|
method: 'POST', path: '/api/billing/change', section: 'billing',
|
|
@@ -3325,12 +3342,26 @@ export const ROUTES = [
|
|
|
3325
3342
|
},
|
|
3326
3343
|
{
|
|
3327
3344
|
method: 'POST', path: '/api/billing/payment-method', section: 'billing',
|
|
3328
|
-
summary: "
|
|
3345
|
+
summary: "Starts a payment-method change: a hosted payment of 0.00 for a new mandate.",
|
|
3329
3346
|
audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
|
|
3330
3347
|
params: [], query: null, request: paymentMethodChangeRequest, response: checkoutResponse,
|
|
3331
3348
|
errors: ['target_state_conflict', ...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
|
|
3332
3349
|
transport: 'http',
|
|
3333
|
-
notes:
|
|
3350
|
+
notes: 'Offer `payment_method_options`. A change is a 0.00 `first` payment on the provider\'s hosted page, restricted to the chosen ' +
|
|
3351
|
+
'method: the answer is operation `mandate_setup` in `payment_started` with `payment.kind` hosted at once; redirect to its ' +
|
|
3352
|
+
'`checkout_url`. Nothing is quoted, so there is no `eligible` step, no confirmation and no VIES. It pays no invoice and clears ' +
|
|
3353
|
+
'no dunning or lock: open invoices stay open. When the provider reports it paid, the new mandate is the account\'s and every ' +
|
|
3354
|
+
'other valid mandate of the customer is revoked; canceled, expired or failed, nothing changes. `GET /api/billing/checkout/:id` ' +
|
|
3355
|
+
'with the `checkout_id` reads the outcome (`purpose: payment_method`). Use one operation_key per method until its payment is ' +
|
|
3356
|
+
'finished. The same key again answers 200 with the same `payment_started` while the payment is open. 502 ' +
|
|
3357
|
+
'payment_provider_unavailable when the provider did not answer: the same key again resumes, and sends the same payment again ' +
|
|
3358
|
+
'under the same idempotency key. 409 target_state_conflict with `{ field: billing, rule: checkout_not_open }` when the key\'s ' +
|
|
3359
|
+
'payment is finished or can no longer be sent: start again with a new key. Same key with another method is a typed ' +
|
|
3360
|
+
'operation_key_reused conflict. A change stored while changes were on hold reads `held` with `mandate_policy_unresolved`; start ' +
|
|
3361
|
+
'again with a new key. Apple Pay with zero-amount changes disabled pays an open invoice through operation ' +
|
|
3362
|
+
'payment_method_invoice, with the buyer/VIES gate, current-amount reconfirmation and USD legacy hold of invoices/:id/pay; ' +
|
|
3363
|
+
'without an open invoice, 400 validation_error has field method and rule applepay_needs_open_invoice. An invoice charged back ' +
|
|
3364
|
+
'is never retried automatically. 404 not_found when no billing account is active or past due.',
|
|
3334
3365
|
},
|
|
3335
3366
|
{
|
|
3336
3367
|
method: 'POST', path: '/api/billing/cancel', section: 'billing',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "17.0.0-next.1",
|
|
4
4
|
"description": "Fleetless wire contracts: the bridge-cloud protocol, the REST API schemas and the error codes, as zod schemas with generated JSON Schema and OpenAPI artifacts.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Dehne Robotik GmbH",
|