II. Construct

__construct()

public function __construct() {
	// Define gateway id
	$this->unique_id = 'sample_withdrawal';


/* ADMIN */

	// Add gateway option to admin
	add_action( 'wpj_after_admin_paypal_settings_fields', function() {
		if ( class_exists( 'Redux' ) ) {
			Redux::setSection( 'jobster_settings', array(
				'id'         => 'sample-withdrawal-settings',
				'title'      => __( 'Sample Withdrawal', 'wpjobster-sample' ),
				'desc'       => __( 'Sample Withdrawal Settings', 'wpjobster-sample' ),
				'subsection' => true,
				'fields'     => wpj_get_gateway_default_fields(
					array(
						'gateway_id'           => 'sample_withdrawal',
						'gateway_name'         => 'Sample Withdrawal',
						'gateway_version'      => WPJ_SAMPLE_WITHDRAWAL_VERSION,
						'enable'               => false,
						'enable_sandbox'       => false,
						'exclude_payment_type' => array( 'job_purchase', 'topup', 'featured', 'withdraw', 'custom_extra', 'tips', 'subscription' ),
						'public_key'           => false,
						'secret_key'           => false,
						'button_name'          => false,
						'succes_page_url'      => false,
						'fail_page_url'        => false,
						'new_fields'           => array(
							array(
								'unique_id' => 'wpjobster_sample_withdrawal_enable',
								'type'      => 'select',
								'title'     => __( 'Enable', 'wpjobster-sample' ),
								'options'   => array(
									'disabled'  => __( 'Disabled', 'wpjobster-sample' ),
									'manual'    => __( 'Manual', 'wpjobster-sample' ),
									'automatic' => __( 'Automatic', 'wpjobster-sample' ),
									'both'      => __( 'Both', 'wpjobster-sample' )
								),
								'default'  => 'both'
							),
							array(
								'unique_id' => 'wpjobster_sample_withdrawal_enablesandbox',
								'type'      => 'switch',
								'title'     => __( 'Enable sandbox', 'wpjobster-sample' ),
								'default'   => false,
								'required' => array( 'wpjobster_sample_withdrawal_enable', '=', array( 'automatic', 'both' ) )
							),
							array(
								'unique_id' => 'sample-withdrawal-keys-settings-section',
								'type'      => 'section',
								'title'     => esc_html__( 'Keys', 'wpjobster-sample' ),
								'indent'    => true,
							),
							array(
								'unique_id' => 'wpjobster_sample_client_id',
								'type'      => 'text',
								'title'     => __( 'Sample client ID', 'wpjobster-sample' ),
							),
							array(
								'unique_id' => 'wpjobster_sample_secret_key',
								'type'      => 'text',
								'title'     => __( 'Sample secret key', 'wpjobster-sample' )
							)
						)
					)
				)
			) );
		}
	});

	// Save options for manual and automatic
	add_action( 'redux/options/jobster_settings/saved', array( $this, 'saveExtraAdminOptions' ) );

	// Show 'Mark automatically as completed' button to admin orders - pending tab only
	add_action( 'wpj_show_hide_automatic_withdrawal_button_filter', array( $this, 'displayAdminAutomaticWithdrawalButton' ), 10, 2 );

	// Show 'Process withdrawal' button to admin orders - pending tab only
	add_action( 'wpj_after_admin_orders_tfoot_buttons', array( $this, 'displayProcessPaymentRequestButton' ) );

	// Process withdrawal order
	add_action( 'wpj_before_admin_orders_content', array( $this, 'processPaymentRequest' ), 11 );



/* WITHDRAWAL */

	// Add gateway to withdrawal gateways
	add_filter( 'wpj_withdrawals_gateways_filter', function( $gateways ) { array_push( $gateways, 'sample' ); return $gateways; }, 10, 1 );
	add_filter( 'wpj_only_withdrawals_gateways_filter', function( $gateways ) { array_push( $gateways, 'sample' ); return $gateways; }, 10, 1 );
	add_filter( 'wpj_withdrawals_gateways_filter', function( $gateways ) { array_push( $gateways, 'sample_automatic' ); return $gateways; }, 10, 1 );
	add_filter( 'wpj_only_withdrawals_gateways_filter', function( $gateways ) { array_push( $gateways, 'sample_automatic' ); return $gateways; }, 10, 1 );

	// Set gateway withdrawal name to database
	add_filter( 'wpjobster_withdraw_method_filter', function ( $method ) {
		if ( $_POST['method'] == 'sample_withdraw' ) $method = "Sample";
		return $method;
	});


/* FRONT */

	// Add gateway to payments page > request withdrawal list
	add_filter( 'wpj_withdrawals_gateways_info_filter', array( $this, 'addGatewayToPaymentsWithdrawalList' ) );

	// Add details input to payments page > request withdrawal list
	add_action( 'wpj_after_withdrawal_gateways_list_details_input', array( $this, 'addGatewayDetailsInputToPaymentsWithdrawalList' ), 10, 1 );

	// Gateway inline styles - use this action if you need to add small styles for your gateway
	add_action( 'wp_enqueue_scripts', function() {
		$style = '.your-class{display:block;}';
		wp_add_inline_style( 'semantic-ui-css', $style );
	});

	// Shortcode settings fields - use this shortcode to show the settings fields to theme settings page
	add_shortcode( 'sample_settings_fields', array( $this, 'addGatewayDetailsInputToSettingsPaymentsList' ) );


/* SETTINGS */

	// Set plugin compatibility - prevents the plugin from activating on other themes
	add_action( 'admin_notices', array( $this, 'checkCompatibility' ) );

	// Set plugin action link
	add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), function ( $links ) {
		return function_exists( 'wpj_generate_settings_link' ) ? array_merge( array( wpj_generate_settings_link( 'sample-withdrawal' ) ), $links ) : $links;
	});

	// Set plugin textdomain
	add_action( 'plugins_loaded', function () {
		load_plugin_textdomain( 'wpjobster-sample', false, trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
	}, 0 );

	// Gateway name translatable
	add_filter( 'wpjobster_database_strings_filter', function( $strings ) {
		$strings['sample_withdrawal'] = _x( 'Sample Withdrawal', 'Sample Withdrawal gateway', 'wpjobster-sample-withdrawal' );
		return $strings;
	}, 10, 1 );

	// Add gateway to all plugins list
	add_filter( 'wpj_withdrawal_gateways_plugins_folder_list_filter', function( $plugins ) {
		$plugins[] = 'wpjobster-sample-withdrawal';
		return $plugins;
	});
}

$this->unique_id - This is the lowercase name of your gateway and it really needs to be unique.


checkCompatibility()

public function checkCompatibility() {
	if ( ! function_exists( 'wpj_get_wpjobster_plugins_list' ) && ! defined( 'wpjobster_VERSION' ) )
		$error = sprintf( __( 'The current theme is not compatible with the %s gateway. Activate the WPJobster theme before installing this plugin.', 'wpjobster' ), $this->unique_id );

	if ( ! empty( $error ) && is_plugin_active( plugin_basename( __FILE__ ) ) ) {

		deactivate_plugins( plugin_basename( __FILE__ ), true ); ?>

		<div data-dismissible="compatibility-theme-notice" class="notice notice-error is-dismissible"><p><?php echo $error; ?></p></div>

		<?php if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] );

	}

	do_action( 'wpj_after_plugin_compatibility_errors', WPJ_SAMPLE_WITHDRAWAL_VERSION, 'Sample Withdrawal', plugin_basename( __FILE__ ), WPJ_SAMPLE_WITHDRAWAL_REQUIRED_THEME_VERSION );
}

This function checks if the gateway is compatible with the theme activated on the site, and if not, it will display a message and will not allow the plugin to be activated until the WPJobster theme is activated