Skip to main content
Version: 2.x

Abstract Class: BillingStore

Defined in: javascript/src/billing/billing-store.ts:40

Abstract billing store — provider-agnostic persistence layer for subscription lifecycle state.

Mirrors Python bursar/billing/store.py.

Extended by

Constructors

Constructor

new BillingStore(): BillingStore

Returns

BillingStore

Properties

providerEnvironment?

readonly optional providerEnvironment?: "live" | "test" | "sandbox"

Defined in: javascript/src/billing/billing-store.ts:42

Exposed by environment-partitioned stores so composition can reject drift.

Methods

claimAutoRechargeAttempt()

abstract claimAutoRechargeAttempt(input): Promise<BillingAutoRechargeAttempt | null>

Defined in: javascript/src/billing/billing-store.ts:192

Parameters

input

AutoRechargeAttemptClaim

Returns

Promise<BillingAutoRechargeAttempt | null>


claimBillingEvent()

abstract claimBillingEvent(provider, eventId, eventType, envelope?): Promise<BillingEventClaim>

Defined in: javascript/src/billing/billing-store.ts:56

Parameters

provider

string

eventId

string

eventType

string

envelope?

Record<string, unknown>

Returns

Promise<BillingEventClaim>


completeBillingEvent()

abstract completeBillingEvent(provider, eventId, claimToken): Promise<boolean>

Defined in: javascript/src/billing/billing-store.ts:63

Parameters

provider

string

eventId

string

claimToken

string

Returns

Promise<boolean>


computeTopupCredits()

abstract computeTopupCredits(amountMinor, topupConfig): Promise<Decimal>

Defined in: javascript/src/billing/billing-store.ts:137

Parameters

amountMinor

number

topupConfig

BillingTopupResult

Returns

Promise<Decimal>


countAutoRechargeAttempts()

abstract countAutoRechargeAttempts(userId, since): Promise<number>

Defined in: javascript/src/billing/billing-store.ts:199

Parameters

userId

string

since

string | Date

Returns

Promise<number>


createBillingCreditGrant()

abstract createBillingCreditGrant(input): Promise<string>

Defined in: javascript/src/billing/billing-store.ts:143

Parameters

input

BillingCreditGrantCreate

Returns

Promise<string>


createBillingSubscriptionChange()

abstract createBillingSubscriptionChange(input): Promise<BillingSubscriptionChange>

Defined in: javascript/src/billing/billing-store.ts:92

Parameters

input

BillingSubscriptionChangeInput

Returns

Promise<BillingSubscriptionChange>


createOrGetCheckoutIntent()

abstract createOrGetCheckoutIntent(input): Promise<CheckoutIntent>

Defined in: javascript/src/billing/billing-store.ts:44

Parameters

input

CheckoutIntentCreate

Returns

Promise<CheckoutIntent>


failBillingEvent()

abstract failBillingEvent(provider, eventId, claimToken, error?): Promise<boolean>

Defined in: javascript/src/billing/billing-store.ts:69

Parameters

provider

string

eventId

string

claimToken

string

error?

string

Returns

Promise<boolean>


getActiveCatalogDocument()

abstract getActiveCatalogDocument(): Promise<Record<string, unknown> | null>

Defined in: javascript/src/billing/billing-store.ts:169

Returns

Promise<Record<string, unknown> | null>


getAutoRechargeProfile()

abstract getAutoRechargeProfile(userId): Promise<BillingAutoRechargeProfile | null>

Defined in: javascript/src/billing/billing-store.ts:187

Parameters

userId

string

Returns

Promise<BillingAutoRechargeProfile | null>


getBillingCreditGrantByPayment()

abstract getBillingCreditGrantByPayment(paymentId): Promise<string | null>

Defined in: javascript/src/billing/billing-store.ts:148

Parameters

paymentId

string

Returns

Promise<string | null>


getBillingCustomer()

abstract getBillingCustomer(provider, providerCustomerId): Promise<string | null>

Defined in: javascript/src/billing/billing-store.ts:85

Parameters

provider

string

providerCustomerId

string

Returns

Promise<string | null>


