/** * Returns the WC API URL for this gateway, based on the current protocol * * @since 2.1.0 * @return string the WC API URL for this server */ public function get_transaction_response_handler_url() { if ($this->transaction_response_handler_url) { return $this->transaction_response_handler_url; } $this->transaction_response_handler_url = add_query_arg('wc-api', get_class($this), home_url('/')); // make ssl if needed if (SV_WC_Plugin_Compatibility::wc_checkout_is_https()) { $this->transaction_response_handler_url = str_replace('http:', 'https:', $this->transaction_response_handler_url); } return $this->transaction_response_handler_url; }
/** * Render a notice for the user to select their desired export format * * @since 1.3.3 * @see SV_WC_Plugin::add_admin_notices() */ public function add_admin_notices() { // show any dependency notices parent::add_admin_notices(); $settings = get_option('woocommerce_authorize_net_cim_credit_card_settings'); // install notice if (empty($settings) && !$this->get_admin_notice_handler()->is_notice_dismissed('install-notice')) { $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('Thanks for installing the WooCommerce Authorize.Net CIM Gateway! To start accepting payments, %sset your Authorize.Net API credentials%s. Need help? See the %sdocumentation%s.', 'woocommerce-gateway-authorize-net-cim'), '<a href="' . $this->get_settings_url() . '">', '</a>', '<a target="_blank" href="' . $this->get_documentation_url() . '">', '</a>'), 'install-notice', array('notice_class' => 'updated')); } $gateway = $this->get_gateway(self::CREDIT_CARD_GATEWAY_ID); // bail if gateway is not available, as proper credentials are needed first if (!$gateway->is_available()) { return; } // check if CIM feature is enabled on customer's authorize.net account if (!get_option('wc_authorize_net_cim_feature_enabled')) { if ($gateway->is_cim_feature_enabled()) { update_option('wc_authorize_net_cim_feature_enabled', true); } else { if (!$this->get_admin_notice_handler()->is_notice_dismissed('cim-add-on-notice')) { $this->get_admin_notice_handler()->add_admin_notice(sprintf(__('The CIM Add-On is not enabled on your Authorize.Net account. Please %scontact Authorize.Net%s to enable CIM. You will be unable to process transactions until CIM is enabled. ', 'woocommerce-gateway-authorize-net-cim'), '<a href="http://support.authorize.net" target="_blank">', '</a>'), 'cim-add-on-notice'); } } } if ($gateway->is_accept_js_enabled() && isset($_GET['page']) && 'wc-settings' === $_GET['page']) { $message = ''; if (!$gateway->get_client_key()) { $message = sprintf(__("%s: A valid Client Key is required to use Accept.js at checkout.", 'woocommerce-gateway-authorize-net-cim'), '<strong>' . $this->get_plugin_name() . '</strong>'); } elseif (!SV_WC_Plugin_Compatibility::wc_checkout_is_https()) { $message = sprintf(__("%s: SSL is required to use Accept.js at checkout.", 'woocommerce-gateway-authorize-net-cim'), '<strong>' . $this->get_plugin_name() . '</strong>'); } if ($message) { $this->get_admin_notice_handler()->add_admin_notice($message, 'accept-js-status', array('dismissible' => false, 'notice_class' => 'error')); } } }
/** * Checks if SSL is required and not available and adds a dismissible admin * notice if so. Notice will not be rendered to the admin user once dismissed * unless on the plugin settings page, if any * * @since 3.0.0 * @see SV_WC_Payment_Gateway_Plugin::add_admin_notices() */ protected function add_ssl_admin_notices() { // check settings: gateway active and SSL enabled if ($this->requires_ssl() && $this->get_admin_notice_handler()->should_display_notice('ssl-required')) { foreach ($this->get_gateway_ids() as $gateway_id) { $settings = $this->get_gateway_settings($gateway_id); if (isset($settings['enabled']) && 'yes' == $settings['enabled']) { if (isset($settings['environment']) && 'production' == $settings['environment']) { // SSL check if gateway enabled/production mode if (!SV_WC_Plugin_Compatibility::wc_checkout_is_https()) { /* translators: Placeholders: %s - plugin name */ $message = sprintf(esc_html__("%s: WooCommerce is not being forced over SSL; your customer's payment data may be at risk.", 'woocommerce-plugin-framework'), '<strong>' . $this->get_plugin_name() . '</strong>'); $this->get_admin_notice_handler()->add_admin_notice($message, 'ssl-required', array('notice_class' => 'error')); // just show the message once for plugins with multiple gateway support break; } } } } } }