Common/View/ViewBuilder.php
private function buildDiscountLine(Model\SaleAdjustmentInterface $adjustment, $level = 0)
    {
        if (Model\AdjustmentTypes::TYPE_DISCOUNT !== $adjustment->getType()) {
            throw new InvalidArgumentException("Unexpected adjustment type.");
        }

        $lineNumber = $this->lineNumber++;

        $view = new LineView(
            'adjustment_' . ($lineNumber - 1),
            'adjustment_' . $adjustment->getId(),
            $lineNumber,
            $level
        );

        if (empty($designation = $adjustment->getDesignation())) {
            $designation = 'Discount ';
            if ($adjustment->getMode() === Model\AdjustmentModes::MODE_PERCENT) {
                $designation .= $this->formatter->percent($adjustment->getAmount());
            }
        }

        $result = $adjustment->getResult();

        $view
            ->setDesignation($designation)
            ->setBase($this->formatter->currency($result->getBase()))
            ->setTaxAmount($this->formatter->currency($result->getTax()))
            ->setTotal($this->formatter->currency($result->getTotal()));

        foreach ($this->types as $type) {
            $type->buildAdjustmentView($adjustment, $view, $this->options);
        }

        return $view;
    }
private function buildDiscountLine(Model\SaleAdjustmentInterface $adjustment, $level = 0)
    {
        if (Model\AdjustmentTypes::TYPE_DISCOUNT !== $adjustment->getType()) {
            throw new InvalidArgumentException("Unexpected adjustment type.");
        }

        $lineNumber = $this->lineNumber++;

        $view = new LineView(
            'adjustment_' . ($lineNumber - 1),
            'adjustment_' . $adjustment->getId(),
            $lineNumber,
            $level
        );

        if (empty($designation = $adjustment->getDesignation())) {
            $designation = 'Discount ';
            if ($adjustment->getMode() === Model\AdjustmentModes::MODE_PERCENT) {
                $designation .= $this->formatter->percent($adjustment->getAmount());
            }
        }

        $result = $adjustment->getResult();

        $view
            ->setDesignation($designation)
            ->setBase($this->formatter->currency($result->getBase()))
            ->setTaxAmount($this->formatter->currency($result->getTax()))
            ->setTotal($this->formatter->currency($result->getTotal()));

        foreach ($this->types as $type) {
            $type->buildAdjustmentView($adjustment, $view, $this->options);
        }

        return $view;
    }
Builds the sale discount line view.

@param Model\SaleAdjustmentInterface $adjustment
@param int                           $level

@return LineView