terminals method

Future<List<TerminalInfo>> terminals()

Lists the terminals known to this device: GET /api/terminals.

Returns the configured terminal objects (id, merchant/company, receipt header lines, type, …) as TerminalInfo. The REST spec and its example disagree on the exact field set, so every field is optional; unmodelled keys stay available via TerminalInfo.raw.

Nicht ueberall vorhanden: am 26.08.2026 antwortete HPS 1.10.0 / Firmware 7.3.6 hier mit 404 Endpoint not implemented. Der Aufruf wirft dann eine HpsHttpException -- er ist kein verlaesslicher Bestandteil des Zahlwegs.

Implementation

Future<List<TerminalInfo>> terminals() async {
  final response = await _send('GET', _uri('api/terminals', null), null);
  if (response.statusCode < 200 || response.statusCode >= 300) {
    throw HpsHttpException(
      response.statusCode,
      _errorMessage(response.body, response.statusCode),
      body: response.body,
    );
  }
  final decoded = jsonDecode(response.body);
  if (decoded is List) {
    return decoded
        .whereType<Map<String, dynamic>>()
        .map(TerminalInfo.fromJson)
        .toList();
  }
  return const <TerminalInfo>[];
}