Skip to content

Commit

Permalink
OP-446 - Fix dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
JanPalen committed Sep 13, 2024
1 parent a34b718 commit dc1bd9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/PaymentProcessing/RefundPaymentProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
use Sylius\Component\Resource\Exception\UpdateHandlingException;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;

final class RefundPaymentProcessor implements PaymentProcessorInterface
{
/** @var Session */
private $session;
/** @var RequestStack */
private $requestStack;

/** @var QuadPayApiClientInterface */
private $quadPayApiClient;

/** @var \Faker\Generator */
private $faker;

public function __construct(Session $session, QuadPayApiClientInterface $quadPayApiClient)
public function __construct(RequestStack $requestStack, QuadPayApiClientInterface $quadPayApiClient)
{
$this->session = $session;
$this->requestStack = $requestStack;
$this->quadPayApiClient = $quadPayApiClient;

$this->faker = \Faker\Factory::create();
Expand All @@ -51,7 +51,8 @@ public function process(PaymentInterface $payment): void
$details = $payment->getDetails();

if (false === isset($details['orderToken'])) {
$this->session->getFlashBag()->add('info', 'The payment refund was made only locally.');
$this->requestStack->getSession()
->getFlashBag()->add('info', 'The payment refund was made only locally.');

return;
}
Expand Down Expand Up @@ -88,7 +89,7 @@ public function process(PaymentInterface $payment): void
$message = (string) $clientException->getResponse()->getBody();
}

$this->session->getFlashBag()->add('error', $message);
$this->requestStack->getSession()->getFlashBag()->add('error', $message);

throw new UpdateHandlingException();
}
Expand Down
3 changes: 2 additions & 1 deletion src/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ services:
class: BitBag\SyliusQuadPayPlugin\PaymentProcessing\RefundPaymentProcessor
public: true
arguments:
- "@session"
# - "@session"
- "@request_stack"
- "@bitbag_sylius_quadpay_plugin.quadpay_api_client"

bitbag_sylius_quadpay_plugin.resolver.payment_state:
Expand Down

0 comments on commit dc1bd9f

Please sign in to comment.