@fleetless/contracts 6.4.0 → 7.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/artifacts/openapi.json +5805 -1805
  3. package/artifacts/routes.json +104 -17
  4. package/artifacts/schema/addon-catalogue-entry.schema.json +1 -15
  5. package/artifacts/schema/billing-address.schema.json +7 -1
  6. package/artifacts/schema/billing-change-request.schema.json +9 -0
  7. package/artifacts/schema/billing-change-response.schema.json +2219 -625
  8. package/artifacts/schema/billing-details-update.schema.json +70 -0
  9. package/artifacts/schema/billing-details.schema.json +27 -3
  10. package/artifacts/schema/billing-view.schema.json +56 -24
  11. package/artifacts/schema/checkout-request.schema.json +90 -154
  12. package/artifacts/schema/checkout-response.schema.json +531 -17
  13. package/artifacts/schema/invoice-pay-request.schema.json +16 -0
  14. package/artifacts/schema/payment-method-change-request.schema.json +7 -0
  15. package/artifacts/schema/plan-catalogue-entry.schema.json +1 -15
  16. package/artifacts/schema/plan-prices.schema.json +1 -15
  17. package/artifacts/schema/purchase-billing-details.schema.json +111 -0
  18. package/artifacts/schema/purchase-conflict-details.schema.json +582 -0
  19. package/artifacts/schema/purchase-hold-reason.schema.json +9 -0
  20. package/artifacts/schema/purchase-intent-confirm-request.schema.json +40 -0
  21. package/artifacts/schema/purchase-intent-lookup-query.schema.json +56 -0
  22. package/artifacts/schema/purchase-intent-response.schema.json +1554 -0
  23. package/artifacts/schema/purchase-operation-key.schema.json +7 -0
  24. package/artifacts/schema/purchase-operation.schema.json +11 -0
  25. package/artifacts/schema/purchase-quote.schema.json +43 -0
  26. package/artifacts/schema/purchase-refusal-rule.schema.json +13 -0
  27. package/artifacts/schema/vat-decision.schema.json +77 -0
  28. package/artifacts/schema/vat-id-check-response.schema.json +111 -25
  29. package/artifacts/schema/vies-pending-reason.schema.json +9 -0
  30. package/dist/billing.d.ts +1128 -75
  31. package/dist/billing.js +174 -66
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +1 -0
  34. package/dist/plans.d.ts +4 -9
  35. package/dist/plans.js +4 -7
  36. package/dist/routes.js +62 -64
  37. package/package.json +2 -2
package/dist/routes.js CHANGED
@@ -12,7 +12,7 @@ import { jobRunListResponse, jobRunQuery, jobRunSummary, jobRunSummaryQuery } fr
12
12
  import { MCP_APP_PATHS, mcpRobotDatasheet, mcpRolePreviewResponse } from './mcp.js';
13
13
  import { authorizationServerMetadata, dynamicClientRegistrationRequest, dynamicClientRegistrationResponse, oauthAuthorizeQuery, oauthRedirectResponse, oauthTokenRequest, oauthTokenResponse, protectedResourceMetadata, } from './oauth.js';
14
14
  import { adminPlanChangeRequest, orgPlan, planChangeRequest } from './plans.js';
