Skip to content

Commit

Permalink
Try to fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Jul 8, 2024
1 parent d876b8c commit a6cc437
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions tests/Behat/Context/Ui/NexiContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

use Behat\Behat\Context\Context;
use Behat\Mink\Session;
use GuzzleHttp\ClientInterface;
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
use GuzzleHttp\Psr7\Request;
use JsonException;
use Psr\Http\Client\ClientInterface;
use Sylius\Behat\Page\Shop\Order\ShowPageInterface;
use Sylius\Bundle\PayumBundle\Model\PaymentSecurityTokenInterface;
use Sylius\Component\Core\Model\PaymentInterface;
Expand All @@ -27,13 +29,13 @@
final class NexiContext implements Context
{
public function __construct(
private PayumCaptureDoPageInterface $payumCaptureDoPage,
private RepositoryInterface $paymentTokenRepository,
private PaymentRepositoryInterface $paymentRepository,
private UrlGeneratorInterface $urlGenerator,
private ClientInterface $client,
private Session $session,
private ShowPageInterface $orderDetails,
private readonly PayumCaptureDoPageInterface $payumCaptureDoPage,
private readonly RepositoryInterface $paymentTokenRepository,
private readonly PaymentRepositoryInterface $paymentRepository,
private readonly UrlGeneratorInterface $urlGenerator,
private readonly GuzzleClientInterface|ClientInterface $client,
private readonly Session $session,
private readonly ShowPageInterface $orderDetails,
) {
// TODO: Why config parameters are not loaded?
$this->urlGenerator->setContext(new RequestContext('', 'GET', '127.0.0.1:8080', 'https'));
Expand Down Expand Up @@ -293,6 +295,20 @@ private function getSuccessResponsePayload(PaymentInterface $payment): array

private function simulateS2SPaymentNotify(PaymentSecurityTokenInterface $token, array $responsePayload): void
{
if ($this->client instanceof ClientInterface) {
$formParams = http_build_query($responsePayload);
$request = new Request(
'POST',
$this->getNotifyUrl($token),
[
'Content-Type' => 'application/x-www-form-urlencoded',
],
$formParams,
);
$this->client->sendRequest($request);

return;
}
$this->client->request(
'POST',
$this->getNotifyUrl($token),
Expand Down

0 comments on commit a6cc437

Please sign in to comment.