User Consent Management Domain

Overview

This domain exposes the Lita consent-data API used to register a consent grant, mint a consent-scoped access token, store a consented data snapshot, retrieve the latest snapshot, and replay a deterministic scoring decision. The flow is centered on consent_reference for lifecycle tracking and request_id for scoring idempotency.

The implementation is FastAPI-based and uses dependency-injected repository access through get_repository. Consent and token access are guarded by _get_consent_and_token, while snapshot reads and writes are restricted to a valid bearer token that resolves back to an active consent. Scoring is intentionally deterministic: the first request for a request_id is computed and persisted, and later calls reuse the stored decision payload.

Architecture Overview

flowchart TD
    subgraph ClientIntegration [Client Integration]
        Client[API client]
        SmokeTest[scripts lita smoke test]
        Pytest[backend tests interface test_lita_endpoints]
    end

    subgraph APIService [Lita Consent Data API]
        Router[APIRouter prefix api lita v1]
        RegisterConsent[register_consent]
        GetConsent[get_consent]
        IssueToken[issue_token]
        SnapshotGuard[_get_consent_and_token]
        StoreSnapshot[store_snapshot]
        ReadSnapshot[read_snapshot]
        ScoreApplication[score_application]
    end

    subgraph PersistenceLayer [Persistence Layer]
        Repository[LitaRepository]
        ConsentRecord[LitaConsentModel]
        TokenRecord[LitaAccessTokenModel]
        SnapshotRecord[LitaDataSnapshotModel]
        DecisionRecord[LitaScoreDecisionModel]
    end

    Client --> Router
    SmokeTest --> Router
    Pytest --> Router

    Router --> RegisterConsent
    Router --> GetConsent
    Router --> IssueToken
    Router --> SnapshotGuard
    Router --> StoreSnapshot
    Router --> ReadSnapshot
    Router --> ScoreApplication

    RegisterConsent --> Repository
    GetConsent --> Repository
    IssueToken --> Repository
    SnapshotGuard --> Repository
    StoreSnapshot --> Repository
    ReadSnapshot --> Repository
    ScoreApplication --> Repository

    Repository --> ConsentRecord
    Repository --> TokenRecord
    Repository --> SnapshotRecord
    Repository --> DecisionRecord

API Endpoints

{
    "title": "Register Consent",
    "description": "Creates a consent record with customer and applicant references, permitted data categories, refresh permissions, and expiry",
    "method": "POST",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/consents",
    "headers": [
        {
            "key": "Content-Type",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "json",
    "requestBody": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"customer_reference\": \"customer_abc\",\n    \"applicant_reference\": \"applicant_xyz\",\n    \"country\": \"GB\",\n    \"product_type\": \"CREDIT_CARD\",\n    \"data_categories\": [\n        \"balances\",\n        \"transactions\"\n    ],\n    \"refresh_permissions\": [\n        \"balances:read\",\n        \"transactions:read\"\n    ],\n    \"expires_at\": \"2030-01-01T00:00:00Z\",\n    \"refresh_allowed\": true\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "201": {
            "description": "Created",
            "body": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"customer_reference\": \"customer_abc\",\n    \"applicant_reference\": \"applicant_xyz\",\n    \"country\": \"GB\",\n    \"product_type\": \"CREDIT_CARD\",\n    \"data_categories\": [\n        \"balances\",\n        \"transactions\"\n    ],\n    \"refresh_permissions\": [\n        \"balances:read\",\n        \"transactions:read\"\n    ],\n    \"expires_at\": \"2030-01-01T00:00:00Z\",\n    \"refresh_allowed\": true,\n    \"revoked_at\": null,\n    \"created_at\": \"2026-03-31T12:00:00Z\",\n    \"updated_at\": \"2026-03-31T12:00:00Z\"\n}"
        },
        "409": {
            "description": "Consent reference already exists",
            "body": "{\n    \"detail\": \"Consent reference already exists\"\n}"
        }
    }
}
{
    "title": "Get Consent",
    "description": "Fetches an existing consent record by consent_reference",
    "method": "GET",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/consents/{consent_reference}",
    "headers": [],
    "queryParams": [],
    "pathParams": [
        {
            "key": "consent_reference",
            "value": "consent_local_001",
            "required": true
        }
    ],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Success",
            "body": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"customer_reference\": \"customer_abc\",\n    \"applicant_reference\": \"applicant_xyz\",\n    \"country\": \"GB\",\n    \"product_type\": \"CREDIT_CARD\",\n    \"data_categories\": [\n        \"balances\",\n        \"transactions\"\n    ],\n    \"refresh_permissions\": [\n        \"balances:read\",\n        \"transactions:read\"\n    ],\n    \"expires_at\": \"2030-01-01T00:00:00Z\",\n    \"refresh_allowed\": true,\n    \"revoked_at\": null,\n    \"created_at\": \"2026-03-31T12:00:00Z\",\n    \"updated_at\": \"2026-03-31T12:00:00Z\"\n}"
        },
        "404": {
            "description": "Consent not found",
            "body": "{\n    \"detail\": \"Consent not found\"\n}"
        }
    }
}

