completionCheck function
CompletionCheck
completionCheck({
- required KeckPaymentMethod paymentMethod,
- required int dueCents,
- required int? tenderedCents,
- required bool changeEnabled,
- required bool cartEmpty,
Darf abgeschlossen werden? Bar mit Rückgeld-Rechnung braucht genug Gegebenes.
Implementation
CompletionCheck completionCheck({
required KeckPaymentMethod paymentMethod,
required int dueCents,
required int? tenderedCents,
required bool changeEnabled,
required bool cartEmpty,
}) {
if (cartEmpty) {
return const CompletionCheck(
ready: false,
reason: 'Noch nichts erfasst — bitte zuerst eine Position aufnehmen.',
);
}
if (paymentMethod == KeckPaymentMethod.cash && changeEnabled && tenderedCents != null && tenderedCents < dueCents) {
return const CompletionCheck(ready: false, reason: 'Gegeben ist weniger als der Betrag.');
}
return const CompletionCheck(ready: true);
}