PluginProbe ʕ •ᴥ•ʔ
GlobalPayments Gateway Provider for WooCommerce / 1.5.0
GlobalPayments Gateway Provider for WooCommerce v1.5.0
1.20.2 1.20.1 1.19.3 1.19.2 1.19.1 1.19.0 1.18.4 1.18.3 trunk 1.0.0 1.0.0-b2 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.6 1.10.7 1.10.8 1.11.0 1.12.0 1.12.1 1.13.0 1.13.1 1.13.2 1.13.3 1.13.4 1.13.7 1.13.8 1.14.0 1.14.1 1.14.2 1.14.3 1.14.4 1.14.5 1.14.6 1.14.7 1.14.8 1.14.9 1.15.0 1.15.2 1.15.4 1.15.5 1.15.6 1.15.8 1.15.9 1.16.0 1.16.1 1.16.2 1.16.3 1.16.4 1.16.5 1.16.6 1.17.0 1.17.1 1.18.0 1.18.1 1.18.2 1.2.0 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5
global-payments-woocommerce / src / Plugin.php
global-payments-woocommerce / src Last commit date
Data 3 years ago Gateways 3 years ago Plugin.php 3 years ago
Plugin.php
100 lines
1 <?php
2 /**
3 * Returns information about the package and handles init.
4 */
5
6 namespace GlobalPayments\WooCommercePaymentGatewayProvider;
7
8 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\HeartlandGateway;
9
10 defined( 'ABSPATH' ) || exit;
11
12 /**
13 * Main plugin class.
14 */
15 class Plugin {
16 /**
17 * Version.
18 *
19 * @var string
20 */
21 const VERSION = '1.5.0';
22
23 /**
24 * Init the package.
25 */
26 public static function init() {
27 load_plugin_textdomain( 'globalpayments-gateway-provider-for-woocommerce', false, self::get_path() . '/languages' );
28
29 if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
30 return;
31 }
32
33 //initialize gift related hooks for Heartland ajax requests
34 if ( true === wp_doing_ajax() || ! empty( $_GET['wc-ajax'] ) ) {
35 $heartlandSettings = get_option( 'woocommerce_globalpayments_heartland_settings' );
36 // prevent checkout blocker when Heartland settings not setted loop
37 if (
38 !empty( $heartlandSettings ) &&
39 'yes' === $heartlandSettings['enabled'] &&
40 'yes' === $heartlandSettings['allow_gift_cards']
41 ) {
42 new HeartlandGateway();
43 }
44 }
45
46 add_filter( 'woocommerce_payment_gateways', array( self::class, 'add_gateways' ) );
47 add_action( 'woocommerce_order_actions', array( Gateways\AbstractGateway::class, 'add_capture_order_action' ) );
48 add_action( 'woocommerce_order_action_capture_credit_card_authorization', array(
49 Gateways\AbstractGateway::class,
50 'capture_credit_card_authorization'
51 ) );
52 }
53
54 /**
55 * Appends our payment gateways to WooCommerce's known list
56 *
57 * @param string[] $methods
58 *
59 * @return string[]
60 */
61 public static function add_gateways( $methods ) {
62 $gateways = array(
63 Gateways\HeartlandGateway::class,
64 Gateways\GeniusGateway::class,
65 Gateways\TransitGateway::class,
66 Gateways\GpApiGateway::class,
67 Gateways\GooglePayGateway::class,
68 Gateways\ApplePayGateway::class,
69 );
70
71 foreach ( $gateways as $gateway ) {
72 $methods[] = $gateway;
73 }
74
75 return $methods;
76 }
77
78 /**
79 * Return the version of the package.
80 *
81 * @return string
82 */
83 public static function get_version() {
84 return self::VERSION;
85 }
86
87 /**
88 * Return the path to the package.
89 *
90 * @return string
91 */
92 public static function get_path() {
93 return dirname( __DIR__ );
94 }
95
96 public static function get_url( $path ) {
97 return plugins_url( $path, dirname( __FILE__ ) );
98 }
99 }
100