id = 'Click'; $this->method_title = __('Click', 'woothemes'); $this->icon = ''; $this->has_fields = false; // Load the form fields. $this->init_form_fields(); // Load the settings. $this->init_settings(); // Define user set variables $this->title = $this->settings['title']; $this->description = $this->settings['description']; $this->test_mode = $this->settings['test_mode']; $this->access_userid = $this->settings['access_userid']; $this->access_accountid = $this->settings['access_accountid']; $this->access_password = $this->settings['access_password']; // test mode if($this->test_mode === 'yes'){ $this->access_url = 'uat.paymarkclick.co.nz'; } else { $this->access_url = 'secure.paymarkclick.co.nz'; } $Click_Userid = $this->access_userid; $Click_Accountid = $this->access_accountid; $Click_Password = $this->access_password; $this->click = new Click_OpenSSL( $this->access_url, $Click_Userid, $Click_Accountid, $Click_Password ); // Actions add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'plugin_action_links' ) ); /* Hook IPN callback logic*/ if (version_compare (WOOCOMMERCE_VERSION, '2.0', '<')) add_action('init', array(&$this, 'check_click_callback')); else add_action( 'woocommerce_api_' . strtolower( get_class( $this ) ), array( $this, 'check_click_callback' ) ); add_action( 'woocommerce_receipt_' . $this->id, array($this, 'receipt_page')); add_action( 'valid-click-callback', array(&$this, 'successful_request') ); add_action( 'woocommerce_email_before_order_table', array($this, 'email_instructions'), 10, 2); /* 1.6.6 */ add_action( 'woocommerce_update_options_payment_gateways', array( $this, 'process_admin_options' ) ); /* 2.0.0 */ add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) ); /* initiation of logging instance */ $this->log = new WC_Logger(); } /** * Add relevant links to plugins page * @param array $links * @return array */ public function plugin_action_links( $links ) { $plugin_links = array( '' . __( 'Settings', 'woocommerce-gateway-click' ) . '', '' . __( 'Support', 'woocommerce-gateway-click' ) . '', '' . __( 'Docs', 'woocommerce-gateway-click' ) . '', ); return array_merge( $plugin_links, $links ); } /** * Initialise Gateway Settings Form Fields */ function init_form_fields() { $default_site_name = home_url() ; $this->form_fields = array( 'enabled' => array( 'title' => __( 'Enable/Disable', 'woothemes' ), 'type' => 'checkbox', 'label' => __( 'Enable Click™', 'woothemes' ), 'default' => 'yes' ), 'title' => array( 'title' => __( 'Title', 'woothemes' ), 'type' => 'text', 'description' => __( 'This controls the title which the user sees during checkout.', 'woothemes' ), 'default' => __( 'Click™', 'woothemes' ), 'css' => 'width: 400px;' ), 'description' => array( 'title' => __( 'Description', 'woothemes' ), 'type' => 'textarea', 'description' => __( 'This controls the description which the user sees during checkout.', 'woothemes' ), 'default' => __("Allows payments by Click™", 'woothemes') ), 'test_mode' => array( 'title' => __( 'Test mode', 'woothemes' ), 'type' => 'checkbox', 'label' => __( 'Enable test mode', 'woothemes' ), 'default' => 'no' ), 'access_userid' => array( 'title' => __( 'Click™ User Name', 'woothemes' ), 'type' => 'text', 'default' => '', 'css' => 'width: 400px;' ), 'access_accountid' => array( 'title' => __( 'Click™ Account ID', 'woothemes' ), 'type' => 'text', 'default' => '', 'css' => 'width: 400px;' ), 'access_password' => array( 'title' => __( 'Click™ Password', 'woothemes' ), 'type' => 'password', 'default' => '', 'css' => 'width: 400px;' ) ); } // End init_form_fields() /** * Admin Panel Options * - Options for bits like 'title' and availability on a country-by-country basis * * @since 1.0.0 */ public function admin_options() { ?>