@peable.to/shared-types 0.15.0 → 0.17.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,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/file.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // (ADR 0016: Orbit owns the object; the storage is Oxy Files, a binding that
4
4
  // never reaches the wire). Stripe's Files API, with Oxy Files underneath.
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FILE_PURPOSE_POLICIES = exports.FILE_STATUSES = exports.FILE_TYPES = exports.FILE_PURPOSES = void 0;
6
+ exports.FILE_PURPOSE_POLICIES = exports.FILE_STATUSES = exports.FILE_TYPES = exports.FILE_UPLOAD_PURPOSES = exports.FILE_PURPOSES = void 0;
7
7
  /**
8
8
  * What a file is FOR. Decided at upload and never changed: the purpose is what
9
9
  * sets the type and size policy, who may see the bytes, and which objects may
@@ -15,9 +15,22 @@ exports.FILE_PURPOSES = [
15
15
  'business_logo',
16
16
  'identity_document',
17
17
  'additional_verification',
18
+ 'finance_report_run',
19
+ ];
20
+ /**
21
+ * The purposes a merchant may upload or import. `finance_report_run` is not
22
+ * among them: a report's CSV is written by Peable's report runs
23
+ * (`/v1/reporting/report_runs`) and nobody else, so a file of that purpose is
24
+ * always a report Peable produced.
25
+ */
26
+ exports.FILE_UPLOAD_PURPOSES = [
27
+ 'dispute_evidence',
28
+ 'business_logo',
29
+ 'identity_document',
30
+ 'additional_verification',
18
31
  ];
19
32
  /** The stored format, by its conventional extension (Stripe's `type`). */
20
- exports.FILE_TYPES = ['pdf', 'png', 'jpg'];
33
+ exports.FILE_TYPES = ['pdf', 'png', 'jpg', 'csv'];
21
34
  /**
22
35
  * Whether the bytes can be used right now.
23
36
  *
@@ -29,16 +42,18 @@ exports.FILE_TYPES = ['pdf', 'png', 'jpg'];
29
42
  */
30
43
  exports.FILE_STATUSES = ['available', 'withheld', 'removed'];
31
44
  /**
32
- * The upload policy of each purpose: the formats it takes, recognised from the
33
- * bytes and never from a client's `Content-Type`, and the largest file.
45
+ * The policy of each purpose: the formats it takes, recognised from the bytes
46
+ * and never from a client's `Content-Type`, and the largest file.
34
47
  *
35
48
  * The provider's own ceilings, restated where the upload is parsed, so a file
36
49
  * the card network would refuse is refused at upload — not at the one-shot
37
- * dispute submission it was meant for.
50
+ * dispute submission it was meant for. `finance_report_run` is Peable's own
51
+ * output (see {@link FILE_UPLOAD_PURPOSES}); its ceiling bounds a report.
38
52
  */
