diff --git a/Helpers/ABTesting/ABTesting.php b/Helpers/ABTesting/ABTesting.php index 91d3e95..2b0d2c2 100644 --- a/Helpers/ABTesting/ABTesting.php +++ b/Helpers/ABTesting/ABTesting.php @@ -16,6 +16,10 @@ public function formatApiResult($result) { $body = $result['body']; + if ($result['error']) { + return $result; + } + $response = [ 'error' => $result['error'], 'message' => $result['message'], diff --git a/Model/Request/Transactions.php b/Model/Request/Transactions.php index dd6a1c6..6c93c05 100644 --- a/Model/Request/Transactions.php +++ b/Model/Request/Transactions.php @@ -10,6 +10,7 @@ use Mondu\Mondu\Model\Ui\ConfigProvider; use Magento\Framework\UrlInterface; use Magento\Framework\Locale\Resolver; +use Mondu\Mondu\Helpers\Logger\Logger as MonduFileLogger; class Transactions extends CommonRequest implements RequestInterface { @@ -58,6 +59,11 @@ class Transactions extends CommonRequest implements RequestInterface */ private $store; + /** + * @var MonduFileLogger + */ + private $monduFileLogger; + /** * @param Curl $curl * @param CartTotalRepository $cartTotalRepository @@ -75,7 +81,8 @@ public function __construct( OrderHelper $orderHelper, UrlInterface $urlBuilder, BuyerParamsInterface $buyerParams, - Resolver $store + Resolver $store, + MonduFileLogger $monduFileLogger ) { $this->_checkoutSession = $checkoutSession; $this->_cartTotalRepository = $cartTotalRepository; @@ -85,6 +92,7 @@ public function __construct( $this->urlBuilder = $urlBuilder; $this->buyerParams = $buyerParams; $this->store = $store; + $this->monduFileLogger = $monduFileLogger; } /** @@ -129,6 +137,10 @@ public function request($_params = []): array ]; } } catch (\Exception $e) { + $this->monduFileLogger->error('Error while creating an order', [ + 'message' => $e->getMessage(), + 'trace' => $e->getTrace() + ]); return [ 'error' => 1, 'body' => null, diff --git a/composer.json b/composer.json index 11b064f..a442342 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "mondu_gmbh/magento2-payment", "description": "Mondu payment method for magento 2", "type": "magento2-module", - "version": "2.3.0", + "version": "2.3.1", "license": [ "MIT" ],