From e71c03d1ede5c6ecb5cd4d38e6eb354b53b89142 Mon Sep 17 00:00:00 2001 From: Noah Siegrist <46855-siegrist@users.noreply.drupalcode.org> Date: Mon, 17 Feb 2025 16:53:55 +0000 Subject: [PATCH 1/2] Use minor usints converter service instead of toMinorUnits function. --- src/Plugin/Commerce/PaymentGateway/DatatransBase.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 62e98b9754848dadfe3e323ed2f2a2bd1a1253c6 Mon Sep 17 00:00:00 2001 From: Noah Siegrist <46855-siegrist@users.noreply.drupalcode.org> Date: Mon, 17 Feb 2025 17:09:10 +0000 Subject: [PATCH 2/2] Min version for commerce --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" } } -- GitLab