isPayoutCancellation function
Storno einer Gutschein-Auszahlung: genau eine positive Barzahlung ohne
refundOf (das Geld kommt in die Lade zurueck). Alles andere bleibt
Rueckzahlung mit negativem Betrag; ob der Beleg eine Auszahlung war,
entscheidet der Server. Liegt das original vor und traegt es keine
Auszahlung, bleibt es bei negativen Rueckzahlungen. Zwilling von
istStornoAuszahlung im npm-Paket.
Implementation
bool isPayoutCancellation(List<KeckPaymentInput> payments, KasseneckReceipt? original) {
if (payments.length != 1) return false;
if (original != null && !(original.vouchers ?? const <KeckVoucher>[]).any((v) => v.action == VoucherAction.payout)) return false;
final z = payments.single;
return z.method == KeckPaymentMethod.cash && z.amountCents > 0 && z.refundOf == null;
}