Skip to content

Commit

Permalink
Merge pull request #5 from dbrax/paymycheckout
Browse files Browse the repository at this point in the history
Merge current updates
  • Loading branch information
dbrax authored Jun 19, 2022
2 parents f6f8b0d + ac2f753 commit 13089fe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 70 deletions.
48 changes: 24 additions & 24 deletions libs/Wc_paymycheckout_mpesa_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand All @@ -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
{


Expand All @@ -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();
}

/**
Expand Down
18 changes: 9 additions & 9 deletions libs/Wc_paymycheckout_tigopesa_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand All @@ -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
{


Expand All @@ -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,
Expand Down Expand Up @@ -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();

Expand Down
64 changes: 29 additions & 35 deletions libs/class-paymycheckout-addgateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/**
Expand All @@ -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.
Expand All @@ -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();


}
}
}
4 changes: 2 additions & 2 deletions paymycheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
* that starts the plugin.
*
* @link https://wordpress.org/plugins/paymycheckout
* @since 1.0.0
* @since 1.0.1
* @package paymycheckout
*
* @wordpress-plugin
* Plugin Name: paymycheckout
* Plugin URI:
* Description: This is a simple Mobile Money (Tigopesa) WooCommerce payment gateway that allows customers to send the shop owner the payment on mobile phone number.
* Version: 1.0.0
* Version: 1.0.1
* Author: Emmanuel Mnzava
* Author URI: https://profiles.wordpress.org/epmnzava
* License: GPLv3
Expand Down

0 comments on commit 13089fe

Please sign in to comment.