@peable.to/contracts 3.0.0 → 4.0.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.
Files changed (58) hide show
  1. package/dist/cjs/resources/billingEngine/public.js +22 -3
  2. package/dist/cjs/resources/checkout/checkoutSessions.js +34 -9
  3. package/dist/cjs/resources/checkout/merchants.js +10 -23
  4. package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +56 -10
  5. package/dist/cjs/resources/connect/balance.js +5 -0
  6. package/dist/cjs/resources/connect/connectedAccounts.js +11 -12
  7. package/dist/cjs/resources/connect/onboarding.js +13 -24
  8. package/dist/cjs/resources/events/webhookDeliveries.js +1 -1
  9. package/dist/cjs/resources/events/webhookEndpoints.js +1 -1
  10. package/dist/cjs/resources/payments/disputes.js +16 -0
  11. package/dist/cjs/resources/payments/paymentIntents.js +39 -2
  12. package/dist/cjs/resources/payments/refunds.js +46 -11
  13. package/dist/cjs/vocabulary/checkout.js +18 -1
  14. package/dist/cjs/vocabulary/errors.js +5 -3
  15. package/dist/cjs/vocabulary/events.js +5 -0
  16. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +24 -4
  17. package/dist/esm/resources/billingEngine/public.js +22 -3
  18. package/dist/esm/resources/checkout/checkoutSessions.js +35 -10
  19. package/dist/esm/resources/checkout/merchants.js +10 -23
  20. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +57 -11
  21. package/dist/esm/resources/connect/balance.js +5 -0
  22. package/dist/esm/resources/connect/connectedAccounts.js +11 -12
  23. package/dist/esm/resources/connect/onboarding.js +12 -23
  24. package/dist/esm/resources/events/webhookDeliveries.js +1 -1
  25. package/dist/esm/resources/events/webhookEndpoints.js +1 -1
  26. package/dist/esm/resources/payments/disputes.js +16 -0
  27. package/dist/esm/resources/payments/paymentIntents.js +39 -2
  28. package/dist/esm/resources/payments/refunds.js +46 -11
  29. package/dist/esm/vocabulary/checkout.js +17 -0
  30. package/dist/esm/vocabulary/errors.js +5 -3
  31. package/dist/esm/vocabulary/events.js +5 -0
  32. package/dist/esm/vocabulary/paymentMethodConfigurations.js +25 -5
  33. package/dist/types/resources/billingEngine/index.d.ts +16 -2
  34. package/dist/types/resources/billingEngine/public.d.ts +32 -3
  35. package/dist/types/resources/checkout/checkoutSessions.d.ts +96 -31
  36. package/dist/types/resources/checkout/index.d.ts +406 -41
  37. package/dist/types/resources/checkout/merchants.d.ts +17 -28
  38. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +440 -8
  39. package/dist/types/resources/connect/balance.d.ts +103 -10
  40. package/dist/types/resources/connect/connectedAccounts.d.ts +4 -4
  41. package/dist/types/resources/connect/index.d.ts +105 -14
  42. package/dist/types/resources/connect/onboarding.d.ts +15 -15
  43. package/dist/types/resources/connect/payouts.d.ts +66 -4
  44. package/dist/types/resources/events/index.d.ts +5 -0
  45. package/dist/types/resources/events/webhookEndpoints.d.ts +7 -0
  46. package/dist/types/resources/payments/disputes.d.ts +35 -0
  47. package/dist/types/resources/payments/index.d.ts +382 -0
  48. package/dist/types/resources/payments/paymentIntents.d.ts +380 -0
  49. package/dist/types/resources/payments/refunds.d.ts +56 -5
  50. package/dist/types/resources/payments/testHelpers.d.ts +31 -0
  51. package/dist/types/resources/tax/deadlines.d.ts +3 -3
  52. package/dist/types/resources/tax/index.d.ts +2 -2
  53. package/dist/types/resources/tax/registrations.d.ts +2 -2
  54. package/dist/types/vocabulary/checkout.d.ts +13 -0
  55. package/dist/types/vocabulary/errors.d.ts +5 -3
  56. package/dist/types/vocabulary/events.d.ts +5 -1
  57. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +21 -7
  58. package/package.json +1 -1
