From 7424fb32346b072e670854f58ec073d48be39ca2 Mon Sep 17 00:00:00 2001
From: Noah Siegrist <46855-siegrist@users.noreply.drupalcode.org>
Date: Tue, 18 Feb 2025 07:52:12 +0000
Subject: [PATCH] Issue #3507218 by siegrist: Commerce 3 compatibility

---
 composer.json                                        | 2 +-
 src/Plugin/Commerce/PaymentGateway/DatatransBase.php | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/composer.json b/composer.json
index cf47389..526e5fd 100644
--- a/composer.json
+++ b/composer.json
@@ -10,6 +10,6 @@
     "source": "http://cgit.drupalcode.org/commerce_datatrans"
   },
   "require": {
-    "drupal/commerce": "2.*"
+    "drupal/commerce": "^2.25 || ^3"
   }
 }
diff --git a/src/Plugin/Commerce/PaymentGateway/DatatransBase.php b/src/Plugin/Commerce/PaymentGateway/DatatransBase.php
index a1b78a2..6f12db1 100644
--- a/src/Plugin/Commerce/PaymentGateway/DatatransBase.php
+++ b/src/Plugin/Commerce/PaymentGateway/DatatransBase.php
@@ -288,7 +288,7 @@ class DatatransBase extends PaymentGatewayBase implements SupportsRefundsInterfa
     $this->assertRefundAmount($payment, $amount);
 
     $data = [
-      'amount' => $this->toMinorUnits($amount),
+      'amount' => $this->minorUnitsConverter->toMinorUnits($amount),
       'currency' => $amount->getCurrencyCode(),
       'refno' => $payment->getOrderId(),
     ];
@@ -348,7 +348,7 @@ class DatatransBase extends PaymentGatewayBase implements SupportsRefundsInterfa
     $order = $payment->getOrder();
 
     // Calculate the amount in the form Datatrans expects it.
-    $amount = $this->toMinorUnits($payment->getAmount());
+    $amount = $this->minorUnitsConverter->toMinorUnits($payment->getAmount());
 
     $data = NestedArray::mergeDeep($data, [
       'currency' => $payment->getAmount()->getCurrencyCode(),
@@ -416,7 +416,7 @@ class DatatransBase extends PaymentGatewayBase implements SupportsRefundsInterfa
     $order = $payment->getOrder();
 
     // Calculate the amount in the form Datatrans expects it.
-    $amount = $this->toMinorUnits($payment->getAmount());
+    $amount = $this->minorUnitsConverter->toMinorUnits($payment->getAmount());
 
     $data = NestedArray::mergeDeep($data, [
       'currency' => $payment->getAmount()->getCurrencyCode(),
-- 
GitLab