Hi derekbaehr,
Try the following:
in you r main plugin folder create the init.php file, for example “alliedwallet-init.php” and add the following code to initialize the plugin:
<?php
/**
* Plugin Name: Jigoshop Alliedwallet Gateway
* Plugin URI: Your plugin URI
* Description: Your plugin description
* Version: Version
* Author: Author name
* Author URI: Author URI
*/
if (!defined(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_DIR’)) {
define(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_DIR’, dirname(__FILE__));
}
// Define plugin URL for assets
if (!defined(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_URL’)) {
define(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_URL’, plugins_url(”, __FILE__));
}
// Define plugin name
if (!defined(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_NAME’)) {
define(‘JIGOSHOP_ALLIEDWALLET_INTEGRATION_NAME’, ‘Jigoshop Alliedwallet Integration’);
}
add_action(‘plugins_loaded’, function(){
load_plugin_textdomain(‘jigoshop_alliedwallet_gateway’, false, dirname(plugin_basename(__FILE__)).’/languages/’);
if (class_exists(‘jigoshop’)) {
//Check version.
if(jigoshop_add_required_version_notice(JIGOSHOP_ALLIEDWALLET_INTEGRATION_NAME, ‘1.11’)){
return;
}
//Init components.
require_once(JIGOSHOP_ALLIEDWALLET_INTEGRATION_DIR.’/src/Jigoshop/Gateway/Alliedwallet.php’);
} else {
add_action(‘admin_notices’, function (){
echo ‘<div class=”error”><p>’;
printf(__(‘%s for proper operation requires active Jigoshop plugin.’, ‘jigoshop_boleto_gateway’),JIGOSHOP_ALLIEDWALLET_INTEGRATION_NAME);
echo ‘</p></div>’;
});
}
add_filter( ‘jigoshop_payment_gateways’, function($methods){
$methods[] = ‘\Jigoshop\Gateway\alliedwallet’;
return $methods;
});
});
Create directory “src/Jigoshop/Gateway” and create the php class file name it like you would like e.g Alliedwallet.php open it and add the code below:
<?php
namespace jigoshop\Gateway;
class alliedwallet extends \jigoshop_payment_gateway
{
public function __construct() {
parent::__construct();
$options = \Jigoshop_Base::get_options();
$this->id = ‘jigoshop_alliedwallet_gateway’;
$this->has_fields = true;
$this->enabled = $options->get(‘jigoshop_alliedwallet_enabled’);
$this->title = $options->get(‘jigoshop_alliedwallet_title’);
$this->description = $options->get(‘jigoshop_alliedwallet_description’);
$this->token = $options->get(‘jigoshop_alliedwallet_apitoken’);
$this->streid = $options->get(‘jigoshop_alliedwallet_storeid’);
$this->testMode = $options->get(‘jigoshop_alliedwallet_gateway_testmode’) == ‘yes’ ? ‘true’ : ‘false’;
}
protected function get_default_options()
{
$defaultSettings = array(
array(
‘name’ => __(‘Alliedwallet Payment Gateway’, ‘jigoshop_alliedwallet_gateway’),
‘type’ => ‘title’,
‘desc’ => __(‘Accepting payment through Alliedwallet Gateway’, ‘jigoshop_alliedwallet_gateway’)
),
array(
‘name’ => __(‘Enable Alliedwallet’, ‘jigoshop_alliedwallet_gateway’),
‘desc’ => ”,
‘tip’ => ”,
‘id’ => ‘jigoshop_alliedwallet_enabled’,
‘std’ => ‘yes’,
‘type’ => ‘checkbox’,
‘choices’ => array(
‘no’ => __(‘No’, ‘jigoshop_alliedwallet_gateway’),
‘yes’ => __(‘Yes’, ‘jigoshop_alliedwallet_gateway’)
),
),
array(
‘name’ => __(‘Method Title’, ‘jigoshop_alliedwallet_gateway’),
‘desc’ => __( ” ),
‘tip’ => __(‘This controls the title which the user sees during checkout’, ‘jigoshop_alliedwallet_gateway’),
‘id’ => ‘jigoshop_alliedwallet_title’,
‘std’ => __(‘Alliedwallet’, ‘jigoshop_alliedwallet_gateway’),
‘type’ => ‘text’
),
array(
‘name’ => __(‘Description’, ‘jigoshop_alliedwallet_gateway’),
‘desc’ => __(”, ”),
‘tip’ => __(‘This controls the description which user sees during checkout’, ‘jigoshop_eselect_gateway’),
‘std’ => __(‘Pay via Alliedwallet Gateway’, ‘jigoshop_alliedwallet_gateway’),
‘id’ => ‘jigoshop_alliedwallet_description’,
‘type’ => ‘textarea’
),
array(
‘name’ => __(‘Store ID’, ‘jigoshop_alliedwallet_gateway’),
‘desc’ => ”,
‘tip’ => __(‘Please enter Your Store ID, this allows You in order to take a payment’, ‘jigoshop_alliedwallet_gateway’),
‘id’ => ‘jigoshop_alliedwallet_storeid’,
‘type’ => ‘text’
),
array(
‘name’ => __(‘API Token’, ‘jigoshop_alliedwallet_gateway’),
‘desc’ => ”,
‘tip’ => __(‘Please enter Your API Token, this allows You in order to take a payment’, ‘jigoshop_alliedwallet_gateway’),
‘id’ => ‘jigoshop_alliedwallet_apitoken’,
‘type’ => ‘text’
),
);
return $defaultSettings;
}
/*
* Process the payment
*/
public function process_payment( $order_id )
{
}
/*
* receipt_page
*/
function receipt_page( $order ) {
}
}
This should be ok for you, of course you will need to rename the settings as you like, I will not be specific to where as I believe you already know that ??