@@ -1,3 +1,16 @@
1
+ /**
2
+ * Why FairCoin cannot be paid with on an order right now (ADR 0021). It is
3
+ * still offered — never hidden — and says why:
4
+ *
5
+ * - `faircoin_wallet_missing` — the Peable wallet of the account that receives
6
+ * (the merchant's owner, or the seller) isn't set up yet: no identity key;
7
+ * - `faircoin_network_closed` — this deployment does not open payments on the
8
+ * order's FairCoin network yet (ADR 0002's gate);
9
+ * - `price_unavailable` — no fresh FairCoin price exists to quote a fiat order;
10
+ * - `temporarily_unavailable` — whether the wallet exists could not be checked.
11
+ */
12
+ export declare const FAIRCOIN_UNAVAILABLE_REASONS: readonly ["faircoin_wallet_missing", "faircoin_network_closed", "price_unavailable", "temporarily_unavailable"];
13
+ export type FaircoinUnavailableReason = (typeof FAIRCOIN_UNAVAILABLE_REASONS)[number];
1
14
  export declare const CHECKOUT_SESSION_MODES: readonly ["payment", "setup", "subscription"];
2
15
  export type CheckoutSessionMode = (typeof CHECKOUT_SESSION_MODES)[number];
3
16
  export declare const CHECKOUT_SESSION_STATUSES: readonly ["open", "complete", "expired"];
@@ -34,6 +34,7 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
34
34
  readonly parameter_missing: "A required parameter is missing; `param` names it.";
35
35
  readonly parameter_unknown: "The request carries a parameter this route does not accept; `param` names it.";
36
36
  readonly payment_intent_unexpected_state: "The PaymentIntent is in a status that does not allow this operation.";
37
+ readonly payment_method_locked: "The payment method cannot be turned off or removed: FairCoin is always offered to every payer; `param` names the field.";
37
38
  readonly payout_not_allowed: "Payouts cannot be created for this account.";
38
39
  readonly rate_limited: "Too many requests; back off and retry.";
39
40
  readonly refund_not_cancelable: "The refund has already left a cancelable state.";
@@ -44,7 +45,6 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
44
45
  readonly test_mode_only: "This operation exists in test mode only.";
45
46
  readonly too_many_streams: "Too many live streams are open for this merchant.";
46
47
  readonly url_invalid: "The URL is not an allowed https URL.";
47
- readonly watch_only_violation: "The extended key carries a private key. Peable only ever accepts watch-only (public) keys.";
48
48
  readonly webhook_endpoint_disabled: "The webhook endpoint is disabled.";
49
49
  readonly webhook_endpoint_limit_reached: "The merchant already has the maximum number of webhook endpoints.";
50
50
  readonly account_not_ready: "The connected account cannot take this payment yet: its onboarding or a capability is incomplete.";
@@ -105,6 +105,9 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
105
105
  readonly promotion_code_minimum_amount: "The purchase is below the promotion code minimum amount.";
106
106
  readonly payment_method_missing: "No payment method is available to charge.";
107
107
  readonly faircoin_cannot_debit: "A FairCoin invoice cannot be charged automatically: the payer signs every payment.";
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
+ 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
+ readonly faircoin_network_closed: "FairCoin payments on this network are not open on this deployment yet. The other payment methods still work.";
108
111
  readonly credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.";
109
112
  readonly test_clock_unexpected_state: "The test clock is advancing; wait until it is ready.";
110
113
  readonly meter_event_customer_missing: "The meter event names no customer of this merchant.";
