Skip to content

Commit

Permalink
Merge pull request #39 from WebKenth/php_compatibility_splittransacti…
Browse files Browse the repository at this point in the history
…on_id

explode requires a string, incase payment TransactionId is null the p…
  • Loading branch information
CodemakersDK authored Dec 30, 2024
2 parents 16c00a6 + e9acf74 commit fba3821
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$adapter = $objectManager->get(\QuickPay\Gateway\Model\Adapter\QuickPayAdapter::class);
$parts = explode('-',$payment->getTransactionId());
$parts = $this->splitTransactionId($payment);
$order = $payment->getOrder();
$transaction = $parts[0];

Expand All @@ -132,7 +132,7 @@ public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$adapter = $objectManager->get(\QuickPay\Gateway\Model\Adapter\QuickPayAdapter::class);
$parts = explode('-',$payment->getTransactionId());
$parts = $this->splitTransactionId($payment);
$order = $payment->getOrder();
$transaction = $parts[0];

Expand All @@ -157,7 +157,7 @@ public function cancel(\Magento\Payment\Model\InfoInterface $payment)
{
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$adapter = $objectManager->get(\QuickPay\Gateway\Model\Adapter\QuickPayAdapter::class);
$parts = explode('-',$payment->getTransactionId());
$parts = $this->splitTransactionId($payment);
$order = $payment->getOrder();
$transaction = $parts[0];

Expand All @@ -171,4 +171,9 @@ public function cancel(\Magento\Payment\Model\InfoInterface $payment)

return $this;
}

public function splitTransactionId($payment)
{
return explode('-',$payment->getTransactionId() ?? '');
}
}

0 comments on commit fba3821

Please sign in to comment.