...
1) GetAgreements
Route: GET
- GET /bright/agreements
ParamsParams:
- customerId (required)
...
- serviceId (required)
...
- serviceId MUST be the EAN / MeteringPointId (ediel number).
...
- (+ CancellationToken)
...
Returns
- 200 OK -> IEnumerable<BrightAgreement>
- 400 BadRequest (declared; see note below)
...
- 401 Unauthorized
What What it does:
Returns the list of active agreements for the given customer + service.
It first validates the customer exists and validates input (customerId required; serviceId required and digits
only).
Validation Validation that affects the result (all surface as HTTP 500 with a message): -
- Customer does not exist -> commonValidator.ValidateCustomer throws
...
- Missing customerId -> "Missing parameter 'CustomerId'."
...
- Missing serviceId -> "Missing parameter 'ServiceId'."
...
- serviceId not digits-only -> "Parameter 'ServiceId' must contain
...
- digits only."
...
- Duplicate ContractName in out -> "Duplicate ContractName(s) found: ..."
...
- Rows for >1 customer / wrong -> "Agreements belong to
...
- multiple customer
- Agreements belongs to wrong CustomerId. Expected id: {id}"
--------------------------------------------------------------------------------
RESPONSE STRUCTURE (BrightAgreement)
--------------------------------------------------------------------------------
...
| Code Block | ||
|---|---|---|
| ||
[
{
"Id": <value> // Hardcoded: set to the supplied serviceId (eanNumber), NOT the
// contract id. (Intended Data: AgreementId / grouping key.)
"ServiceId": <value> // Hardcoded: set to the supplied serviceId (eanNumber).
// (Intended Data: the service id from the row.)
"DisplayName": "Dit elprodukt" // Hardcoded: literal Danish string "Dit elprodukt".
// (Intended Data: contract name - BAKONTRAKT/AFORBKONTR.KONTRAKT.)
"AgreementType": null // Hardcoded null: always null today.
// (Intended Data: BAKONTRAKT.TYP -> ContractType.)
"StartDate": null // Hardcoded null: always null today.
// (Intended Data: AFORBKONTR/BAKONTRAKT.FRADATO -> ContractActiveFrom.)
"EndDate": null // Hardcoded null: always null today.
// (Intended Data: AFORBKONTR/BAKONTRAKT.TILDATO -> ContractActiveTo.)
"HasCapacityTariffs": null // Hardcoded null: always null today.
// (Intended Data: DbAgreement.HasCapacityTariffs - not populated by SQL.)
"Info": [] // Hardcoded: always an empty array (new List<BrightAgreementInfo>()).
// (Intended Data: list of {Title, Key, Value} from InfoTitle/
// InfoKeyInfoKey/InfoValue rows - currently nevernot populated.)
}
] |
| Code Block | ||
|---|---|---|
| ||
{
"Title": <value> // Data (intended): DbAgreement.InfoTitle - nevernot emitted today.
"Key": <value> // Data (intended): DbAgreement.InfoKey - nevernot emitted today.
"Value": <value> // Data (intended): DbAgreement.InfoValue - nevernot emitted today.
} |