code: protected function writeInvoiceTaxesLine()
      {
          $sale = $this->invoice->getSale();
          $date = $sale->getCreatedAt();
  
          $credit = $this->invoice->getType() === InvoiceTypes::TYPE_CREDIT;
  
          foreach ($this->invoice->getTaxesDetails() as $detail) {
              $amount = $this->round($detail['amount']);
  
              if (0 === $this->compare($amount, 0)) {
                  continue; // next tax details
              }
  
              $account = $this->getTaxAccountNumber($detail['rate'], $this->invoice->getNumber());
  
              if ($credit) {
                  $this->writer->credit($account, (string)$amount, $date);
                  $this->balance -= $amount;
              } else {
                  $this->writer->debit($account, (string)$amount, $date);
                  $this->balance += $amount;
              }
          }
      }
docs: Writes the invoice's taxes lines.