-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from dbrax/paymycheckout
Merge current updates
- Loading branch information
Showing
4 changed files
with
64 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ | |
* Loads and defines the internationalization files for this plugin | ||
* so that it is ready for translation. | ||
* | ||
* @link https://github.com/dbrax/wopay | ||
* @link https://github.com/dbrax/paymycheckout | ||
* @since 1.0.0 | ||
* | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
*/ | ||
|
||
/** | ||
|
@@ -20,11 +20,11 @@ | |
* so that it is ready for translation. | ||
* | ||
* @since 1.0.0 | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
* @author Emmanuel Mnzava <[email protected]> | ||
*/ | ||
class Wc_wopay_mpesa_gateway extends WC_Payment_Gateway | ||
class Wc_paymycheckout_mpesa_gateway extends WC_Payment_Gateway | ||
{ | ||
|
||
|
||
|
@@ -35,40 +35,40 @@ class Wc_wopay_mpesa_gateway extends WC_Payment_Gateway | |
public function __construct() | ||
{ | ||
|
||
// $this->id = 'wopay-mpesa'; // payment gateway plugin ID | ||
// $this->icon = ''; // URL of the icon that will be displayed on checkout page near your gateway name | ||
// $this->has_fields = true; // in case you need a custom credit card form | ||
// $this->method_title = 'Wopay Gateway (coming soon)'; | ||
// $this->method_description = 'An online wordpress payment gateway'; // will be displayed on the options page | ||
|
||
// $this->id = 'paymycheckout-mpesa'; // payment gateway plugin ID | ||
// $this->icon = ''; // URL of the icon that will be displayed on checkout page near your gateway name | ||
// $this->has_fields = true; // in case you need a custom credit card form | ||
// $this->method_title = 'paymycheckout Gateway (coming soon)'; | ||
// $this->method_description = 'An online wordpress payment gateway'; // will be displayed on the options page | ||
|
||
// gateways can support subscriptions, refunds, saved payment methods, | ||
// but in this tutorial we begin with simple payments | ||
//$this->supports = array( | ||
// 'products' | ||
// ); | ||
// 'products' | ||
// ); | ||
|
||
// Method with all the options fields | ||
// $this->init_form_fields(); | ||
// $this->init_form_fields(); | ||
|
||
// Load the settings. | ||
// $this->init_settings(); | ||
// $this->title = $this->get_option('title'); | ||
// $this->description = $this->get_option('description'); | ||
// $this->testmode = 'yes' === $this->get_option('testmode'); | ||
// $this->private_key = $this->testmode ? $this->get_option('test_private_key') : $this->get_option('private_key'); | ||
// $this->publishable_key = $this->testmode ? $this->get_option('test_publishable_key') : $this->get_option('publishable_key'); | ||
// $this->init_settings(); | ||
// $this->title = $this->get_option('title'); | ||
// $this->description = $this->get_option('description'); | ||
// $this->testmode = 'yes' === $this->get_option('testmode'); | ||
// $this->private_key = $this->testmode ? $this->get_option('test_private_key') : $this->get_option('private_key'); | ||
// $this->publishable_key = $this->testmode ? $this->get_option('test_publishable_key') : $this->get_option('publishable_key'); | ||
|
||
|
||
// $this->webhookname = "paymentcomplete"; | ||
|
||
// This action hook saves the settings | ||
// add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); | ||
// add_action('woocommerce_update_options_payment_gateways_' . $this->id, array($this, 'process_admin_options')); | ||
|
||
// We need custom JavaScript to obtain a token | ||
//add_action( 'wp_enqueue_scripts', array( $this, 'payment_scripts' ) ); | ||
// add_action('woocommerce_api_' . $this->webhookname, array($this, 'webhook')); | ||
// $this->load_dependencies(); | ||
// add_action('woocommerce_api_' . $this->webhookname, array($this, 'webhook')); | ||
// $this->load_dependencies(); | ||
} | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ | |
* Loads and defines the internationalization files for this plugin | ||
* so that it is ready for translation. | ||
* | ||
* @link https://github.com/dbrax/wopay | ||
* @link https://github.com/dbrax/paymycheckout | ||
* @since 1.0.0 | ||
* | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
*/ | ||
|
||
/** | ||
|
@@ -20,11 +20,11 @@ | |
* so that it is ready for translation. | ||
* | ||
* @since 1.0.0 | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
* @author Emmanuel Mnzava <[email protected]> | ||
*/ | ||
class Wc_wopay_tigopesa_gateway extends WC_Payment_Gateway | ||
class Wc_paymycheckout_tigopesa_gateway extends WC_Payment_Gateway | ||
{ | ||
|
||
|
||
|
@@ -35,10 +35,10 @@ class Wc_wopay_tigopesa_gateway extends WC_Payment_Gateway | |
public function __construct() | ||
{ | ||
|
||
$this->id = 'wopay'; // payment gateway plugin ID | ||
$this->id = 'paymycheckout'; // payment gateway plugin ID | ||
$this->icon = ''; // URL of the icon that will be displayed on checkout page near your gateway name | ||
$this->has_fields = true; // in case you need a custom credit card form | ||
$this->method_title = 'Wopay Gateway'; | ||
$this->method_title = 'paymycheckout Gateway'; | ||
$this->method_description = 'An online wordpress payment gateway'; // will be displayed on the options page | ||
|
||
// gateways can support subscriptions, refunds, saved payment methods, | ||
|
@@ -277,7 +277,7 @@ public function webhook() | |
|
||
header('HTTP/1.1 200 OK'); | ||
echo "callback" . json_encode($_GET); | ||
$order = wc_get_order( $_GET['id'] ); | ||
$order = wc_get_order($_GET['id']); | ||
$order->payment_complete(); | ||
$order->reduce_order_stock(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,11 @@ | |
* Loads and defines the internationalization files for this plugin | ||
* so that it is ready for translation. | ||
* | ||
* @link https://github.com/dbrax/wopay | ||
* @link https://github.com/dbrax/paymycheckout | ||
* @since 1.0.0 | ||
* | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
*/ | ||
|
||
/** | ||
|
@@ -20,21 +20,22 @@ | |
* so that it is ready for translation. | ||
* | ||
* @since 1.0.0 | ||
* @package wopay | ||
* @subpackage wopay/libs | ||
* @package paymycheckout | ||
* @subpackage paymycheckout/libs | ||
* @author Emmanuel Mnzava <[email protected]> | ||
*/ | ||
class wopay_gateway { | ||
class paymycheckout_gateway | ||
{ | ||
|
||
|
||
/** | ||
* The ID of this plugin. | ||
* | ||
* @since 1.0.0 | ||
* @access private | ||
* @var string $wopay The ID of this plugin. | ||
* @var string $paymycheckout The ID of this plugin. | ||
*/ | ||
private $wopay; | ||
private $paymycheckout; | ||
|
||
/** | ||
* The version of this plugin. | ||
|
@@ -49,43 +50,36 @@ class wopay_gateway { | |
* Initialize the class and set its properties. | ||
* | ||
* @since 1.0.0 | ||
* @param string $wopay The name of this plugin. | ||
* @param string $paymycheckout The name of this plugin. | ||
* @param string $version The version of this plugin. | ||
*/ | ||
public function __construct( $wopay, $version ) { | ||
|
||
$this->wopay = $wopay; | ||
$this->version = $version; | ||
|
||
|
||
|
||
public function __construct($paymycheckout, $version) | ||
{ | ||
|
||
$this->paymycheckout = $paymycheckout; | ||
$this->version = $version; | ||
} | ||
|
||
|
||
public function wopay_gateways($gateways ){ | ||
$gateways[] = 'Wc_wopay_tigopesa_gateway'; // your class name is here | ||
// array_push($gateways,'Wc_wopay_mpesa_gateway'); | ||
return $gateways; | ||
|
||
} | ||
|
||
|
||
|
||
public function wopay_init_gateway_class(){ | ||
if(class_exists("WC_Payment_Gateway")){ | ||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'libs/Wc_wopay_tigopesa_gateway.php'; | ||
require_once plugin_dir_path( dirname( __FILE__ ) ) . 'libs/Wc_wopay_mpesa_gateway.php'; | ||
|
||
$gateway_init=new Wc_wopay_tigopesa_gateway(); | ||
//$gateway_init=new Wc_wopay_mpesa_gateway(); | ||
|
||
public function paymycheckout_gateways($gateways) | ||
{ | ||
$gateways[] = 'Wc_paymycheckout_tigopesa_gateway'; // your class name is here | ||
// array_push($gateways,'Wc_paymycheckout_mpesa_gateway'); | ||
return $gateways; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
public function paymycheckout_init_gateway_class() | ||
{ | ||
if (class_exists("WC_Payment_Gateway")) { | ||
require_once plugin_dir_path(dirname(__FILE__)) . 'libs/Wc_paymycheckout_tigopesa_gateway.php'; | ||
require_once plugin_dir_path(dirname(__FILE__)) . 'libs/Wc_paymycheckout_mpesa_gateway.php'; | ||
|
||
$gateway_init = new Wc_paymycheckout_tigopesa_gateway(); | ||
//$gateway_init=new Wc_paymycheckout_mpesa_gateway(); | ||
|
||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters