diff --git a/src/Controller/InvoiceController.php b/src/Controller/InvoiceController.php
index abfa061..174c54a 100644
--- a/src/Controller/InvoiceController.php
+++ b/src/Controller/InvoiceController.php
@@ -47,7 +47,7 @@ class InvoiceController extends ControllerBase implements ContainerInjectionInte
       ->loadRevision($invoice_revision);
     return $this->t('Revision of %title from %date', [
       '%title' => $invoice->label(),
-      '%date' => format_date($invoice->getRevisionCreationTime()),
+      '%date' => \Drupal::service('date.formatter')->format(($invoice->getRevisionCreationTime())),
     ]);
   }
 
@@ -98,7 +98,7 @@ class InvoiceController extends ControllerBase implements ContainerInjectionInte
         $date = Drupal::service('date.formatter')
           ->format($revision->getRevisionCreationTime(), 'short');
         if ($vid != $invoice->getRevisionId()) {
-          $link = $this->l($date, new Url('entity.invoice.revision', [
+          $link = \Drupal\Core\Link::fromTextAndUrl($date, new Url('entity.invoice.revision', [
             'invoice' => $invoice->id(),
             'invoice_revision' => $vid,
           ]));
diff --git a/src/Form/InvoiceForm.php b/src/Form/InvoiceForm.php
index 062ef00..7513c5e 100644
--- a/src/Form/InvoiceForm.php
+++ b/src/Form/InvoiceForm.php
@@ -57,13 +57,13 @@ class InvoiceForm extends ContentEntityForm {
 
     switch ($status) {
       case SAVED_NEW:
-        drupal_set_message($this->t('Created the %label Invoice.', [
+        $this->messenger()->addMessage($this->t('Created the %label Invoice.', [
           '%label' => $entity->label(),
         ]));
         break;
 
       default:
-        drupal_set_message($this->t('Saved the %label Invoice.', [
+        $this->messenger()->addMessage($this->t('Saved the %label Invoice.', [
           '%label' => $entity->label(),
         ]));
     }
diff --git a/src/Form/InvoiceRevisionRevertForm.php b/src/Form/InvoiceRevisionRevertForm.php
index 178c332..f1b91d1 100644
--- a/src/Form/InvoiceRevisionRevertForm.php
+++ b/src/Form/InvoiceRevisionRevertForm.php
@@ -124,7 +124,7 @@ class InvoiceRevisionRevertForm extends ConfirmFormBase {
         '%title' => $this->revision->label(),
         '%revision' => $this->revision->getRevisionId(),
       ]);
-    drupal_set_message(t('Invoice %title has been reverted to the revision from %revision-date.', [
+    $this->messenger()->addMessage(t('Invoice %title has been reverted to the revision from %revision-date.', [
       '%title' => $this->revision->label(),
       '%revision-date' => $this->dateFormatter->format($original_revision_timestamp),
     ]));
diff --git a/src/WalleeService.php b/src/WalleeService.php
index 937f637..9e39289 100644
--- a/src/WalleeService.php
+++ b/src/WalleeService.php
@@ -6,6 +6,7 @@ use Drupal;
 use Drupal\commerce_order\Entity\OrderInterface;
 use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
 use Drupal\Component\Plugin\Exception\PluginNotFoundException;
+use Drupal\Core\File\FileSystemInterface;
 use Drupal\file\Entity\File;
 use Wallee\Sdk\Model\TransactionCreate;
 use Wallee\Sdk\Model\LineItemCreate;
@@ -910,8 +911,8 @@ class WalleeService {
     $invoiceFile = $this->walleeWrapper->getInvoicesByTransactionId($transaction_id);
     $filename = $invoice_entity_id . ".pdf";
     $private_dir = "private://invoices/";
-    file_prepare_directory($private_dir, FILE_CREATE_DIRECTORY);
-    $file = file_save_data(base64_decode($invoiceFile), "private://invoices/" . $filename, FILE_EXISTS_RENAME);
+    FileSystemInterface::prepareDirectory($private_dir, FileSystemInterface::CREATE_DIRECTORY);
+    $file = file_save_data(base64_decode($invoiceFile), "private://invoices/" . $filename, FileSystemInterface::EXISTS_RENAME);
     $local_fid = $file->id();
     Drupal::logger('wallee')
       ->notice("downloaded file with local fild:" . $local_fid);
