public function finalize(): void
    {
        $this->round();

        $old = $this->taxes;

        // Sort by amount
        usort($old, function (Adjustment $a, Adjustment $b): int {
            if ($a->getAmount() == $b->getAmount()) {
                return 0;
            }

            return $a->getAmount() > $b->getAmount() ? 1 : -1;
        });

        $new = [];
        $total = 0;
        foreach ($old as $tax) {
            $amount = Money::round($tax->getAmount(), $this->currency);

            // Fix overflow
            if ($total + $amount > $this->tax) {
                $amount = $this->tax - $total;
            }
            $total += $amount;

            $new[] = new Adjustment($tax->getName(), $amount, $tax->getRate());
        }

        // Sort by rate
        usort($new, function (Adjustment $a, Adjustment $b): int {
            return $a->getRate() > $b->getRate() ? 1 : -1;
        });

        $this->taxes = $new;
    }