Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick477 committed May 20, 2020
1 parent 6248c39 commit 7343979
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Action/NotifyAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
use Payum\Core\Request\Notify;
use Psr\Log\LoggerInterface;
use SM\Factory\FactoryInterface;
use Sylius\Bundle\PayumBundle\Model\GatewayConfigInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\Model\PaymentMethodInterface;
Expand All @@ -47,7 +48,7 @@ public function __construct(LoggerInterface $logger, FactoryInterface $stateMach

public function execute($request): void
{
/** @var $request Notify */
/** @var Notify $request */
$details = ArrayObject::ensureArrayObject($request->getModel());

$this->gateway->execute($httpRequest = new GetHttpRequest());
Expand All @@ -67,9 +68,12 @@ public function execute($request): void
/** @var PaymentMethodInterface $method */
$method = $item->getMethod();

/** @var GatewayConfigInterface $gatewayConfig */
$gatewayConfig = $method->getGatewayConfig();

if (
PaymentInterface::STATE_NEW === $item->getState() &&
MultiSafepayGatewayFactory::FACTORY_NAME === $method->getGatewayConfig()->getFactoryName() &&
MultiSafepayGatewayFactory::FACTORY_NAME === $gatewayConfig->getFactoryName() &&
$payment !== $item
) {
$order->removePayment($item);
Expand Down
5 changes: 5 additions & 0 deletions tests/Behat/Mocker/MultiSafepayApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ public function refund(string $orderId, int $amount, string $currencyCode): void
$currencyCode
);
}

public function isPaymentActive(string $status): bool
{
return $this->container->get('bitbag_sylius_multisafepay_plugin.api_client.multisafepay_api_client')->isPaymentActive($status);
}
}

0 comments on commit 7343979

Please sign in to comment.