@peable.to/shared-types 0.3.4-oxy-one.0 → 0.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.
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PEABLE_BILLING_AUTHORITY_KEYS = void 0;
3
4
  exports.canonicalBillingAuthority = canonicalBillingAuthority;
4
5
  exports.canonicalBillingTaxQuote = canonicalBillingTaxQuote;
5
6
  /** Canonical JSON v1: lexicographic object keys, array order preserved, UTF-8.
@@ -37,3 +38,17 @@ function canonicalBillingTaxQuote(authority) {
37
38
  quote: authority.quote,
38
39
  });
39
40
  }
41
+ /**
42
+ * The PUBLIC halves of the Ed25519 keys production Peable signs billing
43
+ * authority with (signed tax quotes and final invoice authorities), by key id.
44
+ * Pin these as the SDK's `invoiceAuthorityKeys` / `taxQuoteAuthorityKeys`.
45
+ *
46
+ * The private halves exist only in Peable's production secret store and reach
47
+ * the gateway as a mounted file (`PEABLE_BILLING_INVOICE_PRIVATE_KEY_FILE`); the
48
+ * gateway refuses to sign with a key whose public half is not listed here. A
49
+ * rotation adds the new id beside the old one, and the old id is removed only
50
+ * after every authority it signed has been consumed.
51
+ */
52
+ exports.PEABLE_BILLING_AUTHORITY_KEYS = Object.freeze({
53
+ 'peable-billing-2026-10': '-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAt6lkqirzUxlnt22igH+lRWW7+dRRlk4QK0a2wIKfnCA=\n-----END PUBLIC KEY-----\n',
54
+ });
package/dist/cjs/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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.CARD_ONLY_STATUSES = exports.CHAIN_ONLY_STATUSES = exports.PAYMENT_INTENT_RAILS = exports.PAYMENT_INTENT_STATUSES = exports.POST_SETTLEMENT_STATUSES = exports.reachesSettlementFromPayer = exports.canStillBePaid = exports.isValidStatusTransition = exports.isCurrencyCode = exports.decimalsFor = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = exports.isBaseUnitString = exports.UNITS_PER_COIN = void 0;
3
+ 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.CARD_ONLY_STATUSES = exports.CHAIN_ONLY_STATUSES = exports.PAYMENT_INTENT_RAILS = exports.PAYMENT_INTENT_STATUSES = exports.POST_SETTLEMENT_STATUSES = exports.reachesSettlementFromPayer = exports.canStillBePaid = exports.isValidStatusTransition = exports.isCurrencyCode = exports.decimalsFor = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = exports.isBaseUnitString = exports.UNITS_PER_COIN = void 0;
4
4
  // @peable.to/shared-types — public API for the Peable Gateway contract.
5
5
  var money_1 = require("./money");
6
6
  Object.defineProperty(exports, "UNITS_PER_COIN", { enumerable: true, get: function () { return money_1.UNITS_PER_COIN; } });
@@ -31,3 +31,4 @@ Object.defineProperty(exports, "BILLING_SUBSCRIPTION_STATUSES", { enumerable: tr
31
31
  var billing_authority_1 = require("./billing-authority");
32
32
  Object.defineProperty(exports, "canonicalBillingAuthority", { enumerable: true, get: function () { return billing_authority_1.canonicalBillingAuthority; } });
33
33
  Object.defineProperty(exports, "canonicalBillingTaxQuote", { enumerable: true, get: function () { return billing_authority_1.canonicalBillingTaxQuote; } });
34
+ Object.defineProperty(exports, "PEABLE_BILLING_AUTHORITY_KEYS", { enumerable: true, get: function () { return billing_authority_1.PEABLE_BILLING_AUTHORITY_KEYS; } });
@@ -33,3 +33,17 @@ export function canonicalBillingTaxQuote(authority) {
33
33
  quote: authority.quote,
34
34
  });
35
35
  }
