PluginProbe ʕ •ᴥ•ʔ
GlobalPayments Gateway Provider for WooCommerce / 1.2.2
GlobalPayments Gateway Provider for WooCommerce v1.2.2
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 / globalpayments-gateway-provider-for-woocommerce.php
global-payments-woocommerce Last commit date
assets 4 years ago src 4 years ago vendor 4 years ago LICENSE 4 years ago README.md 4 years ago composer.json 4 years ago composer.lock 4 years ago globalpayments-gateway-provider-for-woocommerce.php 4 years ago readme.txt 4 years ago
globalpayments-gateway-provider-for-woocommerce.php
90 lines
1 <?php
2 /**
3 * Plugin Name: GlobalPayments WooCommerce
4 * Plugin URI: https://github.com/globalpayments/globalpayments-woocommerce
5 * Description: This extension allows WooCommerce to use the available Global Payments payment gateways. All card data is tokenized using the respective gateway's tokenization service.
6 * Version: 1.2.2
7 * Requires PHP: 5.5.9
8 * WC tested up to: 6.3.1
9 * Author: Global Payments
10 */
11
12 defined( 'ABSPATH' ) || exit;
13
14 if ( version_compare( PHP_VERSION, '5.5.9', '<' ) ) {
15 return;
16 }
17
18 /**
19 * Autoload SDK.
20 */
21 $autoloader = __DIR__ . '/vendor/autoload.php';
22 if ( is_readable( $autoloader ) ) {
23 include_once $autoloader;
24 add_action( 'plugins_loaded', array( \GlobalPayments\WooCommercePaymentGatewayProvider\Plugin::class, 'init' ) );
25 }
26
27 function globalpayments_update_v110_v111( WP_Upgrader $wp_upgrader, $hook_extra ) {
28 if ( empty( $hook_extra ) || 'plugin' !== $hook_extra[ 'type' ] || ! in_array( plugin_basename( __FILE__ ), $hook_extra[ 'plugins' ] ) ) {
29 return;
30 }
31 if ( 'update' === $hook_extra[ 'action' ] || 'install' === $hook_extra[ 'action' ] ) {
32 $current_plugin_version = get_option( 'woocommerce_globalpayments_version' );
33 if ( ! empty( $current_plugin_version ) ) {
34 return;
35 }
36 $globalpayments_keys = [
37 'globalpayments_gpapi' => [
38 'app_id',
39 'app_key',
40 ],
41 'globalpayments_heartland' => [
42 'public_key',
43 'secret_key',
44 ],
45 'globalpayments_genius' => [
46 'merchant_name',
47 'merchant_site_id',
48 'merchant_key',
49 'web_api_key',
50 ],
51 'globalpayments_transit' => [
52 'merchant_id',
53 'user_id',
54 'password',
55 'device_id',
56 'tsep_device_id',
57 'transaction_key',
58 ],
59 ];
60 foreach ( $globalpayments_keys as $gateway_id => $gateway_keys ) {
61 $settings = get_option( 'woocommerce_' . $gateway_id . '_settings' );
62 if ( 'globalpayments_heartland' === $gateway_id ) {
63 $settings['is_production'] = ( isset( $settings['public_key'] ) && false !== strpos( $settings['public_key'], 'pkapi_prod_' ) ) ? 'yes' : 'no';
64 }
65 // General rule: if the gateway is not set to "Live Mode", move the credentials in sandbox keys.
66 if ( ! isset( $settings['is_production'] ) || ! wc_string_to_bool( $settings['is_production'] ) ) {
67 foreach ( $gateway_keys as $gateway_key ) {
68 if ( ! empty( $settings[$gateway_key] ) ) {
69 $settings['sandbox_' . $gateway_key] = $settings[$gateway_key];
70 $settings[$gateway_key] = '';
71 }
72 }
73 }
74 update_option( 'woocommerce_' . $gateway_id . '_settings', $settings );
75 }
76 }
77 }
78 add_action( 'upgrader_process_complete', 'globalpayments_update_v110_v111', 9, 2 );
79
80 function globalpayments_update_plugin_version( WP_Upgrader $wp_upgrader, $hook_extra ) {
81 if ( empty( $hook_extra ) || 'plugin' !== $hook_extra[ 'type' ] || ! in_array( plugin_basename( __FILE__ ), $hook_extra[ 'plugins' ] ) ) {
82 return;
83 }
84 if ( 'update' === $hook_extra[ 'action' ] || 'install' === $hook_extra[ 'action' ] ) {
85 delete_option( 'woocommerce_globalpayments_version' );
86 update_option( 'woocommerce_globalpayments_version', \GlobalPayments\WooCommercePaymentGatewayProvider\Plugin::VERSION );
87 }
88 }
89 add_action( 'upgrader_process_complete', 'globalpayments_update_plugin_version', 10, 2 );
90