Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The domain is SonWin billing: invoice header rows live in Sonlinc.AKOND, enriched with supply type (AUDEBFORS), PBSI payment rows (also in AKOND), and a "has a rendered PDF" existence check (AKONDDOC -> BDOC).

The result is result is mapped into the Bright-facing BrightInvoice model.

The controller requires authentication ([Authorize] at class level).

It declares 200/400/401/404 response types, but in practice only:

 200 (success),

 401 (missing/invalid auth, enforced by the framework) and

 500 (any thrown exception) are actually produced — see the SCOPE LIMITATIONS and the status-code notes below.

Visibility/filtering is configuration-driven. Each filter toggle is resolved as "local appsettings config wins, otherwise defer to the company's BCHEC flag"

(Sonlinc.BCHED, cached in memory). The SQL is assembled from pure-SQL fragments so only the active clauses appear in the executed statement.

IMPORTANT SCOPE LIMITATIONS:

  - ALL errors surface as HTTP 500. The catch blocks for ArgumentException (400) and KeyNotFoundException (404) are commented out in the controller; only the

    generic `catch (Exception) -> HandleError` remains, which returns 500 with the raw exception message.

    The declared 400/404 ProducesResponseType codes are therefore never produced by controller logic.

  - The 404 "customer not found" path in the service (repository.CustomerExistsAsync) is commented out (dead).

     Customer existence is instead validated via commonValidator.ValidateCustomer (account-search validator) which THROWS on failure -> surfaces as 500, not 404.

  - `ServiceId` (Bright service type) is only mapped for a subset of supply types:

    El -> consumption_trade,

    Vand -> water, 

    Varme -> heating (or cooling when AFREGNTYPE='KØL'),

    Antenne -> tv,

    Bredbånd -> broadband,

    Reno -> waste,

    Gas -> gas_trade.

    Grid/production variants (consumption_grid, production_grid, production_trade, gas_grid) are TODOs and return null.

    All other supply types and a null supply type also return null.

  - `InvoiceStatus` never returns several enum values:

      collection, reminder, deferred_with_interest, deferred_without_interest, investigation, paid_out.

    The KORTSTATUS values that would drive these are not yet identified (TODOs in MapInvoiceStatus).

  - `InvoiceType` only ever returns "pdf" or "missing"; "html" is never produced.

  - The `ocr` Info key is defined in the enum but NEVER emitted (source field in SonWin not yet identified).

  - The "description" Info entry and the "Tekst" Info entry carry the SAME value (r.Tekst) — duplicated under two different labels.

  - Supply-type join (AUDEBFORS) is hard-filtered to FORSYNINGSART = El only;


Visibility/filtering is configuration-driven. Each filter toggle is resolved as "local appsettings config wins, otherwise defer to the company's BCHEC flag"

(Sonlinc.BCHED, cached in memory). The SQL is assembled from pure-SQL fragments so only the active clauses appear in the executed statement    other supply types are not resolved on that join ("extend when confirmed").

--------------------------------------------------------------------------------

...