Skip to main content

reconcileUsage

@forge/monorepo


@forge/monorepo / backend/src / reconcileUsage

Function: reconcileUsage()

reconcileUsage(context, deps, input): Promise<UsageReconciliationReport>

Defined in: backend/src/usage/rollups.ts:164

Compare the ledger's rollups against a provider statement.

Reads the rollups, not the ledger, so reconciliation costs the same whether a tenant has spent a euro or a million — and so a discrepancy in the rollups themselves is visible rather than hidden by recomputing the thing being checked.

Parameters

context

ExecutionContext

deps

rollups

UsageRollupStore

input

ledgerCurrency

string

The currency the ledger records in.

Passed rather than read from a rollup, because a range with no usage has no rollup to read it from — and "no usage" is exactly when a statement showing a charge matters most.

period?

"hour" | "day" | "week" | "month"

statement

ProviderStatement

tolerance?

ReconciliationTolerance

Returns

Promise<UsageReconciliationReport>