1. Home
  2. Jobster
  3. Payment Gateways API
  4. __construct()

__construct()

protected function __construct() {
	$this->priority = 1111;          // 100, 200, 300 [...] are reserved
	$this->unique_slug = 'sample';   // this needs to be unique

	add_action( 'admin_init', 		array( $this, 'check_environment' ) );
	add_action( 'admin_notices', 	array( $this, 'admin_notices' ), 15 );
	add_action( 'plugins_loaded', 	array( $this, 'init_gateways' ), 0 );
	add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 
									array( $this, 'plugin_action_links' ) );

	add_action( 'wpjobster_taketo_sample_gateway', 
									array( $this, 'taketogateway_function' ), 10 );
	add_action( 'wpjobster_processafter_sample_gateway', 
									array( $this, 'processgateway_function' ), 10 );
	if ( isset( $_POST[ 'wpjobster_save_' . $this->unique_slug ] ) ) {
		add_action( 'wpjobster_payment_methods_action', 
									array( $this, 'save_gateway' ), 11 );
	}
}

The class constructor explained:

  1. “priority”:
    The payment gateways are ordered based on this in the admin area and in the sales page. The default gateways are using multiples of 100 as priorities, so a priority between 100 and 200 would place your gateway between the first and the second default gateways.
    It’s better to try something unique, to avoid strange behaviors.
  2. “unique_slug”:
    This is the lowercase name of your gateway and it really needs to be unique.
Was this article helpful to you? Yes No