@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.
@@ -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
+ ];
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ // Merchant branding and customer email settings (Orbit Phase 3).
3
+ //
4
+ // Branding is what the hosted checkout, the embedded checkout and Peable's
5
+ // receipts look like for one merchant. Every value is from a CLOSED set or a
6
+ // validated colour, so nothing a merchant stores can inject markup or a remote
7
+ // font into a payer's page or an email.
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.DEFAULT_BRANDING = exports.BRANDING_COLOR_PATTERN = exports.BRANDING_BORDER_STYLES = exports.BRANDING_FONTS = void 0;
10
+ /** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
11
+ exports.BRANDING_FONTS = [
12
+ 'system',
13
+ 'inter',
14
+ 'roboto',
15
+ 'open_sans',
16
+ 'lato',
17
+ 'source_sans',
18
+ 'noto_sans',
19
+ 'serif',
20
+ 'monospace',
21
+ ];
22
+ exports.BRANDING_BORDER_STYLES = ['rounded', 'rectangular', 'pill'];
23
+ /** `#rrggbb`, lowercase — the only colour spelling branding stores. */
24
+ exports.BRANDING_COLOR_PATTERN = /^#[0-9a-f]{6}$/;
25
+ /** Peable's defaults, applied wherever a merchant set nothing. */
26
+ exports.DEFAULT_BRANDING = Object.freeze({
27
+ primary_color: '#1f6feb',
28
+ accent_color: '#0b1f33',
29
+ font: 'system',
30
+ border_style: 'rounded',
31
+ });
@@ -1,2 +1,45 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHECKOUT_SESSION_ID_TEMPLATE = exports.CHECKOUT_LIMITS = exports.CHECKOUT_TAX_ID_TYPES = exports.CHECKOUT_CUSTOM_FIELD_TYPES = exports.CHECKOUT_BILLING_ADDRESS_COLLECTIONS = exports.CHECKOUT_CUSTOMER_CREATIONS = exports.CHECKOUT_SUBMIT_TYPES = exports.CHECKOUT_LOCALES = exports.CHECKOUT_UI_MODES = exports.CHECKOUT_PAYMENT_STATUSES = exports.CHECKOUT_SESSION_STATUSES = exports.CHECKOUT_SESSION_MODES = void 0;
4
+ exports.CHECKOUT_SESSION_MODES = ['payment', 'setup', 'subscription'];
5
+ exports.CHECKOUT_SESSION_STATUSES = ['open', 'complete', 'expired'];
6
+ exports.CHECKOUT_PAYMENT_STATUSES = ['paid', 'unpaid', 'no_payment_required'];
7
+ exports.CHECKOUT_UI_MODES = ['hosted', 'embedded'];
8
+ /** The languages the hosted and embedded checkout speak. */
9
+ exports.CHECKOUT_LOCALES = ['en', 'es', 'fr', 'de', 'it', 'pt'];
10
+ exports.CHECKOUT_SUBMIT_TYPES = ['auto', 'pay', 'book', 'donate'];
11
+ exports.CHECKOUT_CUSTOMER_CREATIONS = ['always', 'if_required'];
12
+ exports.CHECKOUT_BILLING_ADDRESS_COLLECTIONS = ['auto', 'required'];
13
+ exports.CHECKOUT_CUSTOM_FIELD_TYPES = ['text', 'numeric', 'dropdown'];
14
+ /** Stripe's tax id types Peable collects; `eu_vat` covers every EU member state. */
15
+ exports.CHECKOUT_TAX_ID_TYPES = [
16
+ 'eu_vat',
17
+ 'gb_vat',
18
+ 'ch_vat',
19
+ 'no_vat',
20
+ 'us_ein',
21
+ 'ca_bn',
22
+ ];
23
+ /**
24
+ * Bounds of the session contract, shared by the gateway's validators and the
25
+ * clients that build requests, so the two cannot drift.
26
+ */
27
+ exports.CHECKOUT_LIMITS = Object.freeze({
28
+ lineItemsMax: 20,
29
+ quantityMax: 999999,
30
+ customFieldsMax: 3,
31
+ customFieldKeyMax: 200,
32
+ customFieldLabelMax: 50,
33
+ customFieldTextMax: 255,
34
+ dropdownOptionsMax: 200,
35
+ dropdownOptionLabelMax: 100,
36
+ dropdownOptionValueMax: 100,
37
+ clientReferenceIdMax: 200,
38
+ /** `expires_at` must be between 30 minutes and 24 hours from creation. */
39
+ expiresMinSeconds: 30 * 60,
40
+ expiresMaxSeconds: 24 * 3600,
41
+ shippingCountriesMax: 250,
42
+ termsTextMax: 1200,
43
+ });
44
+ /** The template a `success_url` may carry; replaced with the session's `cs_…`. */
45
+ exports.CHECKOUT_SESSION_ID_TEMPLATE = '{CHECKOUT_SESSION_ID}';
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyWebhook = exports.signWebhook = exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.REQUEST_LOG_RETENTION_DAYS = exports.REQUEST_LOG_METHODS = 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 = 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.DEFAULT_BRANDING = exports.BRANDING_COLOR_PATTERN = exports.BRANDING_BORDER_STYLES = exports.BRANDING_FONTS = exports.CHECKOUT_SESSION_ID_TEMPLATE = exports.CHECKOUT_LIMITS = exports.CHECKOUT_TAX_ID_TYPES = exports.CHECKOUT_CUSTOM_FIELD_TYPES = exports.CHECKOUT_BILLING_ADDRESS_COLLECTIONS = exports.CHECKOUT_CUSTOMER_CREATIONS = exports.CHECKOUT_SUBMIT_TYPES = exports.CHECKOUT_LOCALES = exports.CHECKOUT_UI_MODES = exports.CHECKOUT_PAYMENT_STATUSES = exports.CHECKOUT_SESSION_STATUSES = exports.CHECKOUT_SESSION_MODES = exports.PAYMENT_LINK_LIMITS = 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; } });
@@ -67,6 +77,26 @@ Object.defineProperty(exports, "signWebhook", { enumerable: true, get: function
67
77
  Object.defineProperty(exports, "verifyWebhook", { enumerable: true, get: function () { return webhookSigner_1.verifyWebhook; } });
68
78
  var merchant_1 = require("./merchant");
69
79
  Object.defineProperty(exports, "MERCHANT_ENVIRONMENTS", { enumerable: true, get: function () { return merchant_1.MERCHANT_ENVIRONMENTS; } });
80
+ var paymentLink_1 = require("./paymentLink");
81
+ Object.defineProperty(exports, "PAYMENT_LINK_LIMITS", { enumerable: true, get: function () { return paymentLink_1.PAYMENT_LINK_LIMITS; } });
82
+ var checkoutSession_1 = require("./checkoutSession");
83
+ Object.defineProperty(exports, "CHECKOUT_SESSION_MODES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_MODES; } });
84
+ Object.defineProperty(exports, "CHECKOUT_SESSION_STATUSES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_STATUSES; } });
85
+ Object.defineProperty(exports, "CHECKOUT_PAYMENT_STATUSES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_PAYMENT_STATUSES; } });
86
+ Object.defineProperty(exports, "CHECKOUT_UI_MODES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_UI_MODES; } });
87
+ Object.defineProperty(exports, "CHECKOUT_LOCALES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_LOCALES; } });
88
+ Object.defineProperty(exports, "CHECKOUT_SUBMIT_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SUBMIT_TYPES; } });
89
+ Object.defineProperty(exports, "CHECKOUT_CUSTOMER_CREATIONS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_CUSTOMER_CREATIONS; } });
90
+ Object.defineProperty(exports, "CHECKOUT_BILLING_ADDRESS_COLLECTIONS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_BILLING_ADDRESS_COLLECTIONS; } });
91
+ Object.defineProperty(exports, "CHECKOUT_CUSTOM_FIELD_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_CUSTOM_FIELD_TYPES; } });
92
+ Object.defineProperty(exports, "CHECKOUT_TAX_ID_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_TAX_ID_TYPES; } });
93
+ Object.defineProperty(exports, "CHECKOUT_LIMITS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_LIMITS; } });
94
+ Object.defineProperty(exports, "CHECKOUT_SESSION_ID_TEMPLATE", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_ID_TEMPLATE; } });
95
+ var branding_1 = require("./branding");
96
+ Object.defineProperty(exports, "BRANDING_FONTS", { enumerable: true, get: function () { return branding_1.BRANDING_FONTS; } });
97
+ Object.defineProperty(exports, "BRANDING_BORDER_STYLES", { enumerable: true, get: function () { return branding_1.BRANDING_BORDER_STYLES; } });
98
+ Object.defineProperty(exports, "BRANDING_COLOR_PATTERN", { enumerable: true, get: function () { return branding_1.BRANDING_COLOR_PATTERN; } });
99
+ Object.defineProperty(exports, "DEFAULT_BRANDING", { enumerable: true, get: function () { return branding_1.DEFAULT_BRANDING; } });
70
100
  var social_1 = require("./social");
71
101
  Object.defineProperty(exports, "SOCIAL_SOURCE_APP_MAX_LENGTH", { enumerable: true, get: function () { return social_1.SOCIAL_SOURCE_APP_MAX_LENGTH; } });
72
102
  Object.defineProperty(exports, "SOCIAL_SOURCE_REF_MAX_LENGTH", { enumerable: true, get: function () { return social_1.SOCIAL_SOURCE_REF_MAX_LENGTH; } });
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PAYMENT_LINK_LIMITS = void 0;
4
+ exports.PAYMENT_LINK_LIMITS = Object.freeze({
5
+ lineItemsMax: 20,
6
+ customMessageMax: 500,
7
+ });
@@ -1,2 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REFUND_REASONS = void 0;
4
+ /** Stripe's refund reasons. */
5
+ exports.REFUND_REASONS = ['duplicate', 'fraudulent', 'requested_by_customer'];
@@ -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
+ ];
@@ -0,0 +1,28 @@
1
+ // Merchant branding and customer email settings (Orbit Phase 3).
2
+ //
3
+ // Branding is what the hosted checkout, the embedded checkout and Peable's
4
+ // receipts look like for one merchant. Every value is from a CLOSED set or a
5
+ // validated colour, so nothing a merchant stores can inject markup or a remote
6
+ // font into a payer's page or an email.
7
+ /** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
8
+ export const BRANDING_FONTS = [
9
+ 'system',
10
+ 'inter',
11
+ 'roboto',
12
+ 'open_sans',
13
+ 'lato',
14
+ 'source_sans',
15
+ 'noto_sans',
16
+ 'serif',
17
+ 'monospace',
18
+ ];
19
+ export const BRANDING_BORDER_STYLES = ['rounded', 'rectangular', 'pill'];
20
+ /** `#rrggbb`, lowercase — the only colour spelling branding stores. */
21
+ export const BRANDING_COLOR_PATTERN = /^#[0-9a-f]{6}$/;
22
+ /** Peable's defaults, applied wherever a merchant set nothing. */
23
+ export const DEFAULT_BRANDING = Object.freeze({
24
+ primary_color: '#1f6feb',
25
+ accent_color: '#0b1f33',
26
+ font: 'system',
27
+ border_style: 'rounded',
28
+ });
@@ -1 +1,42 @@
1
- export {};
1
+ export const CHECKOUT_SESSION_MODES = ['payment', 'setup', 'subscription'];
2
+ export const CHECKOUT_SESSION_STATUSES = ['open', 'complete', 'expired'];
3
+ export const CHECKOUT_PAYMENT_STATUSES = ['paid', 'unpaid', 'no_payment_required'];
4
+ export const CHECKOUT_UI_MODES = ['hosted', 'embedded'];
5
+ /** The languages the hosted and embedded checkout speak. */
6
+ export const CHECKOUT_LOCALES = ['en', 'es', 'fr', 'de', 'it', 'pt'];
7
+ export const CHECKOUT_SUBMIT_TYPES = ['auto', 'pay', 'book', 'donate'];
8
+ export const CHECKOUT_CUSTOMER_CREATIONS = ['always', 'if_required'];
9
+ export const CHECKOUT_BILLING_ADDRESS_COLLECTIONS = ['auto', 'required'];
10
+ export const CHECKOUT_CUSTOM_FIELD_TYPES = ['text', 'numeric', 'dropdown'];
11
+ /** Stripe's tax id types Peable collects; `eu_vat` covers every EU member state. */
12
+ export const CHECKOUT_TAX_ID_TYPES = [
13
+ 'eu_vat',
14
+ 'gb_vat',
15
+ 'ch_vat',
16
+ 'no_vat',
17
+ 'us_ein',
18
+ 'ca_bn',
19
+ ];
20
+ /**
21
+ * Bounds of the session contract, shared by the gateway's validators and the
22
+ * clients that build requests, so the two cannot drift.
23
+ */
24
+ export const CHECKOUT_LIMITS = Object.freeze({
25
+ lineItemsMax: 20,
26
+ quantityMax: 999999,
27
+ customFieldsMax: 3,
28
+ customFieldKeyMax: 200,
29
+ customFieldLabelMax: 50,
30
+ customFieldTextMax: 255,
31
+ dropdownOptionsMax: 200,
32
+ dropdownOptionLabelMax: 100,
33
+ dropdownOptionValueMax: 100,
34
+ clientReferenceIdMax: 200,
35
+ /** `expires_at` must be between 30 minutes and 24 hours from creation. */
36
+ expiresMinSeconds: 30 * 60,
37
+ expiresMaxSeconds: 24 * 3600,
38
+ shippingCountriesMax: 250,
39
+ termsTextMax: 1200,
40
+ });
41
+ /** The template a `success_url` may carry; replaced with the session's `cs_…`. */
42
+ export const CHECKOUT_SESSION_ID_TEMPLATE = '{CHECKOUT_SESSION_ID}';
package/dist/esm/index.js CHANGED
@@ -8,10 +8,16 @@ 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';
14
17
  export { MERCHANT_ENVIRONMENTS, } from './merchant.js';
18
+ export { PAYMENT_LINK_LIMITS, } from './paymentLink.js';
19
+ export { CHECKOUT_SESSION_MODES, CHECKOUT_SESSION_STATUSES, CHECKOUT_PAYMENT_STATUSES, CHECKOUT_UI_MODES, CHECKOUT_LOCALES, CHECKOUT_SUBMIT_TYPES, CHECKOUT_CUSTOMER_CREATIONS, CHECKOUT_BILLING_ADDRESS_COLLECTIONS, CHECKOUT_CUSTOM_FIELD_TYPES, CHECKOUT_TAX_ID_TYPES, CHECKOUT_LIMITS, CHECKOUT_SESSION_ID_TEMPLATE, } from './checkoutSession.js';
20
+ export { BRANDING_FONTS, BRANDING_BORDER_STYLES, BRANDING_COLOR_PATTERN, DEFAULT_BRANDING, } from './branding.js';
15
21
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from './social.js';
16
22
  export { BILLING_SUBSCRIPTION_STATUSES, } from './billing.js';
17
23
  export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority.js';
@@ -1 +1,4 @@
1
- export {};
1
+ export const PAYMENT_LINK_LIMITS = Object.freeze({
2
+ lineItemsMax: 20,
3
+ customMessageMax: 500,
4
+ });
@@ -1 +1,2 @@
1
- export {};
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
+ }