39
53
  exports.FILE_PURPOSE_POLICIES = Object.freeze({
40
54
  dispute_evidence: { types: ['pdf', 'png', 'jpg'], max_bytes: 5 * 1024 * 1024 },
41
55
  business_logo: { types: ['png', 'jpg'], max_bytes: 512 * 1024 },
42
56
  identity_document: { types: ['pdf', 'png', 'jpg'], max_bytes: 10 * 1024 * 1024 },
43
57
  additional_verification: { types: ['pdf', 'png', 'jpg'], max_bytes: 10 * 1024 * 1024 },
58
+ finance_report_run: { types: ['csv'], max_bytes: 64 * 1024 * 1024 },
44
59
  });
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.REPORT_TYPE_LAYOUTS = exports.REPORT_TYPE_IDS = exports.REPORT_RUN_STATUSES = exports.SEARCH_SUBSTRING_MIN_LENGTH = exports.SEARCH_QUERY_MAX_LENGTH = exports.SEARCH_QUERY_MAX_CLAUSES = exports.SEARCHABLE_RESOURCES = exports.FILE_TYPES = exports.FILE_STATUSES = exports.FILE_UPLOAD_PURPOSES = 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 = 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 = 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; } });
@@ -51,8 +51,18 @@ Object.defineProperty(exports, "normalizeDisputeReason", { enumerable: true, get
51
51
  var file_1 = require("./file");
52
52
  Object.defineProperty(exports, "FILE_PURPOSES", { enumerable: true, get: function () { return file_1.FILE_PURPOSES; } });
53
53
  Object.defineProperty(exports, "FILE_PURPOSE_POLICIES", { enumerable: true, get: function () { return file_1.FILE_PURPOSE_POLICIES; } });
54
+ Object.defineProperty(exports, "FILE_UPLOAD_PURPOSES", { enumerable: true, get: function () { return file_1.FILE_UPLOAD_PURPOSES; } });
54
55
  Object.defineProperty(exports, "FILE_STATUSES", { enumerable: true, get: function () { return file_1.FILE_STATUSES; } });
55
56
  Object.defineProperty(exports, "FILE_TYPES", { enumerable: true, get: function () { return file_1.FILE_TYPES; } });
57
+ var search_1 = require("./search");
58
+ Object.defineProperty(exports, "SEARCHABLE_RESOURCES", { enumerable: true, get: function () { return search_1.SEARCHABLE_RESOURCES; } });
59
+ Object.defineProperty(exports, "SEARCH_QUERY_MAX_CLAUSES", { enumerable: true, get: function () { return search_1.SEARCH_QUERY_MAX_CLAUSES; } });
60
+ Object.defineProperty(exports, "SEARCH_QUERY_MAX_LENGTH", { enumerable: true, get: function () { return search_1.SEARCH_QUERY_MAX_LENGTH; } });
61
+ Object.defineProperty(exports, "SEARCH_SUBSTRING_MIN_LENGTH", { enumerable: true, get: function () { return search_1.SEARCH_SUBSTRING_MIN_LENGTH; } });
62
+ var reporting_1 = require("./reporting");
63
+ Object.defineProperty(exports, "REPORT_RUN_STATUSES", { enumerable: true, get: function () { return reporting_1.REPORT_RUN_STATUSES; } });
64
+ Object.defineProperty(exports, "REPORT_TYPE_IDS", { enumerable: true, get: function () { return reporting_1.REPORT_TYPE_IDS; } });
65
+ Object.defineProperty(exports, "REPORT_TYPE_LAYOUTS", { enumerable: true, get: function () { return reporting_1.REPORT_TYPE_LAYOUTS; } });
56
66
  var paymentMethodConfiguration_1 = require("./paymentMethodConfiguration");
57
67
  Object.defineProperty(exports, "CARD_RAIL_PAYMENT_METHOD_TYPES", { enumerable: true, get: function () { return paymentMethodConfiguration_1.CARD_RAIL_PAYMENT_METHOD_TYPES; } });
58
68
  Object.defineProperty(exports, "PAYMENT_METHOD_CONFIGURATION_TYPES", { enumerable: true, get: function () { return paymentMethodConfiguration_1.PAYMENT_METHOD_CONFIGURATION_TYPES; } });
@@ -77,6 +87,26 @@ Object.defineProperty(exports, "signWebhook", { enumerable: true, get: function
77
87
  Object.defineProperty(exports, "verifyWebhook", { enumerable: true, get: function () { return webhookSigner_1.verifyWebhook; } });
78
88
  var merchant_1 = require("./merchant");
79
89
  Object.defineProperty(exports, "MERCHANT_ENVIRONMENTS", { enumerable: true, get: function () { return merchant_1.MERCHANT_ENVIRONMENTS; } });
90
+ var paymentLink_1 = require("./paymentLink");
91
+ Object.defineProperty(exports, "PAYMENT_LINK_LIMITS", { enumerable: true, get: function () { return paymentLink_1.PAYMENT_LINK_LIMITS; } });
92
+ var checkoutSession_1 = require("./checkoutSession");
93
+ Object.defineProperty(exports, "CHECKOUT_SESSION_MODES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_MODES; } });
94
+ Object.defineProperty(exports, "CHECKOUT_SESSION_STATUSES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_STATUSES; } });
95
+ Object.defineProperty(exports, "CHECKOUT_PAYMENT_STATUSES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_PAYMENT_STATUSES; } });
96
+ Object.defineProperty(exports, "CHECKOUT_UI_MODES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_UI_MODES; } });
97
+ Object.defineProperty(exports, "CHECKOUT_LOCALES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_LOCALES; } });
98
+ Object.defineProperty(exports, "CHECKOUT_SUBMIT_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SUBMIT_TYPES; } });
99
+ Object.defineProperty(exports, "CHECKOUT_CUSTOMER_CREATIONS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_CUSTOMER_CREATIONS; } });
100
+ Object.defineProperty(exports, "CHECKOUT_BILLING_ADDRESS_COLLECTIONS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_BILLING_ADDRESS_COLLECTIONS; } });
101
+ Object.defineProperty(exports, "CHECKOUT_CUSTOM_FIELD_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_CUSTOM_FIELD_TYPES; } });
102
+ Object.defineProperty(exports, "CHECKOUT_TAX_ID_TYPES", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_TAX_ID_TYPES; } });
103
+ Object.defineProperty(exports, "CHECKOUT_LIMITS", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_LIMITS; } });
104
+ Object.defineProperty(exports, "CHECKOUT_SESSION_ID_TEMPLATE", { enumerable: true, get: function () { return checkoutSession_1.CHECKOUT_SESSION_ID_TEMPLATE; } });
105
+ var branding_1 = require("./branding");
106
+ Object.defineProperty(exports, "BRANDING_FONTS", { enumerable: true, get: function () { return branding_1.BRANDING_FONTS; } });
107
+ Object.defineProperty(exports, "BRANDING_BORDER_STYLES", { enumerable: true, get: function () { return branding_1.BRANDING_BORDER_STYLES; } });
108
+ Object.defineProperty(exports, "BRANDING_COLOR_PATTERN", { enumerable: true, get: function () { return branding_1.BRANDING_COLOR_PATTERN; } });
109
+ Object.defineProperty(exports, "DEFAULT_BRANDING", { enumerable: true, get: function () { return branding_1.DEFAULT_BRANDING; } });
80
110
  var social_1 = require("./social");
81
111
  Object.defineProperty(exports, "SOCIAL_SOURCE_APP_MAX_LENGTH", { enumerable: true, get: function () { return social_1.SOCIAL_SOURCE_APP_MAX_LENGTH; } });
82
112
  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
+ });
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REPORT_RUN_STATUSES = exports.REPORT_TYPE_LAYOUTS = exports.REPORT_TYPE_IDS = void 0;
4
+ /**
5
+ * Every report Peable produces, by Stripe's versioned id: the trailing `.1` is
6
+ * the column layout's version, so a layout can change under a new id without
7
+ * changing a report a merchant already parses.
8
+ */
9
+ exports.REPORT_TYPE_IDS = [
10
+ 'payments.itemized.1',
11
+ 'balance.summary.1',
12
+ 'payouts.itemized.1',
13
+ ];
14
+ /**
15
+ * The layout of each report: its name, every column it can carry and the ones
16
+ * it carries when `parameters.columns` is absent. Fixed per version.
17
+ *
18
+ * - `payments.itemized.1` — one row per payment intent CREATED in the
19
+ * interval. Amounts are base-unit strings, as on the API.
20
+ * - `balance.summary.1` — per currency, the balance at `interval_start`, the
21
+ * activity and payouts inside the interval, and the balance at
22
+ * `interval_end`, from the ledger (ADR 0015). A figure built on a transaction
23
+ * whose fee the provider has not reported is empty, never `0`.
24
+ * - `payouts.itemized.1` — one row per payout created in the interval.
25
+ */
26
+ exports.REPORT_TYPE_LAYOUTS = Object.freeze({
27
+ 'payments.itemized.1': {
28
+ name: 'Itemized payments',
29
+ columns: [
30
+ 'payment_intent_id',
31
+ 'created_utc',
32
+ 'status',
33
+ 'rail',
34
+ 'currency',
35
+ 'amount',
36
+ 'amount_received',
37
+ 'amount_refunded',
38
+ 'customer_id',
39
+ 'charge_id',
40
+ 'capture_method',
41
+ 'description',
42
+ 'receipt_email',
43
+ 'cancellation_reason',
44
+ 'canceled_at_utc',
45
+ ],
46
+ default_columns: [
47
+ 'payment_intent_id',
48
+ 'created_utc',
49
+ 'status',
50
+ 'currency',
51
+ 'amount',
52
+ 'amount_received',
53
+ 'amount_refunded',
54
+ 'customer_id',
55
+ ],
56
+ ledger: false,
57
+ },
58
+ 'balance.summary.1': {
59
+ name: 'Balance summary',
60
+ columns: ['category', 'description', 'currency', 'net_amount', 'transaction_count'],
61
+ default_columns: ['category', 'description', 'currency', 'net_amount'],
62
+ ledger: true,
63
+ },
64
+ 'payouts.itemized.1': {
65
+ name: 'Itemized payouts',
66
+ columns: [
67
+ 'payout_id',
68
+ 'created_utc',
69
+ 'arrival_date_utc',
70
+ 'status',
71
+ 'currency',
72
+ 'amount',
73
+ 'method',
74
+ 'type',
75
+ 'automatic',
76
+ 'description',
77
+ 'statement_descriptor',
78
+ 'failure_code',
79
+ ],
80
+ default_columns: [
81
+ 'payout_id',
82
+ 'created_utc',
83
+ 'arrival_date_utc',
84
+ 'status',
85
+ 'currency',
86
+ 'amount',
87
+ 'automatic',
88
+ ],
89
+ ledger: true,
90
+ },
91
+ });
92
+ exports.REPORT_RUN_STATUSES = ['pending', 'succeeded', 'failed'];
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // The search contract (Stripe's Search API): `GET /v1/<objects>/search?query=…`.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.SEARCH_SUBSTRING_MIN_LENGTH = exports.SEARCH_QUERY_MAX_CLAUSES = exports.SEARCH_QUERY_MAX_LENGTH = exports.SEARCHABLE_RESOURCES = void 0;
5
+ /** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
6
+ exports.SEARCHABLE_RESOURCES = [
7
+ 'payment_intents',
8
+ 'charges',
9
+ 'customers',
10
+ 'products',
11
+ 'prices',
12
+ 'refunds',
13
+ ];
14
+ /** Search query bounds — the gateway's, restated so a client can check before it asks. */
15
+ exports.SEARCH_QUERY_MAX_LENGTH = 1000;
16
+ exports.SEARCH_QUERY_MAX_CLAUSES = 10;
17
+ /** A `~` substring needs at least this many characters (Stripe's rule). */
18
+ exports.SEARCH_SUBSTRING_MIN_LENGTH = 3;
@@ -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/file.js CHANGED
@@ -12,9 +12,22 @@ export const FILE_PURPOSES = [
12
12
  'business_logo',
13
13
  'identity_document',
14
14
  'additional_verification',
15
+ 'finance_report_run',
16
+ ];
17
+ /**
18
+ * The purposes a merchant may upload or import. `finance_report_run` is not
19
+ * among them: a report's CSV is written by Peable's report runs
20
+ * (`/v1/reporting/report_runs`) and nobody else, so a file of that purpose is
21
+ * always a report Peable produced.
22
+ */
23
+ export const FILE_UPLOAD_PURPOSES = [
24
+ 'dispute_evidence',
25
+ 'business_logo',
26
+ 'identity_document',
27
+ 'additional_verification',
15
28
  ];
16
29
  /** The stored format, by its conventional extension (Stripe's `type`). */
17
- export const FILE_TYPES = ['pdf', 'png', 'jpg'];
30
+ export const FILE_TYPES = ['pdf', 'png', 'jpg', 'csv'];
18
31
  /**
19
32
  * Whether the bytes can be used right now.
20
33
  *
@@ -26,16 +39,18 @@ export const FILE_TYPES = ['pdf', 'png', 'jpg'];
26
39
  */
27
40
  export const FILE_STATUSES = ['available', 'withheld', 'removed'];
28
41
  /**
29
- * The upload policy of each purpose: the formats it takes, recognised from the
30
- * bytes and never from a client's `Content-Type`, and the largest file.
42
+ * The policy of each purpose: the formats it takes, recognised from the bytes
43
+ * and never from a client's `Content-Type`, and the largest file.
31
44
  *
32
45
  * The provider's own ceilings, restated where the upload is parsed, so a file
33
46
  * the card network would refuse is refused at upload — not at the one-shot
34
- * dispute submission it was meant for.
47
+ * dispute submission it was meant for. `finance_report_run` is Peable's own
48
+ * output (see {@link FILE_UPLOAD_PURPOSES}); its ceiling bounds a report.
35
49
  */
36
50
  export const FILE_PURPOSE_POLICIES = Object.freeze({
37
51
  dispute_evidence: { types: ['pdf', 'png', 'jpg'], max_bytes: 5 * 1024 * 1024 },
38
52
  business_logo: { types: ['png', 'jpg'], max_bytes: 512 * 1024 },
39
53
  identity_document: { types: ['pdf', 'png', 'jpg'], max_bytes: 10 * 1024 * 1024 },
40
54
  additional_verification: { types: ['pdf', 'png', 'jpg'], max_bytes: 10 * 1024 * 1024 },
55
+ finance_report_run: { types: ['csv'], max_bytes: 64 * 1024 * 1024 },
41
56
  });
package/dist/esm/index.js CHANGED
@@ -6,7 +6,9 @@ export { PEABLE_API_VERSION, } from './event.js';
6
6
  export { WEBHOOK_ENDPOINT_STATUSES, WEBHOOK_ENDPOINT_DISABLED_REASONS, WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT, WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS, } from './webhookEndpoint.js';
7
7
  export { PRICE_BILLING_SCHEMES, PRICE_TIERS_MODES, PRICE_TYPES, RECURRING_INTERVALS, RECURRING_USAGE_TYPES, PRICE_TAX_BEHAVIORS, TRANSFORM_QUANTITY_ROUNDS, COUPON_DURATIONS, CATALOG_LIMITS, } from './catalog.js';
8
8
  export { DISPUTE_FILE_EVIDENCE_FIELDS, DISPUTE_REASONS, DISPUTE_TEXT_EVIDENCE_FIELDS, normalizeDisputeReason, } from './dispute.js';
9
- export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_STATUSES, FILE_TYPES, } from './file.js';
9
+ export { FILE_PURPOSES, FILE_PURPOSE_POLICIES, FILE_UPLOAD_PURPOSES, FILE_STATUSES, FILE_TYPES, } from './file.js';
10
+ export { SEARCHABLE_RESOURCES, SEARCH_QUERY_MAX_CLAUSES, SEARCH_QUERY_MAX_LENGTH, SEARCH_SUBSTRING_MIN_LENGTH, } from './search.js';
11
+ export { REPORT_RUN_STATUSES, REPORT_TYPE_IDS, REPORT_TYPE_LAYOUTS, } from './reporting.js';
10
12
  export { CARD_RAIL_PAYMENT_METHOD_TYPES, PAYMENT_METHOD_CONFIGURATION_TYPES, PAYMENT_METHOD_CURRENCIES, } from './paymentMethodConfiguration.js';
11
13
  export { PAYOUT_INTERVALS, PAYOUT_WEEKLY_ANCHORS, } from './account.js';
12
14
  export { BALANCE_TRANSACTION_STATUSES, BALANCE_TRANSACTION_TYPES, PAYOUT_STATUSES, RECONCILIATION_MISMATCH_KINDS, } from './balance.js';
@@ -15,6 +17,9 @@ export { REQUEST_LOG_METHODS, REQUEST_LOG_RETENTION_DAYS, } from './requestLog.j
15
17
  export { SIMULATED_FAIRCOIN_OUTCOMES, } from './testHelpers.js';
16
18
  export { signWebhook, verifyWebhook } from './webhookSigner.js';
17
19
  export { MERCHANT_ENVIRONMENTS, } from './merchant.js';
20
+ export { PAYMENT_LINK_LIMITS, } from './paymentLink.js';
21
+ 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';
22
+ export { BRANDING_FONTS, BRANDING_BORDER_STYLES, BRANDING_COLOR_PATTERN, DEFAULT_BRANDING, } from './branding.js';
18
23
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from './social.js';
19
24
  export { BILLING_SUBSCRIPTION_STATUSES, } from './billing.js';
20
25
  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
+ });
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Every report Peable produces, by Stripe's versioned id: the trailing `.1` is
3
+ * the column layout's version, so a layout can change under a new id without
4
+ * changing a report a merchant already parses.
5
+ */
6
+ export const REPORT_TYPE_IDS = [
7
+ 'payments.itemized.1',
8
+ 'balance.summary.1',
9
+ 'payouts.itemized.1',
10
+ ];
11
+ /**
12
+ * The layout of each report: its name, every column it can carry and the ones
13
+ * it carries when `parameters.columns` is absent. Fixed per version.
14
+ *
15
+ * - `payments.itemized.1` — one row per payment intent CREATED in the
16
+ * interval. Amounts are base-unit strings, as on the API.
17
+ * - `balance.summary.1` — per currency, the balance at `interval_start`, the
18
+ * activity and payouts inside the interval, and the balance at
19
+ * `interval_end`, from the ledger (ADR 0015). A figure built on a transaction
20
+ * whose fee the provider has not reported is empty, never `0`.
21
+ * - `payouts.itemized.1` — one row per payout created in the interval.
22
+ */
23
+ export const REPORT_TYPE_LAYOUTS = Object.freeze({
24
+ 'payments.itemized.1': {
25
+ name: 'Itemized payments',
26
+ columns: [
27
+ 'payment_intent_id',
28
+ 'created_utc',
29
+ 'status',
30
+ 'rail',
31
+ 'currency',
32
+ 'amount',
33
+ 'amount_received',
34
+ 'amount_refunded',
35
+ 'customer_id',
36
+ 'charge_id',
37
+ 'capture_method',
38
+ 'description',
39
+ 'receipt_email',
40
+ 'cancellation_reason',
41
+ 'canceled_at_utc',
42
+ ],
43
+ default_columns: [
44
+ 'payment_intent_id',
45
+ 'created_utc',
46
+ 'status',
47
+ 'currency',
48
+ 'amount',
49
+ 'amount_received',
50
+ 'amount_refunded',
51
+ 'customer_id',
52
+ ],
53
+ ledger: false,
54
+ },
55
+ 'balance.summary.1': {
56
+ name: 'Balance summary',
57
+ columns: ['category', 'description', 'currency', 'net_amount', 'transaction_count'],
58
+ default_columns: ['category', 'description', 'currency', 'net_amount'],
59
+ ledger: true,
60
+ },
61
+ 'payouts.itemized.1': {
62
+ name: 'Itemized payouts',
63
+ columns: [
64
+ 'payout_id',
65
+ 'created_utc',
66
+ 'arrival_date_utc',
67
+ 'status',
68
+ 'currency',
69
+ 'amount',
70
+ 'method',
71
+ 'type',
72
+ 'automatic',
73
+ 'description',
74
+ 'statement_descriptor',
75
+ 'failure_code',
76
+ ],
77
+ default_columns: [
78
+ 'payout_id',
79
+ 'created_utc',
80
+ 'arrival_date_utc',
81
+ 'status',
82
+ 'currency',
83
+ 'amount',
84
+ 'automatic',
85
+ ],
86
+ ledger: true,
87
+ },
88
+ });
89
+ export const REPORT_RUN_STATUSES = ['pending', 'succeeded', 'failed'];
@@ -0,0 +1,15 @@
1
+ // The search contract (Stripe's Search API): `GET /v1/<objects>/search?query=…`.
2
+ /** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
3
+ export const SEARCHABLE_RESOURCES = [
4
+ 'payment_intents',
5
+ 'charges',
6
+ 'customers',
7
+ 'products',
8
+ 'prices',
9
+ 'refunds',
10
+ ];
11
+ /** Search query bounds — the gateway's, restated so a client can check before it asks. */
12
+ export const SEARCH_QUERY_MAX_LENGTH = 1000;
13
+ export const SEARCH_QUERY_MAX_CLAUSES = 10;
14
+ /** A `~` substring needs at least this many characters (Stripe's rule). */
15
+ export const SEARCH_SUBSTRING_MIN_LENGTH = 3;