15
- import { billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingView, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
15
+ import { purchaseIntentLookupQuery, purchaseIntentConfirmRequest, purchaseIntentResponse, invoicePayRequest, billingCancelRequest, billingChangeRequest, billingChangeResponse, billingDetailsUpdate, billingView, checkoutRequest, checkoutResponse, checkoutStatus, paymentMethodChangeRequest, vatIdCheckRequest, vatIdCheckResponse, } from './billing.js';
16
16
  import { cameraListResponse, cancelRequest, configDraftResponse, configVersionResponse, configVersionsResponse, createRobotRequest, createRobotResponse, datapointListResponse, datapointValue, exposureListResponse, fetchTypesRequest, fetchTypesResponse, historyQuery, historyResponse, introspectionResponse, invokeOrServiceResponse, invokeRequest, jobResponse, liveSessionResponse, orgHealthQuery, orgLatencyQuery, orgLatencyResponse, orgQuotaUsage, orgUsageQuery, orgUsageResponse, patchRobotRequest, patchRobotResponse, publishConfigResponse, publishRequest, putConfigDraftRequest, putRobotDetailsRequest, putRobotDetailsResponse, robotTokenRotateResponse, jointStatePutRequest, jointStatePutResponse, releaseLiveQuery, renameSlugRequest, renameSlugResponse, robotDeleteQuery, resourceHealthListResponse, robotDeletionSummary, robotDetailResponse, robotJobsResponse, robotListResponse, slugUsageResponse, snapshotMetaResponse, typesResponse, } from './rest.js';
17
17
  export const ROUTE_SECTIONS = [
18
18
  { id: 'health', title: 'Health' },
@@ -1406,6 +1406,22 @@ export const ROUTES = [
1406
1406
  'page resolves nothing about the address typed into it, so there is no enumeration oracle here at all.',
1407
1407
  },
1408
1408
  ...developerSignInRoutes('/console/oauth'),
1409
+ {
1410
+ method: 'GET', path: '/waitlist-invite/:token', section: 'developer-auth',
1411
+ summary: 'Starts invite-bound console sign-up for a new Basic organization.',
1412
+ audience: 'internal', auth: 'none', rateLimited: true, ownerTier: false, status: 303,
1413
+ params: [{ name: 'token', description: 'The opaque waiting-list invitation token from the mailed link; never a query parameter.' }],
1414
+ query: null, request: null, response: null, errors: ['rate_limited'], transport: 'http',
1415
+ notes: 'Exchanges a valid seven-day invitation for a short-lived browser-proof cookie, then redirects with `303` into console sign-up. ' +
1416
+ 'The response uses `Cache-Control: no-store` and `Referrer-Policy: no-referrer`; no caller-supplied redirect is accepted. ' +
1417
+ 'Invalid, expired, used, declined or replaced links render the same `410` page; the per-IP backstop answers `429 rate_limited`. ' +
1418
+ 'Only the invited normalized email address may register a new Basic organization under `SIGNUP_MODE=closed`, and the signup code ' +
1419
+ 'still proves control of that address. Every step rechecks the unspent generation, expiry and address; re-inviting immediately ' +
1420
+ 'invalidates the old link and any signup it started. The GET does not consume the invitation: final organization/Owner creation, ' +
1421
+ 'waiting-list transition and single-use consumption share one transaction. The interaction binds the invitation id/generation, ' +
1422
+ 'never the raw token. Tokens, proof values and recipient links stay out of the directory, logs and operator responses. ' +
1423
+ 'Team invitations through `/accept-invite/:token` still join an existing organization.',
1424
+ },
1409
1425
  {
1410
1426
  method: 'GET', path: '/console/oauth/signup/:id', section: 'developer-auth',
1411
1427
  summary: 'Serves step one of console sign-up, the email card.',
@@ -1414,7 +1430,9 @@ export const ROUTES = [
1414
1430
  query: null, request: null, response: null, errors: [], transport: 'http',
1415
1431
  notes: 'HTML: the email field and `Email me a code`, the first of three steps — email, code, organization. While the deployment runs in ' +
1416
1432
  'closed beta this renders the "sign-up is closed" card at `403` instead, keeping the interaction alive and pointing back at sign-in and ' +
1417
- 'the waiting list — the person may well already have an account.',
1433
+ 'the waiting list — the person may well already have an account. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction ' +
1434
+ 'may continue for the invited normalized email address and a new Basic organization. Each step rechecks its unspent invitation ' +
1435
+ 'generation, expiry and address; ordinary public sign-up remains refused.',
1418
1436
  },
1419
1437
  {
1420
1438
  method: 'POST', path: '/console/oauth/signup', section: 'developer-auth',
@@ -1425,7 +1443,9 @@ export const ROUTES = [
1425
1443
  notes: 'A browser form post gets the code card; a JSON caller gets `{ "next", "email" }`, which has no schema. **No password**: the code ' +
1426
1444
  'mailed here, six digits valid ten minutes, proves the address. A per-interaction proof cookie is set here — it is what stops a third ' +
1427
1445
  'party from finishing a sign-up somebody else started. Sign-up is the one surface whose job is to say an address is taken, so `409 ' +
1428
- 'email_taken` is not a leak here.',
1446
+ 'email_taken` is not a leak here. Under `SIGNUP_MODE=closed`, only a valid invite-bound interaction may request the code for the ' +
1447
+ 'invited normalized email address; the unspent invitation generation, expiry and address are rechecked. Ordinary public sign-up ' +
1448
+ 'still answers `403 signup_closed`.',
1429
1449
  },
1430
1450
  {
1431
1451
  method: 'POST', path: '/console/oauth/signup/code', section: 'developer-auth',
@@ -1435,7 +1455,9 @@ export const ROUTES = [
1435
1455
  errors: ['rate_limited', 'token_spent', 'signup_closed', 'wrong_browser', 'validation_error', 'invalid_code'], transport: 'http',
1436
1456
  notes: 'A wrong code renders the code card again with the attempts left (`400 invalid_code`); a spent, expired or exhausted one is `410 ' +
1437
1457
  'token_spent`. The step before must have run in **this** browser (`401 wrong_browser`). A browser form post gets the organization card, ' +
1438
- 'the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema.',
1458
+ 'the address shown `confirmed`; a JSON caller gets `{ "next" }`, which has no schema. Under `SIGNUP_MODE=closed`, only a valid ' +
1459
+ 'invite-bound interaction may continue after rechecking its unspent invitation generation, expiry and invited normalized email ' +
1460
+ 'address. Ordinary public sign-up still answers `403 signup_closed`.',
1439
1461
  },
1440
1462
  {
1441
1463
  method: 'POST', path: '/console/oauth/signup/organization', section: 'developer-auth',
@@ -1447,7 +1469,10 @@ export const ROUTES = [
1447
1469
  'confirmed the address. Both steps before must have run in **this** browser: a missing or mismatched proof cookie is `401 ' +
1448
1470
  'wrong_browser` and the person is sent back to step one. `409 email_taken` when the address was taken meanwhile. A browser form post ' +
1449
1471
  'gets a `303` to the console callback; a JSON caller gets `redirect_to` at `200`. This is the only way an organisation is created: ' +
1450
- '`POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address.',
1472
+ '`POST /api/auth/signup` is gone, because without a password it would hand a session to anybody who names an address. Under ' +
1473
+ '`SIGNUP_MODE=closed`, only a valid invite-bound interaction may create a new Basic organization for the invited normalized email ' +
1474
+ 'address. Rechecking the unspent invitation generation, expiry and address, creating the org/Owner, transitioning the waiting-list ' +
1475
+ 'entry and consuming the invitation happen in that same transaction. Ordinary public sign-up still answers `403 signup_closed`.',
1451
1476
  },
1452
1477
  {
1453
1478
  method: 'POST', path: '/console/oauth/token', section: 'developer-auth',
@@ -2889,22 +2914,29 @@ export const ROUTES = [
2889
2914
  },
2890
2915
  {
2891
2916
  method: 'POST', path: '/api/billing/checkout', section: 'billing',
2892
- summary: 'Starts a Mollie checkout for a plan, or an upgrade paid at once.',
2917
+ summary: "Records a company purchase intent for the first paid plan.",
2893
2918
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
2894
2919
  params: [], query: null, request: checkoutRequest, response: checkoutResponse,
2895
2920
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
2896
2921
  transport: 'http',
2897
- notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/payment-method` and `POST /api/billing/invoices/:id/pay` ' +
2898
- '— the three routes that mint a Mollie checkout. `400 validation_error` names who may not pay with these rules: ' +
2899
- '`{ field: \'billing.address.country\', rule: \'eu_person\' }` for a person in another EU country, ' +
2900
- '`{ field: \'billing.vat_id\', rule: \'vat_id_required\' }` for a company there with no VAT ID, ' +
2901
- '`{ field: \'billing.vat_id\', rule: \'vat_id_invalid\' }` once VIES has said so, and ' +
2902
- '`{ field: \'accept_withdrawal\', rule: \'required\' }` for a person who did not confirm it. `409 target_state_conflict` names ' +
2903
- '`plan` with rule `already_billed` when the org already has an `active` or `past_due` billing account — checkout is for the first ' +
2904
- 'payment only, every later change is `POST /api/billing/change`. `checkout_url` is Mollie\'s hosted page, where the payer ' +
2905
- 'chooses card, PayPal or Apple Pay; the return lands on ' +
2906
- '`<console>/settings/billing?checkout=<checkout_id>`, which polls `GET /api/billing/checkout/:id` until the webhook — or the poll ' +
2907
- 'itself — has reconciled the payment. `409 plan_limit` is the org\'s own usage against the plan being bought.',
2922
+ notes: "Basic stays free for every payer. New paid checkout requires a company, terms, current buyer eligibility and an EUR quote. Other EU countries require direct VIES valid with an identifier; unavailable/unverified or missing identifier returns awaiting_vies without payment or redirect. Cloud checks the non-EU Tax ID and versioned public-email policy, and US state. Persist operation_key before POST; the same org/key/input returns the same intent, different input is 409 target_state_conflict with purchaseConflictDetails rule operation_key_reused. Owner lookup recovers a lost response. Only explicit confirmation of the current quote may create a payment; a worker cannot start it. payment_started.payment.checkout_url exists only for a hosted payment, where the buyer chooses card, PayPal or Apple Pay. Its return is <console>/settings/billing?checkout=<checkout_id>; GET /api/billing/checkout/:id reconciles the recorded payment. An active/past_due account uses billing/change; already_billed and plan_limit retain their existing meanings.",
2923
+ },
2924
+ {
2925
+ method: 'GET', path: '/api/billing/intents', section: 'billing',
2926
+ summary: 'Recovers a purchase intent by operation key or intent ID.',
2927
+ audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
2928
+ params: [], query: purchaseIntentLookupQuery, request: null, response: purchaseIntentResponse,
2929
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
2930
+ 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. Awaiting VIES and eligible states never start payment; Console polls at a bounded interval and asks for fresh confirmation of the displayed quote.',
2931
+ },
2932
+ {
2933
+ method: 'POST', path: '/api/billing/intents/:id/confirm', section: 'billing',
2934
+ summary: 'Confirms the current purchase quote exactly once.',
2935
+ audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 200,
2936
+ params: [{ name: 'id', description: 'The intent ID returned by the start or lookup response.' }],
2937
+ query: null, request: purchaseIntentConfirmRequest, response: purchaseIntentResponse,
2938
+ errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'target_state_conflict', 'plan_limit', 'rate_limited', ...BILLING_OFF, ...MOLLIE], transport: 'http',
2939
+ notes: 'Require the same operation_key and operation plus the displayed quote_revision and buyer_fingerprint. Under the org lock compare current buyer, country, VAT ID, Tax ID, invoice email/policy version, US state, EUR quote, invoice status/amount/currency and integration holds. A stale revision is 409 target_state_conflict with purchaseConflictDetails/current_intent; the owner must confirm again. Foreign or mismatched operation is 404 without disclosure. Pending or held cannot charge. Persist one payment row before the provider call and use its ID as the provider idempotency key. Repeated confirmations and lost responses recover that payment/result; never create another. Look up/adopt a possibly-created payment before resending after a timeout; ambiguity is not permission to charge again.',
2908
2940
  },
2909
2941
  {
2910
2942
  method: 'GET', path: '/api/billing/checkout/:id', section: 'billing',
@@ -2920,64 +2952,37 @@ export const ROUTES = [
2920
2952
  },
2921
2953
  {
2922
2954
  method: 'POST', path: '/api/billing/vat-id/check', section: 'billing',
2923
- summary: 'Checks a VAT ID against VIES, for the checkout form and the details page.',
2955
+ summary: "Checks a VAT ID using requester-aware direct VIES.",
2924
2956
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 200,
2925
2957
  params: [], query: null, request: vatIdCheckRequest, response: vatIdCheckResponse,
2926
2958
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'rate_limited'], transport: 'http',
2927
- notes: 'Rate limited on its own `billing.vat_check` bucket, sized for a form checked on blur rather than for a checkout. Never refuses for ' +
2928
- 'an `unverified` VIES answer — the checkout itself accepts `unverified` and the hourly sweep re-checks it — this route ' +
2929
- 'only reports what VIES currently says, in a different place for the same ID, entered either at checkout or on `PATCH ' +
2930
- '/api/billing/details`.',
2959
+ notes: "Reports status and optional display name only; full evidence stays in protected Finance storage. valid with a missing identifier remains pending/vies_identifier_missing. unverified or unavailable remains pending without zero rating or payment. A form check never authorizes a later charge; Cloud binds current evidence to the buyer and quote at confirmation. Rate limited on billing.vat_check.",
2931
2960
  },
2932
2961
  {
2933
2962
  method: 'PATCH', path: '/api/billing/details', section: 'billing',
2934
- summary: "Edits the billing account's invoice email or VAT ID.",
2963
+ summary: "Edits company billing details for revalidation before the next charge.",
2935
2964
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
2936
2965
  params: [], query: null, request: billingDetailsUpdate, response: billingView,
2937
2966
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found'], transport: 'http',
2938
- notes: '`404 not_found` when the org has no billing account yet — there is nothing here to edit before the first checkout. A new `vat_id` ' +
2939
- 'is re-checked through VIES the same way `POST /api/billing/vat-id/check` does; a valid ID entered here lifts the block a definitive ' +
2940
- '`invalid` answer placed on the next renewal.',
2967
+ notes: "404 not_found when no billing account exists. Edits may change company name, full address/state, Tax ID, VAT ID and invoice email. Validate the merged buyer before a later charge; edits invalidate old evidence and quote revisions. Revalidate the email policy and country requirements. An edit does not create a payment, activate a plan, pay an invoice, clear dunning or lift a lock.",
2941
2968
  },
2942
2969
  {
2943
2970
  method: 'POST', path: '/api/billing/change', section: 'billing',
2944
- summary: "Moves the org's plan, cycle or add-ons, charging increases at once.",
2971
+ summary: "Records a paid-change intent or schedules a decrease.",
2945
2972
  audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
2946
2973
  params: [], query: null, request: billingChangeRequest, response: billingChangeResponse,
2947
2974
  errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', ...BILLING_OFF, ...MOLLIE],
2948
2975
  transport: 'http',
2949
- notes: 'The body names the **absolute** target — plan, cycle and add-ons — never a delta: the route compares it with the ' +
2950
- 'org\'s current state and splits the difference. The increasing part is charged now, through the same proration `changeNetCents` ' +
2951
- 'computes, and takes effect the moment Mollie accepts the `recurring` payment with anything but `failed`, `canceled` or `expired` ' +
2952
- '— card mandates, Apple Pay\'s included, usually answer `paid` within seconds, a PayPal one may stay `pending` for a while; if it ' +
2953
- 'fails later, its open invoice enters dunning like a failed renewal. If Mollie refuses or does not answer, nothing is applied ' +
2954
- 'and this answers `502 payment_provider_unavailable` instead. The decreasing part — a lower plan, yearly → monthly, fewer add-ons — ' +
2955
- 'is stored as a pending change and applied at the period\'s end, same as `PUT /api/org/plan/change`; a lower plan over the target\'s ' +
2956
- 'limits answers `409 plan_limit` and the console opens its choose-what-stays page. Any increase first withdraws a pending ' +
2957
- 'downgrade or cancel, exactly as the admin route does. `409 target_state_conflict` names `billing` with rule `no_account` (no ' +
2958
- 'checkout yet — use `POST /api/billing/checkout`), `past_due` (an open invoice has to be paid first) or `no_valid_mandate` (the ' +
2959
- 'payment method needs renewing first, `POST /api/billing/payment-method`). `charged` in the response is the invoice from the part ' +
2960
- 'charged now, or `null` when the whole request was a decrease.',
2976
+ notes: "The request names an absolute plan/cycle/add-on target and a stable operation_key. Increases need a current company/EUR decision and explicit owner confirmation even after a worker resolves VIES. billingChangeResponse carries intent while awaiting_vies, eligible, refused or held; the old plan stays in effect. Confirm under the org lock, comparing buyer/policy fingerprint and quote revision; use one persisted payment row for provider idempotency. A started paid change returns billing, charged and intent with payment_started. An immediate accepted decrease retains the billing/charged branch (charged null); decreases are scheduled for period end. Existing no_account, past_due, no_valid_mandate and plan_limit conflicts remain. Do not advance periods, cancel existing choices or begin dunning merely because an intent is pending.",
2961
2977
  },
2962
2978
  {
2963
2979
  method: 'POST', path: '/api/billing/payment-method', section: 'billing',
2964
- summary: 'Starts a Mollie checkout for a new payment method.',
2980
+ summary: "Records an invoice-paying method intent or a held mandate setup.",
2965
2981
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
2966
2982
  params: [], query: null, request: paymentMethodChangeRequest, response: checkoutResponse,
2967
- errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
2983
+ errors: ['target_state_conflict', ...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'not_found', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
2968
2984
  transport: 'http',
2969
- notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. Creates a hosted `first` payment on the ' +
2970
- 'existing Mollie customer, restricted to the chosen method (`card` → Mollie\'s `creditcard`, `paypal`, `applepay`). For `card` ' +
2971
- 'and `paypal` it is a payment of `0.00` in the org\'s currency that pays no open invoice: the invoice stays open, the next ' +
2972
- 'dunning retry charges the new mandate — except for an invoice that was charged back, which is never charged again ' +
2973
- 'automatically; pay it with `POST /api/billing/invoices/:id/pay` — and that route still pays any open invoice at once. ' +
2974
- '`applepay` behaves the ' +
2975
- 'same where Mollie accepts a zero-amount Apple Pay payment; where it does not, a change to Apple Pay is only offered together ' +
2976
- 'with paying an open invoice — the payment is then that invoice\'s amount and pays it — and without one this answers ' +
2977
- '`400 validation_error` with `{ field: \'method\', rule: \'applepay_needs_open_invoice\' }`. A client offers what ' +
2978
- '`payment_method_options` in `GET /api/billing` lists. `404 not_found` when the org has no billing account yet. When the new ' +
2979
- 'mandate turns `valid` it becomes the account\'s — an Apple Pay one is a card mandate, shown as `applepay` — and every other ' +
2980
- 'mandate of the customer is revoked.',
2985
+ notes: "Use a stable operation_key and owner intent lookup after reload/timeout. Offer payment_method_options. Apple Pay with zero-amount changes disabled pays an open invoice through operation payment_method_invoice; without one, 400 validation_error has field method and rule applepay_needs_open_invoice. Apply the same buyer/VIES gate, current-amount reconfirmation and USD legacy hold as invoices/:id/pay. Pending, eligible and held contain no checkout URL; redirect only on payment_started.payment.kind hosted. A 0.00 mandate-only setup uses operation mandate_setup and held/mandate_policy_unresolved until the integration decision settles eligibility and currency. It pays no invoice and clears no dunning or lock. An invoice charged back is never retried automatically. 404 not_found when no account exists. Same key with changed input is a typed operation_key_reused conflict.",
2981
2986
  },
2982
2987
  {
2983
2988
  method: 'POST', path: '/api/billing/cancel', section: 'billing',
@@ -3010,20 +3015,13 @@ export const ROUTES = [
3010
3015
  },
3011
3016
  {
3012
3017
  method: 'POST', path: '/api/billing/invoices/:id/pay', section: 'billing',
3013
- summary: 'Pays one open invoice, through a new Mollie payment.',
3018
+ summary: "Records an owner-confirmed payment intent for an open invoice or due charge.",
3014
3019
  audience: 'developer', auth: 'developer', rateLimited: true, ownerTier: true, status: 201,
3015
3020
  params: [{ name: 'id', description: 'The invoice id, from `billingInvoice.id`, of the open invoice to pay — or a due charge\'s id, from `dunning.invoice_id`.' }],
3016
- query: null, request: null, response: checkoutResponse,
3017
- errors: [...DEVELOPER_GUARD, 'tier_required', 'not_found', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
3021
+ query: null, request: invoicePayRequest, response: checkoutResponse,
3022
+ errors: ['validation_error', ...DEVELOPER_GUARD, 'tier_required', 'not_found', 'target_state_conflict', 'rate_limited', ...BILLING_OFF, ...MOLLIE],
3018
3023
  transport: 'http',
3019
- notes: 'Rate limited on the `billing.checkout` bucket, same as `POST /api/billing/checkout`. `409 target_state_conflict` names `invoice` ' +
3020
- 'with rule `not_open` when the invoice is already `paid` or `uncollectible` — there is nothing left to pay. Paying the open ' +
3021
- 'invoice of a locked org unlocks it and keeps the plan running to the period\'s end, the same as a renewal that ' +
3022
- 'succeeds on a retry. `:id` may also be a due charge\'s id from `dunning.invoice_id` in `GET /api/billing`: while the payer\'s ' +
3023
- 'VAT ID is unsettled a held renewal is a due charge that has no number yet, and it is numbered and issued as an invoice ' +
3024
- 'once this payment is paid. The payment charges the amount owed (`dunning.gross_cents`). While that due charge is held by ' +
3025
- 'the VAT ID this answers `409 target_state_conflict` with `{ field: \'billing\', rule: \'vat_id_invalid\' }`. ' +
3026
- '`404 not_found` for an unknown id or one from another org.',
3024
+ notes: "The required operation_key binds the org, invoice and request; reuse with changed input is 409 target_state_conflict (purchaseConflictDetails). :id may be an issued invoice or a due charge with no number. Recheck current buyer eligibility, VIES, invoice status, owed amount and original currency before every new provider call. Invalid VAT is state invalid_vat_id with rule vat_id_invalid, without a payment. Pending/eligible/held has no redirect; after VIES recovers, the owner must confirm the current quote. An issued USD invoice remains held/legacy_usd_invoice: never convert it or call the provider anew until the integration decision resolves the conflict. Already-created payments retain recorded currency/amount and are looked up/reconciled, never replaced. Under the org lock, confirmation checks the current owed amount and returns the same payment identity on retries. invoice_not_open is a typed conflict; 404 not_found for unknown/foreign invoice. Pending itself never pays an invoice, lifts a lock or resets dunning.",
3027
3025
  },
3028
3026
  {
3029
3027
  method: 'POST', path: '/api/billing/mollie/webhook', section: 'billing',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fleetless/contracts",
3
- "version": "6.4.0",
3
+ "version": "7.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",
@@ -62,6 +62,6 @@
62
62
  "@types/node": "^26.2.0",
63
63
  "tsx": "^4.19.0",
64
64
  "typescript": "^5.7.0",
65
- "vitest": "^3.0.0"
65
+ "vitest": "^4.1.11"
66
66
  }
67
67
  }