PluginProbe
HyperPay Payments / 2.3.3
HyperPay Payments v2.3.3
6.6.0 trunk 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.1.0 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 3.0.0 3.0.5 4.0.0 4.0.2 All 34 releases
hyperpay-gateways / includes / class-install.php

class-install.php in HyperPay Payments 2.3.3, at includes/class-install.php

77 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class hyperpay_main
3 {
4 /**
5 * Payment gateway classes.
6 * all new class should added here
7 * @var array
8 */
9 protected static $HP_gateways = [
10 // Add Class Here
11 'WC_Hyperpay_Tabby_Gateway',
12 'WC_Hyperpay_Zoodpay_Gateway',
13 'WC_Hyperpay_Gateway',
14 'WC_Hyperpay_STCPay_Gateway',
15 'WC_Hyperpay_Mada_Gateway',
16 'WC_Hyperpay_ApplePay_Gateway'
17 ];
18
19 /**
20 * First function fire when click on active plugin
21 *
22 * @return void
23 */
24
25 public static function load(): void
26 {
27 foreach (self::$HP_gateways as $names) { // <== looping over all regestered class in $HP_gateways array
28 include_once HYPERPAY_ABSPATH . "gateways/$names.php";
29 }
30
31 /**
32 * this filter documented in woocommerce to asign all gateways to [payments tab] insude woocommerce settings
33 *
34 * @param string filter_name
35 * @param array[class_name,function_name]
36 * @return void
37 */
38
39 add_filter('woocommerce_payment_gateways', ['hyperpay_main', 'get_gateways']);
40 self::run_migration();
41 }
42
43 /**
44 * CREATE tabe on database to store users transaction mode
45 */
46 public static function run_migration(): void
47 {
48
49 global $wpdb;
50 $sql_raw = "CREATE TABLE {$wpdb->prefix}woocommerce_saving_cards (
51 `id` INT AUTO_INCREMENT,
52 `registration_id` VARCHAR(255) NOT NULL,
53 `customer_id` VARCHAR(255) NOT NULL,
54 `mode` int (10) NOT NULL,
55 PRIMARY KEY (`id`)
56 ) ENGINE=INNODB
57 DEFAULT CHARACTER SET utf8
58 COLLATE utf8_unicode_520_ci;";
59
60 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
61 dbDelta($sql_raw, true);
62 }
63
64 /**
65 * Merge the previous gateways with hyperPay gatways
66 *
67 * @param array $gateways
68 * @return array $updated_gateways
69 */
70
71 public static function get_gateways(array $gateways): array
72 {
73
74 return array_merge($gateways, self::$HP_gateways);
75 }
76 }
77