Issue Access Token

{
    "title": "Issue Access Token",
    "description": "Issues a consent-scoped access token and returns its expiry timestamp",
    "method": "POST",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/consents/{consent_reference}/tokens",
    "headers": [
        {
            "key": "Content-Type",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [
        {
            "key": "consent_reference",
            "value": "consent_local_001",
            "required": true
        }
    ],
    "bodyType": "json",
    "requestBody": "{\n    \"expires_in_days\": 30\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "201": {
            "description": "Created",
            "body": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"access_token\": \"8f6d1c1c0c2b4df39a1c5a7f2f7d3b91\",\n    \"expires_at\": \"2026-04-30T12:00:00Z\"\n}"
        },
        "404": {
            "description": "Consent not found",
            "body": "{\n    \"detail\": \"Consent not found\"\n}"
        }
    }
}

Snapshot Storage

Store Snapshot

{
    "title": "Store Snapshot",
    "description": "Stores a consented data snapshot and echoes the consent reference, version, timestamp, and payload",
    "method": "POST",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/data/snapshots",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer <access_token>",
            "required": true
        },
        {
            "key": "Content-Type",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "json",
    "requestBody": "{\n    \"version\": \"1.1\",\n    \"payload\": {\n        \"balances\": {\n            \"available\": 1500,\n            \"currency\": \"GBP\"\n        },\n        \"transactions\": [\n            {\n                \"amount\": -20,\n                \"description\": \"Coffee\"\n            },\n            {\n                \"amount\": -50,\n                \"description\": \"Groceries\"\n            }\n        ]\n    }\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "201": {
            "description": "Created",
            "body": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"version\": \"1.1\",\n    \"stored_at\": \"2026-03-31T12:10:00Z\",\n    \"payload\": {\n        \"balances\": {\n            \"available\": 1500,\n            \"currency\": \"GBP\"\n        },\n        \"transactions\": [\n            {\n                \"amount\": -20,\n                \"description\": \"Coffee\"\n            },\n            {\n                \"amount\": -50,\n                \"description\": \"Groceries\"\n            }\n        ]\n    }\n}"
        },
        "401": {
            "description": "Bearer token required, invalid access token, or expired token",
            "body": "{\n    \"detail\": \"Bearer token required\"\n}"
        },
        "403": {
            "description": "Token revoked, consent revoked, or consent expired",
            "body": "{\n    \"detail\": \"Consent revoked\"\n}"
        },
        "404": {
            "description": "Consent not found",
            "body": "{\n    \"detail\": \"Consent not found\"\n}"
        }
    }
}

Read Latest Snapshot

