Skip to main content
Version: 2.x

Abstract Class: BillingStore

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

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:45

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:202

Parameters​

input​

AutoRechargeAttemptClaim

Returns​

Promise<BillingAutoRechargeAttempt | null>


claimBillingEvent()​

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

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

Parameters​

provider​

string

eventId​

string

eventType​

string

envelope?​

JsonObject

Returns​

Promise<BillingEventClaim>


completeBillingEvent()​

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

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

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:154

Parameters​

amountMinor​

number

topupConfig​

BillingTopupResult

Returns​

Promise<Decimal>


countAutoRechargeAttempts()​

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

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

Parameters​

userId​

string

since​

string | Date

Returns​

Promise<number>


createBillingCreditGrant()​

abstract createBillingCreditGrant(input): Promise<string>

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

Parameters​

input​

BillingCreditGrantCreate

Returns​

Promise<string>


createBillingSubscriptionChange()​

abstract createBillingSubscriptionChange(input): Promise<BillingSubscriptionChange>

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

Parameters​

input​

BillingSubscriptionChangeInput

Returns​

Promise<BillingSubscriptionChange>


createOrGetCheckoutIntent()​

abstract createOrGetCheckoutIntent(input): Promise<CheckoutIntent>

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

Parameters​

input​

CheckoutIntentCreate

Returns​

Promise<CheckoutIntent>


expireSubscriptionGracePeriod()​

abstract expireSubscriptionGracePeriod(subjectId, subscriptionId, expectedGraceEndsAt, expiredAt, terminalPlanKey): Promise<boolean>

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

Parameters​

subjectId​

string

subscriptionId​

string

expectedGraceEndsAt​

string

expiredAt​

string

terminalPlanKey​

string | null

Returns​

Promise<boolean>


failBillingEvent()​

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

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

Parameters​

provider​

string

eventId​

string

claimToken​

string

error?​

string

Returns​

Promise<boolean>


getActiveCatalogDocument()​

abstract getActiveCatalogDocument(): Promise<JsonObject | null>

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

Returns​

Promise<JsonObject | null>


getAutoRechargeProfile()​

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

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

Parameters​

userId​

string

Returns​

Promise<BillingAutoRechargeProfile | null>


getBillingCreditGrantByPayment()​

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

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

Parameters​

paymentId​

string

Returns​

Promise<string | null>


getBillingCustomer()​

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

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

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:211

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:181

Parameters​

provider​

string

providerPaymentId​

string

Returns​

Promise<BillingPaymentRecord | null>


getBillingPreferences()​

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

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

Parameters​

userId​

string

Returns​

Promise<BillingPreferences | null>


getBillingSubscription()​

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

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

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:51

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:99

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:134

Parameters​

userId​

string

statuses?​

string[]

Returns​

Promise<BillingSubscriptionState | null>


getUserSubscriptions()​

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

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

Parameters​

userId​

string

Returns​

Promise<BillingSubscriptionState[]>


grantBillingCredit()​

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

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

Parameters​

grantId​

string

idempotencyKey​

string

Returns​

Promise<BillingCreditPostingResult>


listBillingInvoices()​

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

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

Parameters​

userId​

string

Returns​

Promise<BillingInvoiceRecord[]>


listExpiredGraceSubscriptions()​

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

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

Parameters​

now​

string

limit?​

number

Returns​

Promise<BillingSubscriptionState[]>


postBillingRefund()​

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

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

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:188

Parameters​

userId​

string

Returns​

Promise<boolean>


reconcileSubscriptionEntitlement()​

abstract reconcileSubscriptionEntitlement(subjectId, subscriptionId, billingEventId, expectedStatus, expectedProviderUpdatedAt, planAssignedAt, applyEntitlement, terminalPlanKey, reason): Promise<SubscriptionEntitlementOutcome>

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

Parameters​

subjectId​

string

subscriptionId​

string

billingEventId​

string

expectedStatus​

BillingSubscriptionStatus

expectedProviderUpdatedAt​

string

planAssignedAt​

string | Date | null

applyEntitlement​

boolean

terminalPlanKey​

string | null

reason​

string

Returns​

Promise<SubscriptionEntitlementOutcome>


recordSubscriptionConflict()​

abstract recordSubscriptionConflict(input): Promise<void>

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

Parameters​

input​

BillingSubscriptionConflictCreate

Returns​

Promise<void>


resolveBillingOffer()​

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

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

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:149

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:139

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:144

Parameters​

provider​

string

lookupKey​

string

Returns​

Promise<BillingTopupResult | null>


updateAutoRechargeAttempt()​

abstract updateAutoRechargeAttempt(input): Promise<void>

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

Parameters​

input​

AutoRechargeAttemptUpdate

Returns​

Promise<void>


updateAutoRechargeAttemptByProviderPayment()​

abstract updateAutoRechargeAttemptByProviderPayment(input): Promise<void>

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

Parameters​

input​

AutoRechargeProviderPaymentUpdate

Returns​

Promise<void>


updateBillingSubscriptionChange()​

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

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

Parameters​

id​

string

update​

BillingSubscriptionChangeUpdate

Returns​

Promise<void>


updateCheckoutIntent()​

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

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

Parameters​

id​

string

update​

CheckoutIntentUpdate

Returns​

Promise<void>


upsertAutoRechargeProfile()​

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

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

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:79

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:179

Parameters​

options​

BillingDisputeUpsert

Returns​

Promise<void>


upsertBillingInvoice()​

abstract upsertBillingInvoice(options): Promise<void>

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

Parameters​

options​

BillingInvoiceUpsert

Returns​

Promise<void>


upsertBillingPayment()​

abstract upsertBillingPayment(options): Promise<string>

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

Parameters​

options​

BillingPaymentUpsert

Returns​

Promise<string>


upsertBillingPreferences()​

abstract upsertBillingPreferences(prefs): Promise<void>

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

Parameters​

prefs​

BillingPreferences

Returns​

Promise<void>


upsertBillingRefund()​

abstract upsertBillingRefund(options): Promise<string>

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

Parameters​

options​

BillingRefundUpsert

Returns​

Promise<string>


upsertBillingSubscription()​

abstract upsertBillingSubscription(state): Promise<void>

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

Parameters​

state​

BillingSubscriptionState

Returns​

Promise<void>