@peable.to/shared-types 0.6.0 → 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/dispute.js +0 -15
- package/dist/cjs/list.js +3 -0
- package/dist/cjs/tax.js +2 -2
- package/dist/esm/dispute.js +0 -15
- package/dist/esm/list.js +2 -0
- package/dist/types/checkoutSession.d.ts +10 -4
- package/dist/types/dispute.d.ts +3 -2
- package/dist/types/index.d.ts +4 -3
- package/dist/types/list.d.ts +52 -0
- package/dist/types/paymentIntent.d.ts +15 -3
- package/dist/types/paymentLink.d.ts +11 -0
- package/dist/types/settlement.d.ts +9 -7
- package/dist/types/tax.d.ts +8 -13
- package/package.json +2 -2
package/dist/cjs/dispute.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* A dispute — the card network holding a settled payment's money while a
|
|
4
|
-
* cardholder contests it.
|
|
5
|
-
*
|
|
6
|
-
* Published because `payment_intent.disputed` and `payment_intent.dispute_closed`
|
|
7
|
-
* carry it as their `data.object`. It was route-local at first, with the webhook
|
|
8
|
-
* carrying the PaymentIntent and the detail reachable only through
|
|
9
|
-
* `GET /v1/payment_intents/:id/disputes`. That was inconsistent with the reason
|
|
10
|
-
* those two events exist: `disputed` is a DEADLINE, and a merchant who has to
|
|
11
|
-
* make a second call to learn when evidence is due is a merchant who can miss it
|
|
12
|
-
* while their integration is working exactly as documented.
|
|
13
|
-
*
|
|
14
|
-
* It is also what the provider does. Stripe's `charge.dispute.created` carries
|
|
15
|
-
* the dispute, not the charge — the parity was half-applied.
|
|
16
|
-
*/
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/cjs/list.js
ADDED
package/dist/cjs/tax.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = void 0;
|
|
2
4
|
/**
|
|
3
5
|
* Peable Tax — the wire contract.
|
|
4
6
|
*
|
|
@@ -11,8 +13,6 @@
|
|
|
11
13
|
*
|
|
12
14
|
* Amounts are integers in the currency's minor unit, like the billing quote.
|
|
13
15
|
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = void 0;
|
|
16
16
|
/** How a registration lets the seller collect. `standard`/`simplified` cover
|
|
17
17
|
* one country; the EU One-Stop-Shop schemes cover every EU member state from
|
|
18
18
|
* one identification state; the US is per state; Canadian PST/QST is per
|
package/dist/esm/dispute.js
CHANGED
|
@@ -1,16 +1 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A dispute — the card network holding a settled payment's money while a
|
|
3
|
-
* cardholder contests it.
|
|
4
|
-
*
|
|
5
|
-
* Published because `payment_intent.disputed` and `payment_intent.dispute_closed`
|
|
6
|
-
* carry it as their `data.object`. It was route-local at first, with the webhook
|
|
7
|
-
* carrying the PaymentIntent and the detail reachable only through
|
|
8
|
-
* `GET /v1/payment_intents/:id/disputes`. That was inconsistent with the reason
|
|
9
|
-
* those two events exist: `disputed` is a DEADLINE, and a merchant who has to
|
|
10
|
-
* make a second call to learn when evidence is due is a merchant who can miss it
|
|
11
|
-
* while their integration is working exactly as documented.
|
|
12
|
-
*
|
|
13
|
-
* It is also what the provider does. Stripe's `charge.dispute.created` carries
|
|
14
|
-
* the dispute, not the charge — the parity was half-applied.
|
|
15
|
-
*/
|
|
16
1
|
export {};
|
package/dist/esm/list.js
ADDED
|
@@ -3,11 +3,13 @@ import type { CurrencyCode } from './money';
|
|
|
3
3
|
import type { NetworkType } from './network';
|
|
4
4
|
import type { MerchantDisplay } from './merchantDisplay';
|
|
5
5
|
import type { PaymentIntent, PaymentIntentRail } from './paymentIntent';
|
|
6
|
+
import type { ConnectedAccount } from './settlement';
|
|
6
7
|
/** The merchant/SDK-facing DTO — returned on create and by merchant retrieve. */
|
|
7
8
|
export interface CheckoutSession {
|
|
8
9
|
id: string;
|
|
9
10
|
object: 'checkout_session';
|
|
10
|
-
|
|
11
|
+
/** The wrapped payment's `pi_…`, or the {@link PaymentIntent} with `expand[]=payment_intent`. */
|
|
12
|
+
payment_intent: string | PaymentIntent;
|
|
11
13
|
/** The wrapped intent's `client_secret`, returned to the merchant on create. */
|
|
12
14
|
client_secret: string;
|
|
13
15
|
amount: string;
|
|
@@ -16,10 +18,10 @@ export interface CheckoutSession {
|
|
|
16
18
|
/** FairCoin rail only; `null` on a card session. */
|
|
17
19
|
network: NetworkType | null;
|
|
18
20
|
/**
|
|
19
|
-
* The seller the wrapped payment is made on behalf of (`ca_
|
|
20
|
-
*
|
|
21
|
+
* The seller the wrapped payment is made on behalf of (`ca_…`, or the
|
|
22
|
+
* object with `expand[]=connected_account`), or `null` (ADR 0012 D5).
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
connected_account: string | ConnectedAccount | null;
|
|
23
25
|
metadata: Record<string, string>;
|
|
24
26
|
success_url?: string;
|
|
25
27
|
cancel_url?: string;
|
|
@@ -58,3 +60,7 @@ export interface CreateCheckoutSessionParams {
|
|
|
58
60
|
/** Pay this seller (`ca_…`) rather than the merchant — see `CreatePaymentIntentParams.connectedAccount`. */
|
|
59
61
|
connected_account?: string;
|
|
60
62
|
}
|
|
63
|
+
/** `POST /v1/checkout_sessions/:id` — the merchant's `metadata`, as a patch. */
|
|
64
|
+
export interface UpdateCheckoutSessionParams {
|
|
65
|
+
metadata?: Record<string, string>;
|
|
66
|
+
}
|
package/dist/types/dispute.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PaymentIntent } from './paymentIntent';
|
|
1
2
|
/**
|
|
2
3
|
* A dispute — the card network holding a settled payment's money while a
|
|
3
4
|
* cardholder contests it.
|
|
@@ -25,8 +26,8 @@ export type DisputeStatus = 'needs_response' | 'under_review' | 'won' | 'lost';
|
|
|
25
26
|
export interface Dispute {
|
|
26
27
|
id: string;
|
|
27
28
|
object: 'dispute';
|
|
28
|
-
/** The
|
|
29
|
-
|
|
29
|
+
/** The disputed payment's `pi_…`, or the {@link PaymentIntent} with `expand[]=payment_intent`. */
|
|
30
|
+
payment_intent: string | PaymentIntent;
|
|
30
31
|
/**
|
|
31
32
|
* Amount in the currency's smallest unit as a canonical integer string —
|
|
32
33
|
* the same encoding every other money field on these contracts uses.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { UNITS_PER_COIN, isBaseUnitString, type CurrencyCode, CURRENCY_CODES, CURRENCY_DECIMALS, decimalsFor, isCurrencyCode, } from './money';
|
|
2
2
|
export type { NetworkType } from './network';
|
|
3
|
-
export
|
|
3
|
+
export type { ExpandParams, List, ListParams, RangeQuery } from './list';
|
|
4
|
+
export { type PaymentIntentStatus, type PaymentIntentRail, type PaymentIntent, type CreatePaymentIntentParams, type UpdatePaymentIntentParams, isValidStatusTransition, canStillBePaid, reachesSettlementFromPayer, POST_SETTLEMENT_STATUSES, PAYMENT_INTENT_STATUSES, PAYMENT_INTENT_RAILS, CHAIN_ONLY_STATUSES, CARD_ONLY_STATUSES, EXPIRABLE_STATUSES, canExpire, } from './paymentIntent';
|
|
4
5
|
export type { WebhookEventType, WebhookEvent, WebhookEventPayload, BillingObservation, } from './event';
|
|
5
6
|
export type { Dispute, DisputeEvidence, DisputeStatus } from './dispute';
|
|
6
7
|
export type { CapabilityStatus, ConnectedAccount, ConnectedAccountFaircoin, ConnectedAccountFaircoinStatus, ConnectedAccountRail, Refund, RefundOrigin, RefundStatus, Settlement, Transfer, TransferReversal, TransferReversalStatus, TransferStatus, TransferWithReversal, } from './settlement';
|
|
@@ -9,8 +10,8 @@ export { signWebhook, verifyWebhook } from './webhookSigner';
|
|
|
9
10
|
export { type MerchantEnvironment, type Merchant, MERCHANT_ENVIRONMENTS, } from './merchant';
|
|
10
11
|
export type { MerchantDisplay } from './merchantDisplay';
|
|
11
12
|
export type { AccountLink, ConnectOnboarding, ConnectOnboardingComplete, RegisterFaircoinKeyParams, } from './connect';
|
|
12
|
-
export type { PaymentLink, PublicPaymentLink, CreatePaymentLinkParams, } from './paymentLink';
|
|
13
|
-
export type { CheckoutSession, CheckoutSessionPublic, CreateCheckoutSessionParams, } from './checkoutSession';
|
|
13
|
+
export type { PaymentLink, PublicPaymentLink, CreatePaymentLinkParams, UpdatePaymentLinkParams, } from './paymentLink';
|
|
14
|
+
export type { CheckoutSession, CheckoutSessionPublic, CreateCheckoutSessionParams, UpdateCheckoutSessionParams, } from './checkoutSession';
|
|
14
15
|
export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, type SocialPaymentSource, type SocialNextAddressRequest, type SocialNextAddressResponse, type SocialReceiveCursorResponse, type SocialPaymentDirection, type SocialPayment, type SocialPaymentsResponse, type EnrichmentKind, type EnrichmentResult, type EnrichRequest, type EnrichResponse, } from './social';
|
|
15
16
|
export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type CreateBillingTaxQuoteParams, type BillingTaxQuote, type BillingInvoiceAuthoritySource, type BillingFinalInvoice, type BillingFinalInvoiceAuthority, type BillingFaircoinRenewalChoice, type BillingFaircoinRenewalConsent, type BillingFaircoinRenewalRevocation, type BillingCheckoutSession, type BillingCheckoutObservation, type RetrieveBillingCheckoutOperationParams, type BillingCheckoutOperationSource, type BillingCheckoutOperationRecovery, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type BillingRail, type BillingRailSettlement, type BillingRailOffer, type BillingRailOption, type BillingRailList, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
|
|
16
17
|
export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One page of a list, newest first.
|
|
3
|
+
*
|
|
4
|
+
* `url` is the path that was listed (`/v1/payment_intents`,
|
|
5
|
+
* `/v1/payment_intents/pi_…/refunds`), so a page carries enough to fetch the
|
|
6
|
+
* next one without the caller remembering where it came from.
|
|
7
|
+
*/
|
|
8
|
+
export interface List<T> {
|
|
9
|
+
object: 'list';
|
|
10
|
+
data: T[];
|
|
11
|
+
/** Whether another page exists in the direction this one was read. */
|
|
12
|
+
has_more: boolean;
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A range over an integer Unix-seconds field, Stripe's `created[gt]=…` form.
|
|
17
|
+
* Each bound is optional; together they are a conjunction.
|
|
18
|
+
*/
|
|
19
|
+
export interface RangeQuery {
|
|
20
|
+
gt?: number;
|
|
21
|
+
gte?: number;
|
|
22
|
+
lt?: number;
|
|
23
|
+
lte?: number;
|
|
24
|
+
}
|
|
25
|
+
/** The parameters every list accepts. A route adds its own filters beside them. */
|
|
26
|
+
export interface ListParams {
|
|
27
|
+
/** 1–100. Default 10. */
|
|
28
|
+
limit?: number;
|
|
29
|
+
/**
|
|
30
|
+
* The id of the LAST object of the previous page: the next page is the
|
|
31
|
+
* objects older than it. Mutually exclusive with `ending_before`.
|
|
32
|
+
*/
|
|
33
|
+
starting_after?: string;
|
|
34
|
+
/**
|
|
35
|
+
* The id of the FIRST object of the current page: the page returned is the
|
|
36
|
+
* objects newer than it, still newest first, with `has_more` saying whether
|
|
37
|
+
* there are newer ones still.
|
|
38
|
+
*/
|
|
39
|
+
ending_before?: string;
|
|
40
|
+
/** Exactly this second (`number`), or a range. Unix seconds. */
|
|
41
|
+
created?: number | RangeQuery;
|
|
42
|
+
/**
|
|
43
|
+
* Expand references into objects, `data.`-prefixed on a list
|
|
44
|
+
* (`['data.payment_intent']`). At most four levels deep.
|
|
45
|
+
*/
|
|
46
|
+
expand?: string[];
|
|
47
|
+
}
|
|
48
|
+
/** The parameter a single read or write accepts to expand its answer. */
|
|
49
|
+
export interface ExpandParams {
|
|
50
|
+
/** Dot paths, at most four levels deep (`['payment_intent.connected_account']`). */
|
|
51
|
+
expand?: string[];
|
|
52
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConnectedAccount } from './settlement';
|
|
1
2
|
import type { CurrencyCode } from './money';
|
|
2
3
|
import type { NetworkType } from './network';
|
|
3
4
|
/**
|
|
@@ -95,10 +96,10 @@ export interface PaymentIntent {
|
|
|
95
96
|
* payment to the merchant itself (ADR 0012 D5). On-behalf payments are
|
|
96
97
|
* FairCoin only, and `address` derives from that seller's own key.
|
|
97
98
|
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
99
|
+
* The seller's `ca_…`, or the {@link ConnectedAccount} itself when the
|
|
100
|
+
* request asked for `expand[]=connected_account`.
|
|
100
101
|
*/
|
|
101
|
-
|
|
102
|
+
connected_account: string | ConnectedAccount | null;
|
|
102
103
|
txid: string | null;
|
|
103
104
|
/** On-chain confirmations. Structurally `0` for the whole life of a card payment. */
|
|
104
105
|
confirmations: number;
|
|
@@ -144,3 +145,14 @@ export interface CreatePaymentIntentParams {
|
|
|
144
145
|
*/
|
|
145
146
|
connected_account?: string;
|
|
146
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* `POST /v1/payment_intents/:id`. Only the merchant's own `metadata` is
|
|
150
|
+
* mutable on an intent: everything else is either the payment itself or the
|
|
151
|
+
* state machine's, which moves only through its own operations.
|
|
152
|
+
*
|
|
153
|
+
* `metadata` is a PATCH: named keys are set, a key sent as `""` is removed,
|
|
154
|
+
* keys not named are kept.
|
|
155
|
+
*/
|
|
156
|
+
export interface UpdatePaymentIntentParams {
|
|
157
|
+
metadata?: Record<string, string>;
|
|
158
|
+
}
|
|
@@ -49,3 +49,14 @@ export interface CreatePaymentLinkParams {
|
|
|
49
49
|
metadata?: Record<string, string>;
|
|
50
50
|
success_url?: string;
|
|
51
51
|
}
|
|
52
|
+
/**
|
|
53
|
+
* `POST /v1/payment_links/:id`. `amount`/`network` are deliberately absent — a
|
|
54
|
+
* link's price is immutable once shared.
|
|
55
|
+
*/
|
|
56
|
+
export interface UpdatePaymentLinkParams {
|
|
57
|
+
active?: boolean;
|
|
58
|
+
/** A patch: named keys are set, `""` removes a key, others are kept. */
|
|
59
|
+
metadata?: Record<string, string>;
|
|
60
|
+
/** `null` removes it. */
|
|
61
|
+
success_url?: string | null;
|
|
62
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CurrencyCode } from './money';
|
|
2
2
|
import type { NetworkType } from './network';
|
|
3
|
+
import type { PaymentIntent } from './paymentIntent';
|
|
3
4
|
/** How a provider reports one capability on a seller's account. */
|
|
4
5
|
export type CapabilityStatus = 'active' | 'pending' | 'inactive';
|
|
5
6
|
/** Where one settlement stands. */
|
|
@@ -98,10 +99,10 @@ export interface Transfer {
|
|
|
98
99
|
object: 'transfer';
|
|
99
100
|
/** The merchant's OWN id for what this settles. Their idempotency. */
|
|
100
101
|
external_ref: string;
|
|
101
|
-
/** The `ca_…`
|
|
102
|
-
|
|
103
|
-
/** The `pi_…` this settlement was funded by
|
|
104
|
-
|
|
102
|
+
/** The seller's `ca_…` — never their account id at the provider — or the object, expanded. */
|
|
103
|
+
connected_account: string | ConnectedAccount;
|
|
104
|
+
/** The `pi_…` this settlement was funded by, or the {@link PaymentIntent}, expanded. */
|
|
105
|
+
payment_intent: string | PaymentIntent;
|
|
105
106
|
amount: string;
|
|
106
107
|
currency: string;
|
|
107
108
|
/**
|
|
@@ -163,8 +164,8 @@ export interface TransferWithReversal extends Transfer {
|
|
|
163
164
|
*/
|
|
164
165
|
export interface Settlement {
|
|
165
166
|
object: 'settlement';
|
|
166
|
-
/** The `pi_…` this describes
|
|
167
|
-
|
|
167
|
+
/** The `pi_…` this describes, or the {@link PaymentIntent} with `expand[]=payment_intent`. */
|
|
168
|
+
payment_intent: string | PaymentIntent;
|
|
168
169
|
/**
|
|
169
170
|
* - `available` — settled; these figures are final.
|
|
170
171
|
* - `pending` — a settlement record exists and is not final yet.
|
|
@@ -198,7 +199,8 @@ export interface Refund {
|
|
|
198
199
|
/** `null` on an IMPORTED refund; see {@link RefundOrigin}. */
|
|
199
200
|
external_ref: string | null;
|
|
200
201
|
origin: RefundOrigin;
|
|
201
|
-
|
|
202
|
+
/** The refunded payment's `pi_…`, or the {@link PaymentIntent} with `expand[]=payment_intent`. */
|
|
203
|
+
payment_intent: string | PaymentIntent;
|
|
202
204
|
amount: string;
|
|
203
205
|
currency: CurrencyCode | string;
|
|
204
206
|
status: RefundStatus;
|
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
|
*
|
|
@@ -239,19 +240,13 @@ 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: number;
|
|
250
|
-
/** Exclusive, Unix seconds. */
|
|
251
|
-
to: number;
|
|
252
|
-
limit?: number;
|
|
253
|
-
starting_after?: 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;
|
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
|
}
|