@peable.to/shared-types 0.3.0 → 0.3.1-oxy-one.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 @@
1
+ {"type":"module"}
@@ -29,6 +29,8 @@ export interface BillingHostedSession {
29
29
  /** Provider observations only. Consumers own plan/status/entitlement interpretation. */
30
30
  export interface BillingSubscription {
31
31
  providerSubscriptionId: string;
32
+ /** Discovery only; invoice must still be read and proven paid. */
33
+ latestInvoiceId?: string | null;
32
34
  providerCustomerId: string;
33
35
  providerPriceId: string;
34
36
  storeId: string;
@@ -43,3 +45,42 @@ export interface BillingSubscription {
43
45
  cancelAt: string | null;
44
46
  cancelledAt: string | null;
45
47
  }
48
+ /** Owned recurring checkout correlation; completing checkout is not paid evidence. */
49
+ export interface BillingCheckoutSession extends BillingHostedSession {
50
+ id: string;
51
+ }
52
+ export interface BillingCheckoutObservation {
53
+ id: string;
54
+ status: 'open' | 'complete' | 'expired';
55
+ storeId: string;
56
+ planId: string;
57
+ providerCustomerId: string;
58
+ providerPriceId: string;
59
+ subscription: BillingSubscription | null;
60
+ }
61
+ /** Authenticated authoritative read, one settled full non-prorated line only.
62
+ * Tax figures are provider observations, not a tax quote or seller configuration. */
63
+ export interface BillingInvoiceState extends BillingPaidInvoice {
64
+ chargeId: string;
65
+ amountRefunded: string;
66
+ state: 'paid' | 'fully_refunded' | 'partially_refunded';
67
+ }
68
+ export interface BillingPaidInvoice {
69
+ invoiceId: string;
70
+ lineId: string;
71
+ paymentIntentId: string;
72
+ providerSubscriptionId: string;
73
+ providerCustomerId: string;
74
+ providerPriceId: string;
75
+ storeId: string;
76
+ planId: string;
77
+ livemode: boolean;
78
+ currency: string;
79
+ amountPaid: string;
80
+ netAmount: string | null;
81
+ taxAmount: string | null;
82
+ periodStart: string;
83
+ periodEnd: string;
84
+ paidAt: string;
85
+ observedAt: string;
86
+ }
@@ -58,7 +58,7 @@ export type WebhookEventType = 'payment_intent.confirming' | 'payment_intent.set
58
58
  * Additive to a published contract: an existing consumer that switches on
59
59
  * this union keeps compiling and simply never matches it.
60
60
  */
61
- | 'connected_account.updated';
61
+ | 'connected_account.updated' | 'billing.observation.updated';
62
62
  /**
63
63
  * Which resource each event type carries under `data.object`.
64
64
  *
@@ -68,7 +68,16 @@ export type WebhookEventType = 'payment_intent.confirming' | 'payment_intent.set
68
68
  * the default would silently ship a PaymentIntent to a consumer expecting
69
69
  * something else — which typechecks on both sides and fails only in production.
70
70
  */
71
+ /** Wake-up only. Re-read the owner-bound SDK resource; this is never paid or grant authority. */
72
+ export interface BillingObservation {
73
+ object: 'billing_observation';
74
+ resourceKind: 'subscription' | 'invoice';
75
+ resourceId: string;
76
+ revision: number;
77
+ observedAt: string;
78
+ }
71
79
  export interface WebhookEventPayload {
80
+ 'billing.observation.updated': BillingObservation;
72
81
  'payment_intent.confirming': PaymentIntent;
73
82
  'payment_intent.settled': PaymentIntent;
74
83
  'payment_intent.failed': PaymentIntent;
@@ -1,7 +1,7 @@
1
1
  export { UNITS_PER_COIN, isBaseUnitString, type CurrencyCode, CURRENCY_CODES, CURRENCY_DECIMALS, decimalsFor, isCurrencyCode, } from './money';
2
2
  export { type NetworkType } from './network';
3
3
  export { type PaymentIntentStatus, type PaymentIntentRail, type PaymentIntent, type CreatePaymentIntentParams, isValidStatusTransition, canStillBePaid, reachesSettlementFromPayer, POST_SETTLEMENT_STATUSES, PAYMENT_INTENT_STATUSES, PAYMENT_INTENT_RAILS, CHAIN_ONLY_STATUSES, CARD_ONLY_STATUSES, } from './paymentIntent';
4
- export { type WebhookEventType, type WebhookEvent, type WebhookEventPayload, } from './event';
4
+ export { type WebhookEventType, type WebhookEvent, type WebhookEventPayload, type BillingObservation, } from './event';
5
5
  export { type Dispute, type DisputeEvidence, type DisputeStatus } from './dispute';
6
6
  export { type CapabilityStatus, type ConnectedAccount, type Refund, type RefundOrigin, type RefundStatus, type Settlement, type Transfer, type TransferReversal, type TransferReversalStatus, type TransferStatus, type TransferWithReversal, } from './settlement';
7
7
  export { type WebhookDelivery, type WebhookDeliveryStatus, } from './webhookDelivery';
@@ -11,4 +11,4 @@ export { type MerchantDisplay } from './merchantDisplay';
11
11
  export { type PaymentLink, type PublicPaymentLink, type CreatePaymentLinkParams, } from './paymentLink';
12
12
  export { type CheckoutSession, type CheckoutSessionPublic, type 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 BillingCustomer, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
14
+ export { BILLING_SUBSCRIPTION_STATUSES, type BillingSubscriptionStatus, type BillingCheckoutSession, type BillingCheckoutObservation, type BillingPaidInvoice, type BillingInvoiceState, type BillingCustomer, type EnsureBillingCustomerParams, type CreateBillingCheckoutParams, type CreateBillingPortalParams, type BillingHostedSession, type BillingSubscription, } from './billing';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/shared-types",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-oxy-one.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",
@@ -8,7 +8,9 @@
8
8
  "source": "src/index.ts",
9
9
  "sideEffects": false,
10
10
  "publishConfig": {
11
- "access": "public"
11
+ "access": "public",
12
+ "registry": "https://registry.npmjs.org/",
13
+ "tag": "oxy-one"
12
14
  },
13
15
  "exports": {
14
16
  ".": {