From 1f470cdc0275b6aaf3e633bf7b4d5e9b853144c1 Mon Sep 17 00:00:00 2001 From: inpsyde-maticluznar Date: Tue, 8 Oct 2024 06:45:57 +0200 Subject: [PATCH] Remove settings files --- inc/settings/mollie_advanced_settings.php | 207 ---------------------- inc/settings/mollie_applepay_settings.php | 122 ------------- inc/settings/mollie_components.php | 170 ------------------ src/Settings/MollieSettingsPage.php | 52 ------ 4 files changed, 551 deletions(-) delete mode 100644 inc/settings/mollie_advanced_settings.php delete mode 100644 inc/settings/mollie_applepay_settings.php delete mode 100644 inc/settings/mollie_components.php diff --git a/inc/settings/mollie_advanced_settings.php b/inc/settings/mollie_advanced_settings.php deleted file mode 100644 index e108e62d9..000000000 --- a/inc/settings/mollie_advanced_settings.php +++ /dev/null @@ -1,207 +0,0 @@ - 1, 'nonce_mollie_cleanDb' => $nonce_mollie_cleanDb] -); -$api_payment_description_labels = [ - '{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'), -]; - -$mollieAdvancedSettings = [ - [ - 'id' => $pluginName . '_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' => $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( - '

-
-

%1$s:

- -
-
-

%3$s', - _x('Available variables', 'Payment description options', 'mollie-payments-for-woocommerce'), - implode('', array_map( - static function ($label, $label_description) { - return sprintf( - '

  • - -
  • ', - $label, - substr($label, 1, -1), - $label_description - ); - }, - array_keys($api_payment_description_labels), - $api_payment_description_labels - )), - 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' => $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 .= '

    '; - - return $content; - } - - return $content; - } - - /** - * @param $content - * - * @return string - */ - protected function checkMollieBankTransferNotBACS($content): string - { - $woocommerce_banktransfer_gateway = new WC_Gateway_BACS(); - - 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' - ); - $content .= '

    '; - - return $content; - } - - return $content; - } - - /** - * @param $content - * - * @return string - */ }