Ejemplo n.º 1
0
 /**
  * @param XMLWriter $xmlWriter
  * @param Invoice   $invoice
  */
 protected function addDiscount(XMLWriter $xmlWriter, Invoice $invoice)
 {
     if ($invoice->getDiscount() === null) {
         return;
     }
     $xmlWriter->startElement('discount');
     $xmlWriter->writeElement('percentage', $this->percentageFormatter->format($invoice->getDiscount()));
     $xmlWriter->writeElement('amount', $this->currencyFormatter->formatCurrency($invoice->getDiscountAmount(), $invoice->getCurrencyCode()));
     $xmlWriter->writeElement('after', $this->currencyFormatter->formatCurrency($invoice->getDiscountAmount(), $invoice->getCurrencyCode()));
     $xmlWriter->endElement();
 }