36
+ /**
37
+ * The PUBLIC halves of the Ed25519 keys production Peable signs billing
38
+ * authority with (signed tax quotes and final invoice authorities), by key id.
39
+ * Pin these as the SDK's `invoiceAuthorityKeys` / `taxQuoteAuthorityKeys`.
40
+ *
41
+ * The private halves exist only in Peable's production secret store and reach
42
+ * the gateway as a mounted file (`PEABLE_BILLING_INVOICE_PRIVATE_KEY_FILE`); the
43
+ * gateway refuses to sign with a key whose public half is not listed here. A
44
+ * rotation adds the new id beside the old one, and the old id is removed only
45
+ * after every authority it signed has been consumed.
46
+ */
47
+ export const PEABLE_BILLING_AUTHORITY_KEYS = Object.freeze({
48
+ 'peable-billing-2026-10': '-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAt6lkqirzUxlnt22igH+lRWW7+dRRlk4QK0a2wIKfnCA=\n-----END PUBLIC KEY-----\n',
49
+ });
package/dist/esm/index.js CHANGED
@@ -5,4 +5,4 @@ export { signWebhook, verifyWebhook } from './webhookSigner.js';
5
5
  export { MERCHANT_ENVIRONMENTS, } from './merchant.js';
6
6
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, } from './social.js';
7
7
  export { BILLING_SUBSCRIPTION_STATUSES, } from './billing.js';
8
- export { canonicalBillingAuthority, canonicalBillingTaxQuote } from './billing-authority.js';
8
+ export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority.js';
@@ -1,3 +1,15 @@
1
1
  import type { BillingFinalInvoiceAuthority, BillingTaxQuote } from './billing';
2
2
  export declare function canonicalBillingAuthority(authority: Pick<BillingFinalInvoiceAuthority, 'schemaVersion' | 'source' | 'invoice' | 'method'>): string;
3
3
  export declare function canonicalBillingTaxQuote(authority: Pick<BillingTaxQuote, 'schemaVersion' | 'source' | 'quote'>): string;
