-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13076c0
commit a1a5624
Showing
30 changed files
with
963 additions
and
1,064 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the MIT License | ||
* It is available through the world-wide-web at this URL: | ||
* https://tldrlegal.com/license/mit-license | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license https://tldrlegal.com/license/mit-license | ||
*/ | ||
|
||
namespace Buckaroo\Magento2\Block\Cart; | ||
|
||
class BuckarooConfig extends \Magento\Backend\Block\Template | ||
use Buckaroo\Magento2\Exception; | ||
use Buckaroo\Magento2\Model\ConfigProvider\Factory; | ||
use Magento\Backend\Block\Template; | ||
use Magento\Backend\Block\Template\Context; | ||
use Magento\Framework\Serialize\Serializer\Json; | ||
|
||
class BuckarooConfig extends Template | ||
{ | ||
/** | ||
* @var bool | ||
*/ | ||
protected $_isScopePrivate = false; | ||
|
||
/** | ||
* @var \Buckaroo\Magento2\Model\ConfigProvider\Factory | ||
* @var Factory | ||
*/ | ||
protected $configProviderFactory; | ||
|
||
/** | ||
* @var \Magento\Framework\Json\Encoder | ||
* @var Json | ||
*/ | ||
protected $jsonEncoder; | ||
|
||
/** | ||
* @param \Magento\Backend\Block\Template\Context $context | ||
* @param \Magento\Framework\Json\Encoder $jsonEncoder | ||
* @param \Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory | ||
* @param array $data | ||
* @param Context $context | ||
* @param Json $jsonEncoder | ||
* @param Factory $configProviderFactory | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Magento\Framework\Json\Encoder $jsonEncoder, | ||
\Buckaroo\Magento2\Model\ConfigProvider\Factory $configProviderFactory, | ||
Context $context, | ||
Json $jsonEncoder, | ||
Factory $configProviderFactory, | ||
array $data = [] | ||
) { | ||
parent::__construct($context, $data); | ||
|
@@ -42,11 +63,12 @@ public function __construct( | |
/** | ||
* Retrieve buckaroo configuration | ||
* | ||
* @return array | ||
* @return string | ||
* @throws Exception | ||
*/ | ||
public function getBuckarooConfigJson() | ||
{ | ||
$configProvider = $this->configProviderFactory->get('buckaroo_fee'); | ||
return $this->jsonEncoder->encode($configProvider->getConfig()); | ||
return $this->jsonEncoder->serialize($configProvider->getConfig()); | ||
} | ||
} |
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.