VatSummaryCalculator class
Costruisce il riepilogo IVA di un documento.
Prima questa logica stava dentro ReceiptBuilder, che si ritrovava a fare
tre cose: gestire lo stato aperto/chiuso, ripartire lo sconto di documento
e calcolare l'imposta. Separandola, il builder torna a occuparsi solo del
ciclo di vita del documento e questo calcolo diventa testabile da solo,
senza costruire uno scontrino.
Constructors
- VatSummaryCalculator({VatCalculator calculator = const VatCalculator(), DiscountAllocator allocator = const ProportionalDiscountAllocator()})
-
Crea il calcolatore.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
build(
{required List< ReceiptLine> lines, required Money documentDiscount}) → List<VatBreakdown> -
Scorciatoia per chi vuole solo il riepilogo: equivale a
compute(...).vatSummary. -
compute(
{required List< ReceiptLine> lines, required Money documentDiscount}) → DocumentTotals - Ripartisce lo sconto di documento sulle righe e ne ricava il riepilogo per aliquota.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
summarize(
Iterable< RatedAmount> amounts) → List<VatBreakdown> - Riepilogo per aliquota, ordinato in modo crescente, a partire da importi già al netto di ogni sconto.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited