-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass-wc-gateway-mixpay.php
120 lines (95 loc) · 3.51 KB
/
class-wc-gateway-mixpay.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/**
* @wordpress-plugin
* Plugin Name: MixPay Gateway for WooCommerce
* Plugin URI: https://github.com/MixPayHQ/mixpay-woocommerce-plugin
* Description: Cryptocurrency Payment Gateway.
* Version: 1.1.9
* Author: MixPay
* Author URI: https://www.mixpay.me
* License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wc-mixpay-gateway
* Domain Path: /i18n/languages/
*/
defined( 'ABSPATH' ) || exit;
if ( ! defined( 'MPWC_PLUGIN_FILE' ) ) {
define( 'MPWC_PLUGIN_FILE', __FILE__ );
}
if ( ! defined( 'MPWC_VERSION' ) ) {
define( 'MPWC_VERSION', '1.1.9' );
}
if ( ! defined( 'MPWC_PLUGIN_URL' ) ) {
define( 'MPWC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
if ( !defined( 'MPWC_PLUGIN_DIR_PATH' ) ) {
define( 'MPWC_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ) );
}
if (! defined('MIXPAY_SUPPORT_EMAIL')) {
define('MIXPAY_SUPPORT_EMAIL', 'bd@mixpay.me');
}
if (! defined('MIXPAY_PAY_LINK')) {
define('MIXPAY_PAY_LINK', 'https://mixpay.me/pay');
}
if (! defined('MIXPAY_CODE_LINK')) {
define('MIXPAY_CODE_LINK', 'https://mixpay.me/code');
}
if (! defined('MIXPAY_API_URL')) {
define('MIXPAY_API_URL', 'https://api.mixpay.me/v1');
}
if (! defined('MIXPAY_SETTLEMENT_ASSETS_API')) {
define('MIXPAY_SETTLEMENT_ASSETS_API', MIXPAY_API_URL . '/setting/settlement_assets');
}
if (! defined('MIXPAY_QUOTE_ASSETS_API')) {
define('MIXPAY_QUOTE_ASSETS_API', MIXPAY_API_URL . '/setting/quote_assets');
}
if (! defined('MIXPAY_MIXINUUID_API')) {
define('MIXPAY_MIXINUUID_API', MIXPAY_API_URL . '/user/mixin_uuid');
}
if (! defined('MIXPAY_MULTISIG_API')) {
define('MIXPAY_MULTISIG_API', MIXPAY_API_URL . '/multisig');
}
if (! defined('MIXPAY_ASSETS_EXPIRE_SECONDS')) {
define('MIXPAY_ASSETS_EXPIRE_SECONDS', 600);
}
if (! defined('MIXPAY_PAYMENTS_RESULT')) {
define('MIXPAY_PAYMENTS_RESULT', MIXPAY_API_URL . '/payments_result');
}
if (! defined('MIXPAY_ONE_TIME_PAYMENT')) {
define('MIXPAY_ONE_TIME_PAYMENT', MIXPAY_API_URL . '/one_time_payment');
}
require dirname( MPWC_PLUGIN_FILE ) . '/includes/class-mpwc-init.php';
add_action( 'plugins_loaded', 'load_mpwc' );
/**
* Loads Plugin
*/
function load_mpwc() {
MPWC_Init::get_instance();
}
/**
* Adds plugin page links
*/
if (! function_exists('wc_mixpay_plugin_links')) {
function wc_mixpay_plugin_links($links)
{
$plugin_links = [
'<a href="' . esc_url(admin_url('admin.php?page=wc-settings&tab=checkout§ion=mixpay_gateway')) . '">' . esc_html(__('Configure', 'wc-mixpay-gateway')) . '</a>',
'<a href="mailto:' . esc_html(MIXPAY_SUPPORT_EMAIL) . '">' . esc_html(__('Email Developer', 'wc-mixpay-gateway')) . '</a>',
];
return array_merge($plugin_links, $links);
}
}
add_filter('plugin_action_links_' . plugin_basename(__FILE__), 'wc_mixpay_plugin_links');
if (! function_exists('add_cron_every_minute_interval')) {
function add_cron_every_minute_interval($schedules)
{
if (! isset($schedules['every_minute'])) {
$schedules['every_minute'] = [
'interval' => 60,
'display' => esc_html__('Every minute'),
];
}
return $schedules;
}
}
add_filter('cron_schedules', 'add_cron_every_minute_interval');