Skip to content

Commit c0d4919

Browse files
1 parent 4384ad7 commit c0d4919

File tree

3 files changed

+19
-21
lines changed

3 files changed

+19
-21
lines changed

Handler.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
namespace Dfe\CheckoutCom;
33
use Dfe\CheckoutCom\Handler\DefaultT;
4-
use Exception as E;
54
use Magento\Framework\Phrase;
5+
use \Throwable as Th; # 2023-08-02 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
66
/**
77
* @see \Dfe\CheckoutCom\Handler\Charge
88
* @see \Dfe\CheckoutCom\Handler\CustomerReturn
@@ -56,7 +56,6 @@ private function isInitiatedByMyself():bool {return in_array($this->type(), df_c
5656
* 2016-03-25
5757
* @param array(string => mixed) $req
5858
* @return Phrase|string
59-
* @throws E
6059
*/
6160
static function p(array $req) {/** @var Phrase|string $r */
6261
try {
@@ -75,15 +74,15 @@ static function p(array $req) {/** @var Phrase|string $r */
7574
)
7675
;
7776
}
78-
catch (E $e) {
77+
catch (Th $t) {
7978
df_500();
8079
# 2023-07-25
8180
# "Change the 3rd argument of `df_sentry` from `$context` to `$extra`": https://github.com/mage2pro/core/issues/249
82-
df_sentry(__CLASS__, $e, ['request' => $req]);
81+
df_sentry(__CLASS__, $t, ['request' => $req]);
8382
if (df_my_local()) {
84-
throw $e; # 2016-03-27 Show the stack trace on the screen
83+
throw $t; # 2016-03-27 Show the stack trace on the screen
8584
}
86-
$r = __($e->getMessage());
85+
$r = __($t->getMessage());
8786
}
8887
return $r;
8988
}

Method.php

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
<?php
22
namespace Dfe\CheckoutCom;
3-
use com\checkout\ApiServices\Cards\ResponseModels\Card;
4-
use com\checkout\ApiServices\Charges\RequestModels\ChargeCapture;
5-
use com\checkout\ApiServices\Charges\RequestModels\ChargeRefund;
6-
use com\checkout\ApiServices\Charges\RequestModels\ChargeUpdate;
7-
use com\checkout\ApiServices\Charges\RequestModels\ChargeVoid;
8-
use com\checkout\ApiServices\Charges\ResponseModels\Charge as ChargeResponse;
9-
use com\checkout\helpers\ApiHttpClientCustomException as CE;
103
use Df\Payment\PlaceOrderInternal as PO;
114
use Df\Payment\Source\AC;
125
use Df\Payment\Token;
136
use Dfe\CheckoutCom\SDK\ChargeService;
147
use Magento\Framework\DataObject as _DO;
158
use Magento\Framework\Exception\LocalizedException as LE;
16-
use Magento\Payment\Model\Info as I;
179
use Magento\Payment\Model\InfoInterface as II;
18-
use Magento\Sales\Model\Order\Payment as OP;
1910
use Magento\Sales\Model\Order\Payment\Transaction as T;
11+
use \Throwable as Th; # 2023-08-02 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
12+
use com\checkout\ApiServices\Cards\ResponseModels\Card;
13+
use com\checkout\ApiServices\Charges\RequestModels\ChargeCapture;
14+
use com\checkout\ApiServices\Charges\RequestModels\ChargeRefund;
15+
use com\checkout\ApiServices\Charges\RequestModels\ChargeUpdate;
16+
use com\checkout\ApiServices\Charges\RequestModels\ChargeVoid;
17+
use com\checkout\ApiServices\Charges\ResponseModels\Charge as ChargeResponse;
18+
use com\checkout\helpers\ApiHttpClientCustomException as CE;
2019
/** @method Settings s() */
2120
final class Method extends \Df\Payment\Method {
2221
/**
@@ -543,12 +542,12 @@ private function isCaptureDesired():bool {return AC::c($this->s()->actionDesired
543542
* @return mixed
544543
* @throws \Exception
545544
*/
546-
private function leh(\Closure $f) {return df_try($f, function(\Exception $e):void {
547-
if ($e instanceof CE) {
548-
$e = new LE(__($e->getErrorMessage()), $e);
545+
private function leh(\Closure $f) {return df_try($f, function(Th $th):void {
546+
if ($th instanceof CE) {
547+
$th = new LE(__($th->getErrorMessage()), $th);
549548
}
550-
df_sentry($this, $e);
551-
throw df_lx($e);
549+
df_sentry($this, $th);
550+
throw df_lx($th);
552551
});}
553552

554553
/**

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mage2pro/checkout.com"
3-
,"version": "1.7.4"
3+
,"version": "1.7.5"
44
,"description": "Checkout.com integration with Magento 2"
55
,"type": "magento2-module"
66
,"homepage": "https://mage2.pro/c/extensions/checkout-com"

0 commit comments

Comments
 (0)