';
+ $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 .= '
';
+
+ return $content;
+ }
+
+ return $content;
+ }
+
+ protected function isKlarnaEnabled(): bool
+ {
+ $klarnaGateways = [Constants::KLARNAPAYLATER, Constants::KLARNASLICEIT, Constants::KLARNAPAYNOW, Constants::KLARNA];
+ $isKlarnaEnabled = false;
+ foreach ($klarnaGateways as $klarnaGateway) {
+ if (
+ array_key_exists('mollie_wc_gateway_' . $klarnaGateway, $this->mollieGateways)
+ && array_key_exists($klarnaGateway, $this->paymentMethods)
+ && $this->paymentMethods[$klarnaGateway]->getProperty('enabled') === 'yes'
+ ) {
+ $isKlarnaEnabled = true;
+ break;
+ }
+ }
+ return $isKlarnaEnabled;
+ }
}
diff --git a/src/Settings/Page/MollieSettingsPageOld.php b/src/Settings/MollieSettingsPageOld.php
similarity index 100%
rename from src/Settings/Page/MollieSettingsPageOld.php
rename to src/Settings/MollieSettingsPageOld.php
diff --git a/src/Settings/Page/AbstractPage.php b/src/Settings/Page/AbstractPage.php
index 5a9864cf3..86ce33627 100644
--- a/src/Settings/Page/AbstractPage.php
+++ b/src/Settings/Page/AbstractPage.php
@@ -6,25 +6,50 @@
use Mollie\WooCommerce\Settings\Page\Section\AbstractSection;
use Mollie\WooCommerce\Settings\Settings;
+use Mollie\WooCommerce\Shared\Data;
abstract class AbstractPage
{
protected Settings $settings;
protected string $pluginUrl;
+ protected string $currentSection;
+ protected bool $connectionStatus;
+ protected bool $testModeEnabled;
+ protected array $pages;
+ protected array $mollieGateways;
+ protected array $paymentMethods;
+ protected Data $dataHelper;
+
+ public function __construct(
+ Settings $settings,
+ string $pluginUrl,
+ array $pages,
+ string $currentSection,
+ bool $connectionStatus,
+ bool $testModeEnabled,
+ array $mollieGateways,
+ array $paymentMethods,
+ Data $dataHelper
+ ) {
- public function __construct(Settings $settings, string $pluginUrl)
- {
$this->settings = $settings;
$this->pluginUrl = $pluginUrl;
+ $this->currentSection = $currentSection;
+ $this->connectionStatus = $connectionStatus;
+ $this->testModeEnabled = $testModeEnabled;
+ $this->pages = $pages;
+ $this->mollieGateways = $mollieGateways;
+ $this->paymentMethods = $paymentMethods;
+ $this->dataHelper = $dataHelper;
}
- abstract public function isTab(): bool;
+ abstract public static function isTab(): bool;
- abstract public function slug(): string;
+ abstract public static function slug(): string;
- public function tabName(): string
+ public static function tabName(): string
{
- return '';
+ return 'tabName';
}
protected function sections(): array
@@ -39,16 +64,26 @@ public function settings(): array
foreach ($this->sections() as $sectionClass) {
/** @var AbstractSection $section */
- $section = new $sectionClass($this->settings, $this->pluginUrl);
+ $section = new $sectionClass(
+ $this->settings,
+ $this->pluginUrl,
+ $this->pages,
+ $this->currentSection,
+ $this->connectionStatus,
+ $this->testModeEnabled,
+ $this->mollieGateways,
+ $this->paymentMethods,
+ $this->dataHelper
+ );
foreach ($section->config() as $field) {
$settings[] = $field;
}
- $styles[$sectionClass] = preg_replace('/\s+/', '', $section->styles());
+ $styles[$sectionClass] = $section->styles();
}
array_unshift($settings, [
'id' => $this->settings->getSettingId('styles'),
'type' => 'mollie_content',
- 'value' => implode($styles)
+ 'value' => implode($styles),
]);
return $settings;
}
diff --git a/src/Settings/Page/PageAdvancedSettings.php b/src/Settings/Page/PageAdvancedSettings.php
index 5f21e8b09..8f9aaadab 100644
--- a/src/Settings/Page/PageAdvancedSettings.php
+++ b/src/Settings/Page/PageAdvancedSettings.php
@@ -4,15 +4,36 @@
namespace Mollie\WooCommerce\Settings\Page;
-class PageAdvancedSettings extends AbstractPage {
+use Mollie\WooCommerce\Settings\Page\Section\Advanced;
+use Mollie\WooCommerce\Settings\Page\Section\ConnectionFields;
+use Mollie\WooCommerce\Settings\Page\Section\Header;
+use Mollie\WooCommerce\Settings\Page\Section\Notices;
+use Mollie\WooCommerce\Settings\Page\Section\Tabs;
- public function isTab(): bool
+class PageAdvancedSettings extends AbstractPage
+{
+ public static function isTab(): bool
{
- // TODO: Implement isTab() method.
+ return true;
}
- public function slug(): string
+ public static function tabName(): string
+ {
+ return __('Advanced settings', 'mollie-payments-for-woocommerce');
+ }
+
+ public static function slug(): string
{
return 'mollie_advanced';
}
+
+ public function sections(): array
+ {
+ return [
+ Header::class,
+ Notices::class,
+ Tabs::class,
+ Advanced::class
+ ];
+ }
}
diff --git a/src/Settings/Page/PageApiKeys.php b/src/Settings/Page/PageApiKeys.php
index b393248c5..99fcd7b56 100644
--- a/src/Settings/Page/PageApiKeys.php
+++ b/src/Settings/Page/PageApiKeys.php
@@ -4,15 +4,38 @@
namespace Mollie\WooCommerce\Settings\Page;
-class PageApiKeys extends AbstractPage {
+use Mollie\WooCommerce\Settings\Page\Section\ConnectionFields;
+use Mollie\WooCommerce\Settings\Page\Section\Header;
+use Mollie\WooCommerce\Settings\Page\Section\InstructionsNotConnected;
+use Mollie\WooCommerce\Settings\Page\Section\InstructionsConnected;
+use Mollie\WooCommerce\Settings\Page\Section\Notices;
+use Mollie\WooCommerce\Settings\Page\Section\Tabs;
- public function isTab(): bool
+class PageApiKeys extends AbstractPage
+{
+ public static function isTab(): bool
{
- // TODO: Implement isTab() method.
+ return true;
}
- public function slug(): string
+ public static function slug(): string
{
return 'mollie_api_keys';
}
+
+ public static function tabName(): string
+ {
+ return __('API keys', 'mollie-payments-for-woocommerce');
+ }
+
+ public function sections(): array
+ {
+ return [
+ Header::class,
+ Notices::class,
+ Tabs::class,
+ InstructionsConnected::class,
+ ConnectionFields::class,
+ ];
+ }
}
diff --git a/src/Settings/Page/PageNoApiKey.php b/src/Settings/Page/PageNoApiKey.php
index 4763e18df..172b01ca0 100644
--- a/src/Settings/Page/PageNoApiKey.php
+++ b/src/Settings/Page/PageNoApiKey.php
@@ -6,16 +6,17 @@
use Mollie\WooCommerce\Settings\Page\Section\ConnectionFields;
use Mollie\WooCommerce\Settings\Page\Section\Header;
-use Mollie\WooCommerce\Settings\Page\Section\Instructions;
+use Mollie\WooCommerce\Settings\Page\Section\InstructionsNotConnected;
use Mollie\WooCommerce\Settings\Page\Section\Notices;
-class PageNoApiKey extends AbstractPage {
- public function isTab(): bool
+class PageNoApiKey extends AbstractPage
+{
+ public static function isTab(): bool
{
- // TODO: Implement isTab() method.
+ return false;
}
- public function slug(): string
+ public static function slug(): string
{
return 'mollie_no_api_key';
}
@@ -25,8 +26,8 @@ public function sections(): array
return [
Header::class,
Notices::class,
- Instructions::class,
- ConnectionFields::class
+ InstructionsNotConnected::class,
+ ConnectionFields::class,
];
}
}
diff --git a/src/Settings/Page/PagePaymentMethods.php b/src/Settings/Page/PagePaymentMethods.php
index f15c9f460..04eb9d684 100644
--- a/src/Settings/Page/PagePaymentMethods.php
+++ b/src/Settings/Page/PagePaymentMethods.php
@@ -4,15 +4,37 @@
namespace Mollie\WooCommerce\Settings\Page;
-class PagePaymentMethods extends AbstractPage {
+use Mollie\WooCommerce\Settings\Page\Section\ConnectionStatusFields;
+use Mollie\WooCommerce\Settings\Page\Section\Header;
+use Mollie\WooCommerce\Settings\Page\Section\Notices;
+use Mollie\WooCommerce\Settings\Page\Section\PaymentMethods;
+use Mollie\WooCommerce\Settings\Page\Section\Tabs;
- public function isTab(): bool
+class PagePaymentMethods extends AbstractPage
+{
+ public static function isTab(): bool
{
- // TODO: Implement isTab() method.
+ return true;
}
- public function slug(): string
+ public static function tabName(): string
+ {
+ return __('Payment methods', 'mollie-payments-for-woocommerce');
+ }
+
+ public static function slug(): string
{
return 'mollie_payment_methods';
}
+
+ public function sections(): array
+ {
+ return [
+ Header::class,
+ Notices::class,
+ Tabs::class,
+ ConnectionStatusFields::class,
+ PaymentMethods::class,
+ ];
+ }
}
diff --git a/src/Settings/Page/Section/AbstractSection.php b/src/Settings/Page/Section/AbstractSection.php
index 89549ae76..2a47e23c8 100644
--- a/src/Settings/Page/Section/AbstractSection.php
+++ b/src/Settings/Page/Section/AbstractSection.php
@@ -5,21 +5,47 @@
namespace Mollie\WooCommerce\Settings\Page\Section;
use Mollie\WooCommerce\Settings\Settings;
+use Mollie\WooCommerce\Shared\Data;
abstract class AbstractSection
{
protected Settings $settings;
protected string $pluginUrl;
+ protected string $currentSection;
+ protected bool $connectionStatus;
+ protected bool $testModeEnabled;
+ protected array $pages;
+ protected array $mollieGateways;
+ protected array $paymentMethods;
+ protected Data $dataHelper;
+
+ public function __construct(
+ Settings $settings,
+ string $pluginUrl,
+ array $pages,
+ string $currentSection,
+ bool $connectionStatus,
+ bool $testModeEnabled,
+ array $mollieGateways,
+ array $paymentMethods,
+ Data $dataHelper
+ ) {
- public function __construct(Settings $settings, string $pluginUrl)
- {
$this->settings = $settings;
$this->pluginUrl = $pluginUrl;
+ $this->currentSection = $currentSection;
+ $this->connectionStatus = $connectionStatus;
+ $this->testModeEnabled = $testModeEnabled;
+ $this->pages = $pages;
+ $this->mollieGateways = $mollieGateways;
+ $this->paymentMethods = $paymentMethods;
+ $this->dataHelper = $dataHelper;
}
abstract public function config(): array;
- public function styles(): string{
+ public function styles(): string
+ {
return '';
}
diff --git a/src/Settings/Page/Section/Advanced.php b/src/Settings/Page/Section/Advanced.php
new file mode 100644
index 000000000..e8a4637ac
--- /dev/null
+++ b/src/Settings/Page/Section/Advanced.php
@@ -0,0 +1,231 @@
+ $this->settings->getSettingId('title'),
+ 'title' => __('Mollie advanced settings', 'mollie-payments-for-woocommerce'),
+ 'type' => 'title',
+ 'desc' => '
' . __('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('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' => $this->settings->getSettingId(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' => $this->settings->getSettingId('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' => $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(
+ '
',
+ $label,
+ substr($label, 1, -1),
+ $labelDescription
+ );
+ },
+ array_keys($this->paymentDescriptionLabels()),
+ $this->paymentDescriptionLabels()
+ )),
+ sprintf(
+ /* translators: Placeholder 1: Opening paragraph tag, placeholder 2: Closing paragraph tag */
+ __(
+ 'Select among the available variables the description to be used for this transaction.%1$s(Note: this only works when the method is set to Payments API)%2$s',
+ 'mollie-payments-for-woocommerce'
+ ),
+ '
',
+ '
'
+ )
+ ),
+ ],
+ [
+ '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'
); ?>
= __("Mollie API Keys", 'mollie-payments-for-woocommerce'); ?>
+
+ = 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'
+ );
+ ?>
+
= __("Mollie API Keys", 'mollie-payments-for-woocommerce'); ?>
= __(
- "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
= sprintf(
- __(
- "Log in to your Mollie Dashboard",
- 'mollie-payments-for-woocommerce'
- ),
- 'https://my.mollie.com/dashboard/login?lang=en'
+ __(
+ "Log in to your Mollie Dashboard",
+ 'mollie-payments-for-woocommerce'
+ ),
+ 'https://my.mollie.com/dashboard/login?lang=en'
); ?>
@@ -52,16 +52,16 @@ protected function content(): string
= __(
- "Paste the copied API key into the Live API key or Test API key fields below.",
- '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
+ "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'
); ?>