@@ -116,8 +119,7 @@ export declare const ERROR_CODE_DESCRIPTIONS: {
116
119
  readonly network_mismatch: "The FairCoin network differs from the one this object uses.";
117
120
  readonly link_expired: "The onboarding link has expired or was already used; `refresh_url` is where the seller gets a fresh one.";
118
121
  readonly wrong_seller: "The onboarding link names a different Oxy account; sign in as the seller it was minted for.";
119
- readonly already_registered: "The seller already registered a FairCoin key, and it cannot be changed.";
120
- readonly key_in_use: "The key already receives payments for another account.";
122
+ readonly already_registered: "The seller already confirmed FairCoin payments into their Peable wallet.";
121
123
  readonly no_faircoin_half: "The connected account has no FairCoin half to register a key for.";
122
124
  readonly merchant_missing: "The application has no merchant in this environment yet; register one (Orbit shows \"Set up payments\").";
123
125
  readonly application_membership_required: "The signed-in Oxy account is not a member of the account that owns this application.";
@@ -146,8 +146,12 @@ export type WebhookEndpointStatus = (typeof WEBHOOK_ENDPOINT_STATUSES)[number];
146
146
  * - `delivery_failures` — every delivery to it failed for three days
147
147
  * straight, so Peable stopped sending. Re-enabling it (`disabled: false`)
148
148
  * starts the clock again.
149
+ * - `url_refused` — its stored `url` breaks the rules a URL is
150
+ * registered under (https in live mode, ports 80/443, no private, loopback
151
+ * or reserved address), judged again before every delivery, so Peable never
152
+ * sent to it. It is re-enabled only together with a `url` that passes.
149
153
  */
150
- export declare const WEBHOOK_ENDPOINT_DISABLED_REASONS: readonly ["disabled_by_merchant", "delivery_failures"];
154
+ export declare const WEBHOOK_ENDPOINT_DISABLED_REASONS: readonly ["disabled_by_merchant", "delivery_failures", "url_refused"];
151
155
  export type WebhookEndpointDisabledReason = (typeof WEBHOOK_ENDPOINT_DISABLED_REASONS)[number];
152
156
  /** At most this many endpoints per merchant (per mode). */
153
157
  export declare const WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = 16;
@@ -1,6 +1,13 @@
1
- import { type FiatCurrencyCode } from './money';
1
+ import { type CurrencyCode } from './money';
2
2
  /**
3
- * The methods a configuration can turn on.
3
+ * The methods a configuration lists.
4
+ *
5
+ * `faircoin` is listed and LOCKED (ADR 0021 D2): every payer can always pay
6
+ * with FairCoin, so its entry is always `display_preference.value: 'on'` with
7
+ * `locked: true`, and a create or update that sets it `off` is refused with
8
+ * `payment_method_locked`. It is the chain rail, never a card-provider method:
9
+ * it is never pushed to the provider and never appears in a card PaymentIntent's
10
+ * `payment_method_types`. Every other method is the merchant's to turn on and off.
4
11
  *
5
12
  * `apple_pay` and `google_pay` are WALLETS over a card: a payment made with one
6
13
  * is a `card` payment, so they appear here and never in a PaymentIntent's
@@ -11,19 +18,26 @@ import { type FiatCurrencyCode } from './money';
11
18
  * checkout, `payment-provider-boundary.md`) and giropay (discontinued by the
12
19
  * scheme).
13
20
  */
14
- export declare const PAYMENT_METHOD_CONFIGURATION_TYPES: readonly ["card", "apple_pay", "google_pay", "sepa_debit", "ideal", "bancontact", "eps", "bizum"];
21
+ export declare const PAYMENT_METHOD_CONFIGURATION_TYPES: readonly ["faircoin", "card", "apple_pay", "google_pay", "sepa_debit", "ideal", "bancontact", "eps", "bizum"];
15
22
  export type PaymentMethodConfigurationType = (typeof PAYMENT_METHOD_CONFIGURATION_TYPES)[number];
16
23
  /**
17
24
  * Why a method cannot be offered whatever the merchant chooses.
18
25
  *
19
26
  * - `provider_unsupported` — the processing provider does not offer it;
20
- * - `requires_card` — a wallet rides on card payments, and card is off.
27
+ * - `requires_card` — a wallet rides on card payments, and card is off;
28
+ * - `faircoin_wallet_missing` — the Peable wallet of the account that owns
29
+ * the merchant isn't set up yet (no identity key), so FairCoin cannot be
30
+ * received (ADR 0021 D5); the owner sets it up in Peable;
31
+ * - `faircoin_network_closed` — the deployment does not open the merchant's
32
+ * FairCoin network yet (ADR 0002's gate);
33
+ * - `temporarily_unavailable` — the wallet could not be checked just now.
21
34
  */
22
- export declare const PAYMENT_METHOD_UNAVAILABLE_REASONS: readonly ["provider_unsupported", "requires_card"];
35
+ export declare const PAYMENT_METHOD_UNAVAILABLE_REASONS: readonly ["provider_unsupported", "requires_card", "faircoin_wallet_missing", "faircoin_network_closed", "temporarily_unavailable"];
23
36
  export type PaymentMethodUnavailableReason = (typeof PAYMENT_METHOD_UNAVAILABLE_REASONS)[number];
24
37
  /**
25
38
  * The currencies each method can take a payment in. A method is offered on a
26
39
  * payment only when its currency is listed — so iDEAL never appears on a USD
27
- * payment, and a payer is never shown a method that would fail.
40
+ * payment, and a payer is never shown a method that would fail. FairCoin takes
41
+ * every currency: a `FAIR` order directly, a fiat one at a quoted price (ADR 0021).
28
42
  */
29
- export declare const PAYMENT_METHOD_CURRENCIES: Readonly<Record<PaymentMethodConfigurationType, readonly FiatCurrencyCode[]>>;
43
+ export declare const PAYMENT_METHOD_CURRENCIES: Readonly<Record<PaymentMethodConfigurationType, readonly CurrencyCode[]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/contracts",
3
- "version": "3.0.0",
3
+ "version": "4.0.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",