4
+ /**
5
+ * The PUBLIC halves of the Ed25519 keys production Peable signs billing
6
+ * authority with (signed tax quotes and final invoice authorities), by key id.
7
+ * Pin these as the SDK's `invoiceAuthorityKeys` / `taxQuoteAuthorityKeys`.
8
+ *
9
+ * The private halves exist only in Peable's production secret store and reach
10
+ * the gateway as a mounted file (`PEABLE_BILLING_INVOICE_PRIVATE_KEY_FILE`); the
11
+ * gateway refuses to sign with a key whose public half is not listed here. A
12
+ * rotation adds the new id beside the old one, and the old id is removed only
13
+ * after every authority it signed has been consumed.
14
+ */
15
+ export declare const PEABLE_BILLING_AUTHORITY_KEYS: Readonly<Record<string, string>>;
@@ -5,11 +5,49 @@ export type BillingSubscriptionStatus = (typeof BILLING_SUBSCRIPTION_STATUSES)[n
5
5
  export interface BillingCustomer {
6
6
  providerCustomerId: string;
7
7
  }
8
+ /** A settlement rail a merchant's recurring offers can be paid through. `stripe`
9
+ * (and any further fiat provider) settles in fiat; `faircoin` settles natively
10
+ * to the merchant's watch-only wallet. One merchant may offer several rails at
11
+ * once and the payer chooses; every rail answers through the same subscription,
12
+ * invoice and authority contracts below. */
13
+ export type BillingRail = 'stripe' | 'faircoin' | (string & {});
14
+ export type BillingRailSettlement = 'fiat' | 'faircoin';
15
+ /** One offer a rail can sell. Fiat provider rails bind their prices from the
16
+ * app's own provider catalogue, so they list `offers: null`. */
17
+ export interface BillingRailOffer {
18
+ providerPriceId: string;
19
+ planId: string;
20
+ interval: 'month' | 'year';
21
+ currency: string;
22
+ grossMinorUnits: number;
23
+ taxTreatment: 'inclusive' | 'exclusive';
24
+ }
25
+ export interface BillingRailOption {
26
+ rail: BillingRail;
27
+ settlement: BillingRailSettlement;
28
+ /** The rail a request that names none is served by: the first configured. */
29
+ default: boolean;
30
+ /** Whether `createTaxQuote` is answered for this rail. */
31
+ taxQuotes: boolean;
32
+ /** `automatic`: the provider charges each period. `payer_initiated`: each
33
+ * period is an explicit payment through `renewSubscription`. */
34
+ renewal: 'automatic' | 'payer_initiated';
35
+ offers: BillingRailOffer[] | null;
36
+ }
37
+ export interface BillingRailList {
38
+ object: 'list';
39
+ data: BillingRailOption[];
40
+ }
8
41
  export interface EnsureBillingCustomerParams {
9
42
  storeId: string;
10
43
  storeName: string;
44
+ /** The payer's chosen rail. Omitted: the merchant's default rail. A customer
45
+ * belongs to one rail, and its checkouts and subscriptions follow it. */
46
+ rail?: BillingRail;
11
47
  }
12
48
  export interface CreateBillingCheckoutParams {
49
+ /** Optional assertion of the rail; it must be the rail of `providerCustomerId`. */
50
+ rail?: BillingRail;
13
51
  /** Opt-in fiscal checkout. The full signed quote is immutable and single-use.
14
52
  * Requires a trusted Peable adapter capable of applying these exact amounts. */
15
53
  taxQuote?: BillingTaxQuote;
@@ -185,6 +223,8 @@ export interface BillingFaircoinRenewalRevocation {
185
223
  /** A merchant asks Peable to quote a registered product. Monetary/fiscal
186
224
  * configuration is resolved inside Peable, never supplied by a consumer. */
187
225
  export interface CreateBillingTaxQuoteParams {
226
+ /** Omitted: the first of the merchant's rails that answers tax quotes. */
227
+ rail?: BillingRail;
188
228
  storeId: string;
189
229
  planId: string;
190
230
  customerLocationEvidenceId: string;
@@ -11,6 +11,6 @@ export type { MerchantDisplay } from './merchantDisplay';
11
11
  export type { PaymentLink, PublicPaymentLink, CreatePaymentLinkParams, } from './paymentLink';
12
12
  export type { CheckoutSession, CheckoutSessionPublic, CreateCheckoutSessionParams, } from './checkoutSession';
13
13
  export { SOCIAL_SOURCE_APP_MAX_LENGTH, SOCIAL_SOURCE_REF_MAX_LENGTH, type SocialPaymentSource, type SocialNextAddressRequest, type SocialNextAddressResponse, type SocialReceiveCursorResponse, type SocialPaymentDirection, type SocialPayment, type SocialPaymentsResponse, type EnrichmentKind, type EnrichmentResult, type EnrichRequest, type EnrichResponse, } from './social';
14
- export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type CreateBillingTaxQuoteParams, type BillingTaxQuote, type BillingInvoiceAuthoritySource, type BillingFinalInvoice, type BillingFinalInvoiceAuthority, type BillingFaircoinRenewalChoice, type BillingFaircoinRenewalConsent, type BillingFaircoinRenewalRevocation, type BillingCheckoutSession, type BillingCheckoutObservation, type RetrieveBillingCheckoutOperationParams, type BillingCheckoutOperationSource, type BillingCheckoutOperationRecovery, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
15
- export { canonicalBillingAuthority, canonicalBillingTaxQuote } from './billing-authority';
14
+ export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type CreateBillingTaxQuoteParams, type BillingTaxQuote, type BillingInvoiceAuthoritySource, type BillingFinalInvoice, type BillingFinalInvoiceAuthority, type BillingFaircoinRenewalChoice, type BillingFaircoinRenewalConsent, type BillingFaircoinRenewalRevocation, type BillingCheckoutSession, type BillingCheckoutObservation, type RetrieveBillingCheckoutOperationParams, type BillingCheckoutOperationSource, type BillingCheckoutOperationRecovery, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type BillingRail, type BillingRailSettlement, type BillingRailOffer, type BillingRailOption, type BillingRailList, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
15
+ export { canonicalBillingAuthority, canonicalBillingTaxQuote, PEABLE_BILLING_AUTHORITY_KEYS, } from './billing-authority';
16
16
  export type { BillingFaircoinFxQuote } from './billing';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/shared-types",
3
- "version": "0.3.4-oxy-one.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared TypeScript types for the Peable Gateway — the wire contract shared by the backend, SDK, and frontend.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -9,8 +9,7 @@
9
9
  "sideEffects": false,
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "registry": "https://registry.npmjs.org/",
13
- "tag": "oxy-one"
12
+ "registry": "https://registry.npmjs.org/"
14
13
  },
15
14
  "exports": {
16
15
  ".": {