code: protected function updateTotals(InvoiceInterface $invoice)
      {
          $changed = $this->invoiceCalculator->calculate($invoice);
  
          if ($changed) {
              foreach ($invoice->getLines() as $line) {
                  $this->persistenceHelper->persistAndRecompute($line, false);
              }
          }
  
          return $changed;
      }
docs: Updates the invoice totals.
  
  @param InvoiceInterface $invoice
  
  @return bool