@fleetless/contracts 16.0.0-next.1 → 16.0.0
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 +8 -2
- package/artifacts/openapi.json +192 -12
- package/artifacts/routes.json +3 -3
- package/artifacts/schema/billing-decision-display-response.schema.json +63 -3
- package/artifacts/schema/billing-decision-snapshot.schema.json +63 -3
- package/artifacts/schema/checkout-start-response.schema.json +63 -3
- package/artifacts/schema/plan-change-prepare-response.schema.json +63 -3
- package/dist/billing.d.ts +23 -6
- package/dist/billing.js +20 -6
- package/dist/routes.js +13 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,8 @@ version.
|
|
|
9
9
|
|
|
10
10
|
## [Unreleased]
|
|
11
11
|
|
|
12
|
+
## [16.0.0] — 2026-11-19
|
|
13
|
+
|
|
12
14
|
### Changed
|
|
13
15
|
|
|
14
16
|
- **BREAKING: one consent sentence and one button label per C.4 action**
|
|
@@ -17,8 +19,12 @@ version.
|
|
|
17
19
|
action in `C4_ACTIONS`: `checkout` (`Pay 34,51 € with Mollie`),
|
|
18
20
|
`pay_and_switch` (`Pay 95 € and switch`), `switch` (`Switch to Pro`),
|
|
19
21
|
`schedule_switch` (`Switch to monthly at period end`),
|
|
20
|
-
`schedule_downgrade` (`Schedule downgrade to Plus`)
|
|
21
|
-
(`Cancel at period end`)
|
|
22
|
+
`schedule_downgrade` (`Schedule downgrade to Plus`), `cancel`
|
|
23
|
+
(`Cancel at period end`) and `keep_basic` (`Delete the rest and stay on
|
|
24
|
+
Basic`), a plan change to Basic for an organization already on Basic or
|
|
25
|
+
coming from Enterprise or a grandfathered plan, where there is no Plus or
|
|
26
|
+
Pro plan to cancel. `c4ActionOf` needs `from` for a plan change to Basic and
|
|
27
|
+
throws without it. The snapshot parses only when `text` and
|
|
22
28
|
`action_label` are exactly what `c4Declaration` writes for its own action,
|
|
23
29
|
amounts, plan, cycle and organization. The single `Order and pay` sentence
|
|
24
30
|
(`DR-1374-draft-3-C.4`) no longer parses as a new display. A producer builds
|
package/artifacts/openapi.json
CHANGED
|
@@ -9966,7 +9966,7 @@
|
|
|
9966
9966
|
}
|
|
9967
9967
|
}
|
|
9968
9968
|
},
|
|
9969
|
-
"description": "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT.",
|
|
9969
|
+
"description": "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT. A cancellation to Basic never waits for the VAT treatment; a lower paid plan names its gross, so while the account's VAT treatment is unresolved this route and the PUT answer 409 target_state_conflict with `{ field: billing.vat_id, rule: purchase_eligibility_pending }`.",
|
|
9970
9970
|
"requestBody": {
|
|
9971
9971
|
"required": true,
|
|
9972
9972
|
"content": {
|
|
@@ -10352,7 +10352,7 @@
|
|
|
10352
10352
|
}
|
|
10353
10353
|
}
|
|
10354
10354
|
},
|
|
10355
|
-
"description": "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. A checkout start already returns its display; this route issues one for a paid change, and a fresh one for an intent that is still eligible. `snapshot.declaration` carries the approved sentence of the decision's action (`text_id`, `text`) and the label of its one button (`action_label`): `Pay 34,51 € with Mollie`, `Pay 95 € and switch`, `Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus
|
|
10355
|
+
"description": "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. A checkout start already returns its display; this route issues one for a paid change, and a fresh one for an intent that is still eligible. `snapshot.declaration` carries the approved sentence of the decision's action (`text_id`, `text`) and the label of its one button (`action_label`): `Pay 34,51 € with Mollie`, `Pay 95 € and switch`, `Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus`, `Cancel at period end` or `Delete the rest and stay on Basic`. Render both as sent. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs.",
|
|
10356
10356
|
"requestBody": {
|
|
10357
10357
|
"required": true,
|
|
10358
10358
|
"content": {
|
|
@@ -10410,7 +10410,7 @@
|
|
|
10410
10410
|
}
|
|
10411
10411
|
}
|
|
10412
10412
|
},
|
|
10413
|
-
"description": "Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock. A spent, expired or stale proof answers 409 target_state_conflict with `{ field: confirmation_proof, rule: display_stale }` and changes nothing: fetch a fresh display (for a checkout, a new start with a new key) and press again; never resend the click. One decision, one legal acceptance and, for a charge, the hosted payment commit in this one request. An exact same-key replay returns the original result without another payment or acceptance.
|
|
10413
|
+
"description": "Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock. A spent, expired or stale proof answers 409 target_state_conflict with `{ field: confirmation_proof, rule: display_stale }` and changes nothing: fetch a fresh display (for a checkout, a new start with a new key) and press again; never resend the click. One decision, one legal acceptance and, for a charge, the hosted payment commit in this one request. An exact same-key replay returns the original result without another payment or acceptance. For a checkout, after 502 payment_provider_unavailable the same key and proof may be sent again within 50 minutes: the payment is created with the same idempotency key, so at most one exists. A paid change after a 502 answers charge_in_progress until the earlier charge is settled (within about an hour), then the same key and proof charge once more. While another first payment of the org is open, a checkout answers 409 target_state_conflict with `checkoutOpenDetails` (rule `checkout_open`): continue it at `checkout_url`. A paid change can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; it does not start another charge. After the Lexware issuer cutover, a paid change that charges something while the billing details lack a company name or a full address answers 409 target_state_conflict with `{ field: billing, rule: purchase_eligibility_pending }` before the proof is consumed: nothing is charged until they are complete. Foreign ownership answers 404 without disclosure; held cannot charge.",
|
|
10414
10414
|
"requestBody": {
|
|
10415
10415
|
"required": true,
|
|
10416
10416
|
"content": {
|
|
@@ -19923,7 +19923,8 @@
|
|
|
19923
19923
|
"C4-1168-switch",
|
|
19924
19924
|
"C4-1168-schedule-switch",
|
|
19925
19925
|
"C4-1168-schedule-downgrade",
|
|
19926
|
-
"C4-1168-cancel"
|
|
19926
|
+
"C4-1168-cancel",
|
|
19927
|
+
"C4-1168-keep-basic"
|
|
19927
19928
|
],
|
|
19928
19929
|
"description": "The approved sentence this display shows, one per action."
|
|
19929
19930
|
},
|
|
@@ -20115,6 +20116,25 @@
|
|
|
20115
20116
|
}
|
|
20116
20117
|
}
|
|
20117
20118
|
}
|
|
20119
|
+
},
|
|
20120
|
+
{
|
|
20121
|
+
"if": {
|
|
20122
|
+
"properties": {
|
|
20123
|
+
"text_id": {
|
|
20124
|
+
"const": "C4-1168-keep-basic"
|
|
20125
|
+
}
|
|
20126
|
+
},
|
|
20127
|
+
"required": [
|
|
20128
|
+
"text_id"
|
|
20129
|
+
]
|
|
20130
|
+
},
|
|
20131
|
+
"then": {
|
|
20132
|
+
"properties": {
|
|
20133
|
+
"action_label": {
|
|
20134
|
+
"const": "Delete the rest and stay on Basic"
|
|
20135
|
+
}
|
|
20136
|
+
}
|
|
20137
|
+
}
|
|
20118
20138
|
}
|
|
20119
20139
|
]
|
|
20120
20140
|
},
|
|
@@ -21102,7 +21122,8 @@
|
|
|
21102
21122
|
"C4-1168-switch",
|
|
21103
21123
|
"C4-1168-schedule-switch",
|
|
21104
21124
|
"C4-1168-schedule-downgrade",
|
|
21105
|
-
"C4-1168-cancel"
|
|
21125
|
+
"C4-1168-cancel",
|
|
21126
|
+
"C4-1168-keep-basic"
|
|
21106
21127
|
],
|
|
21107
21128
|
"description": "The approved sentence this display shows, one per action."
|
|
21108
21129
|
},
|
|
@@ -21294,6 +21315,25 @@
|
|
|
21294
21315
|
}
|
|
21295
21316
|
}
|
|
21296
21317
|
}
|
|
21318
|
+
},
|
|
21319
|
+
{
|
|
21320
|
+
"if": {
|
|
21321
|
+
"properties": {
|
|
21322
|
+
"text_id": {
|
|
21323
|
+
"const": "C4-1168-keep-basic"
|
|
21324
|
+
}
|
|
21325
|
+
},
|
|
21326
|
+
"required": [
|
|
21327
|
+
"text_id"
|
|
21328
|
+
]
|
|
21329
|
+
},
|
|
21330
|
+
"then": {
|
|
21331
|
+
"properties": {
|
|
21332
|
+
"action_label": {
|
|
21333
|
+
"const": "Delete the rest and stay on Basic"
|
|
21334
|
+
}
|
|
21335
|
+
}
|
|
21336
|
+
}
|
|
21297
21337
|
}
|
|
21298
21338
|
]
|
|
21299
21339
|
},
|
|
@@ -22281,7 +22321,8 @@
|
|
|
22281
22321
|
"C4-1168-switch",
|
|
22282
22322
|
"C4-1168-schedule-switch",
|
|
22283
22323
|
"C4-1168-schedule-downgrade",
|
|
22284
|
-
"C4-1168-cancel"
|
|
22324
|
+
"C4-1168-cancel",
|
|
22325
|
+
"C4-1168-keep-basic"
|
|
22285
22326
|
],
|
|
22286
22327
|
"description": "The approved sentence this display shows, one per action."
|
|
22287
22328
|
},
|
|
@@ -22473,6 +22514,25 @@
|
|
|
22473
22514
|
}
|
|
22474
22515
|
}
|
|
22475
22516
|
}
|
|
22517
|
+
},
|
|
22518
|
+
{
|
|
22519
|
+
"if": {
|
|
22520
|
+
"properties": {
|
|
22521
|
+
"text_id": {
|
|
22522
|
+
"const": "C4-1168-keep-basic"
|
|
22523
|
+
}
|
|
22524
|
+
},
|
|
22525
|
+
"required": [
|
|
22526
|
+
"text_id"
|
|
22527
|
+
]
|
|
22528
|
+
},
|
|
22529
|
+
"then": {
|
|
22530
|
+
"properties": {
|
|
22531
|
+
"action_label": {
|
|
22532
|
+
"const": "Delete the rest and stay on Basic"
|
|
22533
|
+
}
|
|
22534
|
+
}
|
|
22535
|
+
}
|
|
22476
22536
|
}
|
|
22477
22537
|
]
|
|
22478
22538
|
},
|
|
@@ -26356,7 +26416,8 @@
|
|
|
26356
26416
|
"C4-1168-switch",
|
|
26357
26417
|
"C4-1168-schedule-switch",
|
|
26358
26418
|
"C4-1168-schedule-downgrade",
|
|
26359
|
-
"C4-1168-cancel"
|
|
26419
|
+
"C4-1168-cancel",
|
|
26420
|
+
"C4-1168-keep-basic"
|
|
26360
26421
|
],
|
|
26361
26422
|
"description": "The approved sentence this display shows, one per action."
|
|
26362
26423
|
},
|
|
@@ -26548,6 +26609,25 @@
|
|
|
26548
26609
|
}
|
|
26549
26610
|
}
|
|
26550
26611
|
}
|
|
26612
|
+
},
|
|
26613
|
+
{
|
|
26614
|
+
"if": {
|
|
26615
|
+
"properties": {
|
|
26616
|
+
"text_id": {
|
|
26617
|
+
"const": "C4-1168-keep-basic"
|
|
26618
|
+
}
|
|
26619
|
+
},
|
|
26620
|
+
"required": [
|
|
26621
|
+
"text_id"
|
|
26622
|
+
]
|
|
26623
|
+
},
|
|
26624
|
+
"then": {
|
|
26625
|
+
"properties": {
|
|
26626
|
+
"action_label": {
|
|
26627
|
+
"const": "Delete the rest and stay on Basic"
|
|
26628
|
+
}
|
|
26629
|
+
}
|
|
26630
|
+
}
|
|
26551
26631
|
}
|
|
26552
26632
|
]
|
|
26553
26633
|
},
|
|
@@ -27535,7 +27615,8 @@
|
|
|
27535
27615
|
"C4-1168-switch",
|
|
27536
27616
|
"C4-1168-schedule-switch",
|
|
27537
27617
|
"C4-1168-schedule-downgrade",
|
|
27538
|
-
"C4-1168-cancel"
|
|
27618
|
+
"C4-1168-cancel",
|
|
27619
|
+
"C4-1168-keep-basic"
|
|
27539
27620
|
],
|
|
27540
27621
|
"description": "The approved sentence this display shows, one per action."
|
|
27541
27622
|
},
|
|
@@ -27727,6 +27808,25 @@
|
|
|
27727
27808
|
}
|
|
27728
27809
|
}
|
|
27729
27810
|
}
|
|
27811
|
+
},
|
|
27812
|
+
{
|
|
27813
|
+
"if": {
|
|
27814
|
+
"properties": {
|
|
27815
|
+
"text_id": {
|
|
27816
|
+
"const": "C4-1168-keep-basic"
|
|
27817
|
+
}
|
|
27818
|
+
},
|
|
27819
|
+
"required": [
|
|
27820
|
+
"text_id"
|
|
27821
|
+
]
|
|
27822
|
+
},
|
|
27823
|
+
"then": {
|
|
27824
|
+
"properties": {
|
|
27825
|
+
"action_label": {
|
|
27826
|
+
"const": "Delete the rest and stay on Basic"
|
|
27827
|
+
}
|
|
27828
|
+
}
|
|
27829
|
+
}
|
|
27730
27830
|
}
|
|
27731
27831
|
]
|
|
27732
27832
|
},
|
|
@@ -28714,7 +28814,8 @@
|
|
|
28714
28814
|
"C4-1168-switch",
|
|
28715
28815
|
"C4-1168-schedule-switch",
|
|
28716
28816
|
"C4-1168-schedule-downgrade",
|
|
28717
|
-
"C4-1168-cancel"
|
|
28817
|
+
"C4-1168-cancel",
|
|
28818
|
+
"C4-1168-keep-basic"
|
|
28718
28819
|
],
|
|
28719
28820
|
"description": "The approved sentence this display shows, one per action."
|
|
28720
28821
|
},
|
|
@@ -28906,6 +29007,25 @@
|
|
|
28906
29007
|
}
|
|
28907
29008
|
}
|
|
28908
29009
|
}
|
|
29010
|
+
},
|
|
29011
|
+
{
|
|
29012
|
+
"if": {
|
|
29013
|
+
"properties": {
|
|
29014
|
+
"text_id": {
|
|
29015
|
+
"const": "C4-1168-keep-basic"
|
|
29016
|
+
}
|
|
29017
|
+
},
|
|
29018
|
+
"required": [
|
|
29019
|
+
"text_id"
|
|
29020
|
+
]
|
|
29021
|
+
},
|
|
29022
|
+
"then": {
|
|
29023
|
+
"properties": {
|
|
29024
|
+
"action_label": {
|
|
29025
|
+
"const": "Delete the rest and stay on Basic"
|
|
29026
|
+
}
|
|
29027
|
+
}
|
|
29028
|
+
}
|
|
28909
29029
|
}
|
|
28910
29030
|
]
|
|
28911
29031
|
},
|
|
@@ -47309,7 +47429,8 @@
|
|
|
47309
47429
|
"C4-1168-switch",
|
|
47310
47430
|
"C4-1168-schedule-switch",
|
|
47311
47431
|
"C4-1168-schedule-downgrade",
|
|
47312
|
-
"C4-1168-cancel"
|
|
47432
|
+
"C4-1168-cancel",
|
|
47433
|
+
"C4-1168-keep-basic"
|
|
47313
47434
|
],
|
|
47314
47435
|
"description": "The approved sentence this display shows, one per action."
|
|
47315
47436
|
},
|
|
@@ -47501,6 +47622,25 @@
|
|
|
47501
47622
|
}
|
|
47502
47623
|
}
|
|
47503
47624
|
}
|
|
47625
|
+
},
|
|
47626
|
+
{
|
|
47627
|
+
"if": {
|
|
47628
|
+
"properties": {
|
|
47629
|
+
"text_id": {
|
|
47630
|
+
"const": "C4-1168-keep-basic"
|
|
47631
|
+
}
|
|
47632
|
+
},
|
|
47633
|
+
"required": [
|
|
47634
|
+
"text_id"
|
|
47635
|
+
]
|
|
47636
|
+
},
|
|
47637
|
+
"then": {
|
|
47638
|
+
"properties": {
|
|
47639
|
+
"action_label": {
|
|
47640
|
+
"const": "Delete the rest and stay on Basic"
|
|
47641
|
+
}
|
|
47642
|
+
}
|
|
47643
|
+
}
|
|
47504
47644
|
}
|
|
47505
47645
|
]
|
|
47506
47646
|
},
|
|
@@ -48488,7 +48628,8 @@
|
|
|
48488
48628
|
"C4-1168-switch",
|
|
48489
48629
|
"C4-1168-schedule-switch",
|
|
48490
48630
|
"C4-1168-schedule-downgrade",
|
|
48491
|
-
"C4-1168-cancel"
|
|
48631
|
+
"C4-1168-cancel",
|
|
48632
|
+
"C4-1168-keep-basic"
|
|
48492
48633
|
],
|
|
48493
48634
|
"description": "The approved sentence this display shows, one per action."
|
|
48494
48635
|
},
|
|
@@ -48680,6 +48821,25 @@
|
|
|
48680
48821
|
}
|
|
48681
48822
|
}
|
|
48682
48823
|
}
|
|
48824
|
+
},
|
|
48825
|
+
{
|
|
48826
|
+
"if": {
|
|
48827
|
+
"properties": {
|
|
48828
|
+
"text_id": {
|
|
48829
|
+
"const": "C4-1168-keep-basic"
|
|
48830
|
+
}
|
|
48831
|
+
},
|
|
48832
|
+
"required": [
|
|
48833
|
+
"text_id"
|
|
48834
|
+
]
|
|
48835
|
+
},
|
|
48836
|
+
"then": {
|
|
48837
|
+
"properties": {
|
|
48838
|
+
"action_label": {
|
|
48839
|
+
"const": "Delete the rest and stay on Basic"
|
|
48840
|
+
}
|
|
48841
|
+
}
|
|
48842
|
+
}
|
|
48683
48843
|
}
|
|
48684
48844
|
]
|
|
48685
48845
|
},
|
|
@@ -49667,7 +49827,8 @@
|
|
|
49667
49827
|
"C4-1168-switch",
|
|
49668
49828
|
"C4-1168-schedule-switch",
|
|
49669
49829
|
"C4-1168-schedule-downgrade",
|
|
49670
|
-
"C4-1168-cancel"
|
|
49830
|
+
"C4-1168-cancel",
|
|
49831
|
+
"C4-1168-keep-basic"
|
|
49671
49832
|
],
|
|
49672
49833
|
"description": "The approved sentence this display shows, one per action."
|
|
49673
49834
|
},
|
|
@@ -49859,6 +50020,25 @@
|
|
|
49859
50020
|
}
|
|
49860
50021
|
}
|
|
49861
50022
|
}
|
|
50023
|
+
},
|
|
50024
|
+
{
|
|
50025
|
+
"if": {
|
|
50026
|
+
"properties": {
|
|
50027
|
+
"text_id": {
|
|
50028
|
+
"const": "C4-1168-keep-basic"
|
|
50029
|
+
}
|
|
50030
|
+
},
|
|
50031
|
+
"required": [
|
|
50032
|
+
"text_id"
|
|
50033
|
+
]
|
|
50034
|
+
},
|
|
50035
|
+
"then": {
|
|
50036
|
+
"properties": {
|
|
50037
|
+
"action_label": {
|
|
50038
|
+
"const": "Delete the rest and stay on Basic"
|
|
50039
|
+
}
|
|
50040
|
+
}
|
|
50041
|
+
}
|
|
49862
50042
|
}
|
|
49863
50043
|
]
|
|
49864
50044
|
},
|
package/artifacts/routes.json
CHANGED
|
@@ -6711,7 +6711,7 @@
|
|
|
6711
6711
|
"plan_purchase_closed"
|
|
6712
6712
|
],
|
|
6713
6713
|
"transport": "http",
|
|
6714
|
-
"notes": "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT."
|
|
6714
|
+
"notes": "Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT. A cancellation to Basic never waits for the VAT treatment; a lower paid plan names its gross, so while the account's VAT treatment is unresolved this route and the PUT answer 409 target_state_conflict with `{ field: billing.vat_id, rule: purchase_eligibility_pending }`."
|
|
6715
6715
|
},
|
|
6716
6716
|
{
|
|
6717
6717
|
"method": "PUT",
|
|
@@ -6950,7 +6950,7 @@
|
|
|
6950
6950
|
"plan_purchase_closed"
|
|
6951
6951
|
],
|
|
6952
6952
|
"transport": "http",
|
|
6953
|
-
"notes": "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. A checkout start already returns its display; this route issues one for a paid change, and a fresh one for an intent that is still eligible. `snapshot.declaration` carries the approved sentence of the decision's action (`text_id`, `text`) and the label of its one button (`action_label`): `Pay 34,51 € with Mollie`, `Pay 95 € and switch`, `Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus
|
|
6953
|
+
"notes": "Owner only, Cache-Control: no-store. Cloud persists the snapshot and proof hash for an eligible current checkout or paid-change intent of this Owner and org. A checkout start already returns its display; this route issues one for a paid change, and a fresh one for an intent that is still eligible. `snapshot.declaration` carries the approved sentence of the decision's action (`text_id`, `text`) and the label of its one button (`action_label`): `Pay 34,51 € with Mollie`, `Pay 95 € and switch`, `Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus`, `Cancel at period end` or `Delete the rest and stay on Basic`. Render both as sent. Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs."
|
|
6954
6954
|
},
|
|
6955
6955
|
{
|
|
6956
6956
|
"method": "POST",
|
|
@@ -6986,7 +6986,7 @@
|
|
|
6986
6986
|
"payment_provider_unavailable"
|
|
6987
6987
|
],
|
|
6988
6988
|
"transport": "http",
|
|
6989
|
-
"notes": "Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock. A spent, expired or stale proof answers 409 target_state_conflict with `{ field: confirmation_proof, rule: display_stale }` and changes nothing: fetch a fresh display (for a checkout, a new start with a new key) and press again; never resend the click. One decision, one legal acceptance and, for a charge, the hosted payment commit in this one request. An exact same-key replay returns the original result without another payment or acceptance.
|
|
6989
|
+
"notes": "Checkout and paid-change decisions require confirmation_proof along with the operation key, quote revision and buyer fingerprint shown in the persisted C.4 display. Cloud rechecks buyer, quote, selection, legal references, period and current state under the org lock. A spent, expired or stale proof answers 409 target_state_conflict with `{ field: confirmation_proof, rule: display_stale }` and changes nothing: fetch a fresh display (for a checkout, a new start with a new key) and press again; never resend the click. One decision, one legal acceptance and, for a charge, the hosted payment commit in this one request. An exact same-key replay returns the original result without another payment or acceptance. For a checkout, after 502 payment_provider_unavailable the same key and proof may be sent again within 50 minutes: the payment is created with the same idempotency key, so at most one exists. A paid change after a 502 answers charge_in_progress until the earlier charge is settled (within about an hour), then the same key and proof charge once more. While another first payment of the org is open, a checkout answers 409 target_state_conflict with `checkoutOpenDetails` (rule `checkout_open`): continue it at `checkout_url`. A paid change can return 409 target_state_conflict with field billing and rule charge_in_progress while an earlier charge is unresolved; it does not start another charge. After the Lexware issuer cutover, a paid change that charges something while the billing details lack a company name or a full address answers 409 target_state_conflict with `{ field: billing, rule: purchase_eligibility_pending }` before the proof is consumed: nothing is charged until they are complete. Foreign ownership answers 404 without disclosure; held cannot charge."
|
|
6990
6990
|
},
|
|
6991
6991
|
{
|
|
6992
6992
|
"method": "GET",
|
|
@@ -964,7 +964,8 @@
|
|
|
964
964
|
"C4-1168-switch",
|
|
965
965
|
"C4-1168-schedule-switch",
|
|
966
966
|
"C4-1168-schedule-downgrade",
|
|
967
|
-
"C4-1168-cancel"
|
|
967
|
+
"C4-1168-cancel",
|
|
968
|
+
"C4-1168-keep-basic"
|
|
968
969
|
],
|
|
969
970
|
"description": "The approved sentence this display shows, one per action."
|
|
970
971
|
},
|
|
@@ -1156,6 +1157,25 @@
|
|
|
1156
1157
|
}
|
|
1157
1158
|
}
|
|
1158
1159
|
}
|
|
1160
|
+
},
|
|
1161
|
+
{
|
|
1162
|
+
"if": {
|
|
1163
|
+
"properties": {
|
|
1164
|
+
"text_id": {
|
|
1165
|
+
"const": "C4-1168-keep-basic"
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
"required": [
|
|
1169
|
+
"text_id"
|
|
1170
|
+
]
|
|
1171
|
+
},
|
|
1172
|
+
"then": {
|
|
1173
|
+
"properties": {
|
|
1174
|
+
"action_label": {
|
|
1175
|
+
"const": "Delete the rest and stay on Basic"
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
}
|
|
1159
1179
|
}
|
|
1160
1180
|
]
|
|
1161
1181
|
},
|
|
@@ -2143,7 +2163,8 @@
|
|
|
2143
2163
|
"C4-1168-switch",
|
|
2144
2164
|
"C4-1168-schedule-switch",
|
|
2145
2165
|
"C4-1168-schedule-downgrade",
|
|
2146
|
-
"C4-1168-cancel"
|
|
2166
|
+
"C4-1168-cancel",
|
|
2167
|
+
"C4-1168-keep-basic"
|
|
2147
2168
|
],
|
|
2148
2169
|
"description": "The approved sentence this display shows, one per action."
|
|
2149
2170
|
},
|
|
@@ -2335,6 +2356,25 @@
|
|
|
2335
2356
|
}
|
|
2336
2357
|
}
|
|
2337
2358
|
}
|
|
2359
|
+
},
|
|
2360
|
+
{
|
|
2361
|
+
"if": {
|
|
2362
|
+
"properties": {
|
|
2363
|
+
"text_id": {
|
|
2364
|
+
"const": "C4-1168-keep-basic"
|
|
2365
|
+
}
|
|
2366
|
+
},
|
|
2367
|
+
"required": [
|
|
2368
|
+
"text_id"
|
|
2369
|
+
]
|
|
2370
|
+
},
|
|
2371
|
+
"then": {
|
|
2372
|
+
"properties": {
|
|
2373
|
+
"action_label": {
|
|
2374
|
+
"const": "Delete the rest and stay on Basic"
|
|
2375
|
+
}
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2338
2378
|
}
|
|
2339
2379
|
]
|
|
2340
2380
|
},
|
|
@@ -3322,7 +3362,8 @@
|
|
|
3322
3362
|
"C4-1168-switch",
|
|
3323
3363
|
"C4-1168-schedule-switch",
|
|
3324
3364
|
"C4-1168-schedule-downgrade",
|
|
3325
|
-
"C4-1168-cancel"
|
|
3365
|
+
"C4-1168-cancel",
|
|
3366
|
+
"C4-1168-keep-basic"
|
|
3326
3367
|
],
|
|
3327
3368
|
"description": "The approved sentence this display shows, one per action."
|
|
3328
3369
|
},
|
|
@@ -3514,6 +3555,25 @@
|
|
|
3514
3555
|
}
|
|
3515
3556
|
}
|
|
3516
3557
|
}
|
|
3558
|
+
},
|
|
3559
|
+
{
|
|
3560
|
+
"if": {
|
|
3561
|
+
"properties": {
|
|
3562
|
+
"text_id": {
|
|
3563
|
+
"const": "C4-1168-keep-basic"
|
|
3564
|
+
}
|
|
3565
|
+
},
|
|
3566
|
+
"required": [
|
|
3567
|
+
"text_id"
|
|
3568
|
+
]
|
|
3569
|
+
},
|
|
3570
|
+
"then": {
|
|
3571
|
+
"properties": {
|
|
3572
|
+
"action_label": {
|
|
3573
|
+
"const": "Delete the rest and stay on Basic"
|
|
3574
|
+
}
|
|
3575
|
+
}
|
|
3576
|
+
}
|
|
3517
3577
|
}
|
|
3518
3578
|
]
|
|
3519
3579
|
},
|
|
@@ -945,7 +945,8 @@
|
|
|
945
945
|
"C4-1168-switch",
|
|
946
946
|
"C4-1168-schedule-switch",
|
|
947
947
|
"C4-1168-schedule-downgrade",
|
|
948
|
-
"C4-1168-cancel"
|
|
948
|
+
"C4-1168-cancel",
|
|
949
|
+
"C4-1168-keep-basic"
|
|
949
950
|
],
|
|
950
951
|
"description": "The approved sentence this display shows, one per action."
|
|
951
952
|
},
|
|
@@ -1137,6 +1138,25 @@
|
|
|
1137
1138
|
}
|
|
1138
1139
|
}
|
|
1139
1140
|
}
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
"if": {
|
|
1144
|
+
"properties": {
|
|
1145
|
+
"text_id": {
|
|
1146
|
+
"const": "C4-1168-keep-basic"
|
|
1147
|
+
}
|
|
1148
|
+
},
|
|
1149
|
+
"required": [
|
|
1150
|
+
"text_id"
|
|
1151
|
+
]
|
|
1152
|
+
},
|
|
1153
|
+
"then": {
|
|
1154
|
+
"properties": {
|
|
1155
|
+
"action_label": {
|
|
1156
|
+
"const": "Delete the rest and stay on Basic"
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1140
1160
|
}
|
|
1141
1161
|
]
|
|
1142
1162
|
},
|
|
@@ -2124,7 +2144,8 @@
|
|
|
2124
2144
|
"C4-1168-switch",
|
|
2125
2145
|
"C4-1168-schedule-switch",
|
|
2126
2146
|
"C4-1168-schedule-downgrade",
|
|
2127
|
-
"C4-1168-cancel"
|
|
2147
|
+
"C4-1168-cancel",
|
|
2148
|
+
"C4-1168-keep-basic"
|
|
2128
2149
|
],
|
|
2129
2150
|
"description": "The approved sentence this display shows, one per action."
|
|
2130
2151
|
},
|
|
@@ -2316,6 +2337,25 @@
|
|
|
2316
2337
|
}
|
|
2317
2338
|
}
|
|
2318
2339
|
}
|
|
2340
|
+
},
|
|
2341
|
+
{
|
|
2342
|
+
"if": {
|
|
2343
|
+
"properties": {
|
|
2344
|
+
"text_id": {
|
|
2345
|
+
"const": "C4-1168-keep-basic"
|
|
2346
|
+
}
|
|
2347
|
+
},
|
|
2348
|
+
"required": [
|
|
2349
|
+
"text_id"
|
|
2350
|
+
]
|
|
2351
|
+
},
|
|
2352
|
+
"then": {
|
|
2353
|
+
"properties": {
|
|
2354
|
+
"action_label": {
|
|
2355
|
+
"const": "Delete the rest and stay on Basic"
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
}
|
|
2319
2359
|
}
|
|
2320
2360
|
]
|
|
2321
2361
|
},
|
|
@@ -3303,7 +3343,8 @@
|
|
|
3303
3343
|
"C4-1168-switch",
|
|
3304
3344
|
"C4-1168-schedule-switch",
|
|
3305
3345
|
"C4-1168-schedule-downgrade",
|
|
3306
|
-
"C4-1168-cancel"
|
|
3346
|
+
"C4-1168-cancel",
|
|
3347
|
+
"C4-1168-keep-basic"
|
|
3307
3348
|
],
|
|
3308
3349
|
"description": "The approved sentence this display shows, one per action."
|
|
3309
3350
|
},
|
|
@@ -3495,6 +3536,25 @@
|
|
|
3495
3536
|
}
|
|
3496
3537
|
}
|
|
3497
3538
|
}
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
"if": {
|
|
3542
|
+
"properties": {
|
|
3543
|
+
"text_id": {
|
|
3544
|
+
"const": "C4-1168-keep-basic"
|
|
3545
|
+
}
|
|
3546
|
+
},
|
|
3547
|
+
"required": [
|
|
3548
|
+
"text_id"
|
|
3549
|
+
]
|
|
3550
|
+
},
|
|
3551
|
+
"then": {
|
|
3552
|
+
"properties": {
|
|
3553
|
+
"action_label": {
|
|
3554
|
+
"const": "Delete the rest and stay on Basic"
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
}
|
|
3498
3558
|
}
|
|
3499
3559
|
]
|
|
3500
3560
|
},
|
|
@@ -1043,7 +1043,8 @@
|
|
|
1043
1043
|
"C4-1168-switch",
|
|
1044
1044
|
"C4-1168-schedule-switch",
|
|
1045
1045
|
"C4-1168-schedule-downgrade",
|
|
1046
|
-
"C4-1168-cancel"
|
|
1046
|
+
"C4-1168-cancel",
|
|
1047
|
+
"C4-1168-keep-basic"
|
|
1047
1048
|
],
|
|
1048
1049
|
"description": "The approved sentence this display shows, one per action."
|
|
1049
1050
|
},
|
|
@@ -1235,6 +1236,25 @@
|
|
|
1235
1236
|
}
|
|
1236
1237
|
}
|
|
1237
1238
|
}
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
"if": {
|
|
1242
|
+
"properties": {
|
|
1243
|
+
"text_id": {
|
|
1244
|
+
"const": "C4-1168-keep-basic"
|
|
1245
|
+
}
|
|
1246
|
+
},
|
|
1247
|
+
"required": [
|
|
1248
|
+
"text_id"
|
|
1249
|
+
]
|
|
1250
|
+
},
|
|
1251
|
+
"then": {
|
|
1252
|
+
"properties": {
|
|
1253
|
+
"action_label": {
|
|
1254
|
+
"const": "Delete the rest and stay on Basic"
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1238
1258
|
}
|
|
1239
1259
|
]
|
|
1240
1260
|
},
|
|
@@ -2222,7 +2242,8 @@
|
|
|
2222
2242
|
"C4-1168-switch",
|
|
2223
2243
|
"C4-1168-schedule-switch",
|
|
2224
2244
|
"C4-1168-schedule-downgrade",
|
|
2225
|
-
"C4-1168-cancel"
|
|
2245
|
+
"C4-1168-cancel",
|
|
2246
|
+
"C4-1168-keep-basic"
|
|
2226
2247
|
],
|
|
2227
2248
|
"description": "The approved sentence this display shows, one per action."
|
|
2228
2249
|
},
|
|
@@ -2414,6 +2435,25 @@
|
|
|
2414
2435
|
}
|
|
2415
2436
|
}
|
|
2416
2437
|
}
|
|
2438
|
+
},
|
|
2439
|
+
{
|
|
2440
|
+
"if": {
|
|
2441
|
+
"properties": {
|
|
2442
|
+
"text_id": {
|
|
2443
|
+
"const": "C4-1168-keep-basic"
|
|
2444
|
+
}
|
|
2445
|
+
},
|
|
2446
|
+
"required": [
|
|
2447
|
+
"text_id"
|
|
2448
|
+
]
|
|
2449
|
+
},
|
|
2450
|
+
"then": {
|
|
2451
|
+
"properties": {
|
|
2452
|
+
"action_label": {
|
|
2453
|
+
"const": "Delete the rest and stay on Basic"
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2417
2457
|
}
|
|
2418
2458
|
]
|
|
2419
2459
|
},
|
|
@@ -3401,7 +3441,8 @@
|
|
|
3401
3441
|
"C4-1168-switch",
|
|
3402
3442
|
"C4-1168-schedule-switch",
|
|
3403
3443
|
"C4-1168-schedule-downgrade",
|
|
3404
|
-
"C4-1168-cancel"
|
|
3444
|
+
"C4-1168-cancel",
|
|
3445
|
+
"C4-1168-keep-basic"
|
|
3405
3446
|
],
|
|
3406
3447
|
"description": "The approved sentence this display shows, one per action."
|
|
3407
3448
|
},
|
|
@@ -3593,6 +3634,25 @@
|
|
|
3593
3634
|
}
|
|
3594
3635
|
}
|
|
3595
3636
|
}
|
|
3637
|
+
},
|
|
3638
|
+
{
|
|
3639
|
+
"if": {
|
|
3640
|
+
"properties": {
|
|
3641
|
+
"text_id": {
|
|
3642
|
+
"const": "C4-1168-keep-basic"
|
|
3643
|
+
}
|
|
3644
|
+
},
|
|
3645
|
+
"required": [
|
|
3646
|
+
"text_id"
|
|
3647
|
+
]
|
|
3648
|
+
},
|
|
3649
|
+
"then": {
|
|
3650
|
+
"properties": {
|
|
3651
|
+
"action_label": {
|
|
3652
|
+
"const": "Delete the rest and stay on Basic"
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3596
3656
|
}
|
|
3597
3657
|
]
|
|
3598
3658
|
},
|
|
@@ -972,7 +972,8 @@
|
|
|
972
972
|
"C4-1168-switch",
|
|
973
973
|
"C4-1168-schedule-switch",
|
|
974
974
|
"C4-1168-schedule-downgrade",
|
|
975
|
-
"C4-1168-cancel"
|
|
975
|
+
"C4-1168-cancel",
|
|
976
|
+
"C4-1168-keep-basic"
|
|
976
977
|
],
|
|
977
978
|
"description": "The approved sentence this display shows, one per action."
|
|
978
979
|
},
|
|
@@ -1164,6 +1165,25 @@
|
|
|
1164
1165
|
}
|
|
1165
1166
|
}
|
|
1166
1167
|
}
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
"if": {
|
|
1171
|
+
"properties": {
|
|
1172
|
+
"text_id": {
|
|
1173
|
+
"const": "C4-1168-keep-basic"
|
|
1174
|
+
}
|
|
1175
|
+
},
|
|
1176
|
+
"required": [
|
|
1177
|
+
"text_id"
|
|
1178
|
+
]
|
|
1179
|
+
},
|
|
1180
|
+
"then": {
|
|
1181
|
+
"properties": {
|
|
1182
|
+
"action_label": {
|
|
1183
|
+
"const": "Delete the rest and stay on Basic"
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1167
1187
|
}
|
|
1168
1188
|
]
|
|
1169
1189
|
},
|
|
@@ -2151,7 +2171,8 @@
|
|
|
2151
2171
|
"C4-1168-switch",
|
|
2152
2172
|
"C4-1168-schedule-switch",
|
|
2153
2173
|
"C4-1168-schedule-downgrade",
|
|
2154
|
-
"C4-1168-cancel"
|
|
2174
|
+
"C4-1168-cancel",
|
|
2175
|
+
"C4-1168-keep-basic"
|
|
2155
2176
|
],
|
|
2156
2177
|
"description": "The approved sentence this display shows, one per action."
|
|
2157
2178
|
},
|
|
@@ -2343,6 +2364,25 @@
|
|
|
2343
2364
|
}
|
|
2344
2365
|
}
|
|
2345
2366
|
}
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
"if": {
|
|
2370
|
+
"properties": {
|
|
2371
|
+
"text_id": {
|
|
2372
|
+
"const": "C4-1168-keep-basic"
|
|
2373
|
+
}
|
|
2374
|
+
},
|
|
2375
|
+
"required": [
|
|
2376
|
+
"text_id"
|
|
2377
|
+
]
|
|
2378
|
+
},
|
|
2379
|
+
"then": {
|
|
2380
|
+
"properties": {
|
|
2381
|
+
"action_label": {
|
|
2382
|
+
"const": "Delete the rest and stay on Basic"
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2346
2386
|
}
|
|
2347
2387
|
]
|
|
2348
2388
|
},
|
|
@@ -3330,7 +3370,8 @@
|
|
|
3330
3370
|
"C4-1168-switch",
|
|
3331
3371
|
"C4-1168-schedule-switch",
|
|
3332
3372
|
"C4-1168-schedule-downgrade",
|
|
3333
|
-
"C4-1168-cancel"
|
|
3373
|
+
"C4-1168-cancel",
|
|
3374
|
+
"C4-1168-keep-basic"
|
|
3334
3375
|
],
|
|
3335
3376
|
"description": "The approved sentence this display shows, one per action."
|
|
3336
3377
|
},
|
|
@@ -3522,6 +3563,25 @@
|
|
|
3522
3563
|
}
|
|
3523
3564
|
}
|
|
3524
3565
|
}
|
|
3566
|
+
},
|
|
3567
|
+
{
|
|
3568
|
+
"if": {
|
|
3569
|
+
"properties": {
|
|
3570
|
+
"text_id": {
|
|
3571
|
+
"const": "C4-1168-keep-basic"
|
|
3572
|
+
}
|
|
3573
|
+
},
|
|
3574
|
+
"required": [
|
|
3575
|
+
"text_id"
|
|
3576
|
+
]
|
|
3577
|
+
},
|
|
3578
|
+
"then": {
|
|
3579
|
+
"properties": {
|
|
3580
|
+
"action_label": {
|
|
3581
|
+
"const": "Delete the rest and stay on Basic"
|
|
3582
|
+
}
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3525
3585
|
}
|
|
3526
3586
|
]
|
|
3527
3587
|
},
|
package/dist/billing.d.ts
CHANGED
|
@@ -834,12 +834,13 @@ export declare function formatEur(cents: number): string;
|
|
|
834
834
|
/**
|
|
835
835
|
* What the owner's one click does: buy a first plan, pay now and switch,
|
|
836
836
|
* switch at no charge, switch from yearly to monthly at the period end,
|
|
837
|
-
* schedule a lower plan (or fewer add-ons),
|
|
837
|
+
* schedule a lower plan (or fewer add-ons), cancel to Basic, or stay on
|
|
838
|
+
* Basic and delete what was not kept.
|
|
838
839
|
*/
|
|
839
|
-
export declare const C4_ACTIONS: readonly ["checkout", "pay_and_switch", "switch", "schedule_switch", "schedule_downgrade", "cancel"];
|
|
840
|
+
export declare const C4_ACTIONS: readonly ["checkout", "pay_and_switch", "switch", "schedule_switch", "schedule_downgrade", "cancel", "keep_basic"];
|
|
840
841
|
export type C4Action = (typeof C4_ACTIONS)[number];
|
|
841
842
|
/** The approved sentence of each action, by id, in the order of `C4_ACTIONS`. */
|
|
842
|
-
export declare const C4_TEXT_IDS: readonly ["C4-1168-checkout", "C4-1168-pay-and-switch", "C4-1168-switch", "C4-1168-schedule-switch", "C4-1168-schedule-downgrade", "C4-1168-cancel"];
|
|
843
|
+
export declare const C4_TEXT_IDS: readonly ["C4-1168-checkout", "C4-1168-pay-and-switch", "C4-1168-switch", "C4-1168-schedule-switch", "C4-1168-schedule-downgrade", "C4-1168-cancel", "C4-1168-keep-basic"];
|
|
843
844
|
export type C4TextId = (typeof C4_TEXT_IDS)[number];
|
|
844
845
|
/** The words of one decision display. */
|
|
845
846
|
export interface C4DeclarationText {
|
|
@@ -850,7 +851,7 @@ export interface C4DeclarationText {
|
|
|
850
851
|
/** What a sentence is written from: the organization, the plan it names, the amount due now, the period's gross and its cycle. */
|
|
851
852
|
export interface C4DeclarationValues {
|
|
852
853
|
org: string;
|
|
853
|
-
/** The plan ordered; for `cancel`, the plan cancelled
|
|
854
|
+
/** The plan ordered; for `cancel`, the plan cancelled; unused by `keep_basic`. */
|
|
854
855
|
plan: PlanId;
|
|
855
856
|
dueCents: number;
|
|
856
857
|
periodGrossCents: number;
|
|
@@ -885,8 +886,9 @@ export type C4From = PlanId | {
|
|
|
885
886
|
/**
|
|
886
887
|
* The action of a decision. `checkout` for a first purchase; a paid change
|
|
887
888
|
* charging now is `pay_and_switch`, one taking effect now at no charge
|
|
888
|
-
* `switch`; a plan change to
|
|
889
|
-
* `
|
|
889
|
+
* `switch`; a plan change to another plan is `schedule_downgrade`, to Basic
|
|
890
|
+
* `cancel` from Plus or Pro and `keep_basic` from Basic or Enterprise (a
|
|
891
|
+
* grandfathered plan): that needs `from`, and throws without it. A scheduled paid change is `schedule_downgrade` for a
|
|
890
892
|
* lower plan or fewer add-ons and `schedule_switch` for yearly to monthly on
|
|
891
893
|
* the same plan: that needs `from` when the target is monthly, and throws
|
|
892
894
|
* without it.
|
|
@@ -1399,6 +1401,7 @@ export declare const billingDecisionSnapshot: z.ZodDiscriminatedUnion<readonly [
|
|
|
1399
1401
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
1400
1402
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
1401
1403
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
1404
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
1402
1405
|
}>;
|
|
1403
1406
|
text: z.ZodString;
|
|
1404
1407
|
action_label: z.ZodString;
|
|
@@ -1488,6 +1491,7 @@ export declare const billingDecisionSnapshot: z.ZodDiscriminatedUnion<readonly [
|
|
|
1488
1491
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
1489
1492
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
1490
1493
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
1494
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
1491
1495
|
}>;
|
|
1492
1496
|
text: z.ZodString;
|
|
1493
1497
|
action_label: z.ZodString;
|
|
@@ -2016,6 +2020,7 @@ export declare const billingDecisionSnapshot: z.ZodDiscriminatedUnion<readonly [
|
|
|
2016
2020
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
2017
2021
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
2018
2022
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
2023
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
2019
2024
|
}>;
|
|
2020
2025
|
text: z.ZodString;
|
|
2021
2026
|
action_label: z.ZodString;
|
|
@@ -3034,6 +3039,7 @@ export declare const storedBillingDecisionSnapshot: z.ZodDiscriminatedUnion<[z.Z
|
|
|
3034
3039
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
3035
3040
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
3036
3041
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
3042
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
3037
3043
|
}>;
|
|
3038
3044
|
text: z.ZodString;
|
|
3039
3045
|
action_label: z.ZodString;
|
|
@@ -3575,6 +3581,7 @@ export declare const storedBillingDecisionSnapshot: z.ZodDiscriminatedUnion<[z.Z
|
|
|
3575
3581
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
3576
3582
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
3577
3583
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
3584
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
3578
3585
|
}>;
|
|
3579
3586
|
text: z.ZodString;
|
|
3580
3587
|
action_label: z.ZodString;
|
|
@@ -4122,6 +4129,7 @@ export declare const storedBillingDecisionSnapshot: z.ZodDiscriminatedUnion<[z.Z
|
|
|
4122
4129
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
4123
4130
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
4124
4131
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
4132
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
4125
4133
|
}>;
|
|
4126
4134
|
text: z.ZodString;
|
|
4127
4135
|
action_label: z.ZodString;
|
|
@@ -4650,6 +4658,7 @@ export declare const billingDecisionDisplayResponse: z.ZodObject<{
|
|
|
4650
4658
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
4651
4659
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
4652
4660
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
4661
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
4653
4662
|
}>;
|
|
4654
4663
|
text: z.ZodString;
|
|
4655
4664
|
action_label: z.ZodString;
|
|
@@ -4739,6 +4748,7 @@ export declare const billingDecisionDisplayResponse: z.ZodObject<{
|
|
|
4739
4748
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
4740
4749
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
4741
4750
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
4751
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
4742
4752
|
}>;
|
|
4743
4753
|
text: z.ZodString;
|
|
4744
4754
|
action_label: z.ZodString;
|
|
@@ -5267,6 +5277,7 @@ export declare const billingDecisionDisplayResponse: z.ZodObject<{
|
|
|
5267
5277
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
5268
5278
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
5269
5279
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
5280
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
5270
5281
|
}>;
|
|
5271
5282
|
text: z.ZodString;
|
|
5272
5283
|
action_label: z.ZodString;
|
|
@@ -6259,6 +6270,7 @@ export declare const planChangePrepareResponse: z.ZodObject<{
|
|
|
6259
6270
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
6260
6271
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
6261
6272
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
6273
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
6262
6274
|
}>;
|
|
6263
6275
|
text: z.ZodString;
|
|
6264
6276
|
action_label: z.ZodString;
|
|
@@ -6348,6 +6360,7 @@ export declare const planChangePrepareResponse: z.ZodObject<{
|
|
|
6348
6360
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
6349
6361
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
6350
6362
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
6363
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
6351
6364
|
}>;
|
|
6352
6365
|
text: z.ZodString;
|
|
6353
6366
|
action_label: z.ZodString;
|
|
@@ -6876,6 +6889,7 @@ export declare const planChangePrepareResponse: z.ZodObject<{
|
|
|
6876
6889
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
6877
6890
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
6878
6891
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
6892
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
6879
6893
|
}>;
|
|
6880
6894
|
text: z.ZodString;
|
|
6881
6895
|
action_label: z.ZodString;
|
|
@@ -8282,6 +8296,7 @@ export declare const checkoutStartResponse: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
8282
8296
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
8283
8297
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
8284
8298
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
8299
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
8285
8300
|
}>;
|
|
8286
8301
|
text: z.ZodString;
|
|
8287
8302
|
action_label: z.ZodString;
|
|
@@ -8371,6 +8386,7 @@ export declare const checkoutStartResponse: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
8371
8386
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
8372
8387
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
8373
8388
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
8389
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
8374
8390
|
}>;
|
|
8375
8391
|
text: z.ZodString;
|
|
8376
8392
|
action_label: z.ZodString;
|
|
@@ -8899,6 +8915,7 @@ export declare const checkoutStartResponse: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
8899
8915
|
"C4-1168-schedule-switch": "C4-1168-schedule-switch";
|
|
8900
8916
|
"C4-1168-schedule-downgrade": "C4-1168-schedule-downgrade";
|
|
8901
8917
|
"C4-1168-cancel": "C4-1168-cancel";
|
|
8918
|
+
"C4-1168-keep-basic": "C4-1168-keep-basic";
|
|
8902
8919
|
}>;
|
|
8903
8920
|
text: z.ZodString;
|
|
8904
8921
|
action_label: z.ZodString;
|
package/dist/billing.js
CHANGED
|
@@ -448,12 +448,14 @@ export function formatEur(cents) {
|
|
|
448
448
|
/**
|
|
449
449
|
* What the owner's one click does: buy a first plan, pay now and switch,
|
|
450
450
|
* switch at no charge, switch from yearly to monthly at the period end,
|
|
451
|
-
* schedule a lower plan (or fewer add-ons),
|
|
451
|
+
* schedule a lower plan (or fewer add-ons), cancel to Basic, or stay on
|
|
452
|
+
* Basic and delete what was not kept.
|
|
452
453
|
*/
|
|
453
|
-
export const C4_ACTIONS = ['checkout', 'pay_and_switch', 'switch', 'schedule_switch', 'schedule_downgrade', 'cancel'];
|
|
454
|
+
export const C4_ACTIONS = ['checkout', 'pay_and_switch', 'switch', 'schedule_switch', 'schedule_downgrade', 'cancel', 'keep_basic'];
|
|
454
455
|
/** The approved sentence of each action, by id, in the order of `C4_ACTIONS`. */
|
|
455
456
|
export const C4_TEXT_IDS = [
|
|
456
457
|
'C4-1168-checkout', 'C4-1168-pay-and-switch', 'C4-1168-switch', 'C4-1168-schedule-switch', 'C4-1168-schedule-downgrade', 'C4-1168-cancel',
|
|
458
|
+
'C4-1168-keep-basic',
|
|
457
459
|
];
|
|
458
460
|
/** The single sentence and button of the displays issued before one existed per action. Readable in stored snapshots only. */
|
|
459
461
|
const LEGACY_C4_TEXT_ID = 'DR-1374-draft-3-C.4';
|
|
@@ -479,6 +481,8 @@ export function c4Declaration(action, v) {
|
|
|
479
481
|
return [`Schedule downgrade to ${plan}`, `you order ${plan} for ${v.org} as a business from the end of the current period, ${legal}, and authorise Fleetless to charge ${gross} every ${period} from then until you cancel.`];
|
|
480
482
|
case 'cancel':
|
|
481
483
|
return ['Cancel at period end', `you cancel ${plan} for ${v.org} at the end of the current period; ${v.org} then stays on Basic under the Terms of Service and the Data Processing Agreement, and nothing more is charged.`];
|
|
484
|
+
case 'keep_basic':
|
|
485
|
+
return ['Delete the rest and stay on Basic', `${v.org} stays on Basic under the Terms of Service and the Data Processing Agreement; what you did not keep is deleted, and nothing is charged.`];
|
|
482
486
|
}
|
|
483
487
|
})();
|
|
484
488
|
return { text_id: C4_TEXT_IDS[C4_ACTIONS.indexOf(action)], text: `By selecting “${label}”, ${rest}`, action_label: label };
|
|
@@ -486,8 +490,9 @@ export function c4Declaration(action, v) {
|
|
|
486
490
|
/**
|
|
487
491
|
* The action of a decision. `checkout` for a first purchase; a paid change
|
|
488
492
|
* charging now is `pay_and_switch`, one taking effect now at no charge
|
|
489
|
-
* `switch`; a plan change to
|
|
490
|
-
* `
|
|
493
|
+
* `switch`; a plan change to another plan is `schedule_downgrade`, to Basic
|
|
494
|
+
* `cancel` from Plus or Pro and `keep_basic` from Basic or Enterprise (a
|
|
495
|
+
* grandfathered plan): that needs `from`, and throws without it. A scheduled paid change is `schedule_downgrade` for a
|
|
491
496
|
* lower plan or fewer add-ons and `schedule_switch` for yearly to monthly on
|
|
492
497
|
* the same plan: that needs `from` when the target is monthly, and throws
|
|
493
498
|
* without it.
|
|
@@ -495,8 +500,14 @@ export function c4Declaration(action, v) {
|
|
|
495
500
|
export function c4ActionOf(s, from) {
|
|
496
501
|
if (s.decision_kind === 'checkout')
|
|
497
502
|
return 'checkout';
|
|
498
|
-
if (s.decision_kind === 'plan_change')
|
|
499
|
-
|
|
503
|
+
if (s.decision_kind === 'plan_change') {
|
|
504
|
+
if (s.selection.plan !== 'basic')
|
|
505
|
+
return 'schedule_downgrade';
|
|
506
|
+
if (from === undefined)
|
|
507
|
+
throw new Error('c4ActionOf: a plan change to Basic needs the current plan to tell a cancellation from keeping Basic');
|
|
508
|
+
const current = typeof from === 'string' ? from : from.plan;
|
|
509
|
+
return current === 'plus' || current === 'pro' ? 'cancel' : 'keep_basic';
|
|
510
|
+
}
|
|
500
511
|
if (s.amounts.due_today_gross_cents > 0)
|
|
501
512
|
return 'pay_and_switch';
|
|
502
513
|
if (s.period.anchor !== 'existing_period' || s.period.effective.mode === 'on_confirmation')
|
|
@@ -512,6 +523,8 @@ export function c4ActionOf(s, from) {
|
|
|
512
523
|
}
|
|
513
524
|
/** Every action a snapshot can carry when the plan it starts from is not known. */
|
|
514
525
|
function c4ActionsOf(s) {
|
|
526
|
+
if (s.decision_kind === 'plan_change' && s.selection.plan === 'basic')
|
|
527
|
+
return ['cancel', 'keep_basic'];
|
|
515
528
|
if (s.decision_kind !== 'paid_change' || s.amounts.due_today_gross_cents > 0
|
|
516
529
|
|| s.period.anchor !== 'existing_period' || s.period.effective.mode === 'on_confirmation')
|
|
517
530
|
return [c4ActionOf(s)];
|
|
@@ -529,6 +542,7 @@ const labelRules = {
|
|
|
529
542
|
'C4-1168-schedule-switch': { const: 'Switch to monthly at period end' },
|
|
530
543
|
'C4-1168-schedule-downgrade': { pattern: '^Schedule downgrade to \\S.*$' },
|
|
531
544
|
'C4-1168-cancel': { const: 'Cancel at period end' },
|
|
545
|
+
'C4-1168-keep-basic': { const: 'Delete the rest and stay on Basic' },
|
|
532
546
|
};
|
|
533
547
|
const declaration = z.object({
|
|
534
548
|
text_id: z.enum(C4_TEXT_IDS).meta({ description: 'The approved sentence this display shows, one per action.' }),
|
package/dist/routes.js
CHANGED
|
@@ -3112,7 +3112,9 @@ export const ROUTES = [
|
|
|
3112
3112
|
audience: 'developer', auth: 'developer', rateLimited: false, ownerTier: true, status: 200,
|
|
3113
3113
|
params: [], query: null, request: planChangePrepareRequest, response: planChangePrepareResponse,
|
|
3114
3114
|
errors: [...DEVELOPER_GUARD, 'tier_required', 'validation_error', 'plan_limit', 'target_state_conflict', 'plan_purchase_closed'], transport: 'http',
|
|
3115
|
-
notes: 'Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT.'
|
|
3115
|
+
notes: 'Owner only. Persists a prepared change reference and a short-lived display, without mutating the plan, pending_change, or legal acceptance. A same-key, same-input retry while undecided returns the same change_id with a fresh display. A Basic cancellation reason belongs only in the final PUT. ' +
|
|
3116
|
+
'A cancellation to Basic never waits for the VAT treatment; a lower paid plan names its gross, so while the account\'s VAT treatment ' +
|
|
3117
|
+
'is unresolved this route and the PUT answer 409 target_state_conflict with `{ field: billing.vat_id, rule: purchase_eligibility_pending }`.',
|
|
3116
3118
|
},
|
|
3117
3119
|
{
|
|
3118
3120
|
method: 'PUT', path: '/api/org/plan/change', section: 'org',
|
|
@@ -3246,7 +3248,8 @@ export const ROUTES = [
|
|
|
3246
3248
|
'intent of this Owner and org. A checkout start already returns its display; this route issues one for a paid change, and a fresh ' +
|
|
3247
3249
|
'one for an intent that is still eligible. `snapshot.declaration` carries the approved sentence of the decision\'s action ' +
|
|
3248
3250
|
'(`text_id`, `text`) and the label of its one button (`action_label`): `Pay 34,51 € with Mollie`, `Pay 95 € and switch`, ' +
|
|
3249
|
-
'`Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus
|
|
3251
|
+
'`Switch to Pro`, `Switch to monthly at period end`, `Schedule downgrade to Plus`, `Cancel at period end` or `Delete the rest and stay on Basic`. ' +
|
|
3252
|
+
'Render both as sent. ' +
|
|
3250
3253
|
'Pending, held, refused or accepted intents cannot mint a new proof. The proof never appears in lookup, billing views or logs.',
|
|
3251
3254
|
},
|
|
3252
3255
|
{
|
|
@@ -3261,11 +3264,16 @@ export const ROUTES = [
|
|
|
3261
3264
|
'org lock. A spent, expired or stale proof answers 409 target_state_conflict with `{ field: confirmation_proof, rule: display_stale }` ' +
|
|
3262
3265
|
'and changes nothing: fetch a fresh display (for a checkout, a new start with a new key) and press again; never resend the click. ' +
|
|
3263
3266
|
'One decision, one legal acceptance and, for a charge, the hosted payment commit in this one request. An exact same-key replay ' +
|
|
3264
|
-
'returns the original result without another payment or acceptance.
|
|
3265
|
-
'may be sent again: the payment is created with the same idempotency key, so at most one exists.
|
|
3267
|
+
'returns the original result without another payment or acceptance. For a checkout, after 502 payment_provider_unavailable the same ' +
|
|
3268
|
+
'key and proof may be sent again within 50 minutes: the payment is created with the same idempotency key, so at most one exists. A ' +
|
|
3269
|
+
'paid change after a 502 answers charge_in_progress until the earlier charge is settled (within about an hour), then the same key ' +
|
|
3270
|
+
'and proof charge once more. While another first payment of ' +
|
|
3266
3271
|
'the org is open, a checkout answers 409 target_state_conflict with `checkoutOpenDetails` (rule `checkout_open`): continue it at ' +
|
|
3267
3272
|
'`checkout_url`. A paid change can return 409 target_state_conflict with field billing and rule charge_in_progress while an ' +
|
|
3268
|
-
'earlier charge is unresolved; it does not start another charge.
|
|
3273
|
+
'earlier charge is unresolved; it does not start another charge. After the Lexware issuer cutover, a paid change that charges ' +
|
|
3274
|
+
'something while the billing details lack a company name or a full address answers 409 target_state_conflict with ' +
|
|
3275
|
+
'`{ field: billing, rule: purchase_eligibility_pending }` before the proof is consumed: nothing is charged until they are complete. ' +
|
|
3276
|
+
'Foreign ownership answers 404 without disclosure; held cannot charge.',
|
|
3269
3277
|
},
|
|
3270
3278
|
{
|
|
3271
3279
|
method: 'GET', path: '/api/billing/checkout/:id', section: 'billing',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetless/contracts",
|
|
3
|
-
"version": "16.0.0
|
|
3
|
+
"version": "16.0.0",
|
|
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",
|