Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Aug 3, 2023
1 parent 7fc5fc0 commit b9342a0
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
9 changes: 5 additions & 4 deletions Controller/Index/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ function execute():Text {
# so I use a response convenient for debugging.
$r = Text::i('OK');
}
catch (\Exception $e) {
# 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
catch (\Throwable $t) {
df_500();
$r = Text::i(df_xts($e));
df_log($e);
$r = Text::i(df_xts($t));
df_log($t);
if (df_my_local()) {
throw $e; # 2020-03-27 It is convenient for me to see the exception on the screen.
throw $t; # 2020-03-27 It is convenient for me to see the exception on the screen.
}
}
return $r;
Expand Down
6 changes: 3 additions & 3 deletions Observer.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
namespace Dfe\Sift;
use Closure as F;
use Dfe\Sift\Settings as S;
use Exception as E;
use \Closure as F;
# 2020-02-01
final class Observer {
/**
Expand All @@ -21,6 +20,7 @@ final class Observer {
*/
static function f(F $f, bool $backend = false):void {
try {$backend xor df_is_backend() or !S::s()->enable() or $f();}
catch (E $e) {df_log($e);}
# 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
catch (\Throwable $t) {df_log($t);}
}
}
7 changes: 4 additions & 3 deletions Plugin/Customer/Api/AccountManagementInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ final class AccountManagementInterface {
*/
function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string {
try {return $f($u, $p);}
catch (\Exception $e) {_P::f(function() use($e, $u):void {
# 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
catch (\Throwable $t) {_P::f(function() use($t, $u):void {
# 2020-02-06 https://sift.com/developers/docs/curl/events-api/reserved-events/login
Event::p('login', [
/**
Expand All @@ -28,7 +29,7 @@ function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string {
* »
*/
'failure_reason' => sift_prefix(
$e instanceof Locked || $e instanceof NotConfirmed ? 'account_suspended' : 'wrong_password'
$t instanceof Locked || $t instanceof NotConfirmed ? 'account_suspended' : 'wrong_password'
)
# 2020-02-06
# «Use `login_status` to represent the success or failure of the login attempt»
Expand All @@ -46,6 +47,6 @@ function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string {
,'social_sign_on_type' => ''
,'username' => $u # 2020-02-06 String. «The username entered at the login prompt»
]);
}); throw $e;}
}); throw $t;}
}
}
5 changes: 2 additions & 3 deletions Test/CaseT/API/Account/Decisions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
namespace Dfe\Sift\Test\CaseT\API\Account;
use Dfe\Sift\API\B\GetDecisions as B;
use Exception as E;
/**
* 2020-02-27
* 1) "Retrieve decisions configuration from Sift": https://github.com/mage2pro/sift/issues/19
Expand Down Expand Up @@ -61,8 +60,8 @@ function t01():void {
try {
echo B::decisions()->j();
}
catch (E $e) {
echo df_cc_n(df_xts($e), df_bt_s($e));
catch (\Throwable $t) {
echo df_cc_n(df_xts($t), df_bt_s($t));
}
}
}
4 changes: 2 additions & 2 deletions Test/CaseT/API/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Dfe\Sift\Test\CaseT\API;
use Dfe\Sift\API\Facade\Event as F;
use Dfe\Sift\Settings as S;
use Exception as E;
# 2020-01-25 https://sift.com/developers/docs/curl/events-api
final class Event extends \Dfe\Sift\Test\CaseT {
/** 2020-01-25 @test */
Expand Down Expand Up @@ -60,7 +59,8 @@ function t01_add_item_to_cart():void {
]);
echo $r->j();
}
catch (E $e) {
# 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311
catch (\Throwable $t) {
xdebug_break();
}
}
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "friends-of-commerce/sift-paymentprotect"
,"version": "0.4.1"
"name": "mage2pro/sift"
,"version": "0.4.2"
,"description": "Sift integration with Magento 2"
,"type": "magento2-module"
,"homepage": "https://github.com/Friends-of-Commerce/Sift-PaymentProtect"
,"homepage": "https://github.com/mage2pro/sift"
,"license": "MIT"
,"authors": [{
"name": "Dmitrii Fediuk",
"email": "admin@mage2.pro",
"homepage": "https://github.com/Friends-of-Commerce/Sift-PaymentProtect",
"homepage": "https://www.upwork.com/fl/mage2pro",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=6.3.7", "mage2pro/phone": ">=1.1.0"}
,"require": {"mage2pro/core": ">=10.2.1", "mage2pro/phone": ">=1.1.0"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\Sift\\": ""}}
,"keywords": [
"eCommerce"
Expand Down

0 comments on commit b9342a0

Please sign in to comment.