@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
@@ -2,6 +2,76 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
+ "company_name": {
6
+ "type": "string",
7
+ "minLength": 1,
8
+ "maxLength": 200
9
+ },
10
+ "address": {
11
+ "type": "object",
12
+ "properties": {
13
+ "line1": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 200,
17
+ "description": "Street and number, or the first address line."
18
+ },
19
+ "line2": {
20
+ "anyOf": [
21
+ {
22
+ "type": "string",
23
+ "maxLength": 200
24
+ },
25
+ {
26
+ "type": "null"
27
+ }
28
+ ],
29
+ "description": "A second address line, or `null` when there is none."
30
+ },
31
+ "postal_code": {
32
+ "type": "string",
33
+ "minLength": 1,
34
+ "maxLength": 20,
35
+ "description": "Postal or ZIP code."
36
+ },
37
+ "city": {
38
+ "type": "string",
39
+ "minLength": 1,
40
+ "maxLength": 100,
41
+ "description": "City or town."
42
+ },
43
+ "country": {
44
+ "type": "string",
45
+ "pattern": "^[A-Z]{2}$",
46
+ "description": "The billing country, used for purchase eligibility and VAT."
47
+ },
48
+ "state": {
49
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
50
+ "type": "string",
51
+ "minLength": 1,
52
+ "maxLength": 100
53
+ }
54
+ },
55
+ "required": [
56
+ "line1",
57
+ "line2",
58
+ "postal_code",
59
+ "city",
60
+ "country"
61
+ ],
62
+ "additionalProperties": false
63
+ },
64
+ "tax_id": {
65
+ "anyOf": [
66
+ {
67
+ "type": "string",
68
+ "maxLength": 100
69
+ },
70
+ {
71
+ "type": "null"
72
+ }
73
+ ]
74
+ },
5
75
  "invoice_email": {
6
76
  "description": "Replaces the invoice email. Omitted leaves it as it is.",
7
77
  "type": "string",
@@ -25,7 +25,19 @@
25
25
  "type": "null"
26
26
  }
27
27
  ],
28
- "description": "The company's VAT ID, or `null` for none. Required, and must check out through VIES, for a company outside Germany."
28
+ "description": "The company's VAT ID, or `null` for none. Required for a new purchase in another EU country; direct VIES must confirm it with an identifier."
29
+ },
30
+ "tax_id": {
31
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
32
+ "anyOf": [
33
+ {
34
+ "type": "string",
35
+ "maxLength": 100
36
+ },
37
+ {
38
+ "type": "null"
39
+ }
40
+ ]
29
41
  },
30
42
  "address": {
31
43
  "type": "object",
@@ -63,7 +75,13 @@
63
75
  "country": {
64
76
  "type": "string",
65
77
  "pattern": "^[A-Z]{2}$",
66
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
78
+ "description": "The billing country, used for purchase eligibility and VAT."
79
+ },
80
+ "state": {
81
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
82
+ "type": "string",
83
+ "minLength": 1,
84
+ "maxLength": 100
67
85
  }
68
86
  },
69
87
  "required": [
@@ -143,7 +161,13 @@
143
161
  "country": {
144
162
  "type": "string",
145
163
  "pattern": "^[A-Z]{2}$",
146
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
164
+ "description": "The billing country, used for purchase eligibility and VAT."
165
+ },
166
+ "state": {
167
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
168
+ "type": "string",
169
+ "minLength": 1,
170
+ "maxLength": 100
147
171
  }
148
172
  },
149
173
  "required": [
@@ -37,7 +37,19 @@
37
37
  "type": "null"
38
38
  }
39
39
  ],
40
- "description": "The company's VAT ID, or `null` for none. Required, and must check out through VIES, for a company outside Germany."
40
+ "description": "The company's VAT ID, or `null` for none. Required for a new purchase in another EU country; direct VIES must confirm it with an identifier."
41
+ },
42
+ "tax_id": {
43
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
44
+ "anyOf": [
45
+ {
46
+ "type": "string",
47
+ "maxLength": 100
48
+ },
49
+ {
50
+ "type": "null"
51
+ }
52
+ ]
41
53
  },
