diff --git a/public/images/logo/black.svg b/public/images/logo/black.svg
new file mode 100644
index 000000000..76e679294
--- /dev/null
+++ b/public/images/logo/black.svg
@@ -0,0 +1,18 @@
+
+
+
+
+
+
diff --git a/src/Settings/MollieSettingsPage.php b/src/Settings/MollieSettingsPage.php
new file mode 100644
index 000000000..53cd41b1d
--- /dev/null
+++ b/src/Settings/MollieSettingsPage.php
@@ -0,0 +1,116 @@
+id = 'mollie_settings';
+ $this->label = __('Mollie Settings', 'mollie-payments-for-woocommerce');
+ $this->settingsHelper = $settingsHelper;
+ $this->pluginPath = $pluginPath;
+ $this->pluginUrl = $pluginUrl;
+ $this->gateways = $gateways;
+ $this->isTestModeEnabled = $isTestModeEnabled;
+ $this->dataHelper = $dataHelper;
+ $this->paymentMethods = $paymentMethods;
+ $this->registerContentFieldType();
+ $this->outputSections();
+ parent::__construct();
+ }
+
+ public function registerContentFieldType(): void
+ {
+ add_action('woocommerce_admin_field_mollie_custom_input', static function ($value): void {
+ ?>
+
+
+
+
+
+
+ = $value['value']; ?>
+
+
+
+ id,
+ [$this, 'output_sections']
+ );
+ }
+
+ protected function pages(): array
+ {
+ return [
+ PageNoApiKey::class,
+ PageApiKeys::class,
+ PagePaymentMethods::class,
+ PageAdvancedSettings::class
+ ];
+ }
+
+ public function get_settings($currentSection = '')
+ {
+ $mollieSettings = null;
+ foreach ($this->pages() as $pageClass) {
+ /** @var AbstractPage $page */
+ $page = new $pageClass($this->settingsHelper, $this->pluginUrl);
+ if ($page->slug() === $currentSection) {
+ $mollieSettings = $page->settings();
+ break;
+ }
+ }
+
+ if (!$mollieSettings) {
+ $mollieSettings = (new PageNoApiKey($this->settingsHelper, $this->pluginUrl))->settings();
+ }
+
+ return apply_filters(
+ 'woocommerce_get_settings_' . $this->id,
+ $mollieSettings,
+ $currentSection
+ );
+ }
+}
diff --git a/src/Settings/Page/AbstractPage.php b/src/Settings/Page/AbstractPage.php
new file mode 100644
index 000000000..5a9864cf3
--- /dev/null
+++ b/src/Settings/Page/AbstractPage.php
@@ -0,0 +1,55 @@
+settings = $settings;
+ $this->pluginUrl = $pluginUrl;
+ }
+
+ abstract public function isTab(): bool;
+
+ abstract public function slug(): string;
+
+ public function tabName(): string
+ {
+ return '';
+ }
+
+ protected function sections(): array
+ {
+ return [];
+ }
+
+ public function settings(): array
+ {
+ $settings = [];
+ $styles = [];
+
+ foreach ($this->sections() as $sectionClass) {
+ /** @var AbstractSection $section */
+ $section = new $sectionClass($this->settings, $this->pluginUrl);
+ foreach ($section->config() as $field) {
+ $settings[] = $field;
+ }
+ $styles[$sectionClass] = preg_replace('/\s+/', '', $section->styles());
+ }
+ array_unshift($settings, [
+ 'id' => $this->settings->getSettingId('styles'),
+ 'type' => 'mollie_content',
+ 'value' => implode($styles)
+ ]);
+ return $settings;
+ }
+}
diff --git a/src/Settings/Page/Components.php b/src/Settings/Page/Components.php
deleted file mode 100644
index 59548e33f..000000000
--- a/src/Settings/Page/Components.php
+++ /dev/null
@@ -1,68 +0,0 @@
-id = 'mollie_components';
- $this->label = __('Mollie Components', 'mollie-payments-for-woocommerce');
- $this->pluginPath = $pluginPath;
-
- parent::__construct();
- }
-
- public function output()
- {
- $settings = $this->get_settings();
- WC_Admin_Settings::output_fields($settings);
- }
-
- public function get_settings()
- {
- $componentsSettings = $this->componentsSettings();
-
- /**
- * Filter Component Settings
- *
- * @param array $componentSettings Default components settings for the Credit Card Gateway
- */
- $componentsSettings = apply_filters(self::FILTER_COMPONENTS_SETTINGS, $componentsSettings);
-
- return $componentsSettings;
- }
-
- protected function componentsSettings()
- {
- $componentSettingsFilePath = $this->componentsFilePath();
-
- if (!file_exists($componentSettingsFilePath)) {
- return [];
- }
-
- $components = include $componentSettingsFilePath;
-
- if (!is_array($components)) {
- $components = [];
- }
-
- return $components;
- }
-
- protected function componentsFilePath()
- {
- return $this->pluginPath . '/inc/settings/mollie_components.php';
- }
-}
diff --git a/src/Settings/Page/MollieSettingsPage.php b/src/Settings/Page/MollieSettingsPageOld.php
similarity index 100%
rename from src/Settings/Page/MollieSettingsPage.php
rename to src/Settings/Page/MollieSettingsPageOld.php
diff --git a/src/Settings/Page/PageAdvancedSettings.php b/src/Settings/Page/PageAdvancedSettings.php
new file mode 100644
index 000000000..5f21e8b09
--- /dev/null
+++ b/src/Settings/Page/PageAdvancedSettings.php
@@ -0,0 +1,18 @@
+settings = $settings;
+ $this->pluginUrl = $pluginUrl;
+ }
+
+ abstract public function config(): array;
+
+ public function styles(): string{
+ return '';
+ }
+
+ public function images(): string
+ {
+ return $this->pluginUrl . '/public/images/';
+ }
+}
diff --git a/src/Settings/Page/Section/ConnectionFields.php b/src/Settings/Page/Section/ConnectionFields.php
new file mode 100644
index 000000000..af708c3ba
--- /dev/null
+++ b/src/Settings/Page/Section/ConnectionFields.php
@@ -0,0 +1,86 @@
+ $this->settings->getSettingId('title'),
+ 'title' => '',
+ 'type' => 'title'
+ ],
+ [
+ 'id' => $this->settings->getSettingId('test_mode_enabled'),
+ 'title' => __('Mollie Payment Mode', 'mollie-payments-for-woocommerce'),
+ 'default' => 'no',
+ 'type' => 'select',
+ 'options' => [
+ 'no' => 'Live API',
+ 'yes' => 'Test API'
+ ],
+ 'desc_tip' => __(
+ 'Enable test mode if you want to test the plugin without using real payments.',
+ 'mollie-payments-for-woocommerce'
+ ),
+ ],
+ [
+ 'id' => $this->settings->getSettingId('live_api_key'),
+ 'title' => __('Live API key', 'mollie-payments-for-woocommerce'),
+ 'default' => '',
+ 'type' => 'text',
+ 'desc' => sprintf(
+ /* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
+ __(
+ 'The API key is used to connect to Mollie. You can find your %1$s API key in your %2$sMollie account%3$s',
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'live',
+ '',
+ ' '
+ ),
+ 'css' => 'width: 350px',
+ 'placeholder' => __(
+ 'Live API key should start with live_',
+ 'mollie-payments-for-woocommerce'
+ ),
+ ],
+ [
+ 'id' => $this->settings->getSettingId('test_api_key'),
+ 'title' => __('Test API key', 'mollie-payments-for-woocommerce'),
+ 'default' => '',
+ 'type' => 'text',
+ 'desc' => sprintf(
+ /* translators: Placeholder 1: API key mode (live or test). The surrounding %s's Will be replaced by a link to the Mollie profile */
+ __(
+ 'The API key is used to connect to Mollie. You can find your %1$s API key in your %2$sMollie account%3$s',
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'test',
+ '',
+ ' '
+ ),
+ 'css' => 'width: 350px',
+ 'placeholder' => __(
+ 'Test API key should start with test_',
+ 'mollie-payments-for-woocommerce'
+ ),
+ ],
+ [
+ 'id' => $this->settings->getSettingId('debug'),
+ 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'),
+ 'type' => 'checkbox',
+ 'desc' => __('Log plugin events.', 'mollie-payments-for-woocommerce'),
+ 'default' => 'yes',
+ ],
+ [
+ 'id' => $this->settings->getSettingId('sectionend'),
+ 'type' => 'sectionend',
+ ],
+ ];
+ }
+}
diff --git a/src/Settings/Page/Section/Header.php b/src/Settings/Page/Section/Header.php
new file mode 100644
index 000000000..c6408fcea
--- /dev/null
+++ b/src/Settings/Page/Section/Header.php
@@ -0,0 +1,84 @@
+ $this->settings->getSettingId('header'),
+ 'type' => 'mollie_content',
+ 'value' => $this->content()
+ ]
+ ];
+ }
+
+ public function styles(): string
+ {
+ ob_start();
+ ?>
+
+
+
+ $this->settings->getSettingId('instructions'),
+ 'type' => 'mollie_content',
+ 'value' => $this->content()
+ ]
+ ];
+ }
+
+ protected function content(): string
+ {
+ ob_start();
+ ?>
+ = __("Mollie API Keys", 'mollie-payments-for-woocommerce'); ?>
+
+ = __(
+ "To start receiving payments through the Mollie plugin in your WooCommerce store,
+ you'll need to connect it to your Mollie account using an API key.",
+ 'mollie-payments-for-woocommerce'
+ ); ?>
+
+
+
+ = __("How to find your API keys:", 'mollie-payments-for-woocommerce'); ?>
+
+
+
+
+ = sprintf(
+ __(
+ "Log in to your Mollie Dashboard ",
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'https://my.mollie.com/dashboard/login?lang=en'
+ ); ?>
+
+
+ = __("Navigate to Developers > API keys. ", 'mollie-payments-for-woocommerce'); ?>
+
+
+ = __("Click on Copy next to your API key.", 'mollie-payments-for-woocommerce'); ?>
+
+
+ = __(
+ "Paste the copied API key into the Live API key or Test API key fields below.",
+ 'mollie-payments-for-woocommerce'
+ ); ?>
+
+
+
+ = __(
+ "Please note that your API keys are unique to your Mollie account and should be kept
+ private to ensure the security of your transactions.",
+ 'mollie-payments-for-woocommerce'
+ ); ?>
+
+ $this->settings->getSettingId('notices'),
+ 'type' => 'mollie_content',
+ 'value' => $this->content()
+ ]
+ ];
+ }
+
+ protected function content(): string
+ {
+ ob_start();
+ ?>
+ NOTICES
+ dataHelper = $container->get('settings.data_helper');
assert($this->dataHelper instanceof Data);
$pluginPath = $container->get('shared.plugin_path');
+ $pluginUrl = $container->get('shared.plugin_url');
$paymentMethods = $container->get('gateway.paymentMethods');
// Add settings link to plugins page
@@ -148,7 +148,7 @@ function () use ($optionName, $defaultAdvancedOptions, $defaultComponentsOptions
$gateways = $container->get('gateway.instances');
$isSDDGatewayEnabled = $container->get('gateway.isSDDGatewayEnabled');
- $this->initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $paymentMethods);
+ $this->initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $pluginUrl, $paymentMethods);
add_action(
'woocommerce_admin_settings_sanitize_option',
[$this->settingsHelper, 'updateMerchantIdOnApiKeyChanges'],
@@ -247,10 +247,11 @@ public function maybeSaveDefaultSettings($optionName, $testOption, $defaultOptio
* @param $isSDDGatewayEnabled
* @param $gateways
* @param $pluginPath
+ * @param $pluginUrl
* @param $paymentMethods
* @return void
*/
- protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $paymentMethods): void
+ protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $pluginPath, $pluginUrl, $paymentMethods): void
{
if (!$isSDDGatewayEnabled) {
//remove directdebit gateway from gateways list
@@ -258,10 +259,11 @@ protected function initMollieSettingsPage($isSDDGatewayEnabled, $gateways, $plug
}
add_filter(
'woocommerce_get_settings_pages',
- function ($settings) use ($pluginPath, $gateways, $paymentMethods) {
+ function ($settings) use ($pluginPath, $pluginUrl, $gateways, $paymentMethods) {
$settings[] = new MollieSettingsPage(
$this->settingsHelper,
$pluginPath,
+ $pluginUrl,
$gateways,
$paymentMethods,
$this->isTestModeEnabled,