/** * Renders an admin notices, along with displaying a message on the plugins list table * when activating/deactivating legacy SIM gateway * * @since 3.0 * @see SV_WC_Plugin::render_admin_notices() */ public function render_admin_notices() { parent::render_admin_notices(); if (!empty($_GET['wc_authorize_net_aim_sim_active'])) { if ('activate' == $_GET['wc_authorize_net_aim_sim_active']) { echo '<div class="updated"><p>' . sprintf(__("%sLegacy Authorize.net SIM gateway is now active.%s", self::TEXT_DOMAIN), '<strong>', '</strong>') . '</p></div>'; } else { echo '<div class="updated"><p>' . sprintf(__("%sLegacy Authorize.net SIM gateway is now deactive.%s", self::TEXT_DOMAIN), '<strong>', '</strong>') . '</p></div>'; } } }
/** * 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')); } } }
/** * Setup main plugin class * * @since 1.0 */ public function __construct() { parent::__construct(self::PLUGIN_ID, self::VERSION, array('gateways' => array(self::CREDIT_CARD_GATEWAY_ID => self::CREDIT_CARD_GATEWAY_CLASS_NAME), 'dependencies' => array('SimpleXML', 'xmlwriter', 'dom', 'iconv'), 'require_ssl' => true, 'supports' => array(self::FEATURE_CUSTOMER_ID, self::FEATURE_CAPTURE_CHARGE, self::FEATURE_MY_PAYMENT_METHODS))); // Load gateway files after woocommerce is loaded add_action('sv_wc_framework_plugins_loaded', array($this, 'includes'), 11); add_action('init', array($this, 'include_template_functions'), 25); if (is_admin() && !is_ajax()) { // render the "View Transaction" link in the order edit page add_action('admin_footer-post.php', array($this, 'render_view_transaction_form')); add_action('admin_init', array($this, 'enqueue_order_admin_js')); } }