@happyvertical/smrt-commerce 0.51.32 → 0.51.34
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.
- package/AGENTS.md +17 -0
- package/README.md +88 -0
- package/dist/__tests__/foreign-key-fixtures.d.ts +13 -0
- package/dist/__tests__/foreign-key-fixtures.d.ts.map +1 -0
- package/dist/__tests__/helpers/anchor-fixture.d.ts +36 -0
- package/dist/__tests__/helpers/anchor-fixture.d.ts.map +1 -0
- package/dist/__tests__/helpers/billing-fixture.d.ts +51 -0
- package/dist/__tests__/helpers/billing-fixture.d.ts.map +1 -0
- package/dist/__tests__/helpers/consumer-license-sale.d.ts +13 -0
- package/dist/__tests__/helpers/consumer-license-sale.d.ts.map +1 -0
- package/dist/__tests__/helpers/crypto-rail.d.ts +69 -0
- package/dist/__tests__/helpers/crypto-rail.d.ts.map +1 -0
- package/dist/__tests__/helpers/fake-stripe.d.ts +147 -0
- package/dist/__tests__/helpers/fake-stripe.d.ts.map +1 -0
- package/dist/billing/btcpay.d.ts +40 -0
- package/dist/billing/btcpay.d.ts.map +1 -0
- package/dist/billing/cards.d.ts +14 -4
- package/dist/billing/credits.d.ts +7 -2
- package/dist/billing/credits.d.ts.map +1 -1
- package/dist/billing/crypto.d.ts +32 -0
- package/dist/billing/crypto.d.ts.map +1 -0
- package/dist/billing/cycles.d.ts +21 -1
- package/dist/billing/events.d.ts +23 -4
- package/dist/billing/events.d.ts.map +1 -1
- package/dist/billing/index.d.ts +5 -1
- package/dist/billing/index.d.ts.map +1 -1
- package/dist/billing/invoice-payments.d.ts +29 -0
- package/dist/billing/invoice-payments.d.ts.map +1 -0
- package/dist/billing/jobs.d.ts +3 -3
- package/dist/billing/payment-attempts.d.ts +143 -0
- package/dist/billing/payment-attempts.d.ts.map +1 -0
- package/dist/billing/period-close.d.ts +1 -1
- package/dist/billing/provider.d.ts +109 -3
- package/dist/billing/provider.d.ts.map +1 -1
- package/dist/billing/runtime.d.ts +122 -14
- package/dist/billing/runtime.d.ts.map +1 -1
- package/dist/billing/stripe.d.ts +16 -2
- package/dist/billing/stripe.d.ts.map +1 -1
- package/dist/billing/top-up.d.ts +4 -4
- package/dist/collections/ContractCollection.d.ts +4 -0
- package/dist/collections/ContractLineItemCollection.d.ts +4 -0
- package/dist/collections/CustomerCollection.d.ts +4 -0
- package/dist/collections/FulfillmentCollection.d.ts +5 -1
- package/dist/collections/FulfillmentLineItemCollection.d.ts +4 -0
- package/dist/collections/InvoiceCollection.d.ts +4 -0
- package/dist/collections/InvoiceLineItemCollection.d.ts +5 -1
- package/dist/collections/PaymentAllocationCollection.d.ts +4 -0
- package/dist/collections/PaymentCollection.d.ts +5 -1
- package/dist/collections/PaymentInstrumentCollection.d.ts +4 -0
- package/dist/collections/PaymentIntentCollection.d.ts +12 -1
- package/dist/collections/PayoutCollection.d.ts +12 -1
- package/dist/collections/VendorCollection.d.ts +4 -0
- package/dist/index.d.ts +64 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4055 -2859
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +920 -91
- package/dist/migrations/moneyMinorUnits.d.ts +61 -1
- package/dist/models/Contract.d.ts +6 -2
- package/dist/models/ContractLineItem.d.ts +5 -1
- package/dist/models/Customer.d.ts +5 -1
- package/dist/models/Fulfillment.d.ts +5 -1
- package/dist/models/FulfillmentLineItem.d.ts +5 -1
- package/dist/models/Invoice.d.ts +6 -2
- package/dist/models/InvoiceLineItem.d.ts +5 -1
- package/dist/models/Payment.d.ts +6 -2
- package/dist/models/PaymentAllocation.d.ts +5 -1
- package/dist/models/PaymentInstrument.d.ts +5 -1
- package/dist/models/PaymentIntent.d.ts +24 -1
- package/dist/models/Payout.d.ts +24 -1
- package/dist/models/Vendor.d.ts +5 -1
- package/dist/models/billing.d.ts +111 -1
- package/dist/models/billing.d.ts.map +1 -1
- package/dist/models/index.d.ts +1 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/smrt-knowledge.json +320 -9
- package/dist/types/index.d.ts +5 -1
- package/dist/ui.d.ts +14 -1
- package/package.json +11 -10
package/dist/billing/cycles.d.ts
CHANGED
|
@@ -1,4 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Billing-cycle schedule and proration math (#3116).
|
|
3
|
+
*
|
|
4
|
+
* A payer's billing periods are a pure function of its account's
|
|
5
|
+
* `billingAnchorAt`:
|
|
6
|
+
*
|
|
7
|
+
* - no anchor: UTC calendar months (the default, and the only schedule before
|
|
8
|
+
* #3116);
|
|
9
|
+
* - an anchor `A`: monthly periods `[A + k months, A + (k + 1) months)` at
|
|
10
|
+
* `A`'s UTC time of day. A day past the end of a shorter month is clamped to
|
|
11
|
+
* its last day, always computed from `A` itself, so an anchor on the 31st
|
|
12
|
+
* runs Jan 31 → Feb 28 (29) → Mar 31 without drifting. Before `A` the
|
|
13
|
+
* schedule stays calendar months, and the month `A` falls in ends early at
|
|
14
|
+
* `A` (a *stub* period), so an account that moves from calendar months to an
|
|
15
|
+
* anchor has no gap and no overlap.
|
|
16
|
+
*
|
|
17
|
+
* Every period carries the full cycle it belongs to (`cycleStart`/`cycleEnd`);
|
|
18
|
+
* that cycle's length is the proration denominator, so a stub is billed as the
|
|
19
|
+
* fraction of its calendar month it covers.
|
|
20
|
+
*/
|
|
21
|
+
import type { BillingPeriod } from './period-close.js';
|
|
2
22
|
/** A period of a payer's schedule and the full cycle it prorates against. */
|
|
3
23
|
export interface ScheduledBillingPeriod extends BillingPeriod {
|
|
4
24
|
/** Start of the full monthly cycle (equals `periodStart` except for a stub). */
|
package/dist/billing/events.d.ts
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Provider event processing (#3060): verified webhook deliveries queued in
|
|
3
|
+
* smrt-jobs' durable delivery inbox are applied here.
|
|
4
|
+
*
|
|
5
|
+
* `observe()` re-reads the invoice or subscription from the provider, so an
|
|
6
|
+
* event is applied against current provider state rather than the snapshot it
|
|
7
|
+
* carried; out-of-order and duplicate deliveries therefore converge. The
|
|
8
|
+
* application writes, the inbox completion, and the host standing hook share
|
|
9
|
+
* one transaction.
|
|
10
|
+
*/
|
|
11
|
+
import { type ForgeProjector } from '@happyvertical/smrt-jobs';
|
|
12
|
+
import { type SavedCard } from './cards.js';
|
|
13
|
+
import { type AttemptTarget } from './payment-attempts.js';
|
|
14
|
+
import type { BillingPaymentAttemptState, BillingProviderCheckoutState, BillingProviderEvent, BillingProviderInvoiceState, BillingProviderSubscriptionState } from './provider.js';
|
|
15
|
+
import type { BillingRuntime } from './runtime.js';
|
|
5
16
|
type InvoiceEvent = Extract<BillingProviderEvent, {
|
|
6
17
|
kind: 'invoice';
|
|
7
18
|
}>;
|
|
@@ -14,6 +25,9 @@ type CheckoutEvent = Extract<BillingProviderEvent, {
|
|
|
14
25
|
type PaymentEvent = Extract<BillingProviderEvent, {
|
|
15
26
|
kind: 'payment';
|
|
16
27
|
}>;
|
|
28
|
+
type AttemptEvent = Extract<BillingProviderEvent, {
|
|
29
|
+
kind: 'payment_attempt';
|
|
30
|
+
}>;
|
|
17
31
|
type ObservedEvent = {
|
|
18
32
|
event: InvoiceEvent;
|
|
19
33
|
invoice: BillingProviderInvoiceState;
|
|
@@ -29,6 +43,11 @@ type ObservedEvent = {
|
|
|
29
43
|
} | {
|
|
30
44
|
event: PaymentEvent;
|
|
31
45
|
paymentId: string;
|
|
46
|
+
} | {
|
|
47
|
+
event: AttemptEvent;
|
|
48
|
+
providerName: string;
|
|
49
|
+
attempt: BillingPaymentAttemptState;
|
|
50
|
+
target: AttemptTarget;
|
|
32
51
|
};
|
|
33
52
|
/** Apply up to `limit` queued events for a runtime; returns how many ran. */
|
|
34
53
|
export declare function processBillingEvents(runtime: BillingRuntime, limit: number): Promise<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/billing/events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Aa,CAAC;IACrB,6DAA6D;IAC7D,QAAQ,EAAE,4BAA4B,GAAG,IAAI,CAAC;IAC9C,8DAA8D;IAC9D,IAAI,EAAE,SAAS,GAAG,IAAI,CAAC;CACxB,GACD;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1C;IACE,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,0BAA0B,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;CACvB,CAAC;AAIN,6EAA6E;AAC7E,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,MAAM,CAAC,CAkBjB;AAED,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,cAAc,GACtB,cAAc,CAAC,aAAa,CAAC,CAqG/B"}
|
package/dist/billing/index.d.ts
CHANGED
|
@@ -3,12 +3,16 @@
|
|
|
3
3
|
* card on file, and automatic top-ups (#3139).
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
+
export { type BtcPayBillingProviderOptions, createBtcPayBillingProvider, } from './btcpay.js';
|
|
6
7
|
export type { CreateCardSetupCheckoutInput } from './cards.js';
|
|
7
8
|
export type { CreateCreditCheckoutInput } from './credits.js';
|
|
9
|
+
export { type CryptoBillingProviderOptions, createCryptoBillingProvider, } from './crypto.js';
|
|
8
10
|
export { addBillingMonths, billingPeriodContaining, lastEndedBillingPeriod, prorateMinorUnits, type ScheduledBillingPeriod, } from './cycles.js';
|
|
11
|
+
export { type CreateInvoicePaymentInput, INVOICE_PAYMENT_PURPOSE, } from './invoice-payments.js';
|
|
9
12
|
export { type EnqueueBillingJobOptions, enqueueBillingEvents, enqueueBillingPeriodClose, getBillingRuntime, registerBillingRuntime, unregisterBillingRuntime, } from './jobs.js';
|
|
13
|
+
export { type BillingPaymentPolicy, type CryptoConversionInput, type CryptoSettlement, decideAttempt, type ManualRefundInput, type ManualRefundResult, } from './payment-attempts.js';
|
|
10
14
|
export { type BillingPeriod, BillingPeriodCloseError, type ClosePeriodInput, type PeriodCloseGroupResult, type PeriodCloseOutcome, type PeriodCloseResult, previousCalendarMonth, } from './period-close.js';
|
|
11
|
-
export { type BillingChargeStatus, type BillingCollectionMethod, type BillingInvoiceEventType, type BillingProvider, type BillingProviderChargeInput, type BillingProviderChargeResult, type BillingProviderCheckoutInput, type BillingProviderCheckoutSession, type BillingProviderCheckoutState, type BillingProviderCustomerInput, type BillingProviderEvent, type BillingProviderInvoiceInput, type BillingProviderInvoiceLine, type BillingProviderInvoiceState, type BillingProviderInvoiceStatus, type BillingProviderSetupCheckoutInput, type BillingProviderSubscriptionState, BillingWebhookVerificationError, } from './provider.js';
|
|
15
|
+
export { type BillingChargeStatus, type BillingCollectionMethod, type BillingInvoiceEventType, type BillingPaymentAttemptException, type BillingPaymentAttemptPayment, type BillingPaymentAttemptState, type BillingPaymentAttemptStatus, type BillingProvider, type BillingProviderCapabilities, type BillingProviderChargeInput, type BillingProviderChargeResult, type BillingProviderCheckoutInput, type BillingProviderCheckoutSession, type BillingProviderCheckoutState, type BillingProviderCustomerInput, type BillingProviderEvent, type BillingProviderInvoiceInput, type BillingProviderInvoiceLine, type BillingProviderInvoiceState, type BillingProviderInvoiceStatus, type BillingProviderSetupCheckoutInput, type BillingProviderSubscriptionState, BillingProviderUnsupportedError, BillingWebhookVerificationError, providerCapabilities, } from './provider.js';
|
|
12
16
|
export { type BillingLedgerAccounts, BillingRuntime, type BillingRuntimeOptions, type EnsureProviderCustomerOptions, type PayerStandingChange, type PayerStandingHook, type SyncedBillingAccount, type UpsertBillingAccountInput, } from './runtime.js';
|
|
13
17
|
export { createStripeBillingProvider, type StripeBillingProviderOptions, } from './stripe.js';
|
|
14
18
|
export type { AutoTopUpFailure, AutoTopUpFailureHook, AutoTopUpHookOptions, } from './top-up.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,KAAK,4BAA4B,EACjC,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,yBAAyB,EAC9B,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,wBAAwB,EAC7B,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACrB,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,KAAK,aAAa,EAClB,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,qBAAqB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,eAAe,EACpB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,gCAAgC,EACrC,+BAA+B,EAC/B,+BAA+B,EAC/B,oBAAoB,GACrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,6BAA6B,EAClC,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,GAC/B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,2BAA2B,EAC3B,KAAK,4BAA4B,GAClC,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type BillingProviderCheckoutSession } from './provider.js';
|
|
2
|
+
import type { BillingRuntime } from './runtime.js';
|
|
3
|
+
export declare const INVOICE_PAYMENT_PURPOSE = "invoice_payment";
|
|
4
|
+
export interface CreateInvoicePaymentInput {
|
|
5
|
+
invoiceId: string;
|
|
6
|
+
/** The payment rail (a provider name from `paymentProviders`). */
|
|
7
|
+
provider: string;
|
|
8
|
+
/**
|
|
9
|
+
* Caller-owned id for this attempt; a retry with the same id (and the same
|
|
10
|
+
* amount due) returns the same checkout.
|
|
11
|
+
*/
|
|
12
|
+
purchaseId: string;
|
|
13
|
+
successUrl: string;
|
|
14
|
+
cancelUrl: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface InvoicePaymentMetadata {
|
|
18
|
+
purpose: string;
|
|
19
|
+
sellerTenantId: string;
|
|
20
|
+
payerTenantId: string;
|
|
21
|
+
billingAccountId: string;
|
|
22
|
+
invoiceId: string;
|
|
23
|
+
amount: number;
|
|
24
|
+
currency: string;
|
|
25
|
+
}
|
|
26
|
+
/** Parse checkout metadata written by {@link createInvoicePayment}. */
|
|
27
|
+
export declare function invoicePaymentMetadata(raw: Record<string, string>): InvoicePaymentMetadata | null;
|
|
28
|
+
export declare function createInvoicePayment(runtime: BillingRuntime, input: CreateInvoicePaymentInput): Promise<BillingProviderCheckoutSession>;
|
|
29
|
+
//# sourceMappingURL=invoice-payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invoice-payments.d.ts","sourceRoot":"","sources":["../../src/billing/invoice-payments.ts"],"names":[],"mappings":"AAkBA,OAAO,EACL,KAAK,8BAA8B,EAEpC,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,uBAAuB,oBAAoB,CAAC;AAUzD,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uEAAuE;AACvE,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,sBAAsB,GAAG,IAAI,CAuB/B;AAED,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,8BAA8B,CAAC,CA2HzC"}
|
package/dist/billing/jobs.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { SmrtJob } from '@happyvertical/smrt-jobs';
|
|
2
|
-
import { PeriodCloseResult } from './period-close.js';
|
|
3
|
-
import { BillingRuntime } from './runtime.js';
|
|
1
|
+
import { type SmrtJob } from '@happyvertical/smrt-jobs';
|
|
2
|
+
import type { PeriodCloseResult } from './period-close.js';
|
|
3
|
+
import type { BillingRuntime } from './runtime.js';
|
|
4
4
|
/** Make a runtime available to billing jobs under `name`. */
|
|
5
5
|
export declare function registerBillingRuntime(name: string, runtime: BillingRuntime): void;
|
|
6
6
|
export declare function unregisterBillingRuntime(name: string): void;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment-rail attempts (#3138): per-seller policy, settlement of a rail
|
|
3
|
+
* checkout into credit or an invoice payment, and operator refund and
|
|
4
|
+
* conversion journals.
|
|
5
|
+
*
|
|
6
|
+
* The rail's gateway decides when a checkout is settled (its confirmation
|
|
7
|
+
* policy); this module never counts confirmations. It records everything the
|
|
8
|
+
* rail reports on a `BillingPaymentAttempt` and settles at most once, keyed by
|
|
9
|
+
* the checkout id.
|
|
10
|
+
*/
|
|
11
|
+
import type { DatabaseInterface } from '@happyvertical/smrt-core/migrations';
|
|
12
|
+
import { type BillingPaymentAttempt, type BillingPaymentAttemptFlag, type BillingPaymentAttemptPurpose } from '../models/billing.js';
|
|
13
|
+
import type { BillingPaymentAttemptState } from './provider.js';
|
|
14
|
+
import type { BillingRuntime } from './runtime.js';
|
|
15
|
+
/** Per-seller rules for rail payments. Every default is conservative. */
|
|
16
|
+
export interface BillingPaymentPolicy {
|
|
17
|
+
/**
|
|
18
|
+
* Underpayment accepted as payment in full, in basis points of the price
|
|
19
|
+
* (default 0). The shortfall is not written off in the ledger.
|
|
20
|
+
*/
|
|
21
|
+
underpaymentToleranceBps: number;
|
|
22
|
+
/** Overpayment not flagged for an operator, in basis points (default 0). */
|
|
23
|
+
overpaymentToleranceBps: number;
|
|
24
|
+
/**
|
|
25
|
+
* A payment received after the rate lock expired: `review` (default)
|
|
26
|
+
* flags it and settles nothing; `accept` settles when it covers the price.
|
|
27
|
+
*/
|
|
28
|
+
latePaymentPolicy: 'review' | 'accept';
|
|
29
|
+
/** Settle checkouts an operator marked paid at the rail (default false). */
|
|
30
|
+
acceptManuallyMarked: boolean;
|
|
31
|
+
/** Hold received crypto (default) or hand it to `conversionHandler`. */
|
|
32
|
+
cryptoTreatment: 'hold' | 'convert';
|
|
33
|
+
/**
|
|
34
|
+
* Called after a settlement when `cryptoTreatment` is `convert`. It runs
|
|
35
|
+
* inside the event transaction and may run again on retry: enqueue work
|
|
36
|
+
* (for example a job) rather than calling an exchange directly.
|
|
37
|
+
*/
|
|
38
|
+
conversionHandler?: (settlement: CryptoSettlement) => void | Promise<void>;
|
|
39
|
+
/** Refund basis recorded when a refund does not name one. */
|
|
40
|
+
refundBasis: 'original_native' | 'fiat_at_refund';
|
|
41
|
+
}
|
|
42
|
+
export interface CryptoSettlement {
|
|
43
|
+
sellerTenantId: string;
|
|
44
|
+
attemptId: string;
|
|
45
|
+
paymentId: string;
|
|
46
|
+
provider: string;
|
|
47
|
+
amount: number;
|
|
48
|
+
currency: string;
|
|
49
|
+
nativeCurrency: string;
|
|
50
|
+
nativeAmount: number;
|
|
51
|
+
db: DatabaseInterface;
|
|
52
|
+
}
|
|
53
|
+
export declare function normalizePaymentPolicy(input?: Partial<BillingPaymentPolicy>): BillingPaymentPolicy;
|
|
54
|
+
export type AttemptDecision = {
|
|
55
|
+
action: 'settle';
|
|
56
|
+
flag: BillingPaymentAttemptFlag;
|
|
57
|
+
} | {
|
|
58
|
+
action: 'none';
|
|
59
|
+
flag: BillingPaymentAttemptFlag;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* What a rail checkout's state means for billing. Pure: the same state and
|
|
63
|
+
* policy always decide the same way, so `observe()` and `project()` agree.
|
|
64
|
+
*/
|
|
65
|
+
export declare function decideAttempt(state: BillingPaymentAttemptState, policy: BillingPaymentPolicy, expected: {
|
|
66
|
+
amount: number;
|
|
67
|
+
currency: string;
|
|
68
|
+
}): AttemptDecision;
|
|
69
|
+
/** The purpose and settlement target an attempt's verified metadata names. */
|
|
70
|
+
export interface AttemptTarget {
|
|
71
|
+
purpose: BillingPaymentAttemptPurpose;
|
|
72
|
+
payerTenantId: string;
|
|
73
|
+
billingAccountId: string;
|
|
74
|
+
amount: number;
|
|
75
|
+
currency: string;
|
|
76
|
+
invoiceId: string;
|
|
77
|
+
spendingPolicyId: string;
|
|
78
|
+
grantedByTenantId: string;
|
|
79
|
+
/**
|
|
80
|
+
* The issuer reported the invoice paid by its own collection (for example
|
|
81
|
+
* a card charge whose event has not been applied yet): the rail's money is
|
|
82
|
+
* kept as customer credit, never allocated to the invoice.
|
|
83
|
+
*/
|
|
84
|
+
issuerCollected?: boolean;
|
|
85
|
+
}
|
|
86
|
+
/** Read the target from verified metadata; null when not this seller's. */
|
|
87
|
+
export declare function attemptTarget(runtime: BillingRuntime, metadata: Record<string, string>): AttemptTarget | null;
|
|
88
|
+
export interface AttemptOutcome {
|
|
89
|
+
attempt: BillingPaymentAttempt;
|
|
90
|
+
/** The attempt left `confirming` without settling. */
|
|
91
|
+
endedUnsettled: boolean;
|
|
92
|
+
/** This application settled it. */
|
|
93
|
+
settled: boolean;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Record the rail's current state on the attempt and settle it once when the
|
|
97
|
+
* decision says so. `invoiceHook` applies standing for invoice payments.
|
|
98
|
+
*/
|
|
99
|
+
export declare function applyPaymentAttempt(runtime: BillingRuntime, db: DatabaseInterface, providerName: string, state: BillingPaymentAttemptState, target: AttemptTarget, source: 'webhook' | 'poll'): Promise<AttemptOutcome>;
|
|
100
|
+
export interface ManualRefundInput {
|
|
101
|
+
/** The settled rail `Payment` refunded. */
|
|
102
|
+
paymentId: string;
|
|
103
|
+
/** Fiat value of the refund, minor units of the payment currency. */
|
|
104
|
+
fiatAmount: number;
|
|
105
|
+
/** Native amount sent back (satoshis), when known. */
|
|
106
|
+
nativeAmount?: number;
|
|
107
|
+
/** Default: the seller's `paymentPolicy.refundBasis`. */
|
|
108
|
+
basis?: 'original_native' | 'fiat_at_refund';
|
|
109
|
+
/** The operator's refund reference (for example the refund txid). */
|
|
110
|
+
reference: string;
|
|
111
|
+
reason: string;
|
|
112
|
+
}
|
|
113
|
+
export interface ManualRefundResult {
|
|
114
|
+
journalId: string;
|
|
115
|
+
creditGrantId: string;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Record a refund an operator made outside billing. Refunds come from what
|
|
119
|
+
* the payer is owed: first any overpayment, then — for a credit purchase, or
|
|
120
|
+
* an invoice payment kept as credit because the invoice was paid elsewhere —
|
|
121
|
+
* the price. An invoice payment applied to its invoice is not refundable
|
|
122
|
+
* here (reverse the invoice at the issuer first). Refunds are capped
|
|
123
|
+
* cumulatively per payment and are idempotent by `reference`.
|
|
124
|
+
*/
|
|
125
|
+
export declare function recordManualRefund(runtime: BillingRuntime, input: ManualRefundInput): Promise<ManualRefundResult>;
|
|
126
|
+
export interface CryptoConversionInput {
|
|
127
|
+
/** Operator reference (for example the exchange trade id). */
|
|
128
|
+
reference: string;
|
|
129
|
+
currency: string;
|
|
130
|
+
nativeCurrency: string;
|
|
131
|
+
/** Native amount converted (satoshis). */
|
|
132
|
+
nativeAmount: number;
|
|
133
|
+
/** Book value of the converted holdings, minor units of `currency`. */
|
|
134
|
+
carryingValue: number;
|
|
135
|
+
/** Cash received, minor units. */
|
|
136
|
+
proceeds: number;
|
|
137
|
+
/** Fees paid, minor units (default 0). */
|
|
138
|
+
fees?: number;
|
|
139
|
+
}
|
|
140
|
+
export declare function recordCryptoConversion(runtime: BillingRuntime, input: CryptoConversionInput): Promise<{
|
|
141
|
+
journalId: string;
|
|
142
|
+
}>;
|
|
143
|
+
//# sourceMappingURL=payment-attempts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-attempts.d.ts","sourceRoot":"","sources":["../../src/billing/payment-attempts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAO7E,OAAO,EACL,KAAK,qBAAqB,EAE1B,KAAK,yBAAyB,EAC9B,KAAK,4BAA4B,EAClC,MAAM,sBAAsB,CAAC;AAQ9B,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,yEAAyE;AACzE,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,wBAAwB,EAAE,MAAM,CAAC;IACjC,4EAA4E;IAC5E,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACvC,4EAA4E;IAC5E,oBAAoB,EAAE,OAAO,CAAC;IAC9B,wEAAwE;IACxE,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,6DAA6D;IAC7D,WAAW,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;CACnD;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ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BAAqB,GAC3B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAgDhC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The provider-neutral port period close, webhook intake, and credit
|
|
3
|
+
* purchases talk to (#3060).
|
|
4
|
+
*
|
|
5
|
+
* Every amount crossing this port is **integer minor units** of the named
|
|
6
|
+
* currency, like the rest of commerce. Adapters (see
|
|
7
|
+
* {@link createStripeBillingProvider}) own the conversion to the provider's
|
|
8
|
+
* representation and every provider call; this package never calls a payment
|
|
9
|
+
* provider directly.
|
|
10
|
+
*/
|
|
11
|
+
import type { SubscriptionStatus } from '@happyvertical/smrt-subscriptions';
|
|
12
|
+
import type { Address } from '../types/index.js';
|
|
3
13
|
export interface BillingProviderCustomerInput {
|
|
4
14
|
/** The local billing account id, recorded on the provider customer. */
|
|
5
15
|
accountId: string;
|
|
@@ -53,6 +63,12 @@ export type BillingProviderInvoiceStatus = 'draft' | 'open' | 'paid' | 'void' |
|
|
|
53
63
|
export interface BillingProviderInvoiceState {
|
|
54
64
|
providerInvoiceId: string;
|
|
55
65
|
status: BillingProviderInvoiceStatus;
|
|
66
|
+
/**
|
|
67
|
+
* The invoice was closed as paid outside the provider (for example by a
|
|
68
|
+
* crypto payment rail, #3138). The rail that took the money records it; the
|
|
69
|
+
* provider's own `paid` event must not record a second payment.
|
|
70
|
+
*/
|
|
71
|
+
paidOutOfBand?: boolean;
|
|
56
72
|
currency: string;
|
|
57
73
|
/** Pre-tax subtotal, minor units. */
|
|
58
74
|
subtotal: number;
|
|
@@ -211,11 +227,76 @@ export type BillingProviderEvent = {
|
|
|
211
227
|
amount?: number;
|
|
212
228
|
currency?: string;
|
|
213
229
|
failureCode?: string;
|
|
230
|
+
} | {
|
|
231
|
+
/**
|
|
232
|
+
* A payment rail's checkout changed (#3138). The event carries ids
|
|
233
|
+
* only; `observe()` re-reads the attempt with `getPaymentAttempt()`.
|
|
234
|
+
*/
|
|
235
|
+
kind: 'payment_attempt';
|
|
236
|
+
eventId: string;
|
|
237
|
+
checkoutId: string;
|
|
214
238
|
} | {
|
|
215
239
|
kind: 'ignored';
|
|
216
240
|
eventId: string;
|
|
217
241
|
type: string;
|
|
218
242
|
};
|
|
243
|
+
/** What a provider can do beyond the core port (#3138). */
|
|
244
|
+
export interface BillingProviderCapabilities {
|
|
245
|
+
/**
|
|
246
|
+
* The provider issues, taxes, and sends invoices (`pushInvoice` …). A
|
|
247
|
+
* payment rail (for example a crypto checkout) does not, and cannot be a
|
|
248
|
+
* runtime's issuing provider.
|
|
249
|
+
*/
|
|
250
|
+
issuesInvoices: boolean;
|
|
251
|
+
/** The provider reports checkouts through `getPaymentAttempt()`. */
|
|
252
|
+
paymentAttempts: boolean;
|
|
253
|
+
}
|
|
254
|
+
/** A rail checkout's lifecycle, normalized by the provider (#3138). */
|
|
255
|
+
export type BillingPaymentAttemptStatus = 'open' | 'confirming' | 'settled' | 'expired' | 'invalid';
|
|
256
|
+
export type BillingPaymentAttemptException = 'none' | 'underpaid' | 'overpaid' | 'paid_late' | 'manually_marked';
|
|
257
|
+
export interface BillingPaymentAttemptPayment {
|
|
258
|
+
id: string;
|
|
259
|
+
/** `onchain`, `lightning`, … */
|
|
260
|
+
rail: string;
|
|
261
|
+
/** The asset paid (`BTC`). */
|
|
262
|
+
asset: string;
|
|
263
|
+
/** Amount in the asset's minor units (satoshis for BTC). */
|
|
264
|
+
amount: number;
|
|
265
|
+
/** Fee in the asset's minor units, when reported. */
|
|
266
|
+
fee?: number;
|
|
267
|
+
status: 'confirming' | 'settled' | 'invalid';
|
|
268
|
+
transactionId?: string;
|
|
269
|
+
receivedAt?: string;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A rail checkout as the provider reports it now. Amounts are minor units;
|
|
273
|
+
* `metadata` holds only `smrt_*` keys whose signature verified, and is empty
|
|
274
|
+
* for a checkout this package did not create.
|
|
275
|
+
*/
|
|
276
|
+
export interface BillingPaymentAttemptState {
|
|
277
|
+
checkoutId: string;
|
|
278
|
+
/** The rail order id the checkout was created for. */
|
|
279
|
+
orderId?: string;
|
|
280
|
+
status: BillingPaymentAttemptStatus;
|
|
281
|
+
exception: BillingPaymentAttemptException;
|
|
282
|
+
/** The locked fiat price. */
|
|
283
|
+
amount: number;
|
|
284
|
+
currency: string;
|
|
285
|
+
/** Fiat value received at the locked rate, rounded down. */
|
|
286
|
+
amountPaid: number;
|
|
287
|
+
metadata: Record<string, string>;
|
|
288
|
+
/** The asset the price was quoted in (`BTC`). */
|
|
289
|
+
nativeCurrency?: string;
|
|
290
|
+
/** Asset minor units (satoshis). */
|
|
291
|
+
nativeAmountDue?: number;
|
|
292
|
+
nativeAmountPaid?: number;
|
|
293
|
+
/** Decimal price of one unit of `nativeCurrency` in `currency`. */
|
|
294
|
+
rate?: string;
|
|
295
|
+
rateSource?: string;
|
|
296
|
+
checkoutUrl?: string;
|
|
297
|
+
expiresAt?: Date;
|
|
298
|
+
payments: BillingPaymentAttemptPayment[];
|
|
299
|
+
}
|
|
219
300
|
/**
|
|
220
301
|
* A payment provider as period close sees it. Implementations must be
|
|
221
302
|
* replay-safe: `pushInvoice` with the same `idempotencyKey` returns the same
|
|
@@ -224,6 +305,11 @@ export type BillingProviderEvent = {
|
|
|
224
305
|
export interface BillingProvider {
|
|
225
306
|
/** Provider name recorded on local rows (`stripe`). */
|
|
226
307
|
readonly name: string;
|
|
308
|
+
/**
|
|
309
|
+
* Defaults to an issuing provider without payment attempts (Stripe's
|
|
310
|
+
* shape) when omitted.
|
|
311
|
+
*/
|
|
312
|
+
readonly capabilities?: BillingProviderCapabilities;
|
|
227
313
|
syncCustomer(input: BillingProviderCustomerInput): Promise<{
|
|
228
314
|
providerCustomerId: string;
|
|
229
315
|
}>;
|
|
@@ -240,7 +326,9 @@ export interface BillingProvider {
|
|
|
240
326
|
* {@link BillingWebhookVerificationError} when the signature is invalid;
|
|
241
327
|
* anything verified but not actionable is returned as `ignored`.
|
|
242
328
|
*/
|
|
243
|
-
verifyWebhook(payload: string, signature: string
|
|
329
|
+
verifyWebhook(payload: string, signature: string,
|
|
330
|
+
/** The request headers, for providers that sign with their own header. */
|
|
331
|
+
headers?: Headers | Record<string, string | undefined>): Promise<BillingProviderEvent>;
|
|
244
332
|
/**
|
|
245
333
|
* Charge the customer's saved default payment method off-session,
|
|
246
334
|
* idempotently by `input.idempotencyKey`. A decline or an authentication
|
|
@@ -255,6 +343,24 @@ export interface BillingProvider {
|
|
|
255
343
|
setDefaultPaymentMethod?(providerCustomerId: string, paymentMethodId: string): Promise<void>;
|
|
256
344
|
/** Write an open invoice off as uncollectible. Idempotent. */
|
|
257
345
|
markInvoiceUncollectible?(providerInvoiceId: string): Promise<void>;
|
|
346
|
+
/**
|
|
347
|
+
* Close an issued invoice as paid outside the provider (#3138). Must be
|
|
348
|
+
* idempotent: an invoice already closed this way is a no-op. Callers check
|
|
349
|
+
* `getInvoice()` first and never close an invoice the provider collected
|
|
350
|
+
* itself (a provider may throw for one).
|
|
351
|
+
*/
|
|
352
|
+
markInvoicePaidOutOfBand?(providerInvoiceId: string): Promise<void>;
|
|
353
|
+
/**
|
|
354
|
+
* Read a rail checkout's current state (#3138). Returns null for a
|
|
355
|
+
* checkout this provider did not create.
|
|
356
|
+
*/
|
|
357
|
+
getPaymentAttempt?(checkoutId: string): Promise<BillingPaymentAttemptState | null>;
|
|
358
|
+
}
|
|
359
|
+
/** The provider's capabilities, defaulted for providers that omit them. */
|
|
360
|
+
export declare function providerCapabilities(provider: BillingProvider): BillingProviderCapabilities;
|
|
361
|
+
/** A provider was asked for something it does not do (#3138). */
|
|
362
|
+
export declare class BillingProviderUnsupportedError extends Error {
|
|
363
|
+
constructor(message: string);
|
|
258
364
|
}
|
|
259
365
|
export declare class BillingWebhookVerificationError extends Error {
|
|
260
366
|
constructor(message?: string);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","source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