-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OP-558 - update plugin to Sylius 2 - ecs fix
- Loading branch information
1 parent
3097fba
commit 0b40f18
Showing
4 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file has been created by developers from BitBag. | ||
* Feel free to contact us once you face any issues or want to start | ||
* You can find more information about us on https://bitbag.io and write us | ||
* an email on [email protected]. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusBlacklistPlugin\Checker\FraudSuspicion; | ||
|
@@ -14,14 +21,15 @@ final class FraudSuspicionActionEligibilityChecker implements FraudSuspicionActi | |
{ | ||
public function __construct( | ||
private FraudSuspicionRepositoryInterface $fraudSuspicionRepository, | ||
private CustomerStateResolverInterface $customerStateResolver | ||
) {} | ||
private CustomerStateResolverInterface $customerStateResolver, | ||
) { | ||
} | ||
|
||
public function canAddFraudSuspicion( | ||
OrderInterface $order, | ||
AutomaticBlacklistingConfigurationInterface $automaticBlacklistingConfiguration | ||
AutomaticBlacklistingConfigurationInterface $automaticBlacklistingConfiguration, | ||
): bool { | ||
if ($this->fraudSuspicionRepository->findOneBy(['order' => $order]) !== null) { | ||
if (null !== $this->fraudSuspicionRepository->findOneBy(['order' => $order])) { | ||
return false; | ||
} | ||
|
||
|
@@ -31,7 +39,7 @@ public function canAddFraudSuspicion( | |
$lastFraudSuspicionsOfCustomer = $this->fraudSuspicionRepository->countByCustomerAndCommentAndDate( | ||
$customer, | ||
FraudSuspicionInterface::AUTO_GENERATED_STATUS, | ||
$date | ||
$date, | ||
); | ||
|
||
if ($lastFraudSuspicionsOfCustomer >= $automaticBlacklistingConfiguration->getPermittedFraudSuspicionsNumber()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file has been created by developers from BitBag. | ||
* Feel free to contact us once you face any issues or want to start | ||
* You can find more information about us on https://bitbag.io and write us | ||
* an email on [email protected]. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusBlacklistPlugin\Checker; | ||
|
@@ -10,13 +17,14 @@ | |
final class UserRoleChecker implements UserRoleCheckerInterface | ||
{ | ||
public function __construct( | ||
private TokenStorageInterface $tokenStorage | ||
) {} | ||
private TokenStorageInterface $tokenStorage, | ||
) { | ||
} | ||
|
||
public function isAdmin(): bool | ||
{ | ||
$token = $this->tokenStorage->getToken(); | ||
if ($token === null) { | ||
if (null === $token) { | ||
return false; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file has been created by developers from BitBag. | ||
* Feel free to contact us once you face any issues or want to start | ||
* You can find more information about us on https://bitbag.io and write us | ||
* an email on [email protected]. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusBlacklistPlugin\EntityListener; | ||
|
@@ -15,8 +22,9 @@ class FraudSuspicionEntityListener | |
public function __construct( | ||
private SuspiciousOrderResolverInterface $suspiciousOrderResolver, | ||
private CustomerStateResolverInterface $customerStateResolver, | ||
private FraudSuspicionCommonModelConverterInterface $fraudSuspicionCommonModelConverter | ||
) {} | ||
private FraudSuspicionCommonModelConverterInterface $fraudSuspicionCommonModelConverter, | ||
) { | ||
} | ||
|
||
public function prePersist(FraudSuspicionInterface $newFraudSuspicion, LifecycleEventArgs $event): void | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
<?php | ||
|
||
/* | ||
* This file has been created by developers from BitBag. | ||
* Feel free to contact us once you face any issues or want to start | ||
* You can find more information about us on https://bitbag.io and write us | ||
* an email on [email protected]. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace BitBag\SyliusBlacklistPlugin\Factory; | ||
|
@@ -11,8 +18,9 @@ | |
final class FraudSuspicionFactory implements FraudSuspicionFactoryInterface | ||
{ | ||
public function __construct( | ||
private FactoryInterface $decoratedFactory | ||
) {} | ||
private FactoryInterface $decoratedFactory, | ||
) { | ||
} | ||
|
||
public function createNew(): FraudSuspicionInterface | ||
{ | ||
|
@@ -48,7 +56,7 @@ public function createForAutomaticBlacklistingConfiguration(OrderInterface $orde | |
$fraudSuspicion->setAddressType(FraudSuspicionInterface::SHIPPING_ADDRESS_TYPE); | ||
$fraudSuspicion->setStatus(FraudSuspicionInterface::AUTO_GENERATED_STATUS); | ||
|
||
if ($fraudSuspicion->getCustomerIp() === null) { | ||
if (null === $fraudSuspicion->getCustomerIp()) { | ||
$fraudSuspicion->setCustomerIp($_SERVER['REMOTE_ADDR'] ?? ''); | ||
} | ||
|
||
|