{
    "title": "Read Latest Snapshot",
    "description": "Returns the most recent stored snapshot for the consent resolved from the bearer token",
    "method": "GET",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/data/snapshots/latest",
    "headers": [
        {
            "key": "Authorization",
            "value": "Bearer <access_token>",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "none",
    "requestBody": "",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Success",
            "body": "{\n    \"consent_reference\": \"consent_local_001\",\n    \"version\": \"1.1\",\n    \"stored_at\": \"2026-03-31T12:10:00Z\",\n    \"payload\": {\n        \"balances\": {\n            \"available\": 1500,\n            \"currency\": \"GBP\"\n        },\n        \"transactions\": [\n            {\n                \"amount\": -20,\n                \"description\": \"Coffee\"\n            },\n            {\n                \"amount\": -50,\n                \"description\": \"Groceries\"\n            }\n        ]\n    }\n}"
        },
        "401": {
            "description": "Bearer token required, invalid access token, or expired token",
            "body": "{\n    \"detail\": \"Bearer token required\"\n}"
        },
        "403": {
            "description": "Token revoked, consent revoked, or consent expired",
            "body": "{\n    \"detail\": \"Consent revoked\"\n}"
        },
        "404": {
            "description": "No data available for consent",
            "body": "{\n    \"detail\": \"No data available for consent\"\n}"
        }
    }
}

Deterministic Scoring

Score Application

{
    "title": "Score Application",
    "description": "Computes a deterministic score, decision, approved limit, and reason codes, then caches the decision by request_id",
    "method": "POST",
    "baseUrl": "<LitaConsentApiBaseUrl>",
    "endpoint": "/api/lita/v1/score",
    "headers": [
        {
            "key": "Content-Type",
            "value": "application/json",
            "required": true
        }
    ],
    "queryParams": [],
    "pathParams": [],
    "bodyType": "json",
    "requestBody": "{\n    \"version\": \"1.1\",\n    \"request_id\": \"req-demo-001\",\n    \"applicant\": {\n        \"applicant_reference\": \"app-100\",\n        \"country\": \"GB\"\n    },\n    \"context\": {\n        \"product_type\": \"CREDIT_CARD\"\n    },\n    \"features\": {\n        \"credit_utilization\": 0.65,\n        \"debt_to_income_ratio\": 0.4,\n        \"credit_history_months\": 30,\n        \"monthly_income\": 6000\n    }\n}",
    "formData": [],
    "rawBody": "",
    "responses": {
        "200": {
            "description": "Success",
            "body": "{\n    \"version\": \"1.1\",\n    \"request_id\": \"req-demo-001\",\n    \"score\": 712,\n    \"decision\": \"APPROVE\",\n    \"approved_limit\": 4000,\n    \"model\": {\n        \"name\": \"lita_consent_scoring\",\n        \"version\": \"1.1.0\"\n    },\n    \"reasons\": [\n        {\n            \"code\": \"HIGH_UTILIZATION\"\n        },\n        {\n            \"code\": \"SHORT_HISTORY\"\n        }\n    ]\n}"
        }
    }
}

Component Structure

Route Handlers and Helpers

Method Description
get_repository Builds a LitaRepository from the SQLAlchemy Session returned by get_db.
_serialise_consent Maps a stored consent model to ConsentResponse, including JSON-decoded data_categories and refresh_permissions.
_get_consent_and_token Validates the bearer token, checks revocation and expiry on both token and consent, and returns the resolved consent and token record.
register_consent Normalizes expires_at to UTC when needed, calls repository.create_consent, and converts duplicate key failures into 409.
get_consent Loads a consent by consent_reference and returns 404 when the record is missing.
issue_token Loads the consent, computes token expiry from expires_in_days, issues a token, and returns the token value and expiry.
store_snapshot Persists the incoming snapshot payload and version against the consent resolved from the bearer token.
read_snapshot Fetches the latest snapshot for the consent resolved from the bearer token and JSON-decodes the stored payload.
score_application Replays cached scoring decisions by request_id or computes a new score, decision, and reason list when no cache entry exists.

Request and Response Models

ConsentRequest

[!NOTE] score_application does not read X-Request-Id from headers. Idempotency is keyed to body.request_id, because the handler first calls repository.get_decision(body.request_id) and later persists the response with repository.save_decision(request_id=body.request_id, payload=response.dict()). [!NOTE] score_application has no bearer-token dependency or auth guard. Unlike the snapshot endpoints, it is callable without Authorization, even though the customer-facing documentation describes authenticated scoring calls.

File: backend/src/interface/lita_endpoints.py

