Skip to content

Commit

Permalink
[Maintenance] Remove deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
lchrusciel committed Dec 11, 2024
1 parent 88c81b8 commit 598d2b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 23 deletions.
15 changes: 2 additions & 13 deletions src/Tpay/Resolver/TpayTransactionChannelResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

use CommerceWeavers\SyliusTpayPlugin\PayByLinkPayment\Payum\Factory\GatewayFactory;
use CommerceWeavers\SyliusTpayPlugin\PayByLinkPayment\Payum\Factory\GetTpayTransactionsChannelsFactoryInterface;
use CommerceWeavers\SyliusTpayPlugin\PayByLinkPayment\Payum\Request\GetTpayTransactionsChannels;
use Payum\Core\Model\ArrayObject;
use Payum\Core\Payum;
use Psr\Log\LoggerInterface;
use Tpay\OpenApi\Utilities\TpayException;
Expand All @@ -16,25 +14,16 @@ final class TpayTransactionChannelResolver implements TpayTransactionChannelReso
{
public function __construct(
private readonly Payum $payum,
private readonly ?GetTpayTransactionsChannelsFactoryInterface $getTpayTransactionsChannelsFactory = null,
private readonly GetTpayTransactionsChannelsFactoryInterface $getTpayTransactionsChannelsFactory,
private readonly ?LoggerInterface $logger = null,
) {
if (null === $this->getTpayTransactionsChannelsFactory) {
trigger_deprecation(
'commerce-weavers/sylius-tpay-plugin',
'1.0',
'Not passing a $getTpayTransactionsChannelsFactory to %s constructor is deprecated and will be removed in SyliusTpayPlugin 2.0.',
self::class,
);
}
}

public function resolve(): array
{
$gateway = $this->payum->getGateway(GatewayFactory::NAME);

$value = $this->getTpayTransactionsChannelsFactory?->createNewEmpty()
?? new GetTpayTransactionsChannels(new ArrayObject());
$value = $this->getTpayTransactionsChannelsFactory->createNewEmpty();

try {
$gateway->execute($value, true);
Expand Down
12 changes: 2 additions & 10 deletions src/Tpay/Security/Notification/Verifier/SignatureVerifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,8 @@ public function __construct(
private readonly CertificateResolverInterface $certificateResolver,
private readonly TrustedCertificateResolverInterface $trustedCertificateResolver,
private readonly X509FactoryInterface $x509Factory,
private readonly ?ProductionModeCheckerInterface $productionModeChecker = null,
private readonly ProductionModeCheckerInterface $productionModeChecker,
) {
if (null === $this->productionModeChecker) {
trigger_deprecation(
'commerce-weavers/sylius-tpay-plugin',
'1.0',
'Not passing a $productionModeChecker to %s constructor is deprecated and will be removed in SyliusTpayPlugin 2.0.',
self::class,
);
}
}

public function verify(string $jws, string $requestContent): bool
Expand All @@ -52,7 +44,7 @@ public function verify(string $jws, string $requestContent): bool
throw new InvalidSignatureException('Missing x5u header');
}

$production = $this->productionModeChecker?->isProduction($x5u) ?? false;
$production = $this->productionModeChecker->isProduction($x5u);
$certificate = $this->certificateResolver->resolve($x5u);
$trusted = $this->trustedCertificateResolver->resolve($production);

Expand Down

0 comments on commit 598d2b5

Please sign in to comment.