-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-week-01' into release
- Loading branch information
Showing
20 changed files
with
293 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
FROM cypress/included:12.1.0 | ||
FROM cypress/included:13.6.2 | ||
|
||
WORKDIR /e2e | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
/* | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\Payment\Controller\Checkout; | ||
|
||
use Magento\Framework\App\Action\HttpGetActionInterface; | ||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\Controller\ResultFactory; | ||
use Magento\Framework\Controller\ResultInterface; | ||
use Magento\Framework\Encryption\EncryptorInterface; | ||
use Magento\Framework\Exception\NoSuchEntityException; | ||
use Magento\Framework\Message\ManagerInterface; | ||
use Magento\Sales\Api\OrderRepositoryInterface; | ||
use Magento\Sales\Model\Order; | ||
use Mollie\Payment\Model\Mollie; | ||
|
||
class PaymentLink implements HttpGetActionInterface | ||
{ | ||
/** | ||
* @var RequestInterface | ||
*/ | ||
private $request; | ||
/** | ||
* @var EncryptorInterface | ||
*/ | ||
private $encryptor; | ||
/** | ||
* @var ResultFactory | ||
*/ | ||
private $resultFactory; | ||
/** | ||
* @var ManagerInterface | ||
*/ | ||
private $messageManager; | ||
/** | ||
* @var OrderRepositoryInterface | ||
*/ | ||
private $orderRepository; | ||
/** | ||
* @var Mollie | ||
*/ | ||
private $mollie; | ||
|
||
public function __construct( | ||
RequestInterface $request, | ||
EncryptorInterface $encryptor, | ||
ResultFactory $resultFactory, | ||
ManagerInterface $messageManager, | ||
OrderRepositoryInterface $orderRepository, | ||
Mollie $mollie | ||
) { | ||
$this->request = $request; | ||
$this->encryptor = $encryptor; | ||
$this->resultFactory = $resultFactory; | ||
$this->messageManager = $messageManager; | ||
$this->orderRepository = $orderRepository; | ||
$this->mollie = $mollie; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$orderKey = $this->request->getParam('order'); | ||
if (!$orderKey) { | ||
return $this->returnStatusCode(400); | ||
} | ||
|
||
$id = $this->encryptor->decrypt(base64_decode($orderKey)); | ||
|
||
if (empty($id)) { | ||
return $this->returnStatusCode(404); | ||
} | ||
|
||
try { | ||
$order = $this->orderRepository->get($id); | ||
} catch (NoSuchEntityException $exception) { | ||
return $this->returnStatusCode(404); | ||
} | ||
|
||
if (in_array($order->getState(), [Order::STATE_PROCESSING, Order::STATE_COMPLETE])) { | ||
$this->messageManager->addSuccessMessage(__('Your order has already been paid.')); | ||
|
||
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setUrl('/'); | ||
} | ||
|
||
$url = $this->mollie->startTransaction($order); | ||
|
||
return $this->resultFactory->create(ResultFactory::TYPE_REDIRECT)->setUrl($url); | ||
} | ||
|
||
public function returnStatusCode(int $code): ResultInterface | ||
{ | ||
return $this->resultFactory->create(ResultFactory::TYPE_RAW)->setHttpResponseCode($code); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 0 additions & 43 deletions
43
Observer/SalesModelServiceQuoteSubmitSuccess/StartTransactionForPaymentLinkOrders.php
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.