42
54
  "address": {
43
55
  "type": "object",
@@ -75,7 +87,13 @@
75
87
  "country": {
76
88
  "type": "string",
77
89
  "pattern": "^[A-Z]{2}$",
78
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
90
+ "description": "The billing country, used for purchase eligibility and VAT."
91
+ },
92
+ "state": {
93
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
94
+ "type": "string",
95
+ "minLength": 1,
96
+ "maxLength": 100
79
97
  }
80
98
  },
81
99
  "required": [
@@ -155,7 +173,13 @@
155
173
  "country": {
156
174
  "type": "string",
157
175
  "pattern": "^[A-Z]{2}$",
158
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
176
+ "description": "The billing country, used for purchase eligibility and VAT."
177
+ },
178
+ "state": {
179
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
180
+ "type": "string",
181
+ "minLength": 1,
182
+ "maxLength": 100
159
183
  }
160
184
  },
161
185
  "required": [
@@ -194,7 +218,8 @@
194
218
  "enum": [
195
219
  "valid",
196
220
  "unverified",
197
- "invalid"
221
+ "invalid",
222
+ "unavailable"
198
223
  ]
199
224
  },
200
225
  {
@@ -204,30 +229,37 @@
204
229
  "description": "The payer's VAT ID check, or `null` when no VAT ID was given."
205
230
  },