getBillingCustomerByUserId()

abstract getBillingCustomerByUserId(userId, provider?): Promise<BillingCustomerRecord | null>

Defined in: javascript/src/billing/billing-store.ts:201

Parameters

userId

string

provider?

string | null

Returns

Promise<BillingCustomerRecord | null>


getBillingPayment()

abstract getBillingPayment(provider, providerPaymentId): Promise<BillingPaymentRecord | null>

Defined in: javascript/src/billing/billing-store.ts:164

Parameters

provider

string

providerPaymentId

string

Returns

Promise<BillingPaymentRecord | null>


getBillingPreferences()

abstract getBillingPreferences(userId): Promise<BillingPreferences | null>

Defined in: javascript/src/billing/billing-store.ts:184

Parameters

userId

string

Returns

Promise<BillingPreferences | null>


getBillingSubscription()

abstract getBillingSubscription(provider, providerSubscriptionId): Promise<BillingSubscriptionState | null>

Defined in: javascript/src/billing/billing-store.ts:87

Parameters

provider

string

providerSubscriptionId

string

Returns

Promise<BillingSubscriptionState | null>


getCheckoutIntent()

abstract getCheckoutIntent(id, subjectId): Promise<CheckoutIntent | null>

Defined in: javascript/src/billing/billing-store.ts:48

Parameters

id

string

subjectId

string

Returns

Promise<CheckoutIntent | null>


getOpenBillingSubscriptionChange()

abstract getOpenBillingSubscriptionChange(provider, providerSubscriptionId): Promise<BillingSubscriptionChange | null>

Defined in: javascript/src/billing/billing-store.ts:96

Parameters

provider

string

providerSubscriptionId

string

Returns

Promise<BillingSubscriptionChange | null>


getUserSubscription()

abstract getUserSubscription(userId, statuses?): Promise<BillingSubscriptionState | null>

Defined in: javascript/src/billing/billing-store.ts:117

Parameters

userId

string

statuses?

string[]

Returns

Promise<BillingSubscriptionState | null>


getUserSubscriptions()

abstract getUserSubscriptions(userId): Promise<BillingSubscriptionState[]>

Defined in: javascript/src/billing/billing-store.ts:173

Parameters

userId

string

Returns

Promise<BillingSubscriptionState[]>


grantBillingCredit()

abstract grantBillingCredit(grantId, idempotencyKey): Promise<BillingCreditPostingResult>

Defined in: javascript/src/billing/billing-store.ts:144

Parameters

grantId

string

idempotencyKey

string

Returns

Promise<BillingCreditPostingResult>


listBillingInvoices()

abstract listBillingInvoices(userId): Promise<BillingInvoiceRecord[]>

Defined in: javascript/src/billing/billing-store.ts:156

Parameters

userId

string

Returns

Promise<BillingInvoiceRecord[]>


listExpiredGraceSubscriptions()

abstract listExpiredGraceSubscriptions(now, limit?): Promise<BillingSubscriptionState[]>

Defined in: javascript/src/billing/billing-store.ts:101

Parameters

now

string

limit?

number

Returns

Promise<BillingSubscriptionState[]>


markSubscriptionGraceExpired()

abstract markSubscriptionGraceExpired(subscriptionId, expectedGraceEndsAt, expiredAt?): Promise<boolean>

Defined in: javascript/src/billing/billing-store.ts:106

Parameters

subscriptionId

string

expectedGraceEndsAt

string

expiredAt?

string

Returns

Promise<boolean>


postBillingRefund()

abstract postBillingRefund(refundId, grantId, amountMinor, idempotencyKey): Promise<BillingCreditPostingResult>

Defined in: javascript/src/billing/billing-store.ts:149

Parameters

refundId

string

grantId

string

amountMinor

number

idempotencyKey

string

Returns

Promise<BillingCreditPostingResult>


pseudonymizeFinancialSubject()

abstract pseudonymizeFinancialSubject(userId): Promise<boolean>

Defined in: javascript/src/billing/billing-store.ts:171

Parameters

userId

string

Returns

Promise<boolean>


recordSubscriptionConflict()

