recordMyCashMovement method

Future<CashMovementResult> recordMyCashMovement({
  1. required String idempotencyKey,
  2. required String drawerId,
  3. required String type,
  4. required int amountCents,
  5. String? location,
  6. String? note,
  7. String? recipientId,
  8. String? targetDrawerId,
})

Ein- oder Auszahlung buchen (recordMyCashMovement, Recht cashMove); die Antwort traegt die Bon-Daten „Kassenbewegung“. type aus manualMovementTypes; amountCents positiv, das Vorzeichen setzt der Server nach der Art. Pflichtangaben je Art: note bei other_in und other_out (hoechstens 200 Zeichen), recipientId bei tip_payout, targetDrawerId bei transfer_out. location bei change_in und cash_drop ist freiwillig (aus cashLocations).

Implementation

Future<CashMovementResult> recordMyCashMovement({
  required String idempotencyKey,
  required String drawerId,
  required String type,
  required int amountCents,
  String? location,
  String? note,
  String? recipientId,
  String? targetDrawerId,
}) async {
  const name = Aufrufe.recordMyCashMovement;
  final p = <String, dynamic>{
    'idempotencyKey': idempotencyKey,
    'drawerId': drawerId,
    'type': type,
    'amountCents': amountCents,
    'location': ?location,
    'note': ?note,
    'recipientId': ?recipientId,
    'targetDrawerId': ?targetDrawerId,
  };
  kennung(name, 'drawerId', drawerId);
  // Nur pruefen, wenn gesetzt: Bank/Tresor fragt die Kasse nicht mehr ab.
  if (location != null && !cashLocations.contains(location)) {
    throw anfragefehler(name, 'location muss ${cashLocations.join(' oder ')} sein');
  }
  pruefeSchluessel(name, p);
  pruefeGanzzahlen(name, p);
  return gebuchtLesen(name, await transport.call(name, params: p));
}