Skip to content

Commit

Permalink
Merge pull request #4 from WeareJH/set-status-to-pending-payment-on-r…
Browse files Browse the repository at this point in the history
…edirect

Set status and state to pending payment on redirect to alternative payment methods
  • Loading branch information
Daniel Sloof authored Mar 29, 2021
2 parents 86fe7fb + f78cc01 commit d41fc73
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 d41fc73

Please sign in to comment.