@peable.to/shared-types 0.14.0 → 0.16.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/account.js +23 -0
- package/dist/cjs/balance.js +39 -0
- package/dist/cjs/branding.js +31 -0
- package/dist/cjs/checkoutSession.js +43 -0
- package/dist/cjs/index.js +32 -2
- package/dist/cjs/paymentLink.js +5 -0
- package/dist/cjs/settlement.js +3 -0
- package/dist/esm/account.js +20 -0
- package/dist/esm/balance.js +36 -0
- package/dist/esm/branding.js +28 -0
- package/dist/esm/checkoutSession.js +42 -1
- package/dist/esm/index.js +6 -0
- package/dist/esm/paymentLink.js +4 -1
- package/dist/esm/settlement.js +2 -1
- package/dist/types/account.d.ts +120 -0
- package/dist/types/balance.d.ts +204 -0
- package/dist/types/branding.d.ts +88 -0
- package/dist/types/charge.d.ts +8 -1
- package/dist/types/checkoutSession.d.ts +418 -39
- package/dist/types/event.d.ts +35 -0
- package/dist/types/index.d.ts +8 -4
- package/dist/types/paymentIntent.d.ts +35 -0
- package/dist/types/paymentLink.d.ts +142 -37
- package/dist/types/settlement.d.ts +39 -12
- package/package.json +1 -1
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { CurrencyCode } from './money';
|
|
2
|
+
import type { List } from './list';
|
|
3
|
+
/** One currency's figure in a balance. */
|
|
4
|
+
export interface BalanceAmount {
|
|
5
|
+
/** Signed base units. */
|
|
6
|
+
amount: string;
|
|
7
|
+
currency: CurrencyCode | string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* `GET /v1/balance` — read from the ledger, per currency.
|
|
11
|
+
*
|
|
12
|
+
* A merchant without a fiat account has NO balance and is told so (404
|
|
13
|
+
* `account_missing`), never shown zeros (ADR 0015 consequences).
|
|
14
|
+
*/
|
|
15
|
+
export interface Balance {
|
|
16
|
+
object: 'balance';
|
|
17
|
+
livemode: boolean;
|
|
18
|
+
/** Payable now: the provider has made these funds available. */
|
|
19
|
+
available: BalanceAmount[];
|
|
20
|
+
/** Not yet available at the provider. */
|
|
21
|
+
pending: BalanceAmount[];
|
|
22
|
+
/**
|
|
23
|
+
* FairCoin received straight into the merchant's own wallet (ADR 0015 §5).
|
|
24
|
+
* Recorded for the merchant's books only: Orbit never held it, so it is never
|
|
25
|
+
* payable and no payout draws on it.
|
|
26
|
+
*/
|
|
27
|
+
informational: BalanceAmount[];
|
|
28
|
+
/** The account (`ca_…`) this balance mirrors; `null` for an Oxy first-party merchant. */
|
|
29
|
+
account: string | null;
|
|
30
|
+
}
|
|
31
|
+
/** Orbit's vocabulary for what moved — the provider's own types, provider-neutral. */
|
|
32
|
+
export declare const BALANCE_TRANSACTION_TYPES: readonly ["charge", "payment", "refund", "payment_refund", "adjustment", "application_fee", "application_fee_refund", "payout", "payout_cancel", "payout_failure", "transfer", "transfer_refund", "dispute", "dispute_reversal", "processing_fee", "faircoin_payment", "faircoin_payment_reversal", "other"];
|
|
33
|
+
export type BalanceTransactionType = (typeof BALANCE_TRANSACTION_TYPES)[number];
|
|
34
|
+
/**
|
|
35
|
+
* - `pending` / `available` — the provider's own status for the funds.
|
|
36
|
+
* - `informational` — a FairCoin payment: recorded, never part of a payable balance.
|
|
37
|
+
*/
|
|
38
|
+
export declare const BALANCE_TRANSACTION_STATUSES: readonly ["available", "pending", "informational"];
|
|
39
|
+
export type BalanceTransactionStatus = (typeof BALANCE_TRANSACTION_STATUSES)[number];
|
|
40
|
+
/** One component of a transaction's fee. `processing_fee` is the acquirer's own. */
|
|
41
|
+
export interface BalanceTransactionFeeDetail {
|
|
42
|
+
amount: string;
|
|
43
|
+
currency: string;
|
|
44
|
+
type: 'application_fee' | 'processing_fee' | 'tax' | 'other';
|
|
45
|
+
}
|
|
46
|
+
export interface BalanceTransaction {
|
|
47
|
+
/** `txn_…` */
|
|
48
|
+
id: string;
|
|
49
|
+
object: 'balance_transaction';
|
|
50
|
+
livemode: boolean;
|
|
51
|
+
/** Gross, signed. */
|
|
52
|
+
amount: string;
|
|
53
|
+
/** What was taken, or `null` when the source gave no figure (never `0` for unknown). */
|
|
54
|
+
fee: string | null;
|
|
55
|
+
/** `amount - fee`, as the provider reports it, or `null` with `fee`. */
|
|
56
|
+
net: string | null;
|
|
57
|
+
currency: string;
|
|
58
|
+
type: BalanceTransactionType;
|
|
59
|
+
/** A coarser grouping for reports (`charge`, `refund`, `payout`, `fee`, …). */
|
|
60
|
+
reporting_category: string;
|
|
61
|
+
status: BalanceTransactionStatus;
|
|
62
|
+
/** When the funds became (or become) available; `null` for an informational entry. */
|
|
63
|
+
available_on: number | null;
|
|
64
|
+
/** When it happened at its source. */
|
|
65
|
+
created: number;
|
|
66
|
+
description: string | null;
|
|
67
|
+
exchange_rate: number | null;
|
|
68
|
+
fee_details: BalanceTransactionFeeDetail[];
|
|
69
|
+
/**
|
|
70
|
+
* The Orbit object that caused it (`ch_…`, `re_…`, `po_…`, `fee_…`, `tr_…`,
|
|
71
|
+
* `pi_…`), or `null` when the provider's source is not an object Orbit holds.
|
|
72
|
+
*/
|
|
73
|
+
source: string | null;
|
|
74
|
+
/** The payout (`po_…`) that paid this transaction out, once known. */
|
|
75
|
+
payout: string | null;
|
|
76
|
+
/** The account (`ca_…`) whose balance it moved; `null` for a first-party merchant. */
|
|
77
|
+
account: string | null;
|
|
78
|
+
}
|
|
79
|
+
/** `GET /v1/balance_transactions` filters, beside the list parameters. */
|
|
80
|
+
export interface ListBalanceTransactionsParams {
|
|
81
|
+
type?: BalanceTransactionType;
|
|
82
|
+
/** `po_…`: only the transactions that payout paid out. */
|
|
83
|
+
payout?: string;
|
|
84
|
+
/** An Orbit object id the transaction was caused by. */
|
|
85
|
+
source?: string;
|
|
86
|
+
currency?: string;
|
|
87
|
+
}
|
|
88
|
+
export declare const PAYOUT_STATUSES: readonly ["pending", "in_transit", "paid", "failed", "canceled"];
|
|
89
|
+
export type PayoutStatus = (typeof PAYOUT_STATUSES)[number];
|
|
90
|
+
/**
|
|
91
|
+
* A payout (`po_…`) — the provider moving the merchant's balance to the
|
|
92
|
+
* merchant's bank. Executed by the provider, always; Orbit instructs (a manual
|
|
93
|
+
* payout) or mirrors (a scheduled one). The bank account itself stays at the
|
|
94
|
+
* provider and is never on this object.
|
|
95
|
+
*/
|
|
96
|
+
export interface Payout {
|
|
97
|
+
id: string;
|
|
98
|
+
object: 'payout';
|
|
99
|
+
livemode: boolean;
|
|
100
|
+
/** The account (`ca_…`) paid out. */
|
|
101
|
+
account: string;
|
|
102
|
+
amount: string;
|
|
103
|
+
currency: string;
|
|
104
|
+
status: PayoutStatus;
|
|
105
|
+
/** When the funds are expected in the bank, as the provider estimates. */
|
|
106
|
+
arrival_date: number | null;
|
|
107
|
+
/** `true` when the provider's schedule created it, `false` for `POST /v1/payouts`. */
|
|
108
|
+
automatic: boolean;
|
|
109
|
+
method: 'standard' | 'instant';
|
|
110
|
+
type: 'bank_account' | 'card';
|
|
111
|
+
description: string | null;
|
|
112
|
+
statement_descriptor: string | null;
|
|
113
|
+
/** The provider's failure code when `failed`; never its prose. */
|
|
114
|
+
failure_code: string | null;
|
|
115
|
+
/** The payout's own `txn_…` once ingested. */
|
|
116
|
+
balance_transaction: string | null;
|
|
117
|
+
metadata: Record<string, string>;
|
|
118
|
+
created: number;
|
|
119
|
+
}
|
|
120
|
+
/** `POST /v1/payouts` — a payout instruction for an account on a manual schedule. */
|
|
121
|
+
export interface CreatePayoutParams {
|
|
122
|
+
amount: string;
|
|
123
|
+
currency: CurrencyCode;
|
|
124
|
+
description?: string;
|
|
125
|
+
statement_descriptor?: string;
|
|
126
|
+
method?: 'standard' | 'instant';
|
|
127
|
+
metadata?: Record<string, string>;
|
|
128
|
+
}
|
|
129
|
+
export interface ListPayoutsParams {
|
|
130
|
+
status?: PayoutStatus;
|
|
131
|
+
}
|
|
132
|
+
/** A refund of an application fee (`fr_…`). */
|
|
133
|
+
export interface FeeRefund {
|
|
134
|
+
id: string;
|
|
135
|
+
object: 'fee_refund';
|
|
136
|
+
amount: string;
|
|
137
|
+
currency: string;
|
|
138
|
+
/** The `fee_…` it refunds. */
|
|
139
|
+
fee: string;
|
|
140
|
+
created: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Orbit's fee on one payment (`fee_…`, ADR 0015 §3), taken by the provider from
|
|
144
|
+
* the merchant's account when the charge succeeded. Created from the provider's
|
|
145
|
+
* own record, never computed after the fact.
|
|
146
|
+
*/
|
|
147
|
+
export interface ApplicationFee {
|
|
148
|
+
id: string;
|
|
149
|
+
object: 'application_fee';
|
|
150
|
+
livemode: boolean;
|
|
151
|
+
/** The account (`ca_…`) the fee was taken from. */
|
|
152
|
+
account: string;
|
|
153
|
+
amount: string;
|
|
154
|
+
amount_refunded: string;
|
|
155
|
+
currency: string;
|
|
156
|
+
/** The `ch_…` it was taken on, when Orbit holds the charge. */
|
|
157
|
+
charge: string | null;
|
|
158
|
+
/** The `pi_…` it was taken on. */
|
|
159
|
+
payment_intent: string;
|
|
160
|
+
/** Refunded in full. */
|
|
161
|
+
refunded: boolean;
|
|
162
|
+
refunds: List<FeeRefund>;
|
|
163
|
+
created: number;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* `GET /v1/reports/payout_reconciliation?payout=po_…` — the balance
|
|
167
|
+
* transactions one payout paid out, with their totals. A list page with the
|
|
168
|
+
* report's fields beside it.
|
|
169
|
+
*/
|
|
170
|
+
export interface PayoutReconciliationReport extends List<BalanceTransaction> {
|
|
171
|
+
payout: string;
|
|
172
|
+
/**
|
|
173
|
+
* `complete` once the payout is `paid` and its transactions were read from
|
|
174
|
+
* the provider; `pending` before — the set is not final and the totals may grow.
|
|
175
|
+
*/
|
|
176
|
+
status: 'complete' | 'pending';
|
|
177
|
+
currency: string;
|
|
178
|
+
/** Over EVERY transaction of the payout, not just this page. */
|
|
179
|
+
summary: {
|
|
180
|
+
count: number;
|
|
181
|
+
amount: string;
|
|
182
|
+
fee: string;
|
|
183
|
+
net: string;
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/** What the daily reconciliation found disagreeing with the provider. Never auto-corrected. */
|
|
187
|
+
export declare const RECONCILIATION_MISMATCH_KINDS: readonly ["missing_in_ledger", "amount_mismatch", "status_mismatch", "missing_at_provider", "payout_mismatch", "unbalanced_journal"];
|
|
188
|
+
export type ReconciliationMismatchKind = (typeof RECONCILIATION_MISMATCH_KINDS)[number];
|
|
189
|
+
export interface ReconciliationMismatch {
|
|
190
|
+
id: string;
|
|
191
|
+
object: 'reconciliation_mismatch';
|
|
192
|
+
livemode: boolean;
|
|
193
|
+
account: string | null;
|
|
194
|
+
kind: ReconciliationMismatchKind;
|
|
195
|
+
/** The Orbit object concerned (`txn_…`, `po_…`), when Orbit holds one. */
|
|
196
|
+
object_id: string | null;
|
|
197
|
+
/** What the provider says (`expected`) against what the ledger holds (`actual`). */
|
|
198
|
+
expected: Record<string, unknown> | null;
|
|
199
|
+
actual: Record<string, unknown> | null;
|
|
200
|
+
detected_at: number;
|
|
201
|
+
last_seen_at: number;
|
|
202
|
+
/** Set when a later run no longer sees the difference. */
|
|
203
|
+
resolved_at: number | null;
|
|
204
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
|
|
2
|
+
export declare const BRANDING_FONTS: readonly ["system", "inter", "roboto", "open_sans", "lato", "source_sans", "noto_sans", "serif", "monospace"];
|
|
3
|
+
export type BrandingFont = (typeof BRANDING_FONTS)[number];
|
|
4
|
+
export declare const BRANDING_BORDER_STYLES: readonly ["rounded", "rectangular", "pill"];
|
|
5
|
+
export type BrandingBorderStyle = (typeof BRANDING_BORDER_STYLES)[number];
|
|
6
|
+
/** `#rrggbb`, lowercase — the only colour spelling branding stores. */
|
|
7
|
+
export declare const BRANDING_COLOR_PATTERN: RegExp;
|
|
8
|
+
/** Peable's defaults, applied wherever a merchant set nothing. */
|
|
9
|
+
export declare const DEFAULT_BRANDING: Readonly<{
|
|
10
|
+
primary_color: "#1f6feb";
|
|
11
|
+
accent_color: "#0b1f33";
|
|
12
|
+
font: BrandingFont;
|
|
13
|
+
border_style: BrandingBorderStyle;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* A merchant's branding settings, as Orbit reads and writes them
|
|
17
|
+
* (`GET|POST /v1/merchants/me/branding`, and the dashboard's twin).
|
|
18
|
+
*/
|
|
19
|
+
export interface MerchantBranding {
|
|
20
|
+
object: 'branding_settings';
|
|
21
|
+
livemode: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The square icon: the merchant's avatar (`avatar_file_id`, an Oxy file
|
|
24
|
+
* Peable already governs), shown when `use_avatar_as_icon` is on.
|
|
25
|
+
*/
|
|
26
|
+
use_avatar_as_icon: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The wide logo: the merchant's `business_logo` — a `file_…` of purpose
|
|
29
|
+
* `business_logo` (Files API) — or `null`. Setting it here and through
|
|
30
|
+
* `POST /v1/merchants/me {business_logo}` is the same write.
|
|
31
|
+
*/
|
|
32
|
+
logo: string | null;
|
|
33
|
+
primary_color: string | null;
|
|
34
|
+
accent_color: string | null;
|
|
35
|
+
font: BrandingFont | null;
|
|
36
|
+
border_style: BrandingBorderStyle | null;
|
|
37
|
+
/**
|
|
38
|
+
* Your terms of service (`https://`). Required before a session or link can
|
|
39
|
+
* ask for terms acceptance (`consent_collection.terms_of_service: required`).
|
|
40
|
+
*/
|
|
41
|
+
terms_of_service_url: string | null;
|
|
42
|
+
updated_at: number | null;
|
|
43
|
+
}
|
|
44
|
+
export interface UpdateMerchantBrandingParams {
|
|
45
|
+
use_avatar_as_icon?: boolean;
|
|
46
|
+
/** A `file_…` of purpose `business_logo`; `null` removes it. */
|
|
47
|
+
logo?: string | null;
|
|
48
|
+
/** `#rrggbb` (any case; stored lowercase), `null` for Peable's default. */
|
|
49
|
+
primary_color?: string | null;
|
|
50
|
+
accent_color?: string | null;
|
|
51
|
+
font?: BrandingFont | null;
|
|
52
|
+
border_style?: BrandingBorderStyle | null;
|
|
53
|
+
/** `https://` only; `null` removes it. */
|
|
54
|
+
terms_of_service_url?: string | null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Branding as a payer surface renders it: every field resolved (defaults
|
|
58
|
+
* filled in), the logo and icon as URLs the gateway built through Oxy's media
|
|
59
|
+
* chokepoint — a withheld file is `null`, never a broken image.
|
|
60
|
+
*/
|
|
61
|
+
export interface CheckoutBranding {
|
|
62
|
+
icon_url: string | null;
|
|
63
|
+
logo_url: string | null;
|
|
64
|
+
primary_color: string;
|
|
65
|
+
accent_color: string;
|
|
66
|
+
font: BrandingFont;
|
|
67
|
+
border_style: BrandingBorderStyle;
|
|
68
|
+
}
|
|
69
|
+
/** Which customer emails Peable sends for this merchant. */
|
|
70
|
+
export interface MerchantEmailSettings {
|
|
71
|
+
object: 'email_settings';
|
|
72
|
+
livemode: boolean;
|
|
73
|
+
/** A receipt when a payment succeeds and it has a `receipt_email` (or a collected email). */
|
|
74
|
+
payment_receipts: boolean;
|
|
75
|
+
/** A notice when a refund succeeds. */
|
|
76
|
+
refund_notices: boolean;
|
|
77
|
+
/** A confirmation when a checkout session completes. */
|
|
78
|
+
checkout_confirmations: boolean;
|
|
79
|
+
/** The reply-to address shown on emails, or `null` for none. */
|
|
80
|
+
support_email: string | null;
|
|
81
|
+
updated_at: number | null;
|
|
82
|
+
}
|
|
83
|
+
export interface UpdateMerchantEmailSettingsParams {
|
|
84
|
+
payment_receipts?: boolean;
|
|
85
|
+
refund_notices?: boolean;
|
|
86
|
+
checkout_confirmations?: boolean;
|
|
87
|
+
support_email?: string | null;
|
|
88
|
+
}
|
package/dist/types/charge.d.ts
CHANGED
|
@@ -47,8 +47,15 @@ export interface Charge {
|
|
|
47
47
|
} | null;
|
|
48
48
|
/** Peable-hosted receipts land with Phase 3; the provider's own URL never reaches the wire. */
|
|
49
49
|
receipt_url: string | null;
|
|
50
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* The ledger's `txn_…` for this charge once the provider's balance
|
|
52
|
+
* transaction was ingested (ADR 0015 §4); `null` until then — never a guess.
|
|
53
|
+
*/
|
|
51
54
|
balance_transaction: string | null;
|
|
55
|
+
/** Orbit's `fee_…` taken on this charge, once the provider created it. */
|
|
56
|
+
application_fee: string | null;
|
|
57
|
+
/** The fee instructed on the payment (`application_fee_amount`), or `null`. */
|
|
58
|
+
application_fee_amount: string | null;
|
|
52
59
|
description: string | null;
|
|
53
60
|
receipt_email: string | null;
|
|
54
61
|
metadata: Record<string, string>;
|