@fleetless/contracts 15.6.0 → 16.0.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.
package/CHANGELOG.md CHANGED
@@ -9,6 +9,68 @@ version.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ### Changed
13
+
14
+ - **BREAKING: one consent sentence and one button label per C.4 action**
15
+ (fleetless/fleetless#1168). `billingDecisionSnapshot.declaration` gains a
16
+ required `action_label`, and `text_id` is one of `C4_TEXT_IDS`, one per
17
+ action in `C4_ACTIONS`: `checkout` (`Pay 34,51 € with Mollie`),
18
+ `pay_and_switch` (`Pay 95 € and switch`), `switch` (`Switch to Pro`),
19
+ `schedule_switch` (`Switch to monthly at period end`),
20
+ `schedule_downgrade` (`Schedule downgrade to Plus`), `cancel`
21
+ (`Cancel at period end`) and `keep_basic` (`Delete the rest and stay on
22
+ Basic`), a plan change to Basic for an organization already on Basic or
23
+ coming from Enterprise or a grandfathered plan, where there is no Plus or
24
+ Pro plan to cancel. `c4ActionOf` needs `from` for a plan change to Basic and
25
+ throws without it. The snapshot parses only when `text` and
26
+ `action_label` are exactly what `c4Declaration` writes for its own action,
27
+ amounts, plan, cycle and organization. The single `Order and pay` sentence
28
+ (`DR-1374-draft-3-C.4`) no longer parses as a new display. A producer builds
29
+ the declaration with `c4Declaration(c4ActionOf(snapshot, from), …)`; a
30
+ client renders `text` above one button labelled `action_label`. A snapshot
31
+ stored before this release reads with `storedBillingDecisionSnapshot`.
32
+ - **BREAKING: `POST /api/billing/checkout` answers `checkoutStartResponse`**
33
+ instead of `checkoutResponse`. The start decides in the request: `eligible`
34
+ carries the frozen quote and its C.4 display (`display`, a
35
+ `billingDecisionDisplayResponse` for this intent), so the one click on its
36
+ button confirms with the display's proof; `vies_unavailable`,
37
+ `invalid_vat_id` and `refused` carry no intent, since nothing is stored;
38
+ `held` only with `issuer_cutover_in_progress`; `payment_started` replays a
39
+ confirmed key, hosted only. A checkout never answers `awaiting_vies`. A
40
+ consumer that read `checkoutResponse` from the start reads the new union;
41
+ `checkoutResponse` stays the answer of the invoice, charge and
42
+ payment-method routes.
43
+ - **BREAKING: `purchaseHoldReason` shrinks** to `legacy_usd_invoice`,
44
+ `legacy_payer_unresolved`, `mandate_policy_unresolved` and
45
+ `issuer_cutover_in_progress`. `lexware_contact_pending`,
46
+ `lexware_contact_changed` and `lexware_issuance_paused` are gone: Lexware's
47
+ contact and invoice follow the payment and never hold a purchase.
48
+ - **BREAKING: a paid change never waits for VIES.** `billingChangeResponse`'s
49
+ draft has no `awaiting_vies` variant; when VIES does not answer, the change
50
+ is refused with `viesUnavailableDetails` and nothing is stored.
51
+ - The notes of the checkout start, the display, the confirm and
52
+ `POST /api/billing/change` describe the one-click flow, a fresh operation
53
+ key per press, `display_stale`, the open payment's `checkout_url` and the
54
+ two VIES refusals of a paid change.
55
+
56
+ ### Added
57
+
58
+ - **`GET /api/billing/checkout-draft`** (Owner tier) answers
59
+ `checkoutDraftResponse`: the last checkout start's body as `draft`, or else
60
+ the org's earlier billing details as `prefill`, or both `null`
61
+ (fleetless/fleetless#1168).
62
+ - `formatEur(cents)`: money as the console writes it, `34,51 €` and `29 €`.
63
+ - `c4ActionOf(snapshot, from?)` and `c4Declaration(action, values)`, with
64
+ the types `C4Action`, `C4TextId`, `C4DeclarationText`,
65
+ `C4DeclarationValues`, `C4Decision` and `C4From`.
66
+ - `storedBillingDecisionSnapshot`: also reads the legacy declaration without
67
+ `action_label`, for stored displays and replays only.
68
+ - `checkoutOpenDetails` (`409` rule `checkout_open`, now with
69
+ `checkout_url` to continue the open payment), `viesUnavailableDetails`
70
+ (`409` rule `vies_unavailable` on `POST /api/billing/change`) and
71
+ `purchaseConflictDetails`'s `{ field: 'confirmation_proof', rule:
72
+ 'display_stale' }` for a spent, expired or stale display.
73
+
12
74
  ## [15.6.0] — 2026-11-18
13
75
 
14
76
  ### Added