Property Type Description
consent_reference str Unique consent identifier submitted by the caller.
customer_reference str Customer identifier associated with the consent.
applicant_reference Optional[str] Optional applicant identifier.
country Optional[str] Optional country code, capped at 8 characters.
product_type Optional[str] Optional product type, capped at 64 characters.
data_categories List[str] Consent-scoped data categories.
refresh_permissions List[str] Permission strings allowed for refresh operations.
expires_at datetime Consent expiry timestamp.
refresh_allowed bool Controls whether refresh is permitted.

ConsentResponse

File: backend/src/interface/lita_endpoints.py

Property Type Description
consent_reference str Unique consent identifier.
customer_reference str Customer identifier tied to the consent.
applicant_reference Optional[str] Optional applicant identifier.
country Optional[str] Optional country value stored with the consent.
product_type Optional[str] Optional product type value stored with the consent.
data_categories List[str] Stored data categories, decoded from JSON text.
refresh_permissions List[str] Stored refresh permissions, decoded from JSON text.
expires_at datetime Consent expiry timestamp.
refresh_allowed bool Refresh flag persisted with the consent.
revoked_at Optional[datetime] Revocation timestamp when present.
created_at Optional[datetime] Creation timestamp when present.
updated_at Optional[datetime] Last update timestamp when present.

TokenRequest

File: backend/src/interface/lita_endpoints.py

Property Type Description
expires_in_days int Token lifetime in days, default 90, bounded to 1..365.

TokenResponse

File: backend/src/interface/lita_endpoints.py

Property Type Description
consent_reference str Consent reference used to mint the token.
access_token str Issued access token value.
expires_at datetime Token expiry timestamp.

SnapshotRequest

File: backend/src/interface/lita_endpoints.py

Property Type Description
version str Snapshot version string, default 1.1, capped at 16 characters.
payload Dict[str, Any] Arbitrary JSON payload stored as the consented snapshot.

SnapshotResponse

File: backend/src/interface/lita_endpoints.py

Property Type Description
consent_reference str Consent reference associated with the snapshot.
version str Stored snapshot version.
stored_at datetime Snapshot creation timestamp.
payload Dict[str, Any] Snapshot payload returned as structured JSON.

Applicant

File: backend/src/interface/lita_endpoints.py

Property Type Description
applicant_reference str Applicant identifier supplied in the scoring request.
country str Applicant country code supplied in the scoring request.

ScoreContext

File: backend/src/interface/lita_endpoints.py

Property Type Description
product_type str Product type used during scoring.

ModelMetadata

File: backend/src/interface/lita_endpoints.py

Property Type Description
name str Model name returned in the score response.
version str Model version returned in the score response.

ScoreRequest

File: backend/src/interface/lita_endpoints.py

Property Type Description
version str Request version.
request_id str Idempotency key used for cached decisions.
applicant Applicant Applicant metadata.
context ScoreContext Scoring context.
features Dict[str, Any] Feature dictionary passed into _compute_score.

ScoreResponse

File: backend/src/interface/lita_endpoints.py

Property Type Description
version str Response version.
request_id str Echoed request id.
score int Deterministic numeric score.
decision str Final decision string returned by the scorer.
approved_limit int Approved limit returned by _compute_score.
model ModelMetadata Model metadata included in the response.
reasons List[ReasonCode] Reason-code objects emitted by the scoring run.

Persistence Model Map

The following records are the persistence targets described by the implementation overview and exercised by the endpoint flow:

Record Responsibility
LitaConsentModel Stores consent metadata, expiry, and revocation timestamp.
LitaAccessTokenModel Stores issued tokens scoped to a consent, with expiry and optional revocation.
LitaDataSnapshotModel Stores versioned JSON snapshot payloads per consent.
LitaScoreDecisionModel Stores cached decision payloads keyed by request_id for idempotent scoring.
ConsentGrantModel Domain-facing alias exported by backend/src/models/consent.py.

backend/src/models/consent.py re-exports ConsentGrantModel from src.infra.mysql.models so domain code can import the consent record through the model-facing package.

Feature Flows

