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