Commit d1497a8e authored by Alexandros Moraitis's avatar Alexandros Moraitis Committed by GitHub

[PW-1678] Add global settings in backoffice (#525)

* Add global settings in backoffice

* Add backend model global settings

* Add global settings in backoffice
parent 96ca7f67
<?php
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2019 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Model\Config\Backend;
class Locale extends \Magento\Framework\App\Config\Value
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
*/
private $config;
/**
* Locale constructor.
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\App\Cache\TypeListInterface $cacheTypeList
* @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource
* @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection
* @param array $data
*/
public function __construct(
\Magento\Framework\Model\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\App\Cache\TypeListInterface $cacheTypeList,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = []
) {
$this->config = $config;
parent::__construct($context, $registry, $config, $cacheTypeList, $resource, $resourceCollection, $data);
}
/**
* Process data after load
*
* @return $this
*/
protected function _afterLoad()
{
$value = $this->getValue();
if (empty($value)) {
$this->setValue($this->config->getValue("general/locale/code",
\Magento\Store\Model\ScopeInterface::SCOPE_STORE));
}
return $this;
}
}
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
<fieldset_css>complex</fieldset_css> <fieldset_css>complex</fieldset_css>
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Group</frontend_model> <frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Group</frontend_model>
<include path="Adyen_Payment::system/adyen_getting_started.xml"/> <include path="Adyen_Payment::system/adyen_getting_started.xml"/>
<include path="Adyen_Payment::system/adyen_global_settings.xml"/>
<include path="Adyen_Payment::system/adyen_required_settings.xml"/> <include path="Adyen_Payment::system/adyen_required_settings.xml"/>
<include path="Adyen_Payment::system/adyen_advanced_order_processing.xml"/> <include path="Adyen_Payment::system/adyen_advanced_order_processing.xml"/>
<include path="Adyen_Payment::system/adyen_advanced_notifications.xml"/> <include path="Adyen_Payment::system/adyen_advanced_notifications.xml"/>
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
<p>You can find this in the Adyen back-office. The Adyen back-office can be found on <a target="_blank" href="https://ca-test.adyen.com">https://ca-test.adyen.com</a> for test or <a target="_blank" href="https://ca-live.adyen.com">https://ca-live.adyen.com</a> for live.</p> <p>You can find this in the Adyen back-office. The Adyen back-office can be found on <a target="_blank" href="https://ca-test.adyen.com">https://ca-test.adyen.com</a> for test or <a target="_blank" href="https://ca-live.adyen.com">https://ca-live.adyen.com</a> for live.</p>
<p>If you have any further questions, please visit the <a target="_blank" href="http://www.adyen.com">Adyen.com</a> website or email <a href="mailto:magento@adyen.com">magento@adyen.com</a>.</p> <p>If you have any further questions, please visit the <a target="_blank" href="http://www.adyen.com">Adyen.com</a> website or email <a href="mailto:magento@adyen.com">magento@adyen.com</a>.</p>
]]></comment> ]]></comment>
<field id="version" translate="label" type="label" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Extension version</label>
<frontend_model>\Adyen\Payment\Block\Adminhtml\System\Config\Field\Version</frontend_model>
</field>
</group> </group>
</include> </include>
<?xml version="1.0"?>
<!--
/**
* ######
* ######
* ############ ####( ###### #####. ###### ############ ############
* ############# #####( ###### #####. ###### ############# #############
* ###### #####( ###### #####. ###### ##### ###### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ##### ######
* ###### ###### #####( ###### #####. ###### ##### ##### ######
* ############# ############# ############# ############# ##### ######
* ############ ############ ############# ############ ##### ######
* ######
* #############
* ############
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2015 Adyen BV (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="adyen_global_settings" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1"
showInStore="1">
<label><![CDATA[Global Settings]]></label>
<comment><![CDATA[
<b>
<a target="_blank" href="https://docs.adyen.com/plugins/magento-2">Docs</a>|
<a target="_blank" href="https://support.adyen.com/hc/en-us/sections/360000809984-Plugins">FAQs</a>|
<a target="_blank" href="https://support.adyen.com/hc/en-us/requests/new">Support</a>|
<a target="_blank" href="https://www.adyen.com/status">Platform status</a>|
<a target="_blank" href="https://github.com/Adyen/adyen-magento2/releases">GitHub</a>|
<a target="_blank" href="https://marketplace.magento.com/adyen-module-payment.html">Magento Marketplace</a>|
</b>
]]>
</comment>
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
<field id="demo_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Environment</label>
<source_model>Adyen\Payment\Model\Config\Source\DemoMode</source_model>
<config_path>payment/adyen_abstract/demo_mode</config_path>
<tooltip>
<![CDATA[ In the test mode you must use test cards. See section Documentation & Support for the link to the test cards]]></tooltip>
</field>
<field id="shopper_locale" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Locale</label>
<tooltip>This will override the default shopper locale of the Magento store (e.g. nl_NL). Leave empty to let
Magento decide.
</tooltip>
<config_path>payment/adyen_hpp/shopper_locale</config_path>
<source_model>Magento\Config\Model\Config\Source\Locale</source_model>
<backend_model>Adyen\Payment\Model\Config\Backend\Locale</backend_model>
</field>
<field id="version" translate="label" type="label" sortOrder="40" showInDefault="1" showInWebsite="1"
showInStore="1">
<label>Plugin version</label>
<frontend_model>\Adyen\Payment\Block\Adminhtml\System\Config\Field\Version</frontend_model>
</field>
</group>
</include>
...@@ -54,11 +54,6 @@ ...@@ -54,11 +54,6 @@
<label>Title</label> <label>Title</label>
<config_path>payment/adyen_hpp/title</config_path> <config_path>payment/adyen_hpp/title</config_path>
</field> </field>
<field id="shopper_locale" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Language locale (optional)</label>
<tooltip>This will override the default shopper locale of the Magento store (e.g. nl_NL). Leave empty to let Magento decide.</tooltip>
<config_path>payment/adyen_hpp/shopper_locale</config_path>
</field>
<field id="country_code" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="country_code" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
<label>ISO Country Code (optional)</label> <label>ISO Country Code (optional)</label>
<tooltip>This will override the shopper billing address country when determining what payment methods to display.</tooltip> <tooltip>This will override the shopper billing address country when determining what payment methods to display.</tooltip>
......
...@@ -32,12 +32,6 @@ ...@@ -32,12 +32,6 @@
<tooltip><![CDATA[The merchant account identifier you want to process the (transaction) request with. Find this at the top of the screen in the Adyen Customer Area, where you will see [YourCompanyAccount] > [YourMerchantAccount] . Please note that the merchant account is different from the company account; a company account can have one or more merchant accounts.]]></tooltip> <tooltip><![CDATA[The merchant account identifier you want to process the (transaction) request with. Find this at the top of the screen in the Adyen Customer Area, where you will see [YourCompanyAccount] > [YourMerchantAccount] . Please note that the merchant account is different from the company account; a company account can have one or more merchant accounts.]]></tooltip>
<comment><![CDATA[<a target="_blank" href="https://docs.adyen.com/developers/plugins/magento-2/set-up-the-plugin-in-magento#step3configuretheplugininmagento">Click here for explanation.</a>]]></comment> <comment><![CDATA[<a target="_blank" href="https://docs.adyen.com/developers/plugins/magento-2/set-up-the-plugin-in-magento#step3configuretheplugininmagento">Click here for explanation.</a>]]></comment>
</field> </field>
<field id="demo_mode" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>Test/Production Mode</label>
<source_model>Adyen\Payment\Model\Config\Source\DemoMode</source_model>
<config_path>payment/adyen_abstract/demo_mode</config_path>
<tooltip><![CDATA[ In the test mode you must use test cards. See section Documentation & Support for the link to the test cards]]></tooltip>
</field>
<field id="notification_username" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0"> <field id="notification_username" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
<label>Notification User Name</label> <label>Notification User Name</label>
<config_path>payment/adyen_abstract/notification_username</config_path> <config_path>payment/adyen_abstract/notification_username</config_path>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment