ments-for-woocommerce'); $presentationText .= 'Contact info@mollie.com'; $presentationText .= ' if you have any questions or comments about this plugin.
'; $presentationText .= 'Our pricing is always per transaction. No startup fees, no monthly fees, and no gateway fees. No hidden fees, period.
'; $presentation = '' . ''.$presentationText.'
%s
',
'mollie-payments-for-woocommerce'
),
defined('WC_LOG_DIR') ? WC_LOG_DIR
: WC()->plugin_path() . '/logs/'
);
// Global Mollie settings
$mollie_settings = array(
array(
'id' => $this->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') . '
', ), array( 'id' => $this->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 %s API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'), 'live', '', '' ), 'css' => 'width: 350px', 'placeholder' => $live_placeholder = __('Live API key should start with live_', 'mollie-payments-for-woocommerce'), 'custom_attributes' => array( 'placeholder' => $live_placeholder, 'pattern' => '^live_\w{30,}$', ), ), array( 'id' => $this->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'), ), array( 'id' => $this->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 %s API key in your %sMollie profile%s', 'mollie-payments-for-woocommerce'), 'test', '', '' ), 'css' => 'width: 350px', 'placeholder' => $test_placeholder = __('Test API key should start with test_', 'mollie-payments-for-woocommerce'), 'custom_attributes' => array( 'placeholder' => $test_placeholder, 'pattern' => '^test_\w{30,}$', ), ), [ 'id' => $this->getSettingId('debug'), 'title' => __('Debug Log', 'mollie-payments-for-woocommerce'), 'type' => 'checkbox', 'desc' => $debug_desc, 'default' => 'yes', ], array( 'id' => $this->getSettingId('sectionend'), 'type' => 'sectionend', ), ); return $this->mergeSettings($settings, $mollie_settings); } public function getPaymentConfirmationCheckTime() { $time = strtotime(self::DEFAULT_TIME_PAYMENT_CONFIRMATION_CHECK); $date = new DateTime(); if ($date->getTimestamp() > $time){ $date->setTimestamp($time); $date->add(new DateInterval('P1D')); } else { $date->setTimestamp($time); } return $date->getTimestamp(); } /** * @param string $setting * @return string */ protected function getSettingId ($setting) { global $wp_version; $setting_id = Mollie_WC_Plugin::PLUGIN_ID . '_' . trim($setting); $setting_id_length = strlen($setting_id); $max_option_name_length = 191; /** * Prior to WooPress version 4.4.0, the maximum length for wp_options.option_name is 64 characters. * @see https://core.trac.wordpress.org/changeset/34030 */ if ($wp_version < '4.4.0') { $max_option_name_length = 64; } if ($setting_id_length > $max_option_name_length) { trigger_error("Setting id $setting_id ($setting_id_length) to long for database column wp_options.option_name which is varchar($max_option_name_length).", E_USER_WARNING); } return $setting_id; } /** * @param array $settings * @param array $mollie_settings * @return array */ protected function mergeSettings(array $settings, array $mollie_settings) { $new_settings = array(); $mollie_settings_merged = false; // Find payment gateway options index foreach ($settings as $index => $setting) { if (isset($setting['id']) && $setting['id'] == 'payment_gateways_options' && (!isset($setting['type']) || $setting['type'] != 'sectionend') ) { $new_settings = array_merge($new_settings, $mollie_settings); $mollie_settings_merged = true; } $new_settings[] = $setting; } // Mollie settings not merged yet, payment_gateways_options not found if (!$mollie_settings_merged) { // Append Mollie settings $new_settings = array_merge($new_settings, $mollie_settings); } return $new_settings; } /** * @param $content * * @return string */ protected function checkDirectDebitStatus( $content ) { $ideal_gateway = new Mollie_WC_Gateway_iDEAL(); $sepa_gateway = new Mollie_WC_Gateway_DirectDebit(); if ( ( class_exists( 'WC_Subscription' ) ) && ( $ideal_gateway->is_available() ) && ( ! $sepa_gateway->is_available() ) ) { $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 .= '
'; $content .= __( 'To accept Klarna payments via Mollie, all default WooCommerce checkout fields should be enabled and required. Please ensure that is the case.', 'mollie-payments-for-woocommerce' ); $content .= '