sequenceDiagram
    participant Client as Client
    participant Router as APIRouter
    participant Register as register_consent
    participant Issue as issue_token
    participant Repo as LitaRepository
    participant DB as Database

    Client->>Router: POST api lita v1 consents
    Router->>Register: ConsentRequest
    Register->>Register: normalise expires_at to UTC
    Register->>Repo: create_consent
    Repo->>DB: insert consent record
    DB-->>Repo: consent row
    Repo-->>Register: consent model
    Register-->>Router: ConsentResponse
    Router-->>Client: 201 Created

    Client->>Router: POST api lita v1 consents consent reference tokens
    Router->>Issue: consent_reference and TokenRequest
    Issue->>Repo: get_consent
    Repo->>DB: select consent row
    DB-->>Repo: consent row
    Repo-->>Issue: consent model
    Issue->>Issue: compute expires_at from expires_in_days
    Issue->>Repo: issue_access_token
    Repo->>DB: insert access token
    DB-->>Repo: token row
    Repo-->>Issue: token model
    Issue-->>Router: TokenResponse
    Router-->>Client: 201 Created

Snapshot Storage and Retrieval

sequenceDiagram
    participant Client as Client
    participant Router as APIRouter
    participant Guard as _get_consent_and_token
    participant Store as store_snapshot
    participant Read as read_snapshot
    participant Repo as LitaRepository
    participant DB as Database

    Client->>Router: POST api lita v1 data snapshots
    Router->>Guard: Authorization header
    Guard->>Repo: get_access_token
    Repo->>DB: select token by value
    DB-->>Repo: token row
    Repo-->>Guard: token model
    Guard->>Repo: get_consent_by_id
    Repo->>DB: select consent by id
    DB-->>Repo: consent row
    Repo-->>Guard: consent model and token model
    Guard->>Store: consent and token
    Store->>Repo: record_snapshot
    Repo->>DB: insert snapshot record
    DB-->>Repo: snapshot row
    Repo-->>Store: snapshot model
    Store-->>Router: SnapshotResponse
    Router-->>Client: 201 Created

    Client->>Router: GET api lita v1 data snapshots latest
    Router->>Guard: Authorization header
    Guard->>Repo: get_access_token
    Guard->>Repo: get_consent_by_id
    Router->>Read: consent and token
    Read->>Repo: latest_snapshot
    Repo->>DB: select latest snapshot
    DB-->>Repo: snapshot row
    Repo-->>Read: snapshot model
    Read-->>Router: SnapshotResponse
    Router-->>Client: 200 OK

Deterministic Scoring and Idempotency

sequenceDiagram
    participant Client as Client
    participant Router as APIRouter
    participant Score as score_application
    participant Repo as LitaRepository
    participant DB as Database

    Client->>Router: POST api lita v1 score
    Router->>Score: ScoreRequest
    Score->>Repo: get_decision
    Repo->>DB: select decision by request id
    DB-->>Repo: cached decision or empty
    Repo-->>Score: cached payload or none

    alt cached decision found
        Score-->>Router: ScoreResponse from cache
        Router-->>Client: 200 OK
    else new decision required
        Score->>Score: _compute_score
        Score->>Repo: save_decision
        Repo->>DB: insert decision payload
        DB-->>Repo: stored decision row
        Repo-->>Score: persisted
        Score-->>Router: ScoreResponse
        Router-->>Client: 200 OK
    end

State and Validation

Gate Rule
Consent expiry expires_at is normalized to UTC when naive and compared against datetime.now(timezone.utc).
Token expiry expires_at on the token record is normalized to UTC when naive and compared against datetime.now(timezone.utc).
Token revocation _get_consent_and_token rejects revoked tokens with 403.
Consent revocation _get_consent_and_token rejects revoked consents with 403.
Missing consent _get_consent_and_token returns 404.
Missing token _get_consent_and_token returns 401.

Request Validation Rules

Model Rule
ConsentRequest consent_reference and customer_reference must be non-empty strings up to 128 characters.
ConsentRequest applicant_reference is optional and capped at 128 characters.
ConsentRequest country is optional and capped at 8 characters.
ConsentRequest product_type is optional and capped at 64 characters.
TokenRequest expires_in_days defaults to 90 and must be between 1 and 365.
SnapshotRequest version defaults to 1.1 and is capped at 16 characters.
ScoreRequest version, request_id, applicant, context, and features are required.

Error Handling

