rabattCents function
Rabatt in Cent aus der Eingabe; außerhalb von 0 … Summe gibt es keinen.
Implementation
int? rabattCents(RabattArt art, num wert, int summe) {
if (wert.isNaN || wert.isInfinite || wert < 0) return null;
if (art == RabattArt.prozent && wert > 100) return null;
final c = art == RabattArt.prozent ? (summe * wert / 100).round() : wert.round();
if (c > summe) return null;
return c;
}