-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixing code style requirements and refactor some code and allow iframe checkout from settings * fixing more code style for SDK * adding more code style fix in the SDK * unit test code style fix * refactoring httpParseHeaders function where we removed array_merge from for loop * refactor checkStoreSSLSettings function where replace parse_url by zenduri parse function * fxing some default setting and more code style * fixing the last bit of code style issue * resolved iframe issue for partpay and quadpay * Fixing the iframe for other region issue * update the package version for release Co-authored-by: ben.zhang <[email protected]>
- Loading branch information
1 parent
a1bbad9
commit 024b125
Showing
118 changed files
with
2,027 additions
and
1,670 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 |
---|---|---|
|
@@ -2,18 +2,15 @@ | |
|
||
namespace Zip\ZipPayment\Block\Advert; | ||
|
||
use Magento\Catalog\Block as CatalogBlock; | ||
use Magento\Paypal\Helper\Shortcut\ValidatorInterface; | ||
use \Zip\ZipPayment\Model\Config; | ||
use Zip\ZipPayment\Model\Config; | ||
use Magento\Framework\Pricing\PriceCurrencyInterface; | ||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @category Zip | ||
* @package ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
abstract class AbstractAdvert extends \Magento\Framework\View\Element\Template | ||
{ | ||
|
@@ -40,7 +37,7 @@ abstract class AbstractAdvert extends \Magento\Framework\View\Element\Template | |
protected $_checkoutSession; | ||
|
||
/** | ||
* | ||
* @var PriceCurrencyInterface | ||
*/ | ||
protected $_priceCurrency; | ||
|
||
|
@@ -49,17 +46,21 @@ abstract class AbstractAdvert extends \Magento\Framework\View\Element\Template | |
*/ | ||
protected $_alias = ''; | ||
|
||
protected $_supportedWidgetTypes = array('widget', 'banner', 'tagline'); | ||
/** | ||
* @var array | ||
*/ | ||
protected $_supportedWidgetTypes = ['widget', 'banner', 'tagline']; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
protected $_configConstants = ['widget' => [ | ||
'product' => Config::ADVERTS_PRODUCT_IMAGE_ACTIVE, | ||
'product_selector' => Config::ADVERTS_PRODUCT_IMAGE_SELECTOR, | ||
'cart' => Config::ADVERTS_CART_IMAGE_ACTIVE, | ||
'cart_selector' => Config::ADVERTS_CART_IMAGE_SELECTOR | ||
], | ||
protected $_configConstants = [ | ||
'widget' => [ | ||
'product' => Config::ADVERTS_PRODUCT_IMAGE_ACTIVE, | ||
'product_selector' => Config::ADVERTS_PRODUCT_IMAGE_SELECTOR, | ||
'cart' => Config::ADVERTS_CART_IMAGE_ACTIVE, | ||
'cart_selector' => Config::ADVERTS_CART_IMAGE_SELECTOR | ||
], | ||
'tagline' => [ | ||
'product' => Config::ADVERTS_PRODUCT_TAGLINE_ACTIVE, | ||
'product_selector' => Config::ADVERTS_PRODUCT_TAGLINE_SELECTOR, | ||
|
@@ -86,16 +87,14 @@ public function __construct( | |
\Magento\Checkout\Model\Session $checkoutSession, | ||
PriceCurrencyInterface $priceCurrency, | ||
array $data = [] | ||
) | ||
{ | ||
) { | ||
parent::__construct($context, $data); | ||
|
||
$this->_config = $config; | ||
$this->_registry = $registry; | ||
$this->_logger = $logger; | ||
$this->_checkoutSession = $checkoutSession; | ||
$this->_priceCurrency = $priceCurrency; | ||
|
||
} | ||
|
||
public function getProductPrice() | ||
|
@@ -118,7 +117,7 @@ public function getCartTotal() | |
public function getCurrencyFormat($price) | ||
{ | ||
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); | ||
$currency = $objectManager->get('Magento\Directory\Model\Currency'); | ||
$currency = $objectManager->get(\Magento\Directory\Model\Currency::class); | ||
return $currency->format($price, ['display' => \Zend_Currency::NO_SYMBOL], false); | ||
} | ||
|
||
|
@@ -134,7 +133,6 @@ public function getCurrencySymbol() | |
*/ | ||
protected function _configShow($widget, $page) | ||
{ | ||
|
||
$configPath = $this->_getConfigPath($widget, $page); | ||
return $this->_config->getConfigData($configPath); | ||
} | ||
|
@@ -146,7 +144,7 @@ protected function _configShow($widget, $page) | |
*/ | ||
protected function _isSelectorExist($widget, $page) | ||
{ | ||
$selectorConfigPath =$this->_getConfigPath($widget,$page.'_selector'); | ||
$selectorConfigPath = $this->_getConfigPath($widget, $page . '_selector'); | ||
return empty($this->_config->getValue($selectorConfigPath)) ? false : true ; | ||
} | ||
|
||
|
@@ -157,25 +155,26 @@ protected function _isSelectorExist($widget, $page) | |
*/ | ||
protected function _getConfigPath($widget, $page) | ||
{ | ||
if ($widget && $page) | ||
if ($widget && $page) { | ||
return isset($this->_configConstants[$widget][$page]) ? $this->_configConstants[$widget][$page] : null; | ||
else | ||
} else { | ||
return null; | ||
} | ||
} | ||
|
||
/** | ||
* get element selectors for current widgets | ||
*/ | ||
public function getElementSelectors() | ||
{ | ||
$selectors = array(); | ||
$selectors = []; | ||
|
||
foreach ($this->_supportedWidgetTypes as $widgetType) { | ||
$pageType = $this->getPageType(); | ||
$enabled = $this->_configShow($widgetType, $pageType); | ||
|
||
if ($enabled !== null && $enabled) { | ||
$configPath =$this->_getConfigPath($widgetType,$pageType.'_selector') ; | ||
$configPath = $this->_getConfigPath($widgetType, $pageType . '_selector') ; | ||
$widgetType = $widgetType == 'widget' ? $pageType . '_' . $widgetType : $widgetType; | ||
$selectors[$widgetType] = $this->_config->getValue($configPath); | ||
} | ||
|
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 |
---|---|---|
|
@@ -3,20 +3,14 @@ | |
namespace Zip\ZipPayment\Block\Advert; | ||
|
||
use Magento\Catalog\Block as CatalogBlock; | ||
use Magento\Paypal\Helper\Shortcut\ValidatorInterface; | ||
use \Zip\ZipPayment\Model\Config; | ||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
class Banner extends AbstractAdvert implements CatalogBlock\ShortcutInterface | ||
{ | ||
|
||
/** | ||
* @const string | ||
*/ | ||
|
@@ -39,11 +33,11 @@ public function getAlias() | |
*/ | ||
protected function _toHtml() | ||
{ | ||
if ($this->_configShow(self::ADVERT_TYPE, $this->getPageType()) && !$this->_isSelectorExist(self::ADVERT_TYPE, $this->getPageType())) { | ||
if ($this->_configShow(self::ADVERT_TYPE, $this->getPageType()) | ||
&& !$this->_isSelectorExist(self::ADVERT_TYPE, $this->getPageType())) { | ||
return parent::_toHtml(); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -2,23 +2,16 @@ | |
|
||
namespace Zip\ZipPayment\Block\Advert; | ||
|
||
use Magento\Store\Model\ScopeInterface; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Zip\ZipPayment\MerchantApi\Lib\Model\CommonUtil; | ||
use Magento\Catalog\Block as CatalogBlock; | ||
|
||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
class RootEl extends AbstractAdvert implements CatalogBlock\ShortcutInterface | ||
{ | ||
|
||
/** | ||
* Get country path | ||
*/ | ||
|
@@ -85,16 +78,4 @@ public function getAlias() | |
{ | ||
return $this->_alias; | ||
} | ||
|
||
/** | ||
* Render the block if needed | ||
* | ||
* @return string | ||
*/ | ||
protected function _toHtml() | ||
{ | ||
|
||
return parent::_toHtml(); | ||
|
||
} | ||
} |
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 |
---|---|---|
|
@@ -3,16 +3,11 @@ | |
namespace Zip\ZipPayment\Block\Advert; | ||
|
||
use Magento\Catalog\Block as CatalogBlock; | ||
use Magento\Paypal\Helper\Shortcut\ValidatorInterface; | ||
use \Zip\ZipPayment\Model\Config; | ||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
class Tagline extends AbstractAdvert implements CatalogBlock\ShortcutInterface | ||
{ | ||
|
@@ -39,10 +34,10 @@ public function getAlias() | |
protected function _toHtml() | ||
{ | ||
|
||
if ($this->_configShow(self::WIDGET_TYPE, $this->getPageType()) && !$this->_isSelectorExist(self::WIDGET_TYPE, $this->getPageType())) { | ||
if ($this->_configShow(self::WIDGET_TYPE, $this->getPageType()) | ||
&& !$this->_isSelectorExist(self::WIDGET_TYPE, $this->getPageType())) { | ||
return parent::_toHtml(); | ||
} | ||
return ''; | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -5,12 +5,9 @@ | |
use Magento\Framework\View\Element\Template; | ||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
class Error extends Template | ||
{ | ||
|
@@ -23,15 +20,18 @@ class Error extends Template | |
*/ | ||
const ERROR_HEADER = 'payment/zippayment/zip_messages/error_header'; | ||
|
||
/** | ||
* @var Magento\Framework\Message\ManagerInterface | ||
*/ | ||
protected $_messageManager; | ||
protected $_config; | ||
|
||
public function __construct( | ||
Template\Context $context, | ||
\Magento\Framework\Message\ManagerInterface $messageManager, | ||
\Zip\ZipPayment\Model\Config $config, | ||
array $data = []) | ||
{ | ||
array $data = [] | ||
) { | ||
$this->_messageManager = $messageManager; | ||
$this->_config = $config; | ||
parent::__construct($context, $data); | ||
|
@@ -112,6 +112,5 @@ protected function _prepareLayout() | |
$this->pageConfig->getTitle()->set(__($text)); | ||
|
||
return parent::_prepareLayout(); | ||
|
||
} | ||
} |
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,16 +1,13 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Zip\ZipPayment\Block; | ||
|
||
use Magento\Framework\Phrase; | ||
use Magento\Payment\Block\ConfigurableInfo; | ||
|
||
/** | ||
* Class Info | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @link https://zip.co | ||
*/ | ||
class Info extends ConfigurableInfo | ||
{ | ||
|
@@ -28,5 +25,4 @@ protected function getLabel($field) | |
|
||
return __($field); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -5,12 +5,9 @@ | |
use Magento\Framework\View\Element\Template; | ||
|
||
/** | ||
* @category Zipmoney | ||
* @package Zipmoney_ZipPayment | ||
* @author Zip Plugin Team <[email protected]> | ||
* @copyright 2020 Zip Co Limited | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link http://www.zipmoney.com.au/ | ||
* @link https://zip.co | ||
*/ | ||
class Referred extends Template | ||
{ | ||
|
@@ -30,8 +27,8 @@ public function __construct( | |
Template\Context $context, | ||
\Magento\Framework\Message\ManagerInterface $messageManager, | ||
\Zip\ZipPayment\Model\Config $config, | ||
array $data = []) | ||
{ | ||
array $data = [] | ||
) { | ||
$this->_messageManager = $messageManager; | ||
$this->_config = $config; | ||
parent::__construct($context, $data); | ||
|
@@ -46,7 +43,10 @@ public function getBodyText() | |
{ | ||
$text = $this->_config->getStoreConfig(self::REFERRED_BODY); | ||
if (!$text) { | ||
$text = __('Your application is currently under review by zipMoney and will be processed very shortly. You can contact the customer care at [email protected] for any enquiries'); | ||
$text = __( | ||
'Your application is currently under review by zipMoney and will be processed very shortly. ' | ||
. 'You can contact the customer care at [email protected] for any enquiries' | ||
); | ||
} | ||
return $text; | ||
} | ||
|
@@ -68,5 +68,4 @@ protected function _prepareLayout() | |
|
||
return parent::_prepareLayout(); | ||
} | ||
|
||
} |
Oops, something went wrong.