abstract recordSubscriptionConflict(input): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:175

Parameters

input

BillingSubscriptionConflictCreate

Returns

Promise<void>


resolveBillingOffer()

abstract resolveBillingOffer(provider, productId?, priceId?): Promise<BillingOfferResult | null>

Defined in: javascript/src/billing/billing-store.ts:50

Parameters

provider

string

productId?

string | null

priceId?

string | null

Returns

Promise<BillingOfferResult | null>


resolveBillingOfferByLookup()

abstract resolveBillingOfferByLookup(provider, lookupKey): Promise<BillingOfferResult | null>

Defined in: javascript/src/billing/billing-store.ts:132

Parameters

provider

string

lookupKey

string

Returns

Promise<BillingOfferResult | null>


resolveCreditTopup()

abstract resolveCreditTopup(provider, productId?, priceId?): Promise<BillingTopupResult | null>

Defined in: javascript/src/billing/billing-store.ts:122

Parameters

provider

string

productId?

string | null

priceId?

string | null

Returns

Promise<BillingTopupResult | null>


resolveCreditTopupByLookup()

abstract resolveCreditTopupByLookup(provider, lookupKey): Promise<BillingTopupResult | null>

Defined in: javascript/src/billing/billing-store.ts:127

Parameters

provider

string

lookupKey

string

Returns

Promise<BillingTopupResult | null>


selectSubscriptionEntitlementSource()

abstract selectSubscriptionEntitlementSource(userId, provider, providerSubscriptionId?): Promise<boolean>

Defined in: javascript/src/billing/billing-store.ts:178

Select a current provider subscription as the subject's entitlement source.

Parameters

userId

string

provider

string

providerSubscriptionId?

string | null

Returns

Promise<boolean>


updateAutoRechargeAttempt()

abstract updateAutoRechargeAttempt(input): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:195

Parameters

input

AutoRechargeAttemptUpdate

Returns

Promise<void>


updateAutoRechargeAttemptByProviderPayment()

abstract updateAutoRechargeAttemptByProviderPayment(input): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:196

Parameters

input

AutoRechargeProviderPaymentUpdate

Returns

Promise<void>


updateBillingSubscriptionChange()

abstract updateBillingSubscriptionChange(id, update): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:112

Parameters

id

string

update

BillingSubscriptionChangeUpdate

Returns

Promise<void>


updateCheckoutIntent()

abstract updateCheckoutIntent(id, update): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:46

Parameters

id

string

update

CheckoutIntentUpdate

Returns

Promise<void>


upsertAutoRechargeProfile()

abstract upsertAutoRechargeProfile(profile, options?): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:188

Parameters

profile

BillingAutoRechargeProfile

options?
resetCooldown?

boolean

Returns

Promise<void>


upsertBillingCustomer()

abstract upsertBillingCustomer(provider, providerCustomerId, userId, email?): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:76

Parameters

provider

string

providerCustomerId

string

userId

string

email?

string | null

Returns

Promise<void>


upsertBillingDispute()

abstract upsertBillingDispute(options): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:162

Parameters

options

BillingDisputeUpsert

Returns

Promise<void>


upsertBillingInvoice()

abstract upsertBillingInvoice(options): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:160

Parameters

options

BillingInvoiceUpsert

Returns

Promise<void>


upsertBillingPayment()

abstract upsertBillingPayment(options): Promise<string>

Defined in: javascript/src/billing/billing-store.ts:142

Parameters

options

BillingPaymentUpsert

Returns

Promise<string>


upsertBillingPreferences()

abstract upsertBillingPreferences(prefs): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:186

Parameters

prefs

BillingPreferences

Returns

Promise<void>


upsertBillingRefund()

abstract upsertBillingRefund(options): Promise<string>

Defined in: javascript/src/billing/billing-store.ts:158

Parameters

options

BillingRefundUpsert

Returns

Promise<string>


upsertBillingSubscription()

abstract upsertBillingSubscription(state): Promise<void>

Defined in: javascript/src/billing/billing-store.ts:83

Parameters

state

BillingSubscriptionState

Returns

Promise<void>