Class: LlmCostTracker::Doctor::InvoiceReconciliationCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/llm_cost_tracker/doctor/invoice_reconciliation_check.rb

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/llm_cost_tracker/doctor/invoice_reconciliation_check.rb', line 12

def call
  return unless LlmCostTracker.reconciliation_enabled?
  return unless Probe.table_exists?("llm_cost_tracker_provider_invoices")
  return if no_imports?

  scopes = imported_scopes
  return Check.new(:ok, "invoice reconciliation", "no provider invoices imported yet") if scopes.empty?

  non_canonical = non_canonical_currency_check
  checks = scopes.map { |scope| check_scope_safely(scope) }
  checks << non_canonical if non_canonical
  checks
rescue StandardError => e
  Check.new(:error, "invoice reconciliation", e.message)
end