PluginProbe ʕ •ᴥ•ʔ
GlobalPayments Gateway Provider for WooCommerce / 1.9.4
GlobalPayments Gateway Provider for WooCommerce v1.9.4
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 2 years ago PaymentMethods 2 years ago Utils 3 years ago Plugin.php 2 years ago
Plugin.php
103 lines
1 <?php
2 /**
3 * Returns information about the package and handles init.
4 */
5
6 namespace GlobalPayments\WooCommercePaymentGatewayProvider;
7
8 use GlobalPayments\Api\Gateways\Gateway;
9 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\GpApiGateway;
10 use GlobalPayments\WooCommercePaymentGatewayProvider\Gateways\HeartlandGateway;
11
12 defined( 'ABSPATH' ) || exit;
13
14 /**
15 * Main plugin class.
16 */
17 class Plugin {
18 /**
19 * Version.
20 *
21 * @var string
22 */
23 const VERSION = '1.9.4';
24
25 /**
26 * Init the package.
27 */
28 public static function init() {
29 load_plugin_textdomain( 'globalpayments-gateway-provider-for-woocommerce', false, self::get_path() . '/languages' );
30
31 if ( ! class_exists( 'WC_Payment_Gateway' ) ) {
32 return;
33 }
34
35 //initialize gift related hooks for Heartland ajax requests
36 if ( true === wp_doing_ajax() || ! empty( $_GET['wc-ajax'] ) ) {
37 $heartlandSettings = get_option( 'woocommerce_' . HeartlandGateway::GATEWAY_ID . '_settings' );
38 // prevent checkout blocker when Heartland settings not set loop
39 if (
40 ! empty( $heartlandSettings ) &&
41 isset( $heartlandSettings['enabled'] ) &&
42 'yes' === $heartlandSettings['enabled'] &&
43 isset( $heartlandSettings['allow_gift_cards'] ) &&
44 'yes' === $heartlandSettings['allow_gift_cards']
45 ) {
46 new HeartlandGateway();
47 }
48 }
49
50 add_filter( 'woocommerce_payment_gateways', array( self::class, 'add_gateways' ) );
51 add_action( 'woocommerce_order_actions', array( Gateways\AbstractGateway::class, 'add_capture_order_action' ) );
52 add_action( 'woocommerce_order_action_capture_credit_card_authorization', array(
53 Gateways\AbstractGateway::class,
54 'capture_credit_card_authorization'
55 ) );
56 }
57
58 /**
59 * Appends our payment gateways to WooCommerce's known list.
60 *
61 * @param string[] $methods
62 *
63 * @return string[]
64 */
65 public static function add_gateways( $methods ) {
66 $gateways = array(
67 Gateways\HeartlandGateway::class,
68 Gateways\GeniusGateway::class,
69 Gateways\TransitGateway::class,
70 Gateways\GpApiGateway::class,
71 );
72 $gateways = array_merge( $gateways, GpApiGateway::get_payment_methods() );
73
74 foreach ( $gateways as $gateway ) {
75 $methods[] = $gateway;
76 }
77
78 return $methods;
79 }
80
81 /**
82 * Return the version of the package.
83 *
84 * @return string
85 */
86 public static function get_version() {
87 return self::VERSION;
88 }
89
90 /**
91 * Return the path to the package.
92 *
93 * @return string
94 */
95 public static function get_path() {
96 return dirname( __DIR__ );
97 }
98
99 public static function get_url( $path ) {
100 return plugins_url( $path, dirname( __FILE__ ) );
101 }
102 }
103