public function calculatePrices()
    {
        if ($this->getId()) {
            return;
        }

        $taxFactor = $this->getTaxRate() / 100;
        $total = $pretax = $tax = 0;
        $sums = [];

        /* @var ProductInterface $product */
        foreach ($this->getProducts() as $product) {
            $pPreTax = $product->getPrice();
            $pTax    = $pPreTax * $taxFactor;
            $pTotal  = $pPreTax + $pTax;
            $pQuantity = $product->getQuantity();
            $ptPreTax = $pQuantity * $pPreTax;
            $ptTax    = $pQuantity * $pTax;
            $ptTotal  = $pQuantity * $pTotal;

            $sums[$product->getName()] = [
                'single_pretax' => $pPreTax,
                'single_tax'    => $pTax,
                'single_total'  => $pTotal,
                'pretax' => $ptPreTax,
                'tax'    => $ptTax,
                'total'  => $ptTotal,
            ];

            $total += $ptTotal;
            $pretax += $ptPreTax;
            $tax   += $ptTax;
        }

        $this->prices = [
            'products' => $sums,
            'total'  => $total,
            'tax'    => $tax,
            'pretax' => $pretax,
        ];
    }