@fleetless/contracts 6.2.0 → 6.3.0-next.2

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 (31) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/artifacts/openapi.json +4322 -1887
  3. package/artifacts/routes.json +328 -2
  4. package/artifacts/schema/billing-address.schema.json +49 -0
  5. package/artifacts/schema/billing-cancel-request.schema.json +12 -0
  6. package/artifacts/schema/billing-change-request.schema.json +60 -0
  7. package/artifacts/schema/billing-change-response.schema.json +765 -0
  8. package/artifacts/schema/billing-details-update.schema.json +25 -0
  9. package/artifacts/schema/billing-details.schema.json +176 -0
  10. package/artifacts/schema/billing-invoice.schema.json +76 -0
  11. package/artifacts/schema/billing-view.schema.json +671 -0
  12. package/artifacts/schema/checkout-request.schema.json +252 -0
  13. package/artifacts/schema/checkout-response.schema.json +22 -0
  14. package/artifacts/schema/checkout-status.schema.json +49 -0
  15. package/artifacts/schema/payment-method-change-request.schema.json +19 -0
  16. package/artifacts/schema/payment-method.schema.json +80 -0
  17. package/artifacts/schema/payment-provider-unavailable-details.schema.json +29 -0
  18. package/artifacts/schema/vat-id-check-request.schema.json +22 -0
  19. package/artifacts/schema/vat-id-check-response.schema.json +36 -0
  20. package/dist/billing.d.ts +783 -0
  21. package/dist/billing.js +448 -0
  22. package/dist/errors.d.ts +17 -5
  23. package/dist/errors.js +33 -0
  24. package/dist/index.d.ts +4 -2
  25. package/dist/index.js +5 -1
  26. package/dist/plans.d.ts +9 -9
  27. package/dist/realtime.d.ts +2 -2
  28. package/dist/rest.d.ts +3 -3
  29. package/dist/routes.d.ts +1 -1
  30. package/dist/routes.js +183 -4
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,46 @@ version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ### Added
13
+
14
+ - **Billing.** `src/billing.ts`: `EU_COUNTRIES`, `countryCode`,
15
+ `currencyForCountry`, `normalizeVatId` and `viesCountry`; `vatFor`, who
16
+ may pay and at which VAT rate (Germany 19 %, a company in another EU
17
+ country with a VAT ID VIES confirms 0 % reverse charge, outside the EU
18
+ 0 %, everyone else refused with a named rule); the money functions in
19
+ integer cents (`periodNetCents`, `periodDays`, `remainingDays`,
20
+ `prorateCents`, `changeNetCents`, `chargeAmounts`, `checkoutQuote`); and
21
+ the dunning schedule `BILLING_RETRY_DAYS` and `BILLING_LOCK_DAY`.
22
+ - **The billing read model and requests.** `billingView` (the account, the
23
+ payment method on file, the last 24 invoices), `billingAccount`,
24
+ `billingInvoice`, `paymentMethod`, `billingDetails` and `billingAddress`;
25
+ the requests `checkoutRequest`, `vatIdCheckRequest`,
26
+ `billingChangeRequest` (absolute counts, not deltas),
27
+ `billingCancelRequest`, `billingDetailsUpdate` and
28
+ `paymentMethodChangeRequest`; the answers `checkoutResponse`,
29
+ `checkoutStatus`, `vatIdCheckResponse` and `billingChangeResponse`. Each
30
+ has a JSON Schema in `artifacts/schema/`.
31
+ - **The `billing` route section**, twelve routes: `GET /api/billing`, the
32
+ checkout and its status, the VAT-ID check, billing details, changes,
33
+ the payment method, cancel and resume, an invoice's PDF and paying an
34
+ open invoice, all owner-tier; and Mollie's webhook
35
+ (`POST /api/billing/mollie/webhook`, internal, no auth).
36
+ - **`billing_unavailable`** (`503`): this cloud has no payment provider
37
+ configured, so it takes no payments. Retrying does not help.
38
+ - **`payment_provider_unavailable`** (`502`): Mollie did not answer, or
39
+ answered with an error; nothing was charged. `details` is
40
+ `paymentProviderUnavailableDetails` (`provider`, Mollie's HTTP `status`
41
+ or `null` for a timeout). Retrying may work.
42
+
43
+ ### Changed
44
+
45
+ - **`PATCH /api/admin/orgs/:id/plan`** lists `target_state_conflict`: rule
46
+ `billed` when the org has a billing account and the change would touch
47
+ its currency or period.
48
+ - The notes of **`PUT /api/org/plan/change`** and the admin route no longer
49
+ say payment is missing; an upgrade of a billed org goes through the
50
+ billing routes.
51
+
12
52
  ## [6.2.0] — 2026-10-04
13
53
 
14
54
  ### Added