@peable.to/contracts 5.3.0 → 5.4.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.
@@ -73,7 +73,12 @@ const merchantDescription = zod_1.z.string().min(1).max(512);
73
73
  */
74
74
  exports.registerMerchantParams = zod_1.z
75
75
  .object({
76
- required_confirmations: zod_1.z.number().int().positive().optional(),
76
+ required_confirmations: zod_1.z
77
+ .number()
78
+ .int()
79
+ .positive()
80
+ .optional()
81
+ .describe('Confirmations a FairCoin payment needs to succeed. Defaults to 6 for a live (mainnet) merchant, 1 on testnet.'),
77
82
  display_name: displayName.optional(),
78
83
  avatar_file_id: avatarFileId.optional(),
79
84
  description: merchantDescription.optional(),
@@ -318,7 +318,13 @@ exports.createPaymentIntentParams = zod_1.z
318
318
  ...exports.railParams,
319
319
  ...exports.connectedAccountParam,
320
320
  metadata: params_1.metadataCreateParam.optional(),
321
- expires_in_seconds: zod_1.z.number().int().positive().optional(),
321
+ expires_in_seconds: zod_1.z
322
+ .number()
323
+ .int()
324
+ .positive()
325
+ .max(payments_1.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS)
326
+ .optional()
327
+ .describe('How long the payment stays payable, in seconds: at most 86400 (24 hours). Defaults to 900 (15 minutes).'),
322
328
  payment_method_types: zod_1.z
323
329
  .array(zod_1.z.enum(payments_1.PAYMENT_METHOD_TYPES))
324
330
  .min(1)
@@ -77,7 +77,9 @@ exports.socialNextAddressParams = zod_1.z
77
77
  .strict();
78
78
  exports.socialNextAddressSchema = (0, objects_1.defineComponent)('SocialNextAddress', zod_1.z
79
79
  .object({
80
- address: zod_1.z.string().describe("A fresh single-use address of the recipient's."),
80
+ address: zod_1.z
81
+ .string()
82
+ .describe("A single-use address of the recipient's: the one this sender already holds and has not paid, or a fresh one."),
81
83
  index: zod_1.z.number().int().nonnegative().describe('Its social-receive derivation index.'),
82
84
  })
83
85
  .strict());
@@ -15,7 +15,8 @@ exports.checkoutLocaleDirection = checkoutLocaleDirection;
15
15
  * - `faircoin_network_closed` — this deployment does not open payments on the
16
16
  * order's FairCoin network yet (ADR 0002's gate);
17
17
  * - `price_unavailable` — no fresh FairCoin price exists to quote a fiat order;
18
- * - `temporarily_unavailable` — whether the wallet exists could not be checked.
18
+ * - `temporarily_unavailable` — whether the wallet exists could not be checked, or every
19
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
19
20
  */
20
21
  exports.FAIRCOIN_UNAVAILABLE_REASONS = [
21
22
  'faircoin_wallet_missing',
@@ -134,6 +134,7 @@ exports.ERROR_CODE_DESCRIPTIONS = {
134
134
  faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
135
135
  faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
136
136
  faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
137
+ faircoin_capacity_reached: 'Too many FairCoin payments to this recipient are waiting to be paid right now, so no new FairCoin address can be handed out. The other payment methods still work; try FairCoin again shortly.',
137
138
  faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
138
139
  credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
139
140
  test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
@@ -44,7 +44,8 @@ exports.PAYMENT_METHOD_CONFIGURATION_TYPES = [
44
44
  * received (ADR 0021 D5); the owner sets it up in Peable;
45
45
  * - `faircoin_network_closed` — the deployment does not open the merchant's
46
46
  * FairCoin network yet (ADR 0002's gate);
47
- * - `temporarily_unavailable` — the wallet could not be checked just now.
47
+ * - `temporarily_unavailable` — the wallet could not be checked just now, or every
48
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
48
49
  */
49
50
  exports.PAYMENT_METHOD_UNAVAILABLE_REASONS = [
50
51
  'provider_unsupported',
@@ -4,12 +4,19 @@
4
4
  // contracts are built from. Zod-free, so the wallet and the shared types read
5
5
  // them without bundling a schema.
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.ENRICH_MAX_ADDRESSES = exports.ENRICHMENT_KINDS = exports.SOCIAL_PAYMENT_DIRECTIONS = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.SETUP_INTENT_CANCELLATION_REASONS = exports.SETUP_INTENT_USAGES = exports.SETUP_INTENT_STATUSES = exports.DISPUTE_EVIDENCE_TEXT_MAX = exports.DISPUTE_FILE_EVIDENCE_FIELDS = exports.DISPUTE_TEXT_EVIDENCE_FIELDS = exports.DISPUTE_REASONS = exports.DISPUTE_STATUSES = exports.SETTLEMENT_STATUSES = exports.REFUND_ORIGINS = exports.REFUND_REASONS = exports.REFUND_STATUSES = exports.CLIENT_ACTION_KINDS = exports.PAYMENT_ERROR_TYPES = exports.PAYMENT_METHOD_TYPES = exports.CARD_RAIL_PAYMENT_METHOD_TYPES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.MERCHANT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_RAILS = void 0;
7
+ exports.SIMULATED_FAIRCOIN_OUTCOMES = exports.ENRICH_MAX_ADDRESSES = exports.ENRICHMENT_KINDS = exports.SOCIAL_PAYMENT_DIRECTIONS = exports.SOCIAL_SOURCE_REF_MAX_LENGTH = exports.SOCIAL_SOURCE_APP_MAX_LENGTH = exports.SETUP_INTENT_CANCELLATION_REASONS = exports.SETUP_INTENT_USAGES = exports.SETUP_INTENT_STATUSES = exports.DISPUTE_EVIDENCE_TEXT_MAX = exports.DISPUTE_FILE_EVIDENCE_FIELDS = exports.DISPUTE_TEXT_EVIDENCE_FIELDS = exports.DISPUTE_REASONS = exports.DISPUTE_STATUSES = exports.SETTLEMENT_STATUSES = exports.REFUND_ORIGINS = exports.REFUND_REASONS = exports.REFUND_STATUSES = exports.CLIENT_ACTION_KINDS = exports.PAYMENT_ERROR_TYPES = exports.PAYMENT_METHOD_TYPES = exports.CARD_RAIL_PAYMENT_METHOD_TYPES = exports.PAYMENT_INTENT_SETUP_FUTURE_USAGES = exports.PAYMENT_INTENT_CAPTURE_METHODS = exports.MERCHANT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_CANCELLATION_REASONS = exports.PAYMENT_INTENT_STATUSES = exports.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = exports.PAYMENT_INTENT_RAILS = void 0;
8
8
  /**
9
9
  * Which rail moves the money (ADR 0001 D1). On the INTENT, not on the merchant:
10
10
  * one merchant takes both, and the rail decides which fields mean anything.
11
11
  */
12
12
  exports.PAYMENT_INTENT_RAILS = ['faircoin', 'card'];
13
+ /**
14
+ * The longest a PaymentIntent created through the API may stay payable before
15
+ * it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
16
+ * reserved address in the recipient's wallet for as long as it is payable, so
17
+ * an unbounded expiry is an address nobody can ever recycle (ADR 0021 D9).
18
+ */
19
+ exports.PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
13
20
  /**
14
21
  * Stripe's seven statuses, and no others (ADR 0019). The FairCoin rail walks
15
22
  * four of them (`requires_action` → `processing` → `succeeded` | `canceled`); a
@@ -70,7 +70,12 @@ const merchantDescription = z.string().min(1).max(512);
70
70
  */
71
71
  export const registerMerchantParams = z
72
72
  .object({
73
- required_confirmations: z.number().int().positive().optional(),
73
+ required_confirmations: z
74
+ .number()
75
+ .int()
76
+ .positive()
77
+ .optional()
78
+ .describe('Confirmations a FairCoin payment needs to succeed. Defaults to 6 for a live (mainnet) merchant, 1 on testnet.'),
74
79
  display_name: displayName.optional(),
75
80
  avatar_file_id: avatarFileId.optional(),
76
81
  description: merchantDescription.optional(),
@@ -6,7 +6,7 @@ import { clearable, expandParam, idParam, listQuery, metadataCreateParam, metada
6
6
  import { amount, currency, fiatCurrency, livemode, metadata, network, nullableString, unixSeconds, } from '../../common/primitives.js';
7
7
  import { defineRoute } from '../../route.js';
8
8
  import { CURRENCY_CODES, isBaseUnitString, NETWORK_TYPES } from '../../vocabulary/money.js';
9
- import { CARD_RAIL_PAYMENT_METHOD_TYPES, CLIENT_ACTION_KINDS, MERCHANT_CANCELLATION_REASONS, PAYMENT_ERROR_TYPES, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, PAYMENT_METHOD_TYPES, } from '../../vocabulary/payments.js';
9
+ import { CARD_RAIL_PAYMENT_METHOD_TYPES, CLIENT_ACTION_KINDS, MERCHANT_CANCELLATION_REASONS, PAYMENT_ERROR_TYPES, PAYMENT_INTENT_CANCELLATION_REASONS, PAYMENT_INTENT_CAPTURE_METHODS, PAYMENT_INTENT_RAILS, PAYMENT_INTENT_SETUP_FUTURE_USAGES, PAYMENT_INTENT_STATUSES, PAYMENT_METHOD_TYPES, PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS, } from '../../vocabulary/payments.js';
10
10
  /**
11
11
  * PaymentIntents (`pi_…`) — Stripe's PaymentIntent, at the root (ADR 0019):
12
12
  * one status vocabulary over two rails, the non-custodial FairCoin lifecycle
@@ -315,7 +315,13 @@ export const createPaymentIntentParams = z
315
315
  ...railParams,
316
316
  ...connectedAccountParam,
317
317
  metadata: metadataCreateParam.optional(),
318
- expires_in_seconds: z.number().int().positive().optional(),
318
+ expires_in_seconds: z
319
+ .number()
320
+ .int()
321
+ .positive()
322
+ .max(PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS)
323
+ .optional()
324
+ .describe('How long the payment stays payable, in seconds: at most 86400 (24 hours). Defaults to 900 (15 minutes).'),
319
325
  payment_method_types: z
320
326
  .array(z.enum(PAYMENT_METHOD_TYPES))
321
327
  .min(1)
@@ -74,7 +74,9 @@ export const socialNextAddressParams = z
74
74
  .strict();
75
75
  export const socialNextAddressSchema = defineComponent('SocialNextAddress', z
76
76
  .object({
77
- address: z.string().describe("A fresh single-use address of the recipient's."),
77
+ address: z
78
+ .string()
79
+ .describe("A single-use address of the recipient's: the one this sender already holds and has not paid, or a fresh one."),
78
80
  index: z.number().int().nonnegative().describe('Its social-receive derivation index.'),
79
81
  })
80
82
  .strict());
@@ -11,7 +11,8 @@
11
11
  * - `faircoin_network_closed` — this deployment does not open payments on the
12
12
  * order's FairCoin network yet (ADR 0002's gate);
13
13
  * - `price_unavailable` — no fresh FairCoin price exists to quote a fiat order;
14
- * - `temporarily_unavailable` — whether the wallet exists could not be checked.
14
+ * - `temporarily_unavailable` — whether the wallet exists could not be checked, or every
15
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
15
16
  */
16
17
  export const FAIRCOIN_UNAVAILABLE_REASONS = [
17
18
  'faircoin_wallet_missing',
@@ -129,6 +129,7 @@ export const ERROR_CODE_DESCRIPTIONS = {
129
129
  faircoin_price_unavailable: 'No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.',
130
130
  faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.",
131
131
  faircoin_network_closed: 'FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.',
132
+ faircoin_capacity_reached: 'Too many FairCoin payments to this recipient are waiting to be paid right now, so no new FairCoin address can be handed out. The other payment methods still work; try FairCoin again shortly.',
132
133
  faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.",
133
134
  credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
134
135
  test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
@@ -41,7 +41,8 @@ export const PAYMENT_METHOD_CONFIGURATION_TYPES = [
41
41
  * received (ADR 0021 D5); the owner sets it up in Peable;
42
42
  * - `faircoin_network_closed` — the deployment does not open the merchant's
43
43
  * FairCoin network yet (ADR 0002's gate);
44
- * - `temporarily_unavailable` — the wallet could not be checked just now.
44
+ * - `temporarily_unavailable` — the wallet could not be checked just now, or every
45
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
45
46
  */
46
47
  export const PAYMENT_METHOD_UNAVAILABLE_REASONS = [
47
48
  'provider_unsupported',
@@ -7,6 +7,13 @@
7
7
  * one merchant takes both, and the rail decides which fields mean anything.
8
8
  */
9
9
  export const PAYMENT_INTENT_RAILS = ['faircoin', 'card'];
10
+ /**
11
+ * The longest a PaymentIntent created through the API may stay payable before
12
+ * it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
13
+ * reserved address in the recipient's wallet for as long as it is payable, so
14
+ * an unbounded expiry is an address nobody can ever recycle (ADR 0021 D9).
15
+ */
16
+ export const PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
10
17
  /**
11
18
  * Stripe's seven statuses, and no others (ADR 0019). The FairCoin rail walks
12
19
  * four of them (`requires_action` → `processing` → `succeeded` | `canceled`); a
@@ -7,7 +7,8 @@
7
7
  * - `faircoin_network_closed` — this deployment does not open payments on the
8
8
  * order's FairCoin network yet (ADR 0002's gate);
9
9
  * - `price_unavailable` — no fresh FairCoin price exists to quote a fiat order;
10
- * - `temporarily_unavailable` — whether the wallet exists could not be checked.
10
+ * - `temporarily_unavailable` — whether the wallet exists could not be checked, or every
11
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
11
12
  */
12
13
  export declare const FAIRCOIN_UNAVAILABLE_REASONS: readonly ["faircoin_wallet_missing", "faircoin_network_closed", "price_unavailable", "temporarily_unavailable"];
13
14
  export type FaircoinUnavailableReason = (typeof FAIRCOIN_UNAVAILABLE_REASONS)[number];
@@ -108,6 +108,7 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
108
108
  readonly faircoin_price_unavailable: "No fresh FairCoin price exists right now, so this order cannot be quoted in FAIR. The other payment methods still work; try FairCoin again shortly.";
109
109
  readonly faircoin_wallet_missing: "The Peable wallet that receives this payment (the merchant owner's, or the seller's) isn't set up yet, so it cannot be paid in FairCoin. The other payment methods still work.";
110
110
  readonly faircoin_network_closed: "FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.";
111
+ readonly faircoin_capacity_reached: "Too many FairCoin payments to this recipient are waiting to be paid right now, so no new FairCoin address can be handed out. The other payment methods still work; try FairCoin again shortly.";
111
112
  readonly faircoin_amount_too_small: "One seller's share of this order is below the smallest amount the FairCoin network relays, so it cannot be paid in FairCoin. The other payment methods still work.";
112
113
  readonly credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.";
113
114
  readonly test_clock_unexpected_state: "The test clock is advancing; wait until it is ready.";
@@ -30,7 +30,8 @@ export type PaymentMethodConfigurationType = (typeof PAYMENT_METHOD_CONFIGURATIO
30
30
  * received (ADR 0021 D5); the owner sets it up in Peable;
31
31
  * - `faircoin_network_closed` — the deployment does not open the merchant's
32
32
  * FairCoin network yet (ADR 0002's gate);
33
- * - `temporarily_unavailable` — the wallet could not be checked just now.
33
+ * - `temporarily_unavailable` — the wallet could not be checked just now, or every
34
+ * address the recipient can hold open is open (ADR 0021 D9) — try again shortly.
34
35
  */
35
36
  export declare const PAYMENT_METHOD_UNAVAILABLE_REASONS: readonly ["provider_unsupported", "requires_card", "faircoin_wallet_missing", "faircoin_network_closed", "temporarily_unavailable"];
36
37
  export type PaymentMethodUnavailableReason = (typeof PAYMENT_METHOD_UNAVAILABLE_REASONS)[number];
@@ -4,6 +4,13 @@
4
4
  */
5
5
  export declare const PAYMENT_INTENT_RAILS: readonly ["faircoin", "card"];
6
6
  export type PaymentIntentRail = (typeof PAYMENT_INTENT_RAILS)[number];
7
+ /**
8
+ * The longest a PaymentIntent created through the API may stay payable before
9
+ * it expires (`expires_in_seconds`): 24 hours. A FairCoin payment holds a
10
+ * reserved address in the recipient's wallet for as long as it is payable, so
11
+ * an unbounded expiry is an address nobody can ever recycle (ADR 0021 D9).
12
+ */
13
+ export declare const PAYMENT_INTENT_MAX_EXPIRES_IN_SECONDS: number;
7
14
  /**
8
15
  * Stripe's seven statuses, and no others (ADR 0019). The FairCoin rail walks
9
16
  * four of them (`requires_action` → `processing` → `succeeded` | `canceled`); a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/contracts",
3
- "version": "5.3.0",
3
+ "version": "5.4.0",
4
4
  "description": "The Peable wire, declared once: Zod contracts of every public route, the OpenAPI 3.1 generator and the closed value sets (ADR 0014 D5).",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",