-
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 pull request #677 from mollie/release/2.30.0
Release/2.30.0
- Loading branch information
Showing
72 changed files
with
1,401 additions
and
83 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
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,77 @@ | ||
<?php | ||
/* | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Block\Form; | ||
|
||
use Magento\Framework\View\Element\Template\Context; | ||
use Magento\Payment\Block\Form; | ||
use Mollie\Api\Resources\Terminal; | ||
use Mollie\Payment\Service\Mollie\MollieApiClient; | ||
|
||
/** | ||
* Class Pointofsale | ||
* | ||
* @package Mollie\Payment\Block\Form | ||
*/ | ||
class Pointofsale extends Form | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_template = 'Mollie_Payment::form/pointofsale.phtml'; | ||
/** | ||
* @var MollieApiClient | ||
*/ | ||
private $mollieApiClient; | ||
|
||
public function __construct( | ||
Context $context, | ||
MollieApiClient $mollieApiClient, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
|
||
$this->mollieApiClient = $mollieApiClient; | ||
} | ||
|
||
/** | ||
* @return array{ | ||
* id: string, | ||
* brand: string, | ||
* model: string, | ||
* serialNumber: string|null, | ||
* description: string | ||
* } | ||
* @throws \Magento\Framework\Exception\LocalizedException | ||
* @throws \Magento\Framework\Exception\NoSuchEntityException | ||
* @throws \Mollie\Api\Exceptions\ApiException | ||
*/ | ||
public function getTerminals(): array | ||
{ | ||
$storeId = $this->_storeManager->getStore()->getId(); | ||
|
||
$mollieApiClient = $this->mollieApiClient->loadByStore((int)$storeId); | ||
$terminals = $mollieApiClient->terminals->page(); | ||
|
||
$output = []; | ||
/** @var Terminal $terminal */ | ||
foreach ($terminals as $terminal) { | ||
if (!$terminal->isActive()) { | ||
continue; | ||
} | ||
|
||
$output[] = [ | ||
'id' => $terminal->id, | ||
'brand' => $terminal->brand, | ||
'model' => $terminal->model, | ||
'serialNumber' => $terminal->serialNumber, | ||
'description' => $terminal->description, | ||
]; | ||
} | ||
|
||
return $output; | ||
} | ||
} |
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
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,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\Payment\Controller\Checkout; | ||
|
||
use Magento\Framework\App\Action\HttpGetActionInterface; | ||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\Exception\AuthorizationException; | ||
use Magento\Framework\View\Result\PageFactory; | ||
use Magento\Store\Model\StoreManagerInterface; | ||
|
||
class Pointofsale implements HttpGetActionInterface | ||
{ | ||
/** | ||
* @var PageFactory | ||
*/ | ||
private $resultPageFactory; | ||
/** | ||
* @var RequestInterface | ||
*/ | ||
private $request; | ||
/** | ||
* @var StoreManagerInterface | ||
*/ | ||
private $storeManager; | ||
|
||
public function __construct( | ||
PageFactory $resultPageFactory, | ||
RequestInterface $request, | ||
StoreManagerInterface $storeManager | ||
) { | ||
$this->resultPageFactory = $resultPageFactory; | ||
$this->request = $request; | ||
$this->storeManager = $storeManager; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$token = $this->request->getParam('token'); | ||
if (!$token) { | ||
throw new AuthorizationException(__('Invalid token')); | ||
} | ||
|
||
$resultPage = $this->resultPageFactory->create(); | ||
$resultPage->getConfig()->getTitle()->set(__('Please finish the payment on the terminal.')); | ||
$block = $resultPage->getLayout()->getBlock('mollie.pointofsale.wait'); | ||
$block->setData('token', $token); | ||
$block->setData('storeCode', $this->storeManager->getStore()->getCode()); | ||
|
||
return $resultPage; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\Payment\Model\Adminhtml\Source; | ||
|
||
use Magento\Customer\Api\GroupManagementInterface; | ||
use Magento\Framework\Data\OptionSourceInterface; | ||
|
||
class CustomerGroup implements OptionSourceInterface | ||
{ | ||
/** | ||
* @var GroupManagementInterface | ||
*/ | ||
private $groupManagement; | ||
|
||
public function __construct( | ||
GroupManagementInterface $groupManagement | ||
) { | ||
$this->groupManagement = $groupManagement; | ||
} | ||
|
||
public function toOptionArray(): array | ||
{ | ||
$groups = $this->groupManagement->getLoggedInGroups(); | ||
|
||
$output = []; | ||
foreach ($groups as $group) { | ||
$output[] = [ | ||
'label' => $group->getCode(), | ||
'value' => $group->getId(), | ||
]; | ||
} | ||
|
||
return $output; | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
/* | ||
* Copyright Magmodules.eu. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Mollie\Payment\Model\Methods; | ||
|
||
use Mollie\Payment\Model\Mollie; | ||
|
||
/** | ||
* Class Pointofsale | ||
* | ||
* @package Mollie\Payment\Model\Methods | ||
*/ | ||
class Pointofsale extends Mollie | ||
{ | ||
/** | ||
* Payment method code | ||
* | ||
* @var string | ||
*/ | ||
const CODE = 'mollie_methods_pointofsale'; | ||
} |
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.