code: protected function updateAmountsTotal(SaleInterface $sale)
      {
          $changed = false;
  
          $currency = $sale->getCurrency()->getCode();
  
          $sale->clearResults();
  
          $result = $this->amountCalculator->calculateSale($sale);
  
          if (0 != Money::compare($result->getBase(), $sale->getNetTotal(), $currency)) {
              $sale->setNetTotal($result->getBase());
              $changed = true;
          }
  
          if (0 != Money::compare($result->getTotal(), $sale->getGrandTotal(), $currency)) {
              $sale->setGrandTotal($result->getTotal());
              $changed = true;
          }
  
          return $changed;
      }
docs: Updates the sale's net and grand totals.
  
  @param SaleInterface $sale
  
  @return bool Whether the sale has been changed or not.