Condition Status Source
Duplicate consent_reference 409 register_consent catches IntegrityError.
Missing consent during lookup 404 get_consent.
Missing consent during token issuance 404 issue_token.
Missing bearer token 401 _get_consent_and_token.
Invalid bearer token 401 _get_consent_and_token.
Revoked token 403 _get_consent_and_token.
Expired token 401 _get_consent_and_token.
Missing consent for token 404 _get_consent_and_token.
Revoked consent 403 _get_consent_and_token.
Expired consent 403 _get_consent_and_token.
No latest snapshot available 404 read_snapshot.

Caching Strategy

Area Key Behavior
Scoring decisions request_id score_application calls repository.get_decision(body.request_id) first and reuses the stored payload when present.
Snapshot retrieval Consent identity read_snapshot asks for the latest snapshot for the resolved consent and returns the most recent record.
Consent/token lifecycle None in the handler layer Each route resolves state directly from the repository.

The scoring cache is deterministic because the persisted payload is replayed with ScoreResponse(**cached). This means a repeated submission with the same request_id returns the same response body.

Dependencies

Type Description
APIRouter Defines the /api/lita/v1 route group.
Depends Injects get_db, get_repository, and _get_consent_and_token.
HTTPBearer Extracts bearer credentials for the snapshot routes.
HTTPAuthorizationCredentials Holds the parsed bearer token value.
IntegrityError Surfaces duplicate consent references as 409.
Session SQLAlchemy session dependency for repository construction.
json Serializes and deserializes consent list fields and snapshot payloads.
datetime, timedelta, timezone Used for expiry calculations and UTC normalization.
LitaRepository Repository facade used by all route handlers.

Local Verification

Smoke Test Workflow

./scripts/lita_smoke_test.sh is the single-command local verification path documented for this domain. The script:

  • runs pytest backend/tests/interface/test_lita_endpoints.py -q
  • starts uvicorn src.main:app against the SQLite fallback
  • creates a consent
  • issues a token
  • stores a snapshot
  • reads the latest snapshot
  • calls /api/lita/v1/score twice with the same request_id to confirm idempotency

If pytest or uvicorn are missing, the script bootstraps backend/requirements.txt unless LITA_BOOTSTRAP_DEPS=0 is set.

Manual Verification Commands

# Run the targeted API tests
pytest backend/tests/interface/test_lita_endpoints.py -q

# Run migration regression checks
pytest backend/tests/test_schema_migrations.py -q

# Run the full smoke test
./scripts/lita_smoke_test.sh

Documentation Used by the Smoke Flow

  • documents/lita-consent-data-api.md
  • documents/lita-implementation-overview.md
  • documents/lita-testing-guide.md

Testing Considerations

File Coverage
backend/tests/interface/test_lita_endpoints.py Registers a consent, issues an access token, stores a snapshot, reads it back, and verifies scoring idempotency.
backend/tests/test_schema_migrations.py Seeds legacy application data including financing_consent and connected_accounts to confirm schema compatibility.
scripts/lita_smoke_test.sh End-to-end local verification through the FastAPI app and SQLite fallback.

Endpoint Regression Scenarios Covered in Tests

  • Consent registration returns 201.
  • Token issuance returns 201.
  • Snapshot write and read preserve the payload.
  • Scoring returns the same payload when the same request_id is submitted twice.
  • approved_limit is non-trivial in the scoring response and HIGH_UTILIZATION can appear in the returned reason list.

Key Classes Reference

Class Responsibility
lita_endpoints.py Defines the consent, token, snapshot, and scoring routes plus request and response models.
consent.py Re-exports ConsentGrantModel for domain-facing imports.
customer.py Supporting domain model file referenced by this consent domain.
session.py Supporting domain model file referenced by this consent domain.
lita-consent-data-api.md Customer-facing API specification for consent, data, and scoring behavior.
lita-implementation-overview.md Implementation summary for consent lifecycle, snapshots, scoring, and persistence.
lita-testing-guide.md Local verification and smoke-test instructions.
lita_smoke_test.sh One-shot local smoke test that exercises the domain end to end.
test_lita_endpoints.py FastAPI route tests for the consent-data API.
test_schema_migrations.py Schema regression coverage for legacy consent-adjacent records.