206
231
  "vat": {
207
- "type": "object",
208
- "properties": {
209
- "treatment": {
210
- "type": "string",
211
- "enum": [
212
- "de_standard",
213
- "reverse_charge",
214
- "outside_eu"
232
+ "anyOf": [
233
+ {
234
+ "type": "object",
235
+ "properties": {
236
+ "treatment": {
237
+ "type": "string",
238
+ "enum": [
239
+ "de_standard",
240
+ "reverse_charge",
241
+ "outside_eu"
242
+ ],
243
+ "description": "How the account is taxed."
244
+ },
245
+ "rate_percent": {
246
+ "type": "integer",
247
+ "minimum": -9007199254740991,
248
+ "maximum": 9007199254740991,
249
+ "description": "The VAT rate, in whole percent."
250
+ }
251
+ },
252
+ "required": [
253
+ "treatment",
254
+ "rate_percent"
215
255
  ],
216
- "description": "How the account is taxed."
256
+ "additionalProperties": false
217
257
  },
218
- "rate_percent": {
219
- "type": "integer",
220
- "minimum": -9007199254740991,
221
- "maximum": 9007199254740991,
222
- "description": "The VAT rate, in whole percent."
258
+ {
259
+ "type": "null"
223
260
  }
224
- },
225
- "required": [
226
- "treatment",
227
- "rate_percent"
228
261
  ],
229
- "additionalProperties": false,
230
- "description": "The VAT treatment and rate this account charges at (`vatFor`)."
262
+ "description": "Recorded VAT treatment; null while the current buyer has no eligible decision. Never infer zero rating from a pending account."
231
263
  },
232
264
  "currency": {
233
265
  "type": "string",
@@ -2,13 +2,19 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "type": "object",
4
4
  "properties": {
5
+ "operation_key": {
6
+ "type": "string",
7
+ "format": "uuid",
8
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$",
9
+ "description": "Client-generated UUID persisted before the start request. Unique per org and reused only for identical input."
10
+ },
5
11
  "plan": {
6
12
  "type": "string",
7
13
  "enum": [
8
14
  "plus",
9
15
  "pro"
10
16
  ],
11
- "description": "The plan to buy."
17
+ "description": "The paid plan to buy; Basic requires no checkout."
12
18
  },
13
19
  "cycle": {
14
20
  "type": "string",
@@ -16,10 +22,10 @@
16
22
  "monthly",
17
23
  "yearly"
18
24
  ],
19
- "description": "Monthly, or yearly at 15 % off."
25
+ "description": "Monthly, or yearly at 15 percent off."
20
26
  },
21
27
  "addons": {
22
- "description": "Add-on counts to buy alongside the plan. Pro only; named on `plus`, or without the feature, `400 validation_error`.",
28
+ "description": "Add-on units to buy; Pro only. Cloud refuses add-ons on Plus.",
23
29
  "type": "object",
24
30
  "properties": {
25
31
  "seats": {
@@ -56,193 +62,123 @@
56
62
  "additionalProperties": false
57
63
  },
58
64
  "billing": {
59
- "oneOf": [
60
- {
61
- "type": "object",
62
- "properties": {
63
- "kind": {
65
+ "type": "object",
66
+ "properties": {
67
+ "kind": {
68
+ "type": "string",
69
+ "const": "company",
70
+ "description": "Billed as a company."
71
+ },
72
+ "company_name": {
73
+ "type": "string",
74
+ "minLength": 1,
75
+ "maxLength": 200,
76
+ "description": "The company's legal name, printed on the invoice."
77
+ },
78
+ "vat_id": {
79
+ "anyOf": [
80
+ {
64
81
  "type": "string",
65
- "const": "company",
66
- "description": "Billed as a company."
82
+ "maxLength": 20
67
83
  },
68
- "company_name": {
84
+ {
85
+ "type": "null"
86
+ }
87
+ ],
88
+ "description": "The company's VAT ID, or `null` for none. Required for a new purchase in another EU country; direct VIES must confirm it with an identifier."
89
+ },
90
+ "tax_id": {
91
+ "description": "Free-text Tax ID. Required for a new non-EU purchase; historical records may omit it.",
92
+ "anyOf": [
93
+ {
94
+ "type": "string",
95
+ "maxLength": 100
96
+ },
97
+ {
98
+ "type": "null"
99
+ }
100
+ ]
101
+ },
102
+ "address": {
103
+ "type": "object",
104
+ "properties": {
105
+ "line1": {
69
106
  "type": "string",
70
107
  "minLength": 1,
71
108
  "maxLength": 200,
72
- "description": "The company's legal name, printed on the invoice."
109
+ "description": "Street and number, or the first address line."
73
110
  },
74
- "vat_id": {
111
+ "line2": {
75
112
  "anyOf": [
76
113
  {
77
114
  "type": "string",
78
- "maxLength": 20
115
+ "maxLength": 200
79
116
  },
80
117
  {
81
118
  "type": "null"
82
119
  }
83
120
  ],
84
- "description": "The company's VAT ID, or `null` for none. Required, and must check out through VIES, for a company outside Germany."
85
- },
86
- "address": {
87
- "type": "object",
88
- "properties": {
89
- "line1": {
90
- "type": "string",
91
- "minLength": 1,
92
- "maxLength": 200,
93
- "description": "Street and number, or the first address line."
94
- },
95
- "line2": {
96
- "anyOf": [
97
- {
98
- "type": "string",
99
- "maxLength": 200
100
- },
101
- {
102
- "type": "null"
103
- }
104
- ],
105
- "description": "A second address line, or `null` when there is none."
106
- },
107
- "postal_code": {
108
- "type": "string",
109
- "minLength": 1,
110
- "maxLength": 20,
111
- "description": "Postal or ZIP code."
112
- },
113
- "city": {
114
- "type": "string",
115
- "minLength": 1,
116
- "maxLength": 100,
117
- "description": "City or town."
118
- },
119
- "country": {
120
- "type": "string",
121
- "pattern": "^[A-Z]{2}$",
122
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
123
- }
124
- },
125
- "required": [
126
- "line1",
127
- "line2",
128
- "postal_code",
129
- "city",
130
- "country"
131
- ],
132
- "additionalProperties": false,
133
- "description": "The billing address."
121
+ "description": "A second address line, or `null` when there is none."
134
122
  },
135
- "invoice_email": {
123
+ "postal_code": {
136
124
  "type": "string",
137
- "format": "email",
138
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
139
- "description": "Where invoices and billing mail are sent."
140
- }
141
- },
142
- "required": [
143
- "kind",
144
- "company_name",
145
- "vat_id",
146
- "address",
147
- "invoice_email"
148
- ],
149
- "additionalProperties": false,
150
- "description": "A company: name and an optional VAT ID, never 'full name'."
151
- },
152
- {
153
- "type": "object",
154
- "properties": {
155
- "kind": {
156
- "type": "string",
157
- "const": "person",
158
- "description": "Billed as a person."
125
+ "minLength": 1,
126
+ "maxLength": 20,
127
+ "description": "Postal or ZIP code."
159
128
  },
160
- "full_name": {
129
+ "city": {
161
130
  "type": "string",
162
131
  "minLength": 1,
163
- "maxLength": 200,
164
- "description": "The person's full name, printed on the invoice."
132
+ "maxLength": 100,
133
+ "description": "City or town."
165
134
  },
166
- "address": {
167
- "type": "object",
168
- "properties": {
169
- "line1": {
170
- "type": "string",
171
- "minLength": 1,
172
- "maxLength": 200,
173
- "description": "Street and number, or the first address line."
174
- },
175
- "line2": {
176
- "anyOf": [
177
- {
178
- "type": "string",
179
- "maxLength": 200
180
- },
181
- {
182
- "type": "null"
183
- }
184
- ],
185
- "description": "A second address line, or `null` when there is none."
186
- },
187
- "postal_code": {
188
- "type": "string",
189
- "minLength": 1,
190
- "maxLength": 20,
191
- "description": "Postal or ZIP code."
192
- },
193
- "city": {
194
- "type": "string",
195
- "minLength": 1,
196
- "maxLength": 100,
197
- "description": "City or town."
198
- },
199
- "country": {
200
- "type": "string",
201
- "pattern": "^[A-Z]{2}$",
202
- "description": "The billing country. Decides VAT (`vatFor`) and currency (`currencyForCountry`)."
203
- }
204
- },
205
- "required": [
206
- "line1",
207
- "line2",
208
- "postal_code",
209
- "city",
210
- "country"
211
- ],
212
- "additionalProperties": false,
213
- "description": "The billing address."
135
+ "country": {
136
+ "type": "string",
137
+ "pattern": "^[A-Z]{2}$",
138
+ "description": "The billing country, used for purchase eligibility and VAT."
214
139
  },
215
- "invoice_email": {
140
+ "state": {
141
+ "description": "State or region. A new US purchase requires a two-letter state code; historical addresses may omit it.",
216
142
  "type": "string",
217
- "format": "email",
218
- "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
219
- "description": "Where invoices and billing mail are sent."
143
+ "minLength": 1,
144
+ "maxLength": 100
220
145
  }
221
146
  },
222
147
  "required": [
223
- "kind",
224
- "full_name",
225
- "address",
226
- "invoice_email"
148
+ "line1",
149
+ "line2",
150
+ "postal_code",
151
+ "city",
152
+ "country"
227
153
  ],
228
154
  "additionalProperties": false,
229
- "description": "A person: a full name, never a VAT ID — only a company can be VAT-registered."
155
+ "description": "The billing address."
156
+ },
157
+ "invoice_email": {
158
+ "type": "string",
159
+ "format": "email",
160
+ "pattern": "^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$",
161
+ "description": "Where invoices and billing mail are sent."
230
162
  }
163
+ },
164
+ "required": [
165
+ "kind",
166
+ "company_name",
167
+ "vat_id",
168
+ "address",
169
+ "invoice_email"
231
170
  ],
232
- "description": "Who is paying, and where the invoice goes."
171
+ "additionalProperties": false,
172
+ "description": "The company buying the plan. Country requirements, current VIES and the email policy must pass before charging."
233
173
  },
234
174
  "accept_terms": {
235
175
  "type": "boolean",
236
176
  "const": true,
237
- "description": "Confirms Fleetless's terms of service. Always required."
238
- },
239
- "accept_withdrawal": {
240
- "description": "Confirms the plan starts at once and the 14-day right of withdrawal ends with it. Required for a person; a company sending it is `400 validation_error` — it has no withdrawal right to confirm.",
241
- "type": "boolean",
242
- "const": true
177
+ "description": "Confirms the terms of service for this purchase."
243
178
  }
244
179
  },
245
180
  "required": [
181
+ "operation_key",
246
182
  "plan",
247
183
  "cycle",
248
184
  "billing",