@peable.to/shared-types 0.5.1 → 0.7.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/dist/cjs/billing-authority.js +2 -2
- package/dist/cjs/dispute.js +0 -15
- package/dist/cjs/list.js +3 -0
- package/dist/cjs/tax.js +2 -2
- package/dist/esm/billing-authority.js +2 -2
- package/dist/esm/dispute.js +0 -15
- package/dist/esm/list.js +2 -0
- package/dist/types/billing-authority.d.ts +2 -2
- package/dist/types/billing.d.ts +141 -141
- package/dist/types/checkoutSession.d.ts +22 -16
- package/dist/types/connect.d.ts +6 -6
- package/dist/types/dispute.d.ts +26 -25
- package/dist/types/event.d.ts +5 -5
- package/dist/types/index.d.ts +4 -3
- package/dist/types/list.d.ts +52 -0
- package/dist/types/merchant.d.ts +7 -7
- package/dist/types/merchantDisplay.d.ts +1 -1
- package/dist/types/paymentIntent.d.ts +23 -11
- package/dist/types/paymentLink.d.ts +15 -4
- package/dist/types/settlement.d.ts +41 -39
- package/dist/types/social.d.ts +6 -6
- package/dist/types/tax.d.ts +87 -90
- package/dist/types/webhookDelivery.d.ts +10 -10
- package/package.json +2 -2
package/dist/types/tax.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { List, ListParams } from './list';
|
|
1
2
|
/**
|
|
2
3
|
* Peable Tax — the wire contract.
|
|
3
4
|
*
|
|
@@ -27,7 +28,7 @@ export interface TaxAddress {
|
|
|
27
28
|
country: string;
|
|
28
29
|
/** ISO 3166-2 subdivision without the country prefix (`CA`, `QC`). */
|
|
29
30
|
state?: string | null;
|
|
30
|
-
|
|
31
|
+
postal_code?: string | null;
|
|
31
32
|
city?: string | null;
|
|
32
33
|
line1?: string | null;
|
|
33
34
|
line2?: string | null;
|
|
@@ -44,25 +45,25 @@ export interface TaxCode {
|
|
|
44
45
|
export type TaxCalculationAccount = 'platform' | 'none';
|
|
45
46
|
export interface TaxSettings {
|
|
46
47
|
object: 'tax.settings';
|
|
47
|
-
|
|
48
|
+
merchant_id: string;
|
|
48
49
|
/** `active` once the owner approved; any edit returns it to `draft`. */
|
|
49
50
|
status: 'draft' | 'active';
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
legal_name: string | null;
|
|
52
|
+
head_office: TaxAddress | null;
|
|
53
|
+
default_tax_code: string;
|
|
54
|
+
default_tax_behavior: TaxBehavior;
|
|
55
|
+
calculation_account: TaxCalculationAccount;
|
|
55
56
|
/** The provider that calculates registered sales, when one is reachable. */
|
|
56
57
|
provider: string | null;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
approved_at: number | null;
|
|
59
|
+
approved_by: string | null;
|
|
60
|
+
updated_at: number | null;
|
|
60
61
|
}
|
|
61
62
|
export interface UpdateTaxSettingsParams {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
legal_name?: string | null;
|
|
64
|
+
head_office?: TaxAddress | null;
|
|
65
|
+
default_tax_code?: string;
|
|
66
|
+
default_tax_behavior?: TaxBehavior;
|
|
66
67
|
}
|
|
67
68
|
export interface TaxRegistration {
|
|
68
69
|
object: 'tax.registration';
|
|
@@ -71,38 +72,38 @@ export interface TaxRegistration {
|
|
|
71
72
|
state: string | null;
|
|
72
73
|
scheme: TaxRegistrationScheme;
|
|
73
74
|
/** The government-issued number (VAT id, state permit), when there is one. */
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
registration_number: string | null;
|
|
76
|
+
active_from: number;
|
|
77
|
+
expires_at: number | null;
|
|
77
78
|
/** `pending_approval` until the owner approves; `scheduled` before activeFrom. */
|
|
78
79
|
status: 'pending_approval' | 'scheduled' | 'active' | 'expired';
|
|
79
|
-
|
|
80
|
+
approved_at: number | null;
|
|
80
81
|
/** The mirrored registration at the calculating provider, once synced. */
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
provider_registration_ref: string | null;
|
|
83
|
+
created: number;
|
|
83
84
|
}
|
|
84
85
|
export interface CreateTaxRegistrationParams {
|
|
85
86
|
country: string;
|
|
86
87
|
state?: string | null;
|
|
87
88
|
scheme: TaxRegistrationScheme;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
registration_number?: string | null;
|
|
90
|
+
/** Unix seconds; omitted means immediately on approval. */
|
|
91
|
+
active_from?: number;
|
|
92
|
+
expires_at?: number | null;
|
|
92
93
|
}
|
|
93
94
|
export interface TaxProductCode {
|
|
94
95
|
object: 'tax.product';
|
|
95
96
|
/** The merchant's product or plan reference (a billing `planId`). */
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
product_ref: string;
|
|
98
|
+
tax_code: string;
|
|
99
|
+
updated_at: number;
|
|
99
100
|
}
|
|
100
101
|
export type TaxLocationEvidenceItem = {
|
|
101
102
|
type: 'billing_address';
|
|
102
103
|
address: TaxAddress;
|
|
103
104
|
} | {
|
|
104
105
|
type: 'ip_address';
|
|
105
|
-
|
|
106
|
+
ip_address: string;
|
|
106
107
|
country: string;
|
|
107
108
|
state?: string | null;
|
|
108
109
|
} | {
|
|
@@ -111,13 +112,13 @@ export type TaxLocationEvidenceItem = {
|
|
|
111
112
|
};
|
|
112
113
|
export interface CreateTaxLocationEvidenceParams {
|
|
113
114
|
/** The customer this evidence is about; for billing, the `storeId`. */
|
|
114
|
-
|
|
115
|
+
customer_ref: string;
|
|
115
116
|
evidence: TaxLocationEvidenceItem[];
|
|
116
117
|
}
|
|
117
118
|
export interface TaxLocationEvidence {
|
|
118
119
|
object: 'tax.location_evidence';
|
|
119
120
|
id: string;
|
|
120
|
-
|
|
121
|
+
customer_ref: string;
|
|
121
122
|
/** Only `sufficient` evidence can be calculated against. */
|
|
122
123
|
status: 'sufficient' | 'insufficient' | 'conflicting';
|
|
123
124
|
/** The jurisdiction rule applied, e.g. `eu_digital_two_items`. */
|
|
@@ -129,8 +130,8 @@ export interface TaxLocationEvidence {
|
|
|
129
130
|
country: string;
|
|
130
131
|
state: string | null;
|
|
131
132
|
}[];
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
observed_at: number;
|
|
134
|
+
expires_at: number;
|
|
134
135
|
livemode: boolean;
|
|
135
136
|
}
|
|
136
137
|
export interface TaxLineItemParams {
|
|
@@ -139,39 +140,39 @@ export interface TaxLineItemParams {
|
|
|
139
140
|
amount: number;
|
|
140
141
|
quantity?: number;
|
|
141
142
|
/** Defaults to the product's tax code, then the merchant's default. */
|
|
142
|
-
|
|
143
|
+
tax_code?: string;
|
|
143
144
|
/** Defaults to the merchant's default tax behavior. */
|
|
144
|
-
|
|
145
|
+
tax_behavior?: TaxBehavior;
|
|
145
146
|
}
|
|
146
147
|
export interface CreateTaxCalculationParams {
|
|
147
148
|
currency: string;
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
customer_location_evidence_id: string;
|
|
150
|
+
line_items: TaxLineItemParams[];
|
|
150
151
|
}
|
|
151
152
|
export interface TaxBreakdownEntry {
|
|
152
153
|
country: string;
|
|
153
154
|
state: string | null;
|
|
154
155
|
level: string | null;
|
|
155
|
-
|
|
156
|
-
|
|
156
|
+
display_name: string | null;
|
|
157
|
+
tax_type: string | null;
|
|
157
158
|
/** Decimal string, e.g. `"20.0"`; null when no tax is imposed. */
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
rate_percentage: string | null;
|
|
160
|
+
taxable_amount: number;
|
|
160
161
|
amount: number;
|
|
161
162
|
inclusive: boolean;
|
|
162
163
|
/** Provider reason, or Peable's own `not_registered` / `product_nontaxable`. */
|
|
163
|
-
|
|
164
|
+
taxability_reason: string;
|
|
164
165
|
}
|
|
165
166
|
export interface TaxCalculationLineItem {
|
|
166
167
|
reference: string;
|
|
167
168
|
quantity: number;
|
|
168
|
-
|
|
169
|
-
|
|
169
|
+
tax_code: string;
|
|
170
|
+
tax_behavior: TaxBehavior;
|
|
170
171
|
/** As given: includes tax when inclusive. */
|
|
171
172
|
amount: number;
|
|
172
|
-
|
|
173
|
+
amount_tax: number;
|
|
173
174
|
/** Excluding tax. */
|
|
174
|
-
|
|
175
|
+
amount_net: number;
|
|
175
176
|
breakdown: TaxBreakdownEntry[];
|
|
176
177
|
}
|
|
177
178
|
/** A frozen answer. `collection` says why the tax is what it is:
|
|
@@ -183,31 +184,31 @@ export interface TaxCalculation {
|
|
|
183
184
|
id: string;
|
|
184
185
|
currency: string;
|
|
185
186
|
collection: 'collect' | 'not_registered' | 'nontaxable';
|
|
186
|
-
|
|
187
|
+
registration_id: string | null;
|
|
187
188
|
provider: string | null;
|
|
188
|
-
|
|
189
|
-
|
|
189
|
+
provider_calculation_ref: string | null;
|
|
190
|
+
customer_location_evidence_id: string;
|
|
190
191
|
country: string;
|
|
191
192
|
state: string | null;
|
|
192
193
|
/** What the customer pays. */
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
amount_total: number;
|
|
195
|
+
amount_net: number;
|
|
196
|
+
tax_amount_exclusive: number;
|
|
197
|
+
tax_amount_inclusive: number;
|
|
198
|
+
line_items: TaxCalculationLineItem[];
|
|
199
|
+
tax_date: number;
|
|
200
|
+
created: number;
|
|
201
|
+
expires_at: number;
|
|
201
202
|
livemode: boolean;
|
|
202
203
|
}
|
|
203
204
|
/** What a reversal gave back: the original calculation's amounts, scaled to
|
|
204
205
|
* the refunded share and NEGATIVE (positive only when it reinstates an earlier
|
|
205
206
|
* reversal, e.g. a refund the bank later failed). */
|
|
206
207
|
export interface TaxTransactionReversal {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
amount_total: number;
|
|
209
|
+
amount_net: number;
|
|
210
|
+
tax_amount: number;
|
|
211
|
+
line_items: TaxCalculationLineItem[];
|
|
211
212
|
}
|
|
212
213
|
/** A calculation that was paid. Created by Peable when the payment it priced
|
|
213
214
|
* is accepted on its rail; the report and filings are built from these.
|
|
@@ -219,13 +220,13 @@ export interface TaxTransaction {
|
|
|
219
220
|
object: 'tax.transaction';
|
|
220
221
|
id: string;
|
|
221
222
|
type: 'transaction' | 'reversal';
|
|
222
|
-
|
|
223
|
+
calculation_id: string;
|
|
223
224
|
/** The rail's own object, e.g. the invoice id. */
|
|
224
225
|
reference: string;
|
|
225
226
|
rail: string;
|
|
226
|
-
|
|
227
|
+
committed_at: number;
|
|
227
228
|
/** The original transaction's id, for a reversal. */
|
|
228
|
-
|
|
229
|
+
reversal_of: string | null;
|
|
229
230
|
reversal: TaxTransactionReversal | null;
|
|
230
231
|
calculation: TaxCalculation;
|
|
231
232
|
}
|
|
@@ -239,50 +240,46 @@ export interface CreateTaxReversalParams {
|
|
|
239
240
|
* that is not yet reversed. */
|
|
240
241
|
amount?: number;
|
|
241
242
|
}
|
|
242
|
-
export
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
from: string;
|
|
250
|
-
/** Exclusive ISO timestamp. */
|
|
251
|
-
to: string;
|
|
252
|
-
limit?: number;
|
|
253
|
-
startingAfter?: string;
|
|
254
|
-
}
|
|
243
|
+
export type TaxTransactionList = List<TaxTransaction>;
|
|
244
|
+
/**
|
|
245
|
+
* `GET /v1/tax/transactions`. `created` filters on `committed_at` — the tax
|
|
246
|
+
* date a filing period is judged by — and the list is newest first, like every
|
|
247
|
+
* other list.
|
|
248
|
+
*/
|
|
249
|
+
export type ListTaxTransactionsParams = Omit<ListParams, 'expand'>;
|
|
255
250
|
/** One filing line: totals per jurisdiction, registration, tax type and rate. */
|
|
256
251
|
export interface TaxReportRow {
|
|
257
252
|
country: string;
|
|
258
253
|
state: string | null;
|
|
259
|
-
|
|
254
|
+
registration_id: string | null;
|
|
260
255
|
scheme: TaxRegistrationScheme | null;
|
|
261
256
|
collection: TaxCalculation['collection'];
|
|
262
|
-
|
|
263
|
-
|
|
257
|
+
tax_type: string | null;
|
|
258
|
+
rate_percentage: string | null;
|
|
264
259
|
currency: string;
|
|
265
260
|
transactions: number;
|
|
266
|
-
/** Reversals netted into this row; `
|
|
261
|
+
/** Reversals netted into this row; `taxable_amount` and `tax_amount` are net. */
|
|
267
262
|
reversals: number;
|
|
268
|
-
|
|
269
|
-
|
|
263
|
+
taxable_amount: number;
|
|
264
|
+
tax_amount: number;
|
|
270
265
|
}
|
|
271
266
|
export interface TaxReport {
|
|
272
267
|
object: 'tax.report';
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
/** Inclusive, Unix seconds. */
|
|
269
|
+
from: number;
|
|
270
|
+
/** Exclusive, Unix seconds. */
|
|
271
|
+
to: number;
|
|
275
272
|
rows: TaxReportRow[];
|
|
276
273
|
}
|
|
277
274
|
/** One tax line on a signed final invoice (`include: ['tax_lines']`). */
|
|
278
275
|
export interface BillingInvoiceTaxLine {
|
|
279
|
-
|
|
276
|
+
calculation_id: string;
|
|
280
277
|
country: string;
|
|
281
278
|
state: string | null;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
279
|
+
tax_type: string | null;
|
|
280
|
+
rate_percentage: string | null;
|
|
281
|
+
taxable_minor_units: number;
|
|
282
|
+
tax_minor_units: number;
|
|
286
283
|
inclusive: boolean;
|
|
287
|
-
|
|
284
|
+
taxability_reason: string;
|
|
288
285
|
}
|
|
@@ -22,7 +22,7 @@ export type WebhookDeliveryStatus = 'pending' | 'delivered' | 'failed' | 'dead';
|
|
|
22
22
|
export interface WebhookDelivery {
|
|
23
23
|
id: string;
|
|
24
24
|
object: 'webhook_delivery';
|
|
25
|
-
|
|
25
|
+
merchant_id: string;
|
|
26
26
|
/**
|
|
27
27
|
* The `pi_…` this delivery is about — `null` when the event is not about a
|
|
28
28
|
* payment.
|
|
@@ -32,20 +32,20 @@ export interface WebhookDelivery {
|
|
|
32
32
|
* which is worse than a null: a consumer correlating on it would attach a
|
|
33
33
|
* seller's readiness change to a payment that has nothing to do with it.
|
|
34
34
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
intent_id: string | null;
|
|
36
|
+
event_id: string;
|
|
37
|
+
event_type: WebhookEventType;
|
|
38
38
|
url: string;
|
|
39
39
|
attempts: number;
|
|
40
40
|
delivered: boolean;
|
|
41
|
-
|
|
41
|
+
last_status: WebhookDeliveryStatus;
|
|
42
42
|
/**
|
|
43
43
|
* Why the last attempt did not succeed — operator-facing, never a secret.
|
|
44
44
|
* Absent while pending with no attempts, and after a success.
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
/** When the next attempt is due,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
last_error?: string;
|
|
47
|
+
/** When the next attempt is due, Unix seconds. Absent once the delivery is terminal. */
|
|
48
|
+
next_attempt_at?: number;
|
|
49
|
+
created: number;
|
|
50
|
+
updated_at: number;
|
|
51
51
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peable.to/shared-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Shared TypeScript types for the Peable Gateway — the wire contract shared by the backend, SDK, and frontend.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -74,6 +74,6 @@
|
|
|
74
74
|
"@types/bun": "latest"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@peable.to/contracts": "0.
|
|
77
|
+
"@peable.to/contracts": "0.4.0"
|
|
78
78
|
}
|
|
79
79
|
}
|