@peable.to/shared-types 0.14.0 → 0.15.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/index.js +12 -2
- package/dist/cjs/settlement.js +3 -0
- package/dist/esm/account.js +20 -0
- package/dist/esm/balance.js +36 -0
- package/dist/esm/index.js +3 -0
- 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/charge.d.ts +8 -1
- package/dist/types/event.d.ts +19 -0
- package/dist/types/index.d.ts +5 -2
- package/dist/types/paymentIntent.d.ts +35 -0
- package/dist/types/settlement.d.ts +39 -12
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// The merchant's fiat account (ADR 0015 §1) — `GET /v1/account`.
|
|
3
|
+
//
|
|
4
|
+
// Orbit's funds never reach a Peable bank account: a merchant that takes fiat
|
|
5
|
+
// has its OWN provider account, opened and onboarded through Peable, and this
|
|
6
|
+
// object mirrors it. Everything here is what the provider last reported; the
|
|
7
|
+
// provider is the authority and Orbit never decides readiness itself.
|
|
8
|
+
//
|
|
9
|
+
// A marketplace's sellers (`/v1/connected_accounts`) are provider accounts too,
|
|
10
|
+
// and a platform reads one of them in this same shape by sending
|
|
11
|
+
// `Peable-Account: ca_…` to `GET /v1/account`.
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.PAYOUT_WEEKLY_ANCHORS = exports.PAYOUT_INTERVALS = void 0;
|
|
14
|
+
exports.PAYOUT_INTERVALS = ['manual', 'daily', 'weekly', 'monthly'];
|
|
15
|
+
exports.PAYOUT_WEEKLY_ANCHORS = [
|
|
16
|
+
'monday',
|
|
17
|
+
'tuesday',
|
|
18
|
+
'wednesday',
|
|
19
|
+
'thursday',
|
|
20
|
+
'friday',
|
|
21
|
+
'saturday',
|
|
22
|
+
'sunday',
|
|
23
|
+
];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RECONCILIATION_MISMATCH_KINDS = exports.PAYOUT_STATUSES = exports.BALANCE_TRANSACTION_STATUSES = exports.BALANCE_TRANSACTION_TYPES = void 0;
|
|
4
|
+
/** Orbit's vocabulary for what moved — the provider's own types, provider-neutral. */
|
|
5
|
+
exports.BALANCE_TRANSACTION_TYPES = [
|
|
6
|
+
'charge',
|
|
7
|
+
'payment',
|
|
8
|
+
'refund',
|
|
9
|
+
'payment_refund',
|
|
10
|
+
'adjustment',
|
|
11
|
+
'application_fee',
|
|
12
|
+
'application_fee_refund',
|
|
13
|
+
'payout',
|
|
14
|
+
'payout_cancel',
|
|
15
|
+
'payout_failure',
|
|
16
|
+
'transfer',
|
|
17
|
+
'transfer_refund',
|
|
18
|
+
'dispute',
|
|
19
|
+
'dispute_reversal',
|
|
20
|
+
'processing_fee',
|
|
21
|
+
'faircoin_payment',
|
|
22
|
+
'faircoin_payment_reversal',
|
|
23
|
+
'other',
|
|
24
|
+
];
|
|
25
|
+
/**
|
|
26
|
+
* - `pending` / `available` — the provider's own status for the funds.
|
|
27
|
+
* - `informational` — a FairCoin payment: recorded, never part of a payable balance.
|
|
28
|
+
*/
|
|
29
|
+
exports.BALANCE_TRANSACTION_STATUSES = ['available', 'pending', 'informational'];
|
|
30
|
+
exports.PAYOUT_STATUSES = ['pending', 'in_transit', 'paid', 'failed', 'canceled'];
|
|
31
|
+
/** What the daily reconciliation found disagreeing with the provider. Never auto-corrected. */
|
|
32
|
+
exports.RECONCILIATION_MISMATCH_KINDS = [
|
|
33
|
+
'missing_in_ledger',
|
|
34
|
+
'amount_mismatch',
|
|
35
|
+
'status_mismatch',
|
|
36
|
+
'missing_at_provider',
|
|
37
|
+
'payout_mismatch',
|
|
38
|
+
'unbalanced_journal',
|
|
39
|
+
];
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = exports.PEABLE_BILLING_AUTHORITY_KEYS = exports.canonicalBillingTaxQuote = exports.canonicalBillingAuthority = exports.BILLING_SUBSCRIPTION_STATUSES = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.MERCHANT_ENVIRONMENTS = void 0;
|
|
3
|
+
exports.PAYOUT_STATUSES = exports.BALANCE_TRANSACTION_TYPES = exports.BALANCE_TRANSACTION_STATUSES = exports.PAYOUT_WEEKLY_ANCHORS = exports.PAYOUT_INTERVALS = exports.PAYMENT_METHOD_CURRENCIES = exports.PAYMENT_METHOD_CONFIGURATION_TYPES = exports.CARD_RAIL_PAYMENT_METHOD_TYPES = exports.FILE_TYPES = exports.FILE_STATUSES = exports.FILE_PURPOSE_POLICIES = exports.FILE_PURPOSES = exports.normalizeDisputeReason = exports.DISPUTE_TEXT_EVIDENCE_FIELDS = exports.DISPUTE_REASONS = exports.DISPUTE_FILE_EVIDENCE_FIELDS = exports.CATALOG_LIMITS = exports.COUPON_DURATIONS = exports.TRANSFORM_QUANTITY_ROUNDS = exports.PRICE_TAX_BEHAVIORS = exports.RECURRING_USAGE_TYPES = exports.RECURRING_INTERVALS = exports.PRICE_TYPES = exports.PRICE_TIERS_MODES = exports.PRICE_BILLING_SCHEMES = exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = exports.WEBHOOK_ENDPOINT_STATUSES = exports.PEABLE_API_VERSION = exports.SETUP_INTENT_STATUSES = exports.isValidStatusTransition = exports.canStillBePaid = exports.canExpire = exports.TERMINAL_STATUSES = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_RAILS = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.MERCHANT_CANCELLATION_REASONS = exports.EXPIRABLE_STATUSES = exports.CARD_ONLY_STATUSES = exports.isCurrencyCode = exports.decimalsFor = exports.FIAT_CURRENCY_CODES = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = exports.isBaseUnitString = exports.UNITS_PER_COIN = void 0;
|
|
4
|
+
exports.TAX_LOCATION_EVIDENCE_TYPES = exports.TAX_REGISTRATION_SCHEMES = exports.PEABLE_BILLING_AUTHORITY_KEYS = exports.canonicalBillingTaxQuote = exports.canonicalBillingAuthority = exports.BILLING_SUBSCRIPTION_STATUSES = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.MERCHANT_ENVIRONMENTS = exports.verifyWebhook = exports.signWebhook = exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.REQUEST_LOG_RETENTION_DAYS = exports.REQUEST_LOG_METHODS = exports.REFUND_REASONS = exports.RECONCILIATION_MISMATCH_KINDS = void 0;
|
|
5
5
|
// @peable.to/shared-types — public API for the Peable Gateway contract.
|
|
6
6
|
var money_1 = require("./money");
|
|
7
7
|
Object.defineProperty(exports, "UNITS_PER_COIN", { enumerable: true, get: function () { return money_1.UNITS_PER_COIN; } });
|
|
@@ -57,6 +57,16 @@ var paymentMethodConfiguration_1 = require("./paymentMethodConfiguration");
|
|
|
57
57
|
Object.defineProperty(exports, "CARD_RAIL_PAYMENT_METHOD_TYPES", { enumerable: true, get: function () { return paymentMethodConfiguration_1.CARD_RAIL_PAYMENT_METHOD_TYPES; } });
|
|
58
58
|
Object.defineProperty(exports, "PAYMENT_METHOD_CONFIGURATION_TYPES", { enumerable: true, get: function () { return paymentMethodConfiguration_1.PAYMENT_METHOD_CONFIGURATION_TYPES; } });
|
|
59
59
|
Object.defineProperty(exports, "PAYMENT_METHOD_CURRENCIES", { enumerable: true, get: function () { return paymentMethodConfiguration_1.PAYMENT_METHOD_CURRENCIES; } });
|
|
60
|
+
var account_1 = require("./account");
|
|
61
|
+
Object.defineProperty(exports, "PAYOUT_INTERVALS", { enumerable: true, get: function () { return account_1.PAYOUT_INTERVALS; } });
|
|
62
|
+
Object.defineProperty(exports, "PAYOUT_WEEKLY_ANCHORS", { enumerable: true, get: function () { return account_1.PAYOUT_WEEKLY_ANCHORS; } });
|
|
63
|
+
var balance_1 = require("./balance");
|
|
64
|
+
Object.defineProperty(exports, "BALANCE_TRANSACTION_STATUSES", { enumerable: true, get: function () { return balance_1.BALANCE_TRANSACTION_STATUSES; } });
|
|
65
|
+
Object.defineProperty(exports, "BALANCE_TRANSACTION_TYPES", { enumerable: true, get: function () { return balance_1.BALANCE_TRANSACTION_TYPES; } });
|
|
66
|
+
Object.defineProperty(exports, "PAYOUT_STATUSES", { enumerable: true, get: function () { return balance_1.PAYOUT_STATUSES; } });
|
|
67
|
+
Object.defineProperty(exports, "RECONCILIATION_MISMATCH_KINDS", { enumerable: true, get: function () { return balance_1.RECONCILIATION_MISMATCH_KINDS; } });
|
|
68
|
+
var settlement_1 = require("./settlement");
|
|
69
|
+
Object.defineProperty(exports, "REFUND_REASONS", { enumerable: true, get: function () { return settlement_1.REFUND_REASONS; } });
|
|
60
70
|
var requestLog_1 = require("./requestLog");
|
|
61
71
|
Object.defineProperty(exports, "REQUEST_LOG_METHODS", { enumerable: true, get: function () { return requestLog_1.REQUEST_LOG_METHODS; } });
|
|
62
72
|
Object.defineProperty(exports, "REQUEST_LOG_RETENTION_DAYS", { enumerable: true, get: function () { return requestLog_1.REQUEST_LOG_RETENTION_DAYS; } });
|
package/dist/cjs/settlement.js
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// The merchant's fiat account (ADR 0015 §1) — `GET /v1/account`.
|
|
2
|
+
//
|
|
3
|
+
// Orbit's funds never reach a Peable bank account: a merchant that takes fiat
|
|
4
|
+
// has its OWN provider account, opened and onboarded through Peable, and this
|
|
5
|
+
// object mirrors it. Everything here is what the provider last reported; the
|
|
6
|
+
// provider is the authority and Orbit never decides readiness itself.
|
|
7
|
+
//
|
|
8
|
+
// A marketplace's sellers (`/v1/connected_accounts`) are provider accounts too,
|
|
9
|
+
// and a platform reads one of them in this same shape by sending
|
|
10
|
+
// `Peable-Account: ca_…` to `GET /v1/account`.
|
|
11
|
+
export const PAYOUT_INTERVALS = ['manual', 'daily', 'weekly', 'monthly'];
|
|
12
|
+
export const PAYOUT_WEEKLY_ANCHORS = [
|
|
13
|
+
'monday',
|
|
14
|
+
'tuesday',
|
|
15
|
+
'wednesday',
|
|
16
|
+
'thursday',
|
|
17
|
+
'friday',
|
|
18
|
+
'saturday',
|
|
19
|
+
'sunday',
|
|
20
|
+
];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/** Orbit's vocabulary for what moved — the provider's own types, provider-neutral. */
|
|
2
|
+
export const BALANCE_TRANSACTION_TYPES = [
|
|
3
|
+
'charge',
|
|
4
|
+
'payment',
|
|
5
|
+
'refund',
|
|
6
|
+
'payment_refund',
|
|
7
|
+
'adjustment',
|
|
8
|
+
'application_fee',
|
|
9
|
+
'application_fee_refund',
|
|
10
|
+
'payout',
|
|
11
|
+
'payout_cancel',
|
|
12
|
+
'payout_failure',
|
|
13
|
+
'transfer',
|
|
14
|
+
'transfer_refund',
|
|
15
|
+
'dispute',
|
|
16
|
+
'dispute_reversal',
|
|
17
|
+
'processing_fee',
|
|
18
|
+
'faircoin_payment',
|
|
19
|
+
'faircoin_payment_reversal',
|
|
20
|
+
'other',
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* - `pending` / `available` — the provider's own status for the funds.
|
|
24
|
+
* - `informational` — a FairCoin payment: recorded, never part of a payable balance.
|
|
25
|
+
*/
|
|
26
|
+
export const BALANCE_TRANSACTION_STATUSES = ['available', 'pending', 'informational'];
|
|
27
|
+
export const PAYOUT_STATUSES = ['pending', 'in_transit', 'paid', 'failed', 'canceled'];
|
|
28
|
+
/** What the daily reconciliation found disagreeing with the provider. Never auto-corrected. */
|
|
29
|
+
export const RECONCILIATION_MISMATCH_KINDS = [
|
|
30
|
+
'missing_in_ledger',
|
|
31
|
+
'amount_mismatch',
|
|
32
|
+
'status_mismatch',
|
|
33
|
+
'missing_at_provider',
|
|
34
|
+
'payout_mismatch',
|
|
35
|
+
'unbalanced_journal',
|
|
36
|
+
];
|
package/dist/esm/index.js
CHANGED
|
@@ -8,6 +8,9 @@ export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERV
|
|
|
8
8
|
export { DISPUTE_FILE_EVIDENCE_FIELDS, DISPUTE_REASONS, DISPUTE_TEXT_EVIDENCE_FIELDS, normalizeDisputeReason, } from './dispute.js';
|
|
9
9
|
export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_STATUSES, FILE_TYPES, } from './file.js';
|
|
10
10
|
export { CARD_RAIL_PAYMENT_METHOD_TYPES, PAYMENT_METHOD_CONFIGURATION_TYPES, PAYMENT_METHOD_CURRENCIES, } from './paymentMethodConfiguration.js';
|
|
11
|
+
export { PAYOUT_INTERVALS, PAYOUT_WEEKLY_ANCHORS, } from './account.js';
|
|
12
|
+
export { BALANCE_TRANSACTION_STATUSES, BALANCE_TRANSACTION_TYPES, PAYOUT_STATUSES, RECONCILIATION_MISMATCH_KINDS, } from './balance.js';
|
|
13
|
+
export { REFUND_REASONS } from './settlement.js';
|
|
11
14
|
export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, } from './requestLog.js';
|
|
12
15
|
export { SIMULATED_FAIRCOIN_OUTCOMES, } from './testHelpers.js';
|
|
13
16
|
export { signWebhook, verifyWebhook } from './webhookSigner.js';
|
package/dist/esm/settlement.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
/** Stripe's refund reasons. */
|
|
2
|
+
export const REFUND_REASONS = ['duplicate', 'fraudulent', 'requested_by_customer'];
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** A capability's state as the provider reports it; `null` means never requested. */
|
|
2
|
+
export type AccountCapabilityStatus = 'active' | 'pending' | 'inactive';
|
|
3
|
+
/** Whose account this is: the merchant's own, or one of its marketplace sellers. */
|
|
4
|
+
export type AccountType = 'merchant' | 'connected';
|
|
5
|
+
/**
|
|
6
|
+
* What the provider is waiting on. Requirement IDENTIFIERS only
|
|
7
|
+
* (`individual.verification.document`), never their values: the gateway
|
|
8
|
+
* records that a document is owed and never learns what it says.
|
|
9
|
+
*/
|
|
10
|
+
export interface AccountRequirements {
|
|
11
|
+
currently_due: string[];
|
|
12
|
+
eventually_due: string[];
|
|
13
|
+
past_due: string[];
|
|
14
|
+
/** Submitted and being checked — nothing for the merchant to do. */
|
|
15
|
+
pending_verification: string[];
|
|
16
|
+
/** Why charges or payouts are disabled, in the provider's own code, or `null`. */
|
|
17
|
+
disabled_reason: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface AccountBusinessProfile {
|
|
20
|
+
name: string | null;
|
|
21
|
+
url: string | null;
|
|
22
|
+
support_email: string | null;
|
|
23
|
+
support_url: string | null;
|
|
24
|
+
product_description: string | null;
|
|
25
|
+
/** Merchant category code. */
|
|
26
|
+
mcc: string | null;
|
|
27
|
+
}
|
|
28
|
+
export declare const PAYOUT_INTERVALS: readonly ["manual", "daily", "weekly", "monthly"];
|
|
29
|
+
export type PayoutInterval = (typeof PAYOUT_INTERVALS)[number];
|
|
30
|
+
export declare const PAYOUT_WEEKLY_ANCHORS: readonly ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
|
|
31
|
+
export type PayoutWeeklyAnchor = (typeof PAYOUT_WEEKLY_ANCHORS)[number];
|
|
32
|
+
/**
|
|
33
|
+
* When the provider pays the balance out. `manual` means only an explicit
|
|
34
|
+
* `POST /v1/payouts` does — the provider still executes it; Orbit never moves
|
|
35
|
+
* the money itself (ADR 0015 §4).
|
|
36
|
+
*/
|
|
37
|
+
export interface AccountPayoutSchedule {
|
|
38
|
+
interval: PayoutInterval;
|
|
39
|
+
/** Days between a payment and its funds becoming payable; `null` when not reported. */
|
|
40
|
+
delay_days: number | null;
|
|
41
|
+
/** `weekly` only. */
|
|
42
|
+
weekly_anchor: PayoutWeeklyAnchor | null;
|
|
43
|
+
/** `monthly` only: the day of the month, 1–31. */
|
|
44
|
+
monthly_anchor: number | null;
|
|
45
|
+
}
|
|
46
|
+
export interface AccountSettings {
|
|
47
|
+
payouts: {
|
|
48
|
+
schedule: AccountPayoutSchedule | null;
|
|
49
|
+
/** What the merchant's bank statement shows for a payout. */
|
|
50
|
+
statement_descriptor: string | null;
|
|
51
|
+
};
|
|
52
|
+
payments: {
|
|
53
|
+
/** What a cardholder's statement shows — the merchant is the merchant of record. */
|
|
54
|
+
statement_descriptor: string | null;
|
|
55
|
+
};
|
|
56
|
+
branding: {
|
|
57
|
+
primary_color: string | null;
|
|
58
|
+
secondary_color: string | null;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export interface Account {
|
|
62
|
+
/** `ca_…` — the same id space as a marketplace seller. */
|
|
63
|
+
id: string;
|
|
64
|
+
object: 'account';
|
|
65
|
+
/** `true` for a `production` merchant (ADR 0017). */
|
|
66
|
+
livemode: boolean;
|
|
67
|
+
type: AccountType;
|
|
68
|
+
/** ISO 3166-1 alpha-2. Fixed at the provider once created. */
|
|
69
|
+
country: string;
|
|
70
|
+
default_currency: string | null;
|
|
71
|
+
business_profile: AccountBusinessProfile;
|
|
72
|
+
capabilities: {
|
|
73
|
+
card_payments: AccountCapabilityStatus | null;
|
|
74
|
+
transfers: AccountCapabilityStatus | null;
|
|
75
|
+
};
|
|
76
|
+
requirements: AccountRequirements;
|
|
77
|
+
/** Whether the account can take payments as merchant of record (`on_behalf_of`). */
|
|
78
|
+
charges_enabled: boolean;
|
|
79
|
+
/** Whether the provider will pay this account's balance out. */
|
|
80
|
+
payouts_enabled: boolean;
|
|
81
|
+
settings: AccountSettings;
|
|
82
|
+
/** The last provider read; `null` before the first one completed. */
|
|
83
|
+
last_synced_at: number | null;
|
|
84
|
+
created: number;
|
|
85
|
+
}
|
|
86
|
+
/** `POST /v1/account`: the account's settings, written to the provider and read back. */
|
|
87
|
+
export interface UpdateAccountParams {
|
|
88
|
+
/**
|
|
89
|
+
* Opening the account: required the first time (when the merchant has none),
|
|
90
|
+
* refused afterwards — a provider account's country cannot change.
|
|
91
|
+
*/
|
|
92
|
+
country?: string;
|
|
93
|
+
business_type?: 'individual' | 'company';
|
|
94
|
+
business_profile?: Partial<AccountBusinessProfile>;
|
|
95
|
+
settings?: {
|
|
96
|
+
payouts?: {
|
|
97
|
+
schedule?: {
|
|
98
|
+
interval: PayoutInterval;
|
|
99
|
+
delay_days?: number;
|
|
100
|
+
weekly_anchor?: PayoutWeeklyAnchor;
|
|
101
|
+
monthly_anchor?: number;
|
|
102
|
+
};
|
|
103
|
+
statement_descriptor?: string;
|
|
104
|
+
};
|
|
105
|
+
payments?: {
|
|
106
|
+
statement_descriptor?: string;
|
|
107
|
+
};
|
|
108
|
+
branding?: {
|
|
109
|
+
primary_color?: string;
|
|
110
|
+
secondary_color?: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/** `POST /v1/account_links`: hosted onboarding (or an update of what was submitted). */
|
|
115
|
+
export interface CreateAccountLinkParams {
|
|
116
|
+
refresh_url: string;
|
|
117
|
+
return_url: string;
|
|
118
|
+
/** Defaults to `account_onboarding`. */
|
|
119
|
+
type?: 'account_onboarding' | 'account_update';
|
|
120
|
+
}
|
|
@@ -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
|
+
}
|
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>;
|
package/dist/types/event.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Account } from './account';
|
|
2
|
+
import type { ApplicationFee, Balance, Payout } from './balance';
|
|
1
3
|
import type { Charge } from './charge';
|
|
2
4
|
import type { Coupon, Price, Product, PromotionCode } from './catalog';
|
|
3
5
|
import type { Customer } from './customer';
|
|
@@ -105,6 +107,23 @@ export interface WebhookEventPayload {
|
|
|
105
107
|
* intent.
|
|
106
108
|
*/
|
|
107
109
|
'connected_account.updated': ConnectedAccount;
|
|
110
|
+
/**
|
|
111
|
+
* The merchant's OWN fiat account changed (ADR 0015 §1) — readiness,
|
|
112
|
+
* requirements, settings. Emitted when a field the merchant acts on moved.
|
|
113
|
+
*/
|
|
114
|
+
'account.updated': Account;
|
|
115
|
+
/** Orbit's fee was taken on a succeeded charge (ADR 0015 §3). */
|
|
116
|
+
'application_fee.created': ApplicationFee;
|
|
117
|
+
/** Part or all of a fee went back (a refund with `refund_application_fee`). */
|
|
118
|
+
'application_fee.refunded': ApplicationFee;
|
|
119
|
+
/** A payout of the merchant's account, mirrored from the provider (ADR 0015 §5). */
|
|
120
|
+
'payout.created': Payout;
|
|
121
|
+
'payout.updated': Payout;
|
|
122
|
+
'payout.paid': Payout;
|
|
123
|
+
'payout.failed': Payout;
|
|
124
|
+
'payout.canceled': Payout;
|
|
125
|
+
/** Funds became available in the account; carries the balance read from the ledger. */
|
|
126
|
+
'balance.available': Balance;
|
|
108
127
|
'billing.observation.updated': BillingObservation;
|
|
109
128
|
/**
|
|
110
129
|
* A synthetic event sent to ONE endpoint when its owner asks to test it
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { UNITS_PER_COIN, isBaseUnitString, type CurrencyCode, type FiatCurrencyCode, CURRENCY_CODES, CURRENCY_DECIMALS, FIAT_CURRENCY_CODES, decimalsFor, isCurrencyCode, } from './money';
|
|
2
2
|
export type { NetworkType } from './network';
|
|
3
3
|
export type { ExpandParams, List, ListParams, RangeQuery } from './list';
|
|
4
|
-
export { type Address, type AddressParams, type CancelPaymentIntentParams, type CapturePaymentIntentParams, type ConfirmPaymentIntentParams, type CreatePaymentIntentParams, type PaymentIntent, type PaymentIntentCancellationReason, type PaymentIntentCaptureMethod, type PaymentIntentFaircoin, type PaymentIntentLastPaymentError, type PaymentIntentNextAction, type PaymentIntentRail, type PaymentIntentSetupFutureUsage, type PaymentIntentStatus, type PaymentMethodType, type Shipping, type ShippingParams, type UpdatePaymentIntentParams, CARD_ONLY_STATUSES, EXPIRABLE_STATUSES, MERCHANT_CANCELLATION_REASONS, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, TERMINAL_STATUSES, canExpire, canStillBePaid, isValidStatusTransition, } from './paymentIntent';
|
|
4
|
+
export { type Address, type AddressParams, type CancelPaymentIntentParams, type CapturePaymentIntentParams, type ConfirmPaymentIntentParams, type CreatePaymentIntentParams, type PaymentIntent, type PaymentIntentCancellationReason, type PaymentIntentCaptureMethod, type PaymentIntentFaircoin, type PaymentIntentLastPaymentError, type PaymentIntentNextAction, type PaymentIntentRail, type PaymentIntentSetupFutureUsage, type PaymentIntentStatus, type PaymentIntentTransferData, type PaymentMethodType, type Shipping, type ShippingParams, type UpdatePaymentIntentParams, CARD_ONLY_STATUSES, EXPIRABLE_STATUSES, MERCHANT_CANCELLATION_REASONS, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, TERMINAL_STATUSES, canExpire, canStillBePaid, isValidStatusTransition, } from './paymentIntent';
|
|
5
5
|
export type { CardDetails, Charge, ChargeOutcome } from './charge';
|
|
6
6
|
export type { CreateCustomerParams, Customer, DeletedCustomer, UpdateCustomerParams, } from './customer';
|
|
7
7
|
export type { AttachPaymentMethodParams, BillingDetails, PaymentMethod, UpdatePaymentMethodParams, } from './paymentMethod';
|
|
@@ -12,7 +12,10 @@ export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERV
|
|
|
12
12
|
export { DISPUTE_FILE_EVIDENCE_FIELDS, DISPUTE_REASONS, DISPUTE_TEXT_EVIDENCE_FIELDS, normalizeDisputeReason, type Dispute, type DisputeEvidence, type DisputeEvidenceDetails, type DisputeEvidenceField, type DisputeEvidenceParams, type DisputeFileEvidenceField, type DisputeReason, type DisputeStatus, type DisputeTextEvidenceField, type ListDisputesParams, type UpdateDisputeParams, } from './dispute';
|
|
13
13
|
export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_STATUSES, FILE_TYPES, type CreateFileFromOxyParams, type FileObject, type FilePurpose, type FileStatus, type FileType, type ListFilesParams, } from './file';
|
|
14
14
|
export { CARD_RAIL_PAYMENT_METHOD_TYPES, PAYMENT_METHOD_CONFIGURATION_TYPES, PAYMENT_METHOD_CURRENCIES, type CardRailPaymentMethodType, type CreatePaymentMethodConfigurationParams, type CreatePaymentMethodDomainParams, type ListPaymentMethodDomainsParams, type PaymentMethodConfiguration, type PaymentMethodConfigurationEntry, type PaymentMethodConfigurationEntryParams, type PaymentMethodConfigurationType, type PaymentMethodDisplayPreference, type PaymentMethodDomain, type PaymentMethodDomainWalletStatus, type PaymentMethodUnavailableReason, type UpdatePaymentMethodConfigurationParams, type UpdatePaymentMethodDomainParams, } from './paymentMethodConfiguration';
|
|
15
|
-
export
|
|
15
|
+
export { PAYOUT_INTERVALS, PAYOUT_WEEKLY_ANCHORS, type Account, type AccountBusinessProfile, type AccountCapabilityStatus, type AccountPayoutSchedule, type AccountRequirements, type AccountSettings, type AccountType, type CreateAccountLinkParams, type PayoutInterval, type PayoutWeeklyAnchor, type UpdateAccountParams, } from './account';
|
|
16
|
+
export { BALANCE_TRANSACTION_STATUSES, BALANCE_TRANSACTION_TYPES, PAYOUT_STATUSES, RECONCILIATION_MISMATCH_KINDS, type ApplicationFee, type Balance, type BalanceAmount, type BalanceTransaction, type BalanceTransactionFeeDetail, type BalanceTransactionStatus, type BalanceTransactionType, type CreatePayoutParams, type FeeRefund, type ListBalanceTransactionsParams, type ListPayoutsParams, type Payout, type PayoutReconciliationReport, type PayoutStatus, type ReconciliationMismatch, type ReconciliationMismatchKind, } from './balance';
|
|
17
|
+
export { REFUND_REASONS } from './settlement';
|
|
18
|
+
export type { CapabilityStatus, ConnectedAccount, ConnectedAccountFaircoin, ConnectedAccountFaircoinStatus, ConnectedAccountRail, CreateRefundParams, Refund, RefundOrigin, RefundReason, RefundStatus, UpdateRefundParams, Settlement, Transfer, TransferReversal, TransferReversalStatus, TransferStatus, TransferWithReversal, } from './settlement';
|
|
16
19
|
export type { WebhookDelivery, WebhookDeliveryStatus, } from './webhookDelivery';
|
|
17
20
|
export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, type RequestLog, type RequestLogListParams, type RequestLogMethod, type RequestLogStatusFilter, } from './requestLog';
|
|
18
21
|
export { SIMULATED_FAIRCOIN_OUTCOMES, type SimulatedFaircoinOutcome, type SimulateFaircoinPaymentParams, } from './testHelpers';
|
|
@@ -231,6 +231,21 @@ export interface PaymentIntent {
|
|
|
231
231
|
* FairCoin only, and `faircoin.address` derives from that seller's own key.
|
|
232
232
|
*/
|
|
233
233
|
connected_account: string | ConnectedAccount | null;
|
|
234
|
+
/**
|
|
235
|
+
* Orbit's fee on this card payment, taken by the provider from the
|
|
236
|
+
* destination account when the charge succeeds (ADR 0015 §3) — the
|
|
237
|
+
* INSTRUCTION; the fee actually taken is the `application_fee` object.
|
|
238
|
+
* `null` on a platform charge.
|
|
239
|
+
*/
|
|
240
|
+
application_fee_amount: string | null;
|
|
241
|
+
/**
|
|
242
|
+
* A destination charge (ADR 0015 §2): the account (`ca_…`) the funds go to,
|
|
243
|
+
* and the amount transferred when the platform named one. `null` on a
|
|
244
|
+
* platform charge.
|
|
245
|
+
*/
|
|
246
|
+
transfer_data: PaymentIntentTransferData | null;
|
|
247
|
+
/** The account (`ca_…`) that is the merchant of record, or `null` (the platform). */
|
|
248
|
+
on_behalf_of: string | null;
|
|
234
249
|
client_secret: string;
|
|
235
250
|
metadata: Record<string, string>;
|
|
236
251
|
/** When an UNPAID intent expires. Meaningful only while `can_expire`. */
|
|
@@ -240,6 +255,13 @@ export interface PaymentIntent {
|
|
|
240
255
|
created: number;
|
|
241
256
|
updated_at: number;
|
|
242
257
|
}
|
|
258
|
+
/** Where a destination charge's funds go (`transfer_data`). */
|
|
259
|
+
export interface PaymentIntentTransferData {
|
|
260
|
+
/** `ca_…` */
|
|
261
|
+
destination: string;
|
|
262
|
+
/** Base units transferred; `null` means the whole amount less `application_fee_amount`. */
|
|
263
|
+
amount: string | null;
|
|
264
|
+
}
|
|
243
265
|
/** `POST /v1/payment_intents`. */
|
|
244
266
|
export interface CreatePaymentIntentParams {
|
|
245
267
|
/** Amount in the currency's smallest unit, as a canonical integer string. */
|
|
@@ -278,6 +300,19 @@ export interface CreatePaymentIntentParams {
|
|
|
278
300
|
expires_in_seconds?: number;
|
|
279
301
|
/** FairCoin only: pay this seller (`ca_…`, ADR 0012 D5). */
|
|
280
302
|
connected_account?: string;
|
|
303
|
+
/**
|
|
304
|
+
* Card only, a platform acting for one of its connected accounts: Orbit's
|
|
305
|
+
* fee for this payment. Needs `transfer_data` (or `on_behalf_of`); refused
|
|
306
|
+
* beside `transfer_data.amount`.
|
|
307
|
+
*/
|
|
308
|
+
application_fee_amount?: string;
|
|
309
|
+
/** Card only: a destination charge to one of the platform's connected accounts. */
|
|
310
|
+
transfer_data?: {
|
|
311
|
+
destination: string;
|
|
312
|
+
amount?: string;
|
|
313
|
+
};
|
|
314
|
+
/** Card only: make this connected account (`ca_…`) the merchant of record. */
|
|
315
|
+
on_behalf_of?: string;
|
|
281
316
|
/** Card only, with `confirm`: where a redirect-based challenge returns. */
|
|
282
317
|
return_url?: string;
|
|
283
318
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccountRequirements } from './account';
|
|
1
2
|
import type { CurrencyCode } from './money';
|
|
2
3
|
import type { NetworkType } from './network';
|
|
3
4
|
import type { PaymentIntent } from './paymentIntent';
|
|
@@ -84,17 +85,12 @@ export interface ConnectedAccount {
|
|
|
84
85
|
transfers_capability: CapabilityStatus | null;
|
|
85
86
|
card_payments_capability: CapabilityStatus | null;
|
|
86
87
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
88
|
+
* What the provider is waiting on — requirement IDENTIFIERS, never their
|
|
89
|
+
* values (the gateway records that a seller owes a document; it never learns
|
|
90
|
+
* what the document says) — and the provider's own `disabled_reason`. The
|
|
91
|
+
* same shape as `Account.requirements`.
|
|
90
92
|
*/
|
|
91
|
-
requirements:
|
|
92
|
-
currently_due: number;
|
|
93
|
-
eventually_due: number;
|
|
94
|
-
past_due: number;
|
|
95
|
-
pending_verification: number;
|
|
96
|
-
};
|
|
97
|
-
disabled_reason_codes: readonly string[];
|
|
93
|
+
requirements: AccountRequirements;
|
|
98
94
|
last_synced_at: number | null;
|
|
99
95
|
created: number;
|
|
100
96
|
updated_at: number;
|
|
@@ -203,8 +199,15 @@ export interface Settlement {
|
|
|
203
199
|
/** Present only when a conversion happened. `null` is not a rate of 1. */
|
|
204
200
|
exchange_rate: number | null;
|
|
205
201
|
}
|
|
206
|
-
/**
|
|
207
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Where one refund stands — the MONEY's own lifecycle, not the payment's.
|
|
204
|
+
* `canceled` only through `POST /v1/refunds/:id/cancel`, where the provider
|
|
205
|
+
* still allows it.
|
|
206
|
+
*/
|
|
207
|
+
export type RefundStatus = 'pending' | 'succeeded' | 'failed' | 'canceled';
|
|
208
|
+
/** Stripe's refund reasons. */
|
|
209
|
+
export declare const REFUND_REASONS: readonly ["duplicate", "fraudulent", "requested_by_customer"];
|
|
210
|
+
export type RefundReason = (typeof REFUND_REASONS)[number];
|
|
208
211
|
/**
|
|
209
212
|
* Who created a refund.
|
|
210
213
|
*
|
|
@@ -229,7 +232,31 @@ export interface Refund {
|
|
|
229
232
|
amount: string;
|
|
230
233
|
currency: CurrencyCode | string;
|
|
231
234
|
status: RefundStatus;
|
|
235
|
+
reason: RefundReason | null;
|
|
232
236
|
failure_code: string | null;
|
|
237
|
+
metadata: Record<string, string>;
|
|
233
238
|
created: number;
|
|
234
239
|
updated_at: number;
|
|
235
240
|
}
|
|
241
|
+
/** `POST /v1/refunds`. */
|
|
242
|
+
export interface CreateRefundParams {
|
|
243
|
+
/** The `pi_…` being refunded. */
|
|
244
|
+
payment_intent: string;
|
|
245
|
+
/** YOUR id for this refund. The idempotency. */
|
|
246
|
+
external_ref: string;
|
|
247
|
+
/** Minor units, as a canonical integer string. Zero is refused. */
|
|
248
|
+
amount: string;
|
|
249
|
+
reason?: RefundReason;
|
|
250
|
+
metadata?: Record<string, string>;
|
|
251
|
+
/**
|
|
252
|
+
* Also refund Orbit's application fee, in proportion to the amount refunded
|
|
253
|
+
* (a payment that carried one: a destination charge, ADR 0015 §2).
|
|
254
|
+
*/
|
|
255
|
+
refund_application_fee?: boolean;
|
|
256
|
+
/** Also reverse the transfer to the destination account, in proportion. */
|
|
257
|
+
reverse_transfer?: boolean;
|
|
258
|
+
}
|
|
259
|
+
/** `POST /v1/refunds/:id` — the merchant's own bookkeeping; `metadata` is a patch. */
|
|
260
|
+
export interface UpdateRefundParams {
|
|
261
|
+
metadata?: Record<string, string>;
|
|
262
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@peable.to/shared-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|