@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.
@@ -71,10 +71,10 @@ export type WebhookEventType = 'payment_intent.confirming' | 'payment_intent.set
71
71
  /** Wake-up only. Re-read the owner-bound SDK resource; this is never paid or grant authority. */
72
72
  export interface BillingObservation {
73
73
  object: 'billing_observation';
74
- resourceKind: 'subscription' | 'invoice';
75
- resourceId: string;
74
+ resource_kind: 'subscription' | 'invoice';
75
+ resource_id: string;
76
76
  revision: number;
77
- observedAt: string;
77
+ observed_at: number;
78
78
  }
79
79
  export interface WebhookEventPayload {
80
80
  'billing.observation.updated': BillingObservation;
@@ -97,7 +97,7 @@ export interface WebhookEventPayload {
97
97
  *
98
98
  * ```ts
99
99
  * if (event.type === 'payment_intent.disputed') {
100
- * event.data.object.evidenceDueAt; // Dispute, not PaymentIntent
100
+ * event.data.object.evidence_due_at; // Dispute, not PaymentIntent
101
101
  * }
102
102
  * ```
103
103
  *
@@ -116,7 +116,7 @@ export type WebhookEvent<K extends WebhookEventType = WebhookEventType> = {
116
116
  id: string;
117
117
  object: 'event';
118
118
  type: T;
119
- created: string;
119
+ created: number;
120
120
  /**
121
121
  * The connected account (`ca_…`) this event is about — Stripe's
122
122
  * `event.account` (ADR 0012 D7). Present on every event for an on-behalf
@@ -4,7 +4,7 @@ export type MerchantEnvironment = (typeof MERCHANT_ENVIRONMENTS)[number];
4
4
  export interface Merchant {
5
5
  id: string;
6
6
  object: 'merchant';
7
- oxyAppId: string;
7
+ oxy_app_id: string;
8
8
  environment: MerchantEnvironment;
9
9
  /**
10
10
  * The FairCoin chain this merchant accepts on — `null` on a CARD-ONLY
@@ -18,17 +18,20 @@ export interface Merchant {
18
18
  network: NetworkType | null;
19
19
  /** `null` on a card-only merchant. Nullable together with `network`. */
20
20
  xpub: string | null;
21
- webhookUrl?: string;
22
- requiredConfirmations: number;
21
+ webhook_url?: string;
22
+ required_confirmations: number;
23
23
  /**
24
24
  * Payer-facing branding. Absent when unset — `MerchantDisplay` is what a
25
25
  * payer surface renders, and it substitutes a neutral fallback; these are
26
26
  * the raw values the merchant owns.
27
27
  */
28
- displayName?: string;
29
- /** Bare Oxy file id, not a URL. `MerchantDisplay.avatarUrl` resolves it. */
30
- avatarFileId?: string;
28
+ display_name?: string;
29
+ /**
30
+ * Bare Oxy file id, not a URL. `MerchantDisplay.avatarUrl` resolves it.
31
+ * Absent again once Oxy reports the file deleted or taken down.
32
+ */
33
+ avatar_file_id?: string;
31
34
  description?: string;
32
- createdAt: string;
33
- updatedAt: string;
35
+ created: number;
36
+ updated_at: number;
34
37
  }
@@ -2,6 +2,6 @@ export interface MerchantDisplay {
2
2
  /** `Merchant.displayName`, or a neutral fallback when unset. */
3
3
  name: string;
4
4
  /** Resolved server-side via the canonical media chokepoint; `null` when the merchant has no avatar. */
5
- avatarUrl: string | null;
5
+ avatar_url: string | null;
6
6
  description: string | null;
7
7
  }
@@ -89,7 +89,7 @@ export interface PaymentIntent {
89
89
  * FairCoin rail only; `null` on a card payment, which reserves no address.
90
90
  */
91
91
  address: string | null;
92
- merchantId: string;
92
+ merchant_id: string;
93
93
  /**
94
94
  * The seller this payment is made ON BEHALF OF (`ca_…`), or `null` for a
95
95
  * payment to the merchant itself (ADR 0012 D5). On-behalf payments are
@@ -98,17 +98,17 @@ export interface PaymentIntent {
98
98
  * Optional in the type only so fixtures written against earlier versions
99
99
  * still compile; a gateway at this version always sends it.
100
100
  */
101
- connectedAccountId?: string | null;
101
+ connected_account_id?: string | null;
102
102
  txid: string | null;
103
103
  /** On-chain confirmations. Structurally `0` for the whole life of a card payment. */
104
104
  confirmations: number;
105
- clientSecret: string;
105
+ client_secret: string;
106
106
  metadata: Record<string, string>;
107
107
  /**
108
108
  * When an UNPAID intent expires. Meaningful only while {@link canExpire}
109
109
  * is true for `status` — see `canExpire` below.
110
110
  */
111
- expiresAt: string;
111
+ expires_at: number;
112
112
  /**
113
113
  * Whether this intent can still expire (ADR 0012 D9). `false` once the payer
114
114
  * has reported a broadcast: a FairCoin payment that is `broadcast` or
@@ -117,9 +117,9 @@ export interface PaymentIntent {
117
117
  * Optional in the type only for fixtures written against earlier versions;
118
118
  * a gateway at this version always sends it.
119
119
  */
120
- canExpire?: boolean;
121
- createdAt: string;
122
- updatedAt: string;
120
+ can_expire?: boolean;
121
+ created: number;
122
+ updated_at: number;
123
123
  }
124
124
  export interface CreatePaymentIntentParams {
125
125
  /** Amount in the currency's smallest unit, as a canonical integer string. */
@@ -134,7 +134,7 @@ export interface CreatePaymentIntentParams {
134
134
  /** Defaults to `'FAIR'` on the faircoin rail; required on the card rail. */
135
135
  currency?: CurrencyCode;
136
136
  metadata?: Record<string, string>;
137
- expiresInSeconds?: number;
137
+ expires_in_seconds?: number;
138
138
  /**
139
139
  * Create the payment ON BEHALF OF this connected account (`ca_…`) — the
140
140
  * address derives from the seller's own key and the coins go straight to
@@ -142,5 +142,5 @@ export interface CreatePaymentIntentParams {
142
142
  * is refused. The account's FairCoin half must be `active` and `network`
143
143
  * must be the account's network.
144
144
  */
145
- connectedAccount?: string;
145
+ connected_account?: string;
146
146
  }
@@ -20,11 +20,11 @@ export interface PaymentLink {
20
20
  active: boolean;
21
21
  metadata: Record<string, string>;
22
22
  /** Optional post-payment redirect target for the checkout page. */
23
- successUrl?: string;
23
+ success_url?: string;
24
24
  /** Canonical `checkout.peable.to/l/<id>` URL. */
25
25
  url: string;
26
- createdAt: string;
27
- updatedAt: string;
26
+ created: number;
27
+ updated_at: number;
28
28
  }
29
29
  /** What an unauthenticated checkout-page visitor may see — no secrets, no metadata. */
30
30
  export interface PublicPaymentLink {
@@ -47,5 +47,5 @@ export interface CreatePaymentLinkParams {
47
47
  /** Defaults to `'FAIR'` on the faircoin rail; required on the card rail. */
48
48
  currency?: CurrencyCode;
49
49
  metadata?: Record<string, string>;
50
- successUrl?: string;
50
+ success_url?: string;
51
51
  }
@@ -35,15 +35,15 @@ export interface ConnectedAccountFaircoin {
35
35
  network: NetworkType;
36
36
  status: ConnectedAccountFaircoinStatus;
37
37
  /** The Oxy user who may register the key — and, once `active`, who did. */
38
- oxyUserId: string;
38
+ oxy_user_id: string;
39
39
  /** When the seller registered their key. `null` while `pending`. */
40
- registeredAt: string | null;
40
+ registered_at: number | null;
41
41
  }
42
42
  export interface ConnectedAccount {
43
43
  id: string;
44
44
  object: 'connected_account';
45
45
  /** The merchant's OWN id for this seller — how they address it. */
46
- externalRef: string;
46
+ external_ref: string;
47
47
  /** Which halves this account has. Never empty. */
48
48
  rails: readonly ConnectedAccountRail[];
49
49
  /**
@@ -57,7 +57,7 @@ export interface ConnectedAccount {
57
57
  * no card half and was never asked for one (ADR 0012 D1).
58
58
  */
59
59
  country: string | null;
60
- defaultCurrency: string | null;
60
+ default_currency: string | null;
61
61
  /**
62
62
  * Whether this seller can receive a CARD settlement (a transfer) right now.
63
63
  * Always `false` on a FairCoin-only seller.
@@ -68,40 +68,40 @@ export interface ConnectedAccount {
68
68
  * question that belongs to the merchant.
69
69
  */
70
70
  payable: boolean;
71
- payoutsEnabled: boolean;
72
- chargesEnabled: boolean;
71
+ payouts_enabled: boolean;
72
+ charges_enabled: boolean;
73
73
  /**
74
74
  * `null` means the capability was never REQUESTED, which is a different fact
75
75
  * from the provider declining it (`inactive`). Collapsing the two makes "why
76
76
  * is this seller stuck" unanswerable.
77
77
  */
78
- transfersCapability: CapabilityStatus | null;
79
- cardPaymentsCapability: CapabilityStatus | null;
78
+ transfers_capability: CapabilityStatus | null;
79
+ card_payments_capability: CapabilityStatus | null;
80
80
  /**
81
81
  * COUNTS of outstanding requirements, never the requirements themselves and
82
82
  * never their values. The gateway records that a seller owes a document; it
83
83
  * does not learn what the document says.
84
84
  */
85
85
  requirements: {
86
- currentlyDue: number;
87
- eventuallyDue: number;
88
- pastDue: number;
89
- pendingVerification: number;
86
+ currently_due: number;
87
+ eventually_due: number;
88
+ past_due: number;
89
+ pending_verification: number;
90
90
  };
91
- disabledReasonCodes: readonly string[];
92
- lastSyncedAt: string | null;
93
- createdAt: string;
94
- updatedAt: string;
91
+ disabled_reason_codes: readonly string[];
92
+ last_synced_at: number | null;
93
+ created: number;
94
+ updated_at: number;
95
95
  }
96
96
  export interface Transfer {
97
97
  id: string;
98
98
  object: 'transfer';
99
99
  /** The merchant's OWN id for what this settles. Their idempotency. */
100
- externalRef: string;
100
+ external_ref: string;
101
101
  /** The `ca_…` of the seller — never their account id at the provider. */
102
- connectedAccountId: string;
102
+ connected_account_id: string;
103
103
  /** The `pi_…` this settlement was funded by — never an internal primary key. */
104
- paymentIntentId: string;
104
+ payment_intent_id: string;
105
105
  amount: string;
106
106
  currency: string;
107
107
  /**
@@ -111,11 +111,11 @@ export interface Transfer {
111
111
  * add up reversals it may not have all seen, which is why this is the
112
112
  * provider's own total rather than a sum of the reversals below.
113
113
  */
114
- amountReversed: string;
114
+ amount_reversed: string;
115
115
  status: TransferStatus;
116
- failureMessage: string | null;
117
- createdAt: string;
118
- updatedAt: string;
116
+ failure_message: string | null;
117
+ created: number;
118
+ updated_at: number;
119
119
  }
120
120
  /**
121
121
  * One reversal operation, returned beside the settlement it acted on.
@@ -128,12 +128,12 @@ export interface TransferReversal {
128
128
  id: string;
129
129
  object: 'transfer_reversal';
130
130
  /** The merchant's own id for this reversal — their `Idempotency-Key`. */
131
- externalRef: string;
131
+ external_ref: string;
132
132
  amount: string;
133
133
  currency: string;
134
134
  status: TransferReversalStatus;
135
- failureMessage: string | null;
136
- createdAt: string;
135
+ failure_message: string | null;
136
+ created: number;
137
137
  }
138
138
  /** What `POST /v1/transfers/:id/reversals` answers: the transfer, and the leg. */
139
139
  export interface TransferWithReversal extends Transfer {
@@ -164,7 +164,7 @@ export interface TransferWithReversal extends Transfer {
164
164
  export interface Settlement {
165
165
  object: 'settlement';
166
166
  /** The `pi_…` this describes. */
167
- paymentIntentId: string;
167
+ payment_intent_id: string;
168
168
  /**
169
169
  * - `available` — settled; these figures are final.
170
170
  * - `pending` — a settlement record exists and is not final yet.
@@ -177,10 +177,10 @@ export interface Settlement {
177
177
  net: string | null;
178
178
  /** The SETTLEMENT currency, which may differ from the payment's. */
179
179
  currency: string | null;
180
- /** When the funds become available, ISO-8601. */
181
- availableOn: string | null;
180
+ /** When the funds become available, Unix seconds. */
181
+ available_on: number | null;
182
182
  /** Present only when a conversion happened. `null` is not a rate of 1. */
183
- exchangeRate: number | null;
183
+ exchange_rate: number | null;
184
184
  }
185
185
  /** Where one refund stands — the MONEY's own lifecycle, not the payment's. */
186
186
  export type RefundStatus = 'pending' | 'succeeded' | 'failed';
@@ -196,9 +196,9 @@ export interface Refund {
196
196
  id: string;
197
197
  object: 'refund';
198
198
  /** `null` on an IMPORTED refund; see {@link RefundOrigin}. */
199
- externalRef: string | null;
199
+ external_ref: string | null;
200
200
  origin: RefundOrigin;
201
- paymentIntentId: string;
201
+ payment_intent_id: string;
202
202
  amount: string;
203
203
  currency: CurrencyCode | string;
204
204
  status: RefundStatus;
@@ -210,8 +210,8 @@ export interface Refund {
210
210
  * them re-read the intent is a round trip whose answer can move on before it
211
211
  * arrives.
212
212
  */
213
- paymentStatus: string;
214
- failureCode: string | null;
215
- createdAt: string;
216
- updatedAt: string;
213
+ payment_status: string;
214
+ failure_code: string | null;
215
+ created: number;
216
+ updated_at: number;
217
217
  }
@@ -78,7 +78,7 @@ export interface SocialReceiveCursorResponse {
78
78
  * `SOCIAL_RECEIVE_FIRST_FRESH_INDEX - 1`, since index 0 itself is the
79
79
  * caller's stable default address and is never reserved through this flow.
80
80
  */
81
- reservedThrough: number;
81
+ reserved_through: number;
82
82
  /**
83
83
  * The identity public key (hex) those addresses were derived from, as the
84
84
  * backend saw it. A device compares it with the key it derives from itself:
@@ -88,7 +88,7 @@ export interface SocialReceiveCursorResponse {
88
88
  * `null` means exactly one thing: this caller has no cursor, so no address
89
89
  * has ever been reserved for them. Every cursor that exists names its key.
90
90
  */
91
- identityPublicKey: string | null;
91
+ identity_public_key: string | null;
92
92
  }
93
93
  /** Where a transaction's counterparty identity came from (spec §4.8). */
94
94
  export type EnrichmentKind = 'merchant' | 'user' | 'unknown';
@@ -100,9 +100,9 @@ export type EnrichmentKind = 'merchant' | 'user' | 'unknown';
100
100
  export interface EnrichmentResult {
101
101
  kind: EnrichmentKind;
102
102
  /** Merchant name or user's `name.displayName ?? handle`. */
103
- displayName?: string;
103
+ display_name?: string;
104
104
  /** Bare Oxy file id — render via the canonical media chokepoint, never a URL. */
105
- avatarFileId?: string;
105
+ avatar_file_id?: string;
106
106
  /** Present for `kind: 'user'` only. */
107
107
  username?: string;
108
108
  /** Present for `kind: 'merchant'` only. */
@@ -151,8 +151,8 @@ export interface SocialPayment {
151
151
  * than dropping the payment.
152
152
  */
153
153
  source?: SocialPaymentSource;
154
- /** ISO-8601. When the address was minted, which is when the payment was set up. */
155
- createdAt: string;
154
+ /** Unix seconds. When the address was minted, which is when the payment was set up. */
155
+ created: number;
156
156
  }
157
157
  /** Response of `GET /v1/social/me/payments`, newest first. */
158
158
  export interface SocialPaymentsResponse {