From 8f3fb307666fdc0ba4d1fe618171444ca291213a Mon Sep 17 00:00:00 2001
From: inpsyde-maticluznar
+
+ = __(
+ 'Effortless payments for your customers, designed for growth',
+ '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'); ?>
+
+
+ = __(
+ "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'
+ ); ?>
+ = $value['desc']; ?> ';
+ $content .= $warning_message;
+ $content .= ' ';
+ $content .= __(
+ 'You have the WooCommerce default Direct Bank Transfer (BACS) payment gateway enabled in WooCommerce. Mollie strongly advices only using Bank Transfer via Mollie and disabling the default WooCommerce BACS payment gateway to prevent possible conflicts.',
+ 'mollie-payments-for-woocommerce'
+ );
+ $content .= ' ';
+ $content .= sprintf(
+ /* translators: Placeholder 1: Opening link tag. Placeholder 2: Closing link tag. Placeholder 3: Opening link tag. Placeholder 4: Closing link tag. */
+ __(
+ 'You have activated Klarna. To accept payments, please make sure all default WooCommerce checkout fields are enabled and required. For more information, go to %1$sKlarna Pay Later documentation%2$s or %3$sKlarna Slice it documentation%4$s',
+ 'mollie-payments-for-woocommerce'
+ ),
+ '',
+ '',
+ '',
+ ''
+ );
+ $content .= ' ' . __('The following options are required to use the plugin and are used by all Mollie payment methods', 'mollie-payments-for-woocommerce') . '
+
+ 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();
+ ?>
+
+
+
+
+
+
+
+ = $value['value']; ?>
+
+
+ = __("Mollie API Keys", 'mollie-payments-for-woocommerce'); ?>
+
+
+
+ if (!empty($value['value'])) : ?>
= $value['value']; ?>
+
+
+
@@ -76,8 +85,8 @@ public function registerContentFieldType(): void
public function outputSections()
{
add_action(
- 'woocommerce_sections_' . $this->id,
- [$this, 'output_sections']
+ 'woocommerce_sections_' . $this->id,
+ [$this, 'output_sections']
);
}
@@ -87,30 +96,141 @@ protected function pages(): array
PageNoApiKey::class,
PageApiKeys::class,
PagePaymentMethods::class,
- PageAdvancedSettings::class
+ PageAdvancedSettings::class,
];
}
public function get_settings($currentSection = '')
{
+ $defaultSection = $currentSection;
+ $connectionStatus = $this->settings->getConnectionStatus();
+
+ if (!$connectionStatus) {
+ $defaultSection = PageNoApiKey::slug();
+ }
+
+ if ($connectionStatus && $defaultSection === PageNoApiKey::slug()) {
+ $defaultSection = PageApiKeys::slug();
+ }
+
+ if ($defaultSection === '') {
+ $defaultSection = PageApiKeys::slug();
+ }
+
$mollieSettings = null;
foreach ($this->pages() as $pageClass) {
/** @var AbstractPage $page */
- $page = new $pageClass($this->settingsHelper, $this->pluginUrl);
- if ($page->slug() === $currentSection) {
+ $page = new $pageClass(
+ $this->settings,
+ $this->pluginUrl,
+ $this->pages(),
+ $defaultSection,
+ $connectionStatus,
+ $this->isTestModeEnabled,
+ $this->mollieGateways,
+ $this->paymentMethods,
+ $this->dataHelper
+ );
+ if ($page::slug() === $defaultSection) {
$mollieSettings = $page->settings();
break;
}
}
- if (!$mollieSettings) {
- $mollieSettings = (new PageNoApiKey($this->settingsHelper, $this->pluginUrl))->settings();
- }
-
return apply_filters(
- 'woocommerce_get_settings_' . $this->id,
- $mollieSettings,
- $currentSection
+ 'woocommerce_get_settings_' . $this->id,
+ $mollieSettings,
+ $currentSection
);
}
+
+ protected function checkDirectDebitStatus($content): string
+ {
+ $hasCustomSepaSettings = $this->paymentMethods["directdebit"]->getProperty('enabled') !== false;
+ $isSepaEnabled = !$hasCustomSepaSettings || $this->paymentMethods["directdebit"]->getProperty('enabled') === 'yes';
+ $sepaGatewayAllowed = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]);
+ if ($sepaGatewayAllowed && !$isSepaEnabled) {
+ $warning_message = __(
+ "You have WooCommerce Subscriptions activated, but not SEPA Direct Debit. Enable SEPA Direct Debit if you want to allow customers to pay subscriptions with iDEAL and/or other 'first' payment methods.",
+ 'mollie-payments-for-woocommerce'
+ );
+
+ $content .= '%1$s
. Required if WooCommerce Subscriptions is being used! Read more about %2$s and how it improves your conversion.',
+ 'mollie-payments-for-woocommerce'
+ ),
+ strtolower(__('Enabled', 'mollie-payments-for-woocommerce')),
+ __('Single Click Payments', 'mollie-payments-for-woocommerce')
+ ),
+ 'type' => 'checkbox',
+ 'default' => 'yes',
+
+ ],
+ [
+ 'id' => $this->settings->getSettingId('api_switch'),
+ 'title' => __(
+ 'Select API Method',
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'type' => 'select',
+ 'options' => [
+ PaymentService::PAYMENT_METHOD_TYPE_ORDER => ucfirst(
+ PaymentService::PAYMENT_METHOD_TYPE_ORDER
+ ) . ' (' . __('default', 'mollie-payments-for-woocommerce')
+ . ')',
+ PaymentService::PAYMENT_METHOD_TYPE_PAYMENT => ucfirst(
+ PaymentService::PAYMENT_METHOD_TYPE_PAYMENT
+ ),
+ ],
+ 'default' => PaymentService::PAYMENT_METHOD_TYPE_ORDER,
+ 'desc' => sprintf(
+ /* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
+ __(
+ 'Click %1$shere%2$s to read more about the differences between the Payments and Orders API',
+ 'mollie-payments-for-woocommerce'
+ ),
+ '',
+ ''
+ ),
+ ],
+ [
+ 'id' => $this->settings->getSettingId('api_payment_description'),
+ 'title' => __(
+ 'API Payment Description',
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'type' => 'text',
+ 'default' => '{orderNumber}',
+ 'desc' => sprintf(
+ '
%3$s', + _x('Available variables', 'Payment description options', 'mollie-payments-for-woocommerce'), + implode('', array_map( + static function ($label, $labelDescription) { + return sprintf( + '
', + '
' + ) + ), + ], + [ + 'id' => $this->settings->getSettingId('gatewayFeeLabel'), + 'title' => __( + 'Surcharge gateway fee label', + 'mollie-payments-for-woocommerce' + ), + 'type' => 'text', + 'custom_attributes' => ['maxlength' => '30'], + 'default' => __('Gateway Fee', 'mollie-payments-for-woocommerce'), + 'desc' => __( + 'This is the label will appear in frontend when the surcharge applies', + 'mollie-payments-for-woocommerce' + ), + ], + [ + 'id' => $this->settings->getSettingId('removeOptionsAndTransients'), + 'title' => __( + 'Remove Mollie data from Database on uninstall', + 'mollie-payments-for-woocommerce' + ), + 'type' => 'checkbox', + 'default' => 'no', + 'desc' => __("Remove options and scheduled actions from database when uninstalling the plugin.", "mollie-payments-for-woocommerce") . ' (' . strtolower( + __('Clear now', 'mollie-payments-for-woocommerce') + ) . ')', + ], + [ + 'id' => $this->settings->getSettingId('sectionend'), + 'type' => 'sectionend', + ], + ]; + + return apply_filters( + 'inpsyde.mollie-advanced-settings', + $config, + $this->settings->getPluginId() + ); + } + + protected function paymentDescriptionLabels(): array{ + return [ + '{orderNumber}' => _x('Order number', 'Label {orderNumber} description for payment description options', 'mollie-payments-for-woocommerce'), + '{storeName}' => _x('Site Title', 'Label {storeName} description for payment description options', 'mollie-payments-for-woocommerce'), + '{customer.firstname}' => _x('Customer\'s first name', 'Label {customer.firstname} description for payment description options', 'mollie-payments-for-woocommerce'), + '{customer.lastname}' => _x('Customer\'s last name', 'Label {customer.lastname} description for payment description options', 'mollie-payments-for-woocommerce'), + '{customer.company}' => _x('Customer\'s company name', 'Label {customer.company} description for payment description options', 'mollie-payments-for-woocommerce'), + ]; + } + + protected function cleanDbUrl(): string{ + return add_query_arg( + ['cleanDB-mollie' => 1, 'nonce_mollie_cleanDb' => wp_create_nonce('nonce_mollie_cleanDb')] + ); + } + + protected function content(): string + { + ob_start(); + ?> + $this->settings->getSettingId('title'), 'title' => '', - 'type' => 'title' + 'type' => 'title', ], + $this->connectionStatusField($this->settings, $this->connectionStatus), [ 'id' => $this->settings->getSettingId('test_mode_enabled'), 'title' => __('Mollie Payment Mode', 'mollie-payments-for-woocommerce'), @@ -21,8 +24,12 @@ public function config(): array 'type' => 'select', 'options' => [ 'no' => 'Live API', - 'yes' => 'Test API' + 'yes' => 'Test API', ], + 'desc' => __( + 'Select Live API to receive real payments and Test API to test transactions without a fee.', + 'mollie-payments-for-woocommerce' + ), 'desc_tip' => __( 'Enable test mode if you want to test the plugin without using real payments.', 'mollie-payments-for-woocommerce' @@ -34,14 +41,11 @@ public function config(): array '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', + "Use your Live API key when you're ready to receive real payments.", 'mollie-payments-for-woocommerce' ), - 'live', - '', - '' + 'https://my.mollie.com/dashboard/developers/api-keys?utm_source=woocommerce&utm_medium=plugin&utm_campaign=partner' ), 'css' => 'width: 350px', 'placeholder' => __( @@ -55,14 +59,11 @@ public function config(): array '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', + "Use your Test APl key to check the connection and test transactions without a fee.", 'mollie-payments-for-woocommerce' ), - 'test', - '', - '' + 'https://my.mollie.com/dashboard/developers/api-keys?utm_source=woocommerce&utm_medium=plugin&utm_campaign=partner' ), 'css' => 'width: 350px', 'placeholder' => __( @@ -74,7 +75,13 @@ public function config(): array 'id' => $this->settings->getSettingId('debug'), 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'), 'type' => 'checkbox', - 'desc' => __('Log plugin events.', 'mollie-payments-for-woocommerce'), + 'desc' => sprintf( + __( + "Log plugin events. View logs", + 'mollie-payments-for-woocommerce' + ), + $this->settings->getLogsUrl() + ), 'default' => 'yes', ], [ diff --git a/src/Settings/Page/Section/ConnectionStatusFields.php b/src/Settings/Page/Section/ConnectionStatusFields.php new file mode 100644 index 000000000..68312324d --- /dev/null +++ b/src/Settings/Page/Section/ConnectionStatusFields.php @@ -0,0 +1,46 @@ + $this->settings->getSettingId('title'), + 'title' => '', + 'type' => 'title', + ], + $this->connectionStatusField($this->settings, $this->connectionStatus), + $this->refreshStatusField(), + [ + 'id' => $this->settings->getSettingId('sectionend'), + 'type' => 'sectionend', + ], + ]; + } + + public function refreshStatusField(): array + { + $refreshNonce = wp_create_nonce('nonce_mollie_refresh_methods'); + $refreshUrl = add_query_arg( + ['refresh-methods' => 1, 'nonce_mollie_refresh_methods' => $refreshNonce] + ); + + return [ + 'id' => $this->settings->getSettingId('refresh_status'), + 'title' => __('Payment method availability', 'mollie-payments-for-woocommerce'), + 'value' => '' . __('Refresh Mollie payment methods', 'mollie-payments-for-woocommerce') . '', + 'desc' => __( + 'Click this button to refresh your payment methods, e.g. if you recently enabled new payment methods in your Mollie profile', + 'mollie-payments-for-woocommerce' + ), + 'type' => 'mollie_custom_input', + ]; + } +} diff --git a/src/Settings/Page/Section/ConnectionStatusTrait.php b/src/Settings/Page/Section/ConnectionStatusTrait.php new file mode 100644 index 000000000..ff1c0514c --- /dev/null +++ b/src/Settings/Page/Section/ConnectionStatusTrait.php @@ -0,0 +1,36 @@ + $settings->getSettingId('connection_status'), + 'title' => __('Mollie Connection Status', 'mollie-payments-for-woocommerce'), + 'value' => $this->connectionStatus($settings, $connectionStatus), + 'type' => 'mollie_custom_input', + ]; + } + + protected function connectionStatus(Settings $settings, bool $connectionStatus): ?string + { + $testMode = $settings->isTestModeEnabled(); + if (!$connectionStatus) { + return __( + 'Failed to connect to Mollie API - check your API keys ✖', + 'mollie-payments-for-woocommerce' + ); + } + if ($testMode) { + return __('Successfully connected with Test API ✓', 'mollie-payments-for-woocommerce'); + } + return __('Successfully connected with Live API ✓', 'mollie-payments-for-woocommerce'); + } +} diff --git a/src/Settings/Page/Section/Header.php b/src/Settings/Page/Section/Header.php index c6408fcea..0f07b0309 100644 --- a/src/Settings/Page/Section/Header.php +++ b/src/Settings/Page/Section/Header.php @@ -10,10 +10,10 @@ public function config(): array { return [ [ - 'id' => $this->settings->getSettingId('header'), - 'type' => 'mollie_content', - 'value' => $this->content() - ] + 'id' => $this->settings->getSettingId('header'), + 'type' => 'mollie_content', + 'value' => $this->content(), + ], ]; } @@ -62,8 +62,8 @@ protected function content(): string= __( - 'Effortless payments for your customers, designed for growth', - 'mollie-payments-for-woocommerce' + 'Effortless payments for your customers, designed for growth', + 'mollie-payments-for-woocommerce' ); ?>
diff --git a/src/Settings/Page/Section/InstructionsConnected.php b/src/Settings/Page/Section/InstructionsConnected.php new file mode 100644 index 000000000..689e9dbf8 --- /dev/null +++ b/src/Settings/Page/Section/InstructionsConnected.php @@ -0,0 +1,46 @@ + $this->settings->getSettingId('instructions'), + 'type' => 'mollie_content', + 'value' => $this->content(), + ], + ]; + } + + protected function content(): string + { + ob_start(); + ?> ++ = sprintf( + __( + "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' + ), + 'https://my.mollie.com/dashboard/developers/api-keys?utm_source=woocommerce&utm_medium=plugin&utm_campaign=partner' + ); ?> +
++ = + __( + '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('instructions'), 'type' => 'mollie_content', - 'value' => $this->content() - ] + 'value' => $this->content(), + ], ]; } @@ -24,9 +24,9 @@ protected function content(): string= __( - "To start receiving payments through the Mollie plugin in your WooCommerce store, + "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' + 'mollie-payments-for-woocommerce' ); ?>
@@ -37,11 +37,11 @@ protected function content(): string
= __( - "Please note that your API keys are unique to your Mollie account and should be kept + "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' + 'mollie-payments-for-woocommerce' ); ?>
$this->settings->getSettingId('notices'), - 'type' => 'mollie_content', - 'value' => $this->content() - ] + 'id' => $this->settings->getSettingId('notices'), + 'type' => 'mollie_content', + 'value' => $this->content(), + ], ]; } diff --git a/src/Settings/Page/Section/PaymentMethods.php b/src/Settings/Page/Section/PaymentMethods.php new file mode 100644 index 000000000..9bf80ea80 --- /dev/null +++ b/src/Settings/Page/Section/PaymentMethods.php @@ -0,0 +1,246 @@ + $this->settings->getSettingId('notices'), + 'type' => 'mollie_content', + 'value' => $this->content(), + ], + ]; + } + + protected function content(): string + { + ob_start(); + ?> += $description; ?>
+= $value['desc']; ?>
+= $value['desc']; // WPCS: XSS ok. ?>
'; @@ -177,8 +177,8 @@ protected function checkMollieBankTransferNotBACS($content): string if ($woocommerce_banktransfer_gateway->is_available()) { $content .= '
'; $content .= __( - 'You have the WooCommerce default Direct Bank Transfer (BACS) payment gateway enabled in WooCommerce. Mollie strongly advices only using Bank Transfer via Mollie and disabling the default WooCommerce BACS payment gateway to prevent possible conflicts.', - 'mollie-payments-for-woocommerce' + 'You have the WooCommerce default Direct Bank Transfer (BACS) payment gateway enabled in WooCommerce. Mollie strongly advices only using Bank Transfer via Mollie and disabling the default WooCommerce BACS payment gateway to prevent possible conflicts.', + 'mollie-payments-for-woocommerce' ); $content .= '
'; - $content .= sprintf( - /* translators: Placeholder 1: Opening link tag. Placeholder 2: Closing link tag. Placeholder 3: Opening link tag. Placeholder 4: Closing link tag. */ - __( - 'You have activated Klarna. To accept payments, please make sure all default WooCommerce checkout fields are enabled and required. For more information, go to %1$sKlarna Pay Later documentation%2$s or %3$sKlarna Slice it documentation%4$s', - 'mollie-payments-for-woocommerce' - ), - '', - '', - '', - '' - ); - $content .= '
' . __( - 'Please go to', - 'mollie-payments-for-woocommerce' - ) . '' . __( - ' the signup page', - 'mollie-payments-for-woocommerce' - ) . ' '; - $presentationText .= __( - ' to create a new Mollie account and start receiving payments in a couple of minutes. ', - 'mollie-payments-for-woocommerce' - ); - $presentationText .= __( - 'Contact ', - 'mollie-payments-for-woocommerce' - ) . 'info@mollie.com'; - $presentationText .= __( - ' if you have any questions or comments about this plugin.', - 'mollie-payments-for-woocommerce' - ) . '
'; - $presentationText .= '' . __( - 'Our pricing is always per transaction. No startup fees, no monthly fees, and no gateway fees. No hidden fees, period.', - 'mollie-payments-for-woocommerce' - ) . '
'; - - $presentation = '' - . '' . $presentationText . '
%s
',
- 'mollie-payments-for-woocommerce'
- ),
- defined('WC_LOG_DIR') ? WC_LOG_DIR
- : WC()->plugin_path() . '/logs/'
- );
-
- // Global Mollie settings
- $mollieSettings = [
- [
- 'id' => $this->settingsHelper->getSettingId('title'),
- 'title' => __('Mollie Settings', 'mollie-payments-for-woocommerce'),
- 'type' => 'title',
- 'desc' => '' . $content . '
' - . '' . __( - 'The following options are required to use the plugin and are used by all Mollie payment methods', - 'mollie-payments-for-woocommerce' - ) . '
', - ], - [ - 'id' => $this->settingsHelper->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->settingsHelper->getSettingId('test_mode_enabled'), - 'title' => __('Enable test mode', 'mollie-payments-for-woocommerce'), - 'default' => 'no', - 'type' => 'checkbox', - 'desc_tip' => __( - 'Enable test mode if you want to test the plugin without using real payments.', - 'mollie-payments-for-woocommerce' - ), - ], - [ - 'id' => $this->settingsHelper->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->settingsHelper->getSettingId('debug'), - 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'), - 'type' => 'checkbox', - 'desc' => $debugDesc, - 'default' => 'yes', - ], - [ - 'id' => $this->settingsHelper->getSettingId('sectionend'), - 'type' => 'sectionend', - ], - ]; - - return $this->mergeSettings($settings, $mollieSettings); - } - /** - * @return string - */ - public function getMollieMethods(): string - { - $content = ''; - - $dataHelper = $this->dataHelper; - - // Is Test mode enabled? - $testMode = $this->isTestModeEnabled; - $apiKey = $this->settingsHelper->getApiKey(); - - if ( - isset($_GET['refresh-methods']) && - isset($_GET['nonce_mollie_refresh_methods']) && - wp_verify_nonce( - filter_input(INPUT_GET, 'nonce_mollie_refresh_methods', FILTER_SANITIZE_SPECIAL_CHARS), - 'nonce_mollie_refresh_methods' - ) - ) { - /* Reload active Mollie methods */ - $methods = $dataHelper->getAllPaymentMethods($apiKey, $testMode, false); - foreach ($methods as $key => $method) { - $methods['mollie_wc_gateway_' . $method['id']] = $method; - unset($methods[$key]); - } - $this->registeredGateways = $methods; - } - if ( - isset($_GET['cleanDB-mollie']) && wp_verify_nonce( - filter_input(INPUT_GET, 'nonce_mollie_cleanDb', FILTER_SANITIZE_SPECIAL_CHARS), - 'nonce_mollie_cleanDb' - ) - ) { - $cleaner = $this->settingsHelper->cleanDb(); - $cleaner->cleanAll(); - //set default settings - foreach ($this->paymentMethods as $paymentMethod) { - $paymentMethod->getSettings(); - } - } - - $iconAvailable = ' ' . strtolower(__('Enabled', 'mollie-payments-for-woocommerce')) . ''; - $iconNoAvailable = ' ' . strtolower(__('Disabled', 'mollie-payments-for-woocommerce')) . ''; - - $content .= ''; - $content .= $warning_message; - $content .= '
'; - $content .= __( - 'You have the WooCommerce default Direct Bank Transfer (BACS) payment gateway enabled in WooCommerce. Mollie strongly advices only using Bank Transfer via Mollie and disabling the default WooCommerce BACS payment gateway to prevent possible conflicts.', - 'mollie-payments-for-woocommerce' - ); - $content .= '
'; - $content .= sprintf( - /* translators: Placeholder 1: Opening link tag. Placeholder 2: Closing link tag. Placeholder 3: Opening link tag. Placeholder 4: Closing link tag. */ - __( - 'You have activated Klarna. To accept payments, please make sure all default WooCommerce checkout fields are enabled and required. For more information, go to %1$sKlarna Pay Later documentation%2$s or %3$sKlarna Slice it documentation%4$s', - 'mollie-payments-for-woocommerce' - ), - '', - '', - '', - '' - ); - $content .= '
'; - $content .= __( - 'You have activated Billie. To accept payments, please make sure all default WooCommerce checkout fields are enabled and required. The billing company field is required as well. Make sure to enable the billing company field in the WooCommerce settings if you are using Woocommerce blocks.', - 'mollie-payments-for-woocommerce' - ); - $content .= '
'; - $content .= '- = __( + = esc_html(__( 'Effortless payments for your customers, designed for growth', 'mollie-payments-for-woocommerce' - ); ?> + )); ?>
- = sprintf( + = wp_kses(sprintf( __( "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' ), 'https://my.mollie.com/dashboard/developers/api-keys?utm_source=woocommerce&utm_medium=plugin&utm_campaign=partner' - ); ?> + ), [ + 'a' => [ + 'target' => [], + 'href' => [], + ], + ]); ?>
= - __( - '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' - ); + esc_html(__( + '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' + )); ?>
-- = __( + = esc_html(__( "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'); ?> + = esc_html(__("How to find your API keys:", 'mollie-payments-for-woocommerce')); ?>
- = __( + = esc_html(__( "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(), + 'id' => $this->settings->getSettingId('notices'), + 'type' => 'mollie_content', + 'value' => $this->content(), ], ]; } @@ -21,7 +24,123 @@ protected function content(): string { ob_start(); ?> - NOTICES ++ = wp_kses($message, [ + 'a' => [ + 'href' => [], + 'target' => [], + ], + ]); ?> +
+= $description; ?>
+= esc_html($description); ?>
= wp_kses($message, [ 'a' => [ @@ -140,8 +141,50 @@ protected function notice(string $message) ], ]); ?>
+' . __('The following options are required to use the plugin and are used by all Mollie payment methods', 'mollie-payments-for-woocommerce') . '
', - ], - [ - 'id' => $pluginName . '_order_status_cancelled_payments', - 'title' => __('Order status after cancelled payment', 'mollie-payments-for-woocommerce'), - 'type' => 'select', - 'options' => [ - 'pending' => __('Pending', 'woocommerce'), - 'cancelled' => __('Cancelled', 'woocommerce'), - ], - 'desc' => __('Status for orders when a payment (not a Mollie order via the Orders API) is cancelled. Default: pending. Orders with status Pending can be paid with another payment method, customers can try again. Cancelled orders are final. Set this to Cancelled if you only have one payment method or don\'t want customers to re-try paying with a different payment method. This doesn\'t apply to payments for orders via the new Orders API and Klarna payments.', 'mollie-payments-for-woocommerce'), - 'default' => 'pending', - ], - [ - 'id' => $pluginName . '_' . SharedDataDictionary::SETTING_NAME_PAYMENT_LOCALE, - 'title' => __('Payment screen language', 'mollie-payments-for-woocommerce'), - 'type' => 'select', - 'options' => [ - SharedDataDictionary::SETTING_LOCALE_WP_LANGUAGE => __( - 'Automatically send WordPress language', - 'mollie-payments-for-woocommerce' - ) . ' (' . __('default', 'mollie-payments-for-woocommerce') . ')', - SharedDataDictionary::SETTING_LOCALE_DETECT_BY_BROWSER => __( - 'Detect using browser language', - 'mollie-payments-for-woocommerce' - ), - 'en_US' => __('English', 'mollie-payments-for-woocommerce'), - 'nl_NL' => __('Dutch', 'mollie-payments-for-woocommerce'), - 'nl_BE' => __('Flemish (Belgium)', 'mollie-payments-for-woocommerce'), - 'fr_FR' => __('French', 'mollie-payments-for-woocommerce'), - 'fr_BE' => __('French (Belgium)', 'mollie-payments-for-woocommerce'), - 'de_DE' => __('German', 'mollie-payments-for-woocommerce'), - 'de_AT' => __('Austrian German', 'mollie-payments-for-woocommerce'), - 'de_CH' => __('Swiss German', 'mollie-payments-for-woocommerce'), - 'es_ES' => __('Spanish', 'mollie-payments-for-woocommerce'), - 'ca_ES' => __('Catalan', 'mollie-payments-for-woocommerce'), - 'pt_PT' => __('Portuguese', 'mollie-payments-for-woocommerce'), - 'it_IT' => __('Italian', 'mollie-payments-for-woocommerce'), - 'nb_NO' => __('Norwegian', 'mollie-payments-for-woocommerce'), - 'sv_SE' => __('Swedish', 'mollie-payments-for-woocommerce'), - 'fi_FI' => __('Finnish', 'mollie-payments-for-woocommerce'), - 'da_DK' => __('Danish', 'mollie-payments-for-woocommerce'), - 'is_IS' => __('Icelandic', 'mollie-payments-for-woocommerce'), - 'hu_HU' => __('Hungarian', 'mollie-payments-for-woocommerce'), - 'pl_PL' => __('Polish', 'mollie-payments-for-woocommerce'), - 'lv_LV' => __('Latvian', 'mollie-payments-for-woocommerce'), - 'lt_LT' => __('Lithuanian', 'mollie-payments-for-woocommerce'), - ], - 'desc' => sprintf( - /* translators: Placeholder 1: link tag Placeholder 2: closing tag */ - __('Sending a language (or locale) is required. The option \'Automatically send WordPress language\' will try to get the customer\'s language in WordPress (and respects multilanguage plugins) and convert it to a format Mollie understands. If this fails, or if the language is not supported, it will fall back to American English. You can also select one of the locales currently supported by Mollie, that will then be used for all customers.', 'mollie-payments-for-woocommerce'), - '', - '' - ), - 'default' => SharedDataDictionary::SETTING_LOCALE_WP_LANGUAGE, - ], - [ - 'id' => $pluginName . '_customer_details', - 'title' => __('Store customer details at Mollie', 'mollie-payments-for-woocommerce'), - 'desc' => sprintf( - /* translators: Placeholder 1: enabled or disabled Placeholder 2: translated string */ - __( - 'Should Mollie store customers name and email address for Single Click Payments? Default%1$s
. Required if WooCommerce Subscriptions is being used! Read more about %2$s and how it improves your conversion.',
- 'mollie-payments-for-woocommerce'
- ),
- strtolower(__('Enabled', 'mollie-payments-for-woocommerce')),
- __('Single Click Payments', 'mollie-payments-for-woocommerce')
- ),
- 'type' => 'checkbox',
- 'default' => 'yes',
-
- ],
- [
- 'id' => $pluginName . '_api_switch',
- 'title' => __(
- 'Select API Method',
- 'mollie-payments-for-woocommerce'
- ),
- 'type' => 'select',
- 'options' => [
- PaymentService::PAYMENT_METHOD_TYPE_ORDER => ucfirst(
- PaymentService::PAYMENT_METHOD_TYPE_ORDER
- ) . ' (' . __('default', 'mollie-payments-for-woocommerce')
- . ')',
- PaymentService::PAYMENT_METHOD_TYPE_PAYMENT => ucfirst(
- PaymentService::PAYMENT_METHOD_TYPE_PAYMENT
- ),
- ],
- 'default' => PaymentService::PAYMENT_METHOD_TYPE_ORDER,
- 'desc' => sprintf(
- /* translators: Placeholder 1: opening link tag, placeholder 2: closing link tag */
- __(
- 'Click %1$shere%2$s to read more about the differences between the Payments and Orders API',
- 'mollie-payments-for-woocommerce'
- ),
- '',
- ''
- ),
- ],
- [
- 'id' => $pluginName . '_api_payment_description',
- 'title' => __(
- 'API Payment Description',
- 'mollie-payments-for-woocommerce'
- ),
- 'type' => 'text',
- 'default' => '{orderNumber}',
- 'desc' => sprintf(
- '
-
- %3$s', - _x('Available variables', 'Payment description options', 'mollie-payments-for-woocommerce'), - implode('', array_map( - static function ($label, $label_description) { - return sprintf( - '
', - '
' - ) - ), - ], - [ - 'id' => $pluginName . '_gatewayFeeLabel', - 'title' => __( - 'Surcharge gateway fee label', - 'mollie-payments-for-woocommerce' - ), - 'type' => 'text', - 'custom_attributes' => ['maxlength' => '30'], - 'default' => __('Gateway Fee', 'mollie-payments-for-woocommerce'), - 'desc' => __( - 'This is the label will appear in frontend when the surcharge applies', - 'mollie-payments-for-woocommerce' - ), - ], - [ - 'id' => $pluginName . '_removeOptionsAndTransients', - 'title' => __( - 'Remove Mollie data from Database on uninstall', - 'mollie-payments-for-woocommerce' - ), - 'type' => 'checkbox', - 'default' => 'no', - 'desc' => __("Remove options and scheduled actions from database when uninstalling the plugin.", "mollie-payments-for-woocommerce") . ' (' . strtolower( - __('Clear now', 'mollie-payments-for-woocommerce') - ) . ')', - ], - [ - 'id' => $pluginName . '_sectionend', - 'type' => 'sectionend', - ], -]; - -return apply_filters('inpsyde.mollie-advanced-settings', $mollieAdvancedSettings, $pluginName); diff --git a/inc/settings/mollie_applepay_settings.php b/inc/settings/mollie_applepay_settings.php deleted file mode 100644 index 2ef1c3fa0..000000000 --- a/inc/settings/mollie_applepay_settings.php +++ /dev/null @@ -1,122 +0,0 @@ - $title . '_' . 'title', - 'title' => __('Apple Pay', 'mollie-payments-for-woocommerce'), - 'type' => 'title', - 'desc' => '' . __('The following options are required to use the Apple Pay gateway', 'mollie-payments-for-woocommerce') . '
', - ], - - [ - 'id' => 'enabled', - 'title' => __('Enable/Disable', 'mollie-payments-for-woocommerce'), - /* translators: Placeholder 1: Gateway title */ - 'desc' => sprintf(__('Enable %s', 'mollie-payments-for-woocommerce'), $title), - 'type' => 'checkbox', - 'default' => 'yes', - 'value' => isset($applePayOption['enabled']) ? $applePayOption['enabled'] : 'yes', - - ], - [ - 'id' => 'title', - 'title' => __('Title', 'mollie-payments-for-woocommerce'), - 'desc' => sprintf( - /* translators: Placeholder 1: Gateway title */ - __( - 'This controls the title which the user sees during checkout. Default%s
',
- 'mollie-payments-for-woocommerce'
- ),
- $title
- ),
- 'desc_tip' => true,
- 'type' => 'text',
- 'default' => $title,
- 'value' => isset($applePayOption['title']) ? $applePayOption['title'] : $title,
-
- ],
- [
- 'id' => 'display_logo',
- 'title' => __('Display logo', 'mollie-payments-for-woocommerce'),
- 'desc' => __(
- 'Display logo',
- 'mollie-payments-for-woocommerce'
- ),
- 'desc_tip' => true,
- 'type' => 'checkbox',
- 'default' => 'yes',
- 'value' => isset($applePayOption['display_logo']) ? $applePayOption['display_logo'] : 'yes',
-
- ],
- [
- 'id' => 'description',
- 'title' => __('Description', 'mollie-payments-for-woocommerce'),
- 'desc' => sprintf(
- /* translators: Placeholder 1: Gateway description */
- __(
- 'Payment method description that the customer will see on your checkout. Default %s
',
- 'mollie-payments-for-woocommerce'
- ),
- $description
- ),
- 'desc_tip' => true,
- 'type' => 'text',
- 'default' => $description,
- 'value' => isset($applePayOption['description']) ? $applePayOption['description'] : $description,
- ],
- [
- 'id' => $pluginId . '_' . 'sectionend',
- 'type' => 'sectionend',
- ],
- [
- 'id' => $title . '_' . 'title_button',
- 'title' => __(
- 'Apple Pay button settings',
- 'mollie-payments-for-woocommerce'
- ),
- 'type' => 'title',
- 'desc' => '' . __('The following options are required to use the Apple Pay Direct Button', 'mollie-payments-for-woocommerce') . '
', - ], - [ - 'id' => 'mollie_apple_pay_button_enabled_cart', - 'title' => __('Enable Apple Pay Button on Cart page', 'mollie-payments-for-woocommerce'), - 'desc' => sprintf( - /* translators: Placeholder 1: enabled or disabled */ - __( - 'Enable the Apple Pay direct buy button on the Cart page', - 'mollie-payments-for-woocommerce' - ), - $description - ), - 'type' => 'checkbox', - 'default' => 'no', - 'value' => isset($applePayOption['mollie_apple_pay_button_enabled_cart']) ? $applePayOption['mollie_apple_pay_button_enabled_cart'] : 'no', - - ], - [ - 'id' => 'mollie_apple_pay_button_enabled_product', - 'title' => __('Enable Apple Pay Button on Product page', 'mollie-payments-for-woocommerce'), - 'desc' => sprintf( - /* translators: Placeholder 1: enabled or disabled */ - __( - 'Enable the Apple Pay direct buy button on the Product page', - 'mollie-payments-for-woocommerce' - ), - $description - ), - 'type' => 'checkbox', - 'default' => 'no', - 'value' => isset($applePayOption['mollie_apple_pay_button_enabled_product']) ? $applePayOption['mollie_apple_pay_button_enabled_product'] : 'no', - - ], - [ - 'id' => $pluginName . '_' . 'sectionend', - 'type' => 'sectionend', - ], -]; diff --git a/inc/settings/mollie_components.php b/inc/settings/mollie_components.php deleted file mode 100644 index ac81476d9..000000000 --- a/inc/settings/mollie_components.php +++ /dev/null @@ -1,170 +0,0 @@ - 'title', - 'id' => 'mollie_components_styles', - 'title' => _x( - 'Base Styles', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - ], - StylesPropertiesDictionary::BACKGROUND_COLOR => [ - 'type' => 'color', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::BACKGROUND_COLOR, - 'title' => _x('Background Color', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => '#ffffff', - ], - StylesPropertiesDictionary::TEXT_COLOR => [ - 'type' => 'color', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::TEXT_COLOR, - 'title' => _x('Text Color', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => '#000000', - ], - StylesPropertiesDictionary::INPUT_PLACEHOLDER => [ - 'type' => 'color', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::INPUT_PLACEHOLDER, - 'title' => _x('Placeholder Color', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => '#cccccc', - ], - StylesPropertiesDictionary::FONT_SIZE => [ - 'type' => 'text', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::FONT_SIZE, - 'title' => _x('Font Size', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'desc_tip' => _x( - 'Defines the component font size. Allowed units: \'em\', \'px\', \'rem\'.', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'default' => '16px', - ], - StylesPropertiesDictionary::FONT_WEIGHT => [ - 'type' => 'select', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::FONT_WEIGHT, - 'title' => _x('Font Weight', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => 'normal', - 'options' => [ - 'lighter' => _x('Lighter', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'normal' => _x('Regular', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'bolder' => _x('Bold', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - ], - ], - StylesPropertiesDictionary::LETTER_SPACING => [ - 'type' => 'number', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::LETTER_SPACING, - 'title' => _x('Letter Spacing', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => '0', - ], - StylesPropertiesDictionary::LINE_HEIGHT => [ - 'type' => 'number', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::LINE_HEIGHT, - 'title' => _x('Line Height', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => '1.2', - 'custom_attributes' => [ - 'step' => '.1', - ], - ], - StylesPropertiesDictionary::PADDING => [ - 'type' => 'text', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::PADDING, - 'title' => _x('Padding', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'desc_tip' => _x( - 'Add padding to the components. Allowed units include `16px 16px 16px 16px` and `em`, `px`, `rem`.', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'default' => '.63em', - ], - StylesPropertiesDictionary::TEXT_ALIGN => [ - 'type' => 'select', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::TEXT_ALIGN, - 'title' => _x('Align Text', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => 'left', - 'options' => [ - 'left' => _x('Left', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'right' => _x('Right', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'center' => _x('Center', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'justify' => _x('Justify', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - ], - ], - StylesPropertiesDictionary::TEXT_TRANSFORM => [ - 'type' => 'select', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::TEXT_TRANSFORM, - 'title' => _x('Transform Text ', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'default' => 'none', - 'options' => [ - 'none' => _x( - 'None', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'capitalize' => _x( - 'Capitalize', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'uppercase' => _x( - 'Uppercase', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'lowercase' => _x( - 'Lowercase', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'full-width' => _x( - 'Full Width', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'full-size-kana' => _x( - 'Full Size Kana', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - ], - ], - [ - 'type' => 'sectionend', - 'id' => 'mollie_components_styles', - ], - [ - 'type' => 'title', - 'id' => 'mollie_components_invalid_styles', - 'title' => _x( - 'Invalid Status Styles', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - ], - StylesPropertiesDictionary::INVALID_TEXT_COLOR => [ - 'type' => 'color', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::INVALID_TEXT_COLOR, - 'title' => _x('Text Color', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'desc_tip' => _x( - 'Text Color for invalid input.', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'default' => '#000000', - ], - StylesPropertiesDictionary::INVALID_BACKGROUND_COLOR => [ - 'type' => 'color', - 'id' => 'mollie_components_' . StylesPropertiesDictionary::INVALID_BACKGROUND_COLOR, - 'title' => _x('Background Color', 'Mollie Components Settings', 'mollie-payments-for-woocommerce'), - 'desc_tip' => _x( - 'Background Color for invalid input.', - 'Mollie Components Settings', - 'mollie-payments-for-woocommerce' - ), - 'default' => '#FFF0F0', - ], - [ - 'type' => 'sectionend', - 'id' => 'mollie_components_invalid_styles', - ], -]; diff --git a/src/Settings/MollieSettingsPage.php b/src/Settings/MollieSettingsPage.php index 04be819e0..6e225d5e7 100644 --- a/src/Settings/MollieSettingsPage.php +++ b/src/Settings/MollieSettingsPage.php @@ -10,8 +10,6 @@ use Mollie\WooCommerce\Settings\Page\PageNoApiKey; use Mollie\WooCommerce\Settings\Page\PagePaymentMethods; use Mollie\WooCommerce\Shared\Data; -use Mollie\WooCommerce\PaymentMethods\Constants; -use WC_Gateway_BACS; use WC_Settings_Page; class MollieSettingsPage extends WC_Settings_Page @@ -143,54 +141,4 @@ public function get_settings($currentSection = '') $currentSection ); } - - protected function checkDirectDebitStatus($content): string - { - $hasCustomSepaSettings = $this->paymentMethods["directdebit"]->getProperty('enabled') !== false; - $isSepaEnabled = !$hasCustomSepaSettings || $this->paymentMethods["directdebit"]->getProperty('enabled') === 'yes'; - $sepaGatewayAllowed = !empty($this->registeredGateways["mollie_wc_gateway_directdebit"]); - if ($sepaGatewayAllowed && !$isSepaEnabled) { - $warning_message = __( - "You have WooCommerce Subscriptions activated, but not SEPA Direct Debit. Enable SEPA Direct Debit if you want to allow customers to pay subscriptions with iDEAL and/or other 'first' payment methods.", - 'mollie-payments-for-woocommerce' - ); - - $content .= ''; - $content .= $warning_message; - $content .= '
'; - $content .= __( - 'You have the WooCommerce default Direct Bank Transfer (BACS) payment gateway enabled in WooCommerce. Mollie strongly advices only using Bank Transfer via Mollie and disabling the default WooCommerce BACS payment gateway to prevent possible conflicts.', - 'mollie-payments-for-woocommerce' - ); - $content .= '
' . __('The following options are required to use the plugin and are used by all Mollie payment methods', 'mollie-payments-for-woocommerce') . '
', ], + [ + 'id' => $this->settings->getSettingId('debug'), + 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'), + 'type' => 'checkbox', + 'desc' => sprintf( + __( + "Log plugin events. View logs", + 'mollie-payments-for-woocommerce' + ), + $this->settings->getLogsUrl() + ), + 'default' => 'yes', + ], [ 'id' => $this->settings->getSettingId('order_status_cancelled_payments'), 'title' => __('Order status after cancelled payment', 'mollie-payments-for-woocommerce'), diff --git a/src/Settings/Page/Section/ConnectionFields.php b/src/Settings/Page/Section/ConnectionFields.php index 681c7d437..0708ba200 100644 --- a/src/Settings/Page/Section/ConnectionFields.php +++ b/src/Settings/Page/Section/ConnectionFields.php @@ -71,19 +71,6 @@ public function config(): array 'mollie-payments-for-woocommerce' ), ], - [ - 'id' => $this->settings->getSettingId('debug'), - 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'), - 'type' => 'checkbox', - 'desc' => sprintf( - __( - "Log plugin events. View logs", - 'mollie-payments-for-woocommerce' - ), - $this->settings->getLogsUrl() - ), - 'default' => 'yes', - ], [ 'id' => $this->settings->getSettingId('sectionend'), 'type' => 'sectionend', diff --git a/src/Settings/Page/Section/ConnectionStatusTrait.php b/src/Settings/Page/Section/ConnectionStatusTrait.php index ff1c0514c..2639fd9b5 100644 --- a/src/Settings/Page/Section/ConnectionStatusTrait.php +++ b/src/Settings/Page/Section/ConnectionStatusTrait.php @@ -29,8 +29,8 @@ protected function connectionStatus(Settings $settings, bool $connectionStatus): ); } if ($testMode) { - return __('Successfully connected with Test API ✓', 'mollie-payments-for-woocommerce'); + return __('Successfully connected with Test API ✓', 'mollie-payments-for-woocommerce'); } - return __('Successfully connected with Live API ✓', 'mollie-payments-for-woocommerce'); + return __('Successfully connected with Live API ✓', 'mollie-payments-for-woocommerce'); } } diff --git a/src/Settings/SettingsModule.php b/src/Settings/SettingsModule.php index efdbb4590..61ecb6632 100644 --- a/src/Settings/SettingsModule.php +++ b/src/Settings/SettingsModule.php @@ -194,7 +194,8 @@ public function addPluginActionLinks(array $links): array public function maybeTestModeNotice(): bool { $testModeEnabled = get_option('mollie-payments-for-woocommerce_test_mode_enabled', true); - $shouldShowNotice = $testModeEnabled === 'yes'; + $testKeyEntered = get_option('mollie-payments-for-woocommerce_test_api_key', true); + $shouldShowNotice = $testModeEnabled === 'yes' && !empty($testKeyEntered); if (!$shouldShowNotice) { return false; }