Skip to content

Instantly share code, notes, and snippets.

@Frank-Magmodules
Created July 28, 2023 13:49
Show Gist options
  • Save Frank-Magmodules/dcd6754421295480f7d9f0db661e6305 to your computer and use it in GitHub Desktop.
Save Frank-Magmodules/dcd6754421295480f7d9f0db661e6305 to your computer and use it in GitHub Desktop.
diff --git a/Model/Client/Payments.php b/Model/Client/Payments.php
index 35dee01..943aa2e 100644
--- a/Model/Client/Payments.php
+++ b/Model/Client/Payments.php
@@ -178,7 +178,7 @@ class Payments extends AbstractModel
$orderId = $order->getEntityId();
$transactionId = $order->getMollieTransactionId();
- if (!empty($transactionId) && !preg_match('/^ord_\w+$/', $transactionId)) {
+ if (!empty($transactionId) && substr($transactionId, 0, 4) != 'ord_') {
$payment = $mollieApi->payments->get($transactionId);
return $payment->getCheckoutUrl();
}
diff --git a/Model/Mollie.php b/Model/Mollie.php
index ef6ef2c..73da501 100644
--- a/Model/Mollie.php
+++ b/Model/Mollie.php
@@ -333,7 +333,7 @@ class Mollie extends Adapter
try {
$connection->beginTransaction();
- if (preg_match('/^ord_\w+$/', $transactionId)) {
+ if (substr($transactionId, 0, 4) == 'ord_') {
$result = $this->ordersApi->processTransaction($order, $mollieApi, $type, $paymentToken);
} else {
$result = $this->paymentsApi->processTransaction($order, $mollieApi, $type, $paymentToken);
@@ -369,7 +369,7 @@ class Mollie extends Adapter
$mollieApi = $this->loadMollieApi($apiKey);
- if (preg_match('/^ord_\w+$/', $transactionId)) {
+ if (substr($transactionId, 0, 4) == 'ord_') {
return $this->ordersApi->orderHasUpdate($order, $mollieApi);
} else {
return $this->paymentsApi->orderHasUpdate($order, $mollieApi);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment