Table of Contents

Namespace Integrations.Application.Common

Classes

AdminAuditLog

Adds AdminAuditEntry rows to the current unit of work; they are saved with the change they describe.

BusinessClock

Business time: timestamps and business dates ("today") in PVC's time zone rather than UTC, so a 9pm Eastern commit is still today. Uses its own keyed TimeProvider so tests can move business time without also freezing infrastructure timers (HTTP retries, timeouts).

CallerScope

The caller for work that does not run inside an HTTP request: a consumed message (its publisher) or a scheduled job (the system). It flows with the async call, so it also reaches scopes created along the way (audit rows, nested units of work). The HTTP ICallerContext uses it when set and falls back to the request's user.

ConflictException

The request conflicts with the resource's current state, e.g. editing a committed document (HTTP 409).

ContentHash

Content hashes for idempotency: "is this replay the same request as the one already stored?".

The hash covers a canonical form of the request, not its raw JSON: null members are dropped, object keys are sorted and decimals are normalized (100.00 and 100 are the same amount). So adding an optional (nullable) member to a contract does not change the hash of requests that leave it out, and a replay of a stored document stays a replay after a deploy. Hashes carry a version prefix (Version) so the canonical form can change again without confusing old rows.

EntityAccessDeniedException

The caller's token does not grant access to the entity (HTTP 403).

FeatureDisabledException

The entity has not enabled the feature (e.g. tax commit before the Avalara go-live).

IntegrationException

Base for expected failures. Code is a stable, machine-readable error code returned to callers (RFC 7807 code extension) so they never have to parse messages.

IntegrationsTelemetry

Activity source and meter for service-specific traces and metrics.

NotFoundException

The requested resource does not exist (HTTP 404).

ProviderCall

One call to an external provider, as recorded for audit.

ProviderRejectedException

The provider understood the request and rejected it (bad address, unknown tax code, ...). Retrying will not help.

ProviderUnavailableException

The external provider (AvaTax, FX source) could not be reached or is failing. Callers fall back to the manual process; the service never invents a tax amount or rate.

RequestValidationException

Request failed validation. Errors maps field names to messages.

SystemCallerContext

The service itself (scheduled jobs, start-up seeding): may act on every entity.

Interfaces

IAppDbContext

Persistence used by the application services. Implemented by the Postgres DbContext.

ICallerContext

Who is calling, and which entities they may act on.

IDistributedLock

Cluster-wide mutual exclusion (scheduled jobs, rate imports) across replicas.

IEventPublisher

Publishes integration events. Messages are written to the transactional outbox and delivered only when SaveChangesAsync(CancellationToken) commits, so state changes and events never diverge.

IProviderAudit

Records outbound provider calls (audit table + metrics). Never throws.