Skip to content

Commit

Permalink
Set status and state to pending payment on redirect to alternative pa…
Browse files Browse the repository at this point in the history
…yment methods
  • Loading branch information
szreka committed Mar 29, 2021
1 parent 86fe7fb commit f78cc01
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Service/AdyenRedirect.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Jh\AdyenPayment\Api\Data\RedirectResponseInterface;
use Jh\AdyenPayment\Api\Data\RedirectResponseInterfaceFactory;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Sales\Model\Order;

class AdyenRedirect implements AdyenRedirectInterface
{
Expand All @@ -31,6 +32,12 @@ public function execute(int $orderId): RedirectResponseInterface
$redirectUrl = $order->getPayment()->getAdditionalInformation('redirectUrl') ?? '';
}

if (!empty($redirectUrl)) {
$order->setState(Order::STATE_PENDING_PAYMENT);
$order->setStatus(Order::STATE_PENDING_PAYMENT);
$this->orderRepository->save($order);
}

/** @var RedirectResponseInterface $response */
$response = $this->redirectResponseFactory->create();

Expand Down

0 comments on commit f78cc01

Please sign in to comment.