Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Command/Handler/CapturePaymentRequestHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function __construct(
private PayPlugPaymentDataCreator $paymentDataCreator,
#[Autowire(service: 'sylius_shop.provider.order_pay.after_pay_url')]
private UrlProviderInterface $afterPayUrlProvider,
private UrlGeneratorInterface $urlGenerator,
) {}

public function __invoke(CapturePaymentRequest $capturePaymentRequest): void
Expand Down Expand Up @@ -67,9 +66,6 @@ public function __invoke(CapturePaymentRequest $capturePaymentRequest): void
'cancel_url' => $returnUrl . '?&' . http_build_query(['status' => PayPlugApiClientInterface::STATUS_CANCELED]),
];

$notificationUrl = $this->urlGenerator->generate('sylius_payment_method_notify', ['code' => $payment->getMethod()?->getCode()], UrlGeneratorInterface::ABSOLUTE_URL);
$data['notification_url'] = $notificationUrl;

$paymentRequest->setPayload($data);

try {
Expand Down
5 changes: 5 additions & 0 deletions src/Creator/PayPlugPaymentDataCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Sylius\Component\Core\Model\Shipment;
use Sylius\Component\Resource\Repository\RepositoryInterface;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class PayPlugPaymentDataCreator
{
Expand All @@ -41,6 +42,7 @@ public function __construct(
private RepositoryInterface $payplugCardRepository,
private RequestStack $requestStack,
private PayplugFeatureChecker $payplugFeatureChecker,
private UrlGeneratorInterface $urlGenerator,
) {
}

Expand Down Expand Up @@ -83,6 +85,9 @@ public function create(
$paymentMethod = $payment->getMethod();
$gatewayFactoryName = $paymentMethod?->getGatewayConfig()?->getFactoryName();

$notificationUrl = $this->urlGenerator->generate('sylius_payment_method_notify', ['code' => $payment->getMethod()?->getCode()], UrlGeneratorInterface::ABSOLUTE_URL);
$details['notification_url'] = $notificationUrl;

if (
PayPlugGatewayFactory::FACTORY_NAME === $gatewayFactoryName &&
$paymentMethod instanceof PaymentMethodInterface
Expand Down
4 changes: 0 additions & 4 deletions src/Provider/Payment/ApplePayPaymentProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace PayPlug\SyliusPayPlugPlugin\Provider\Payment;

use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use LogicException;
use Payplug\Resource\IVerifiableAPIResource;
use Payplug\Resource\Payment;
Expand All @@ -32,7 +31,6 @@
use Sylius\Component\Payment\PaymentTransitions;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\RouterInterface;
use Webmozart\Assert\Assert;

class ApplePayPaymentProvider
Expand All @@ -45,7 +43,6 @@ public function __construct(
#[Autowire('@payplug_sylius_payplug_plugin.api_client.apple_pay')]
private PayPlugApiClientInterface $applePayClient,
private OrderTokenAssignerInterface $orderTokenAssigner,
private RouterInterface $router,
private LoggerInterface $logger,
) {
}
Expand Down Expand Up @@ -81,7 +78,6 @@ public function provide(Request $request, OrderInterface $order): PaymentInterfa
);

$paymentData = $paymentDataObject->getArrayCopy();
$paymentData['notification_url'] = $this->router->generate('sylius_payment_method_notify', ['code' => $payment->getMethod()?->getCode()], RouterInterface::ABSOLUTE_URL);
$this->logger->notice('[Payplug] ApplePay payment data', ['data' => $paymentData]);

$paymentResource = $this->applePayClient->createPayment($paymentData);
Expand Down
Loading