Skip to content

Commit

Permalink
Merge pull request #54 from JerrySmidt/3.1.7
Browse files Browse the repository at this point in the history
3.1.7
  • Loading branch information
JerrySmidt authored Aug 29, 2022
2 parents 979cc19 + ffc533c commit b68b3ac
Show file tree
Hide file tree
Showing 47 changed files with 999 additions and 1,294 deletions.
11 changes: 10 additions & 1 deletion Block/Onepage/LayoutProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@ public function process($jsLayout)
$shippingFields = $this->_changeAddressFieldsPosition($shippingFields);

// Autofill fields copy
$autofillFields = array_intersect_key($shippingFields, ['address_autofill_nl' => 1, 'address_autofill_intl' => 1, 'address_autofill_formatted_output' => 1]);
$autofillFields = array_intersect_key(
$shippingFields,
[
'address_autofill_nl' => 1,
'address_autofill_intl' => 1,
'address_autofill_formatted_output' => 1,
'address_autofill_bypass' => 1,
]
);

// Billing step
$billingConfiguration = &$jsLayout['components']
Expand Down Expand Up @@ -145,6 +153,7 @@ private function _changeAddressFieldsPosition($addressFields)
'address_autofill_intl' => '910',
'address_autofill_nl' => '920',
'address_autofill_formatted_output' => '930',
'address_autofill_bypass' => '935',
'street' => '940',
'postcode' => '950',
'city' => '960',
Expand Down
87 changes: 0 additions & 87 deletions Block/System/Config/Form/Apikey/Checker.php

This file was deleted.

22 changes: 0 additions & 22 deletions Block/System/Config/Form/Field/ReadOnlyField.php

This file was deleted.

91 changes: 91 additions & 0 deletions Block/System/Config/Status.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?php

namespace Flekto\Postcode\Block\System\Config;

use Flekto\Postcode\Helper\StoreConfigHelper;
use Magento\Backend\Block\Template;
use Magento\Framework\Data\Form\Element\AbstractElement;
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;

use Magento\Framework\App\Config\ConfigResource\ConfigInterface;

class Status extends Template implements RendererInterface
{
protected $_template = 'Flekto_Postcode::system/config/status.phtml';
protected $_scopeConfig;
protected $_storeConfigHelper;
protected $_resourceConfig;

/**
* @param Template\Context $context
* @param StoreConfigHelper $storeConfigHelper
* @param ConfigInterface $resourceConfig
* @param array $data
*/
public function __construct(
Template\Context $context,
StoreConfigHelper $storeConfigHelper,
ConfigInterface $resourceConfig,
array $data = []
) {
$this->_scopeConfig = $context->getScopeConfig();
$this->_storeConfigHelper = $storeConfigHelper;
$this->_resourceConfig = $resourceConfig;
parent::__construct($context, $data);
}

/**
* @param AbstractElement $element
*
* @return string
*/
public function render(AbstractElement $element): string
{
/** @noinspection PhpUndefinedMethodInspection */
$this->setElement($element);

return $this->toHtml();
}

/**
* Get config to be used in the status template.
*
* @return array
*/
public function getConfig(): array
{
return [
'enabled' => $this->_storeConfigHelper->isSetFlag(StoreConfigHelper::PATH['enabled']),
'module_version' => $this->_storeConfigHelper->getValue(StoreConfigHelper::PATH['module_version']),
'supported_countries' => $this->_storeConfigHelper->getSupportedCountries(),
'account_name' => $this->_storeConfigHelper->getValue(StoreConfigHelper::PATH['account_name']),
'account_status' => $this->_storeConfigHelper->getValue(StoreConfigHelper::PATH['account_status']), // Defaults to "new", see etc/config.xml.
'has_credentials' => $this->_storeConfigHelper->hasCredentials(),
];
}

/**
* Get short description of API status.
*
* @return string
*/
public function getApiStatusDescription(): string
{
$status = $this->_storeConfigHelper->getValue(StoreConfigHelper::PATH['account_status']);

switch ($status)
{
case \Flekto\Postcode\Helper\ApiClientHelper::API_ACCOUNT_STATUS_NEW:
return __('not connected');
case \Flekto\Postcode\Helper\ApiClientHelper::API_ACCOUNT_STATUS_ACTIVE:
return __('active');
case \Flekto\Postcode\Helper\ApiClientHelper::API_ACCOUNT_STATUS_INVALID_CREDENTIALS:
return __('invalid key and/or secret');
case \Flekto\Postcode\Helper\ApiClientHelper::API_ACCOUNT_STATUS_INACTIVE:
return __('inactive');
default:
throw new \Exception('Invalid account status value.');
}
}

}
98 changes: 0 additions & 98 deletions Controller/Adminhtml/System/Config/Apicheck.php

This file was deleted.

Loading

0 comments on commit b68b3ac

Please sign in to comment.