@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! defined('ABSPATH')) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | { |
25 | 25 | $ajax_events = array('pagantis_checkout'); |
26 | 26 | foreach ($ajax_events as $ajax_event => $nopriv) { |
27 | - add_action('wp_ajax_woocommerce_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
27 | + add_action('wp_ajax_woocommerce_'.$ajax_event, array(__CLASS__, $ajax_event)); |
|
28 | 28 | if ($nopriv) { |
29 | 29 | add_action( |
30 | - 'wp_ajax_nopriv_woocommerce_' . $ajax_event, |
|
30 | + 'wp_ajax_nopriv_woocommerce_'.$ajax_event, |
|
31 | 31 | array(__CLASS__, $ajax_event) |
32 | 32 | ); |
33 | 33 | // WC AJAX can be used for frontend ajax requests. |
34 | - add_action('wc_ajax_' . $ajax_event, array(__CLASS__, $ajax_event)); |
|
34 | + add_action('wc_ajax_'.$ajax_event, array(__CLASS__, $ajax_event)); |
|
35 | 35 | } |
36 | 36 | } |
37 | 37 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | include_once('class-wc-pagantis-logger.php'); |
17 | 17 | $config = self::getExtraConfig(); |
18 | 18 | $value = $config[$key]; |
19 | - if ($unSerialized === true) { |
|
19 | + if ($unSerialized===true) { |
|
20 | 20 | return unserialize($value); |
21 | 21 | } else { |
22 | 22 | return $value; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | public static function getExtraConfig() |
63 | 63 | { |
64 | 64 | global $wpdb; |
65 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
65 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
66 | 66 | $response = array(); |
67 | 67 | $dbResult = $wpdb->get_results("select config, value from $tableName", ARRAY_A); |
68 | 68 | foreach ($dbResult as $value) { |
@@ -3,12 +3,12 @@ discard block |
||
3 | 3 | |
4 | 4 | use Pagantis\ModuleUtils\Model\Log\LogEntry; |
5 | 5 | |
6 | -require_once dirname(__FILE__) . '/class-wc-pagantis-config.php'; |
|
6 | +require_once dirname(__FILE__).'/class-wc-pagantis-config.php'; |
|
7 | 7 | |
8 | 8 | function pg_areKeysSet() |
9 | 9 | { |
10 | 10 | $settings = pg_get_plugin_settings(); |
11 | - if ($settings['pagantis_public_key'] == '' || $settings['pagantis_private_key'] == '') { |
|
11 | + if ($settings['pagantis_public_key']=='' || $settings['pagantis_private_key']=='') { |
|
12 | 12 | return false; |
13 | 13 | } |
14 | 14 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | { |
20 | 20 | $settings = pg_get_plugin_settings(); |
21 | 21 | |
22 | - if ($settings['simulator'] !== 'yes') { |
|
22 | + if ($settings['simulator']!=='yes') { |
|
23 | 23 | WC_Admin_Settings::add_error(__('Error: PG Simulator is not enabled', 'pagantis')); |
24 | 24 | |
25 | 25 | return false; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $allowedCountries = WC_Pagantis_Config::getAllowedCountriesSerialized(); |
35 | 35 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries)); |
36 | 36 | |
37 | - if (! $allowedCountry) { |
|
37 | + if (!$allowedCountry) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | $minAmount = WC_Pagantis_Config::getValueOfKey('PAGANTIS_DISPLAY_MIN_AMOUNT'); |
51 | 51 | $maxAmount = WC_Pagantis_Config::getValueOfKey('PAGANTIS_DISPLAY_MAX_AMOUNT'); |
52 | 52 | $totalPrice = $product->get_price(); |
53 | - $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
54 | - if (! $validAmount) { |
|
53 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount=='0')); |
|
54 | + if (!$validAmount) { |
|
55 | 55 | return false; |
56 | 56 | } |
57 | 57 | |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | $minAmount = WC_Pagantis_Config::getValueOfKey('PAGANTIS_DISPLAY_MIN_AMOUNT'); |
84 | 84 | $maxAmount = WC_Pagantis_Config::getValueOfKey('PAGANTIS_DISPLAY_MAX_AMOUNT'); |
85 | 85 | $totalPrice = $product->get_price(); |
86 | - $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount == '0')); |
|
87 | - if ($settings['enabled'] !== 'yes' || pg_areKeysSet() || pg_isSimulatorSettingEnabled() |
|
88 | - || ! pg_IsCountryAllowed() |
|
89 | - || ! pg_IsAmountValid() |
|
86 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount=='0')); |
|
87 | + if ($settings['enabled']!=='yes' || pg_areKeysSet() || pg_isSimulatorSettingEnabled() |
|
88 | + || !pg_IsCountryAllowed() |
|
89 | + || !pg_IsAmountValid() |
|
90 | 90 | ) { |
91 | 91 | return; |
92 | 92 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $metaProduct = get_post_meta($product_id); |
103 | 103 | |
104 | 104 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) |
105 | - && $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
105 | + && $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | */ |
125 | 125 | function preparePriceSelector($css_price_selector) |
126 | 126 | { |
127 | - if ($css_price_selector === 'default' || $css_price_selector === '') { |
|
128 | - $css_price_selector === $this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
|
129 | - } elseif (! unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
|
127 | + if ($css_price_selector==='default' || $css_price_selector==='') { |
|
128 | + $css_price_selector===$this->defaultConfigs['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
|
129 | + } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
|
130 | 130 | $css_price_selector = serialize(array($css_price_selector)); |
131 | 131 | } |
132 | 132 | |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | function pg_wc_is_screen_correct() |
137 | 137 | { |
138 | 138 | $current_screen = get_current_screen(); |
139 | - if ('shop_order' === $current_screen->id || 'plugins' === $current_screen->id |
|
140 | - || 'woocommerce_page_wc-settings' === $current_screen->id |
|
139 | + if ('shop_order'===$current_screen->id || 'plugins'===$current_screen->id |
|
140 | + || 'woocommerce_page_wc-settings'===$current_screen->id |
|
141 | 141 | ) { |
142 | 142 | return true; |
143 | 143 | } |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | function pg_wc_check_db_log_table() |
158 | 158 | { |
159 | 159 | global $wpdb; |
160 | - $tableName = $wpdb->prefix . PAGANTIS_LOGS_TABLE; |
|
161 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") !== $tableName) { |
|
160 | + $tableName = $wpdb->prefix.PAGANTIS_LOGS_TABLE; |
|
161 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!==$tableName) { |
|
162 | 162 | $charset_collate = $wpdb->get_charset_collate(); |
163 | 163 | $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, |
164 | 164 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate"; |
165 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
165 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
166 | 166 | dbDelta($sql); |
167 | 167 | } |
168 | 168 | |
@@ -180,5 +180,5 @@ discard block |
||
180 | 180 | { |
181 | 181 | $shop_page = wc_get_page_permalink('shop'); |
182 | 182 | |
183 | - return (is_ssl() && 'https' === substr($shop_page, 0, 5)); |
|
183 | + return (is_ssl() && 'https'===substr($shop_page, 0, 5)); |
|
184 | 184 | } |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Pagantis\ModuleUtils\Model\Log\LogEntry; |
4 | 4 | |
5 | -if (! defined('ABSPATH')) { |
|
5 | +if (!defined('ABSPATH')) { |
|
6 | 6 | exit; |
7 | 7 | } |
8 | 8 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public static function writeLog($message, $start_time = null, $end_time = null) |
25 | 25 | { |
26 | - if (! class_exists('WC_Logger')) { |
|
26 | + if (!class_exists('WC_Logger')) { |
|
27 | 27 | return; |
28 | 28 | } |
29 | 29 | |
@@ -32,25 +32,25 @@ discard block |
||
32 | 32 | self::$logger = wc_get_logger(); |
33 | 33 | } |
34 | 34 | |
35 | - $isDebugLogEnabled = 'yes' === WC_Admin_Settings::get_option('debug', 'no'); |
|
35 | + $isDebugLogEnabled = 'yes'===WC_Admin_Settings::get_option('debug', 'no'); |
|
36 | 36 | $settings = get_option('woocommerce_pagantis_settings'); |
37 | 37 | |
38 | 38 | if (empty($settings) || isset($settings['debug']) && $isDebugLogEnabled) { |
39 | 39 | return; |
40 | 40 | } |
41 | 41 | |
42 | - if (! is_null($start_time)) { |
|
43 | - $formatted_start_time = date_i18n(get_option('date_format') . ' g:ia', $start_time); |
|
42 | + if (!is_null($start_time)) { |
|
43 | + $formatted_start_time = date_i18n(get_option('date_format').' g:ia', $start_time); |
|
44 | 44 | $end_time = is_null($end_time) ? current_time('timestamp') : $end_time; |
45 | - $formatted_end_time = date_i18n(get_option('date_format') . ' g:ia', $end_time); |
|
45 | + $formatted_end_time = date_i18n(get_option('date_format').' g:ia', $end_time); |
|
46 | 46 | $elapsed_time = round(abs($end_time - $start_time) / 60, 2); |
47 | 47 | |
48 | - $log_entry = "\n" . '====Pagantis Version: ' . PAGANTIS_VERSION . '====' . "\n"; |
|
49 | - $log_entry .= '====Start Log ' . $formatted_start_time . '====' . "\n" . $message . "\n"; |
|
50 | - $log_entry .= '====End Log ' . $formatted_end_time . ' (' . $elapsed_time . ')====' . "\n\n"; |
|
48 | + $log_entry = "\n".'====Pagantis Version: '.PAGANTIS_VERSION.'===='."\n"; |
|
49 | + $log_entry .= '====Start Log '.$formatted_start_time.'===='."\n".$message."\n"; |
|
50 | + $log_entry .= '====End Log '.$formatted_end_time.' ('.$elapsed_time.')===='."\n\n"; |
|
51 | 51 | } else { |
52 | - $log_entry = "\n" . '====Pagantis Version: ' . PAGANTIS_VERSION . '====' . "\n"; |
|
53 | - $log_entry .= '====Start Log====' . "\n" . $message . "\n" . '====End Log====' . "\n\n"; |
|
52 | + $log_entry = "\n".'====Pagantis Version: '.PAGANTIS_VERSION.'===='."\n"; |
|
53 | + $log_entry .= '====Start Log===='."\n".$message."\n".'====End Log===='."\n\n"; |
|
54 | 54 | } |
55 | 55 | if (defined('WP_DEBUG') && WP_DEBUG) { |
56 | 56 | error_log($log_entry); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public static function insert_log_entry_in_wpdb($exception = null, $message = null) |
81 | 81 | { |
82 | - require_once(__ROOT__ . '/vendor/autoload.php'); |
|
82 | + require_once(__ROOT__.'/vendor/autoload.php'); |
|
83 | 83 | |
84 | 84 | global $wpdb; |
85 | 85 | pg_wc_check_db_log_table(); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | } else { |
90 | 90 | $logEntry = $logEntry->info($message); |
91 | 91 | } |
92 | - $tableName = $wpdb->prefix . PAGANTIS_LOGS_TABLE; |
|
92 | + $tableName = $wpdb->prefix.PAGANTIS_LOGS_TABLE; |
|
93 | 93 | $wpdb->insert($tableName, array('log' => $logEntry->toJson())); |
94 | 94 | } |
95 | 95 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | //namespace Gateways; |
17 | 17 | |
18 | 18 | |
19 | -if ( ! defined('ABSPATH')) { |
|
19 | +if (!defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | define('PAGANTIS_VERSION', '8.3.7'); |
@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function __construct() |
67 | 67 | { |
68 | - require_once(plugin_dir_path(__FILE__) . 'vendor/autoload.php'); |
|
69 | - require_once dirname(__FILE__) . '/includes/class-wc-pagantis-config.php'; |
|
70 | - require_once dirname(__FILE__) . '/includes/functions.php'; |
|
68 | + require_once(plugin_dir_path(__FILE__).'vendor/autoload.php'); |
|
69 | + require_once dirname(__FILE__).'/includes/class-wc-pagantis-config.php'; |
|
70 | + require_once dirname(__FILE__).'/includes/functions.php'; |
|
71 | 71 | |
72 | - $this->template_path = plugin_dir_path(__FILE__) . 'templates/'; |
|
72 | + $this->template_path = plugin_dir_path(__FILE__).'templates/'; |
|
73 | 73 | |
74 | 74 | $this->prepare_wpdb_tables(); |
75 | 75 | $this->initialConfig = WC_Pagantis_Config::getDefaultConfig(); |
76 | 76 | |
77 | 77 | $this->extraConfig = WC_Pagantis_Config::getExtraConfig(); |
78 | 78 | add_action('plugins_loaded', array($this, 'bootstrap')); |
79 | - load_plugin_textdomain('pagantis', false, basename(dirname(__FILE__)) . '/languages'); |
|
79 | + load_plugin_textdomain('pagantis', false, basename(dirname(__FILE__)).'/languages'); |
|
80 | 80 | add_filter('woocommerce_payment_gateways', array($this, 'add_pagantis_gateway')); |
81 | 81 | add_filter('woocommerce_available_payment_gateways', array($this, 'check_if_pg_is_in_available_gateways'), |
82 | 82 | 9999); |
83 | 83 | add_filter('plugin_row_meta', array($this, 'get_plugin_row_meta_links'), 10, 2); |
84 | - add_filter('plugin_action_links_' . plugin_basename(__FILE__), array($this, 'get_plugin_action_links')); |
|
84 | + add_filter('plugin_action_links_'.plugin_basename(__FILE__), array($this, 'get_plugin_action_links')); |
|
85 | 85 | |
86 | 86 | add_action('wp_enqueue_scripts', 'add_pagantis_widget_js'); |
87 | 87 | add_action('rest_api_init', array($this, 'register_pg_rest_routes')); //Endpoint |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public static function get_instance() |
104 | 104 | { |
105 | - if (null === self::$instance) { |
|
105 | + if (null===self::$instance) { |
|
106 | 106 | self::$instance = new self(); |
107 | 107 | } |
108 | 108 | |
@@ -147,10 +147,10 @@ discard block |
||
147 | 147 | throw new Exception(__('Pagantis requires WooCommerce version 3.0 or greater', 'pagantis')); |
148 | 148 | } |
149 | 149 | |
150 | - if ( ! function_exists('curl_init')) { |
|
150 | + if (!function_exists('curl_init')) { |
|
151 | 151 | throw new Exception(__('Pagantis requires cURL to be installed on your server', 'pagantis')); |
152 | 152 | } |
153 | - if ( ! version_compare(phpversion(), '5.3.0', '>=')) { |
|
153 | + if (!version_compare(phpversion(), '5.3.0', '>=')) { |
|
154 | 154 | throw new Exception(__('Pagantis requires PHP 5.3 or greater to be installed on your server', 'pagantis')); |
155 | 155 | } |
156 | 156 | } |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | { |
180 | 180 | $post_id = $product->get_id(); |
181 | 181 | $pagantis_promoted_value = $_REQUEST['pagantis_promoted']; |
182 | - if ($pagantis_promoted_value === 'on') { |
|
182 | + if ($pagantis_promoted_value==='on') { |
|
183 | 183 | $pagantis_promoted_value = 'yes'; |
184 | 184 | } else { |
185 | 185 | $pagantis_promoted_value = 'no'; |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | public function pagantisPromotedVarSave($post_id) |
213 | 213 | { |
214 | 214 | $pagantis_promoted_value = $_POST['pagantis_promoted']; |
215 | - if ($pagantis_promoted_value === null) { |
|
215 | + if ($pagantis_promoted_value===null) { |
|
216 | 216 | $pagantis_promoted_value = 'no'; |
217 | 217 | } |
218 | 218 | update_post_meta($post_id, 'custom_product_pagantis_promoted', esc_attr($pagantis_promoted_value)); |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function loadPagantisTranslation($mofile, $domain) |
227 | 227 | { |
228 | - if ('pagantis' === $domain) { |
|
229 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
228 | + if ('pagantis'===$domain) { |
|
229 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | return $mofile; |
@@ -239,19 +239,19 @@ discard block |
||
239 | 239 | { |
240 | 240 | global $wpdb; |
241 | 241 | |
242 | - $tableName = $wpdb->prefix . PAGANTIS_CONCURRENCY_TABLE; |
|
243 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") !== $tableName) { |
|
242 | + $tableName = $wpdb->prefix.PAGANTIS_CONCURRENCY_TABLE; |
|
243 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!==$tableName) { |
|
244 | 244 | $charset_collate = $wpdb->get_charset_collate(); |
245 | 245 | $sql = "CREATE TABLE $tableName ( order_id int NOT NULL, |
246 | 246 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (order_id)) $charset_collate"; |
247 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
247 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
248 | 248 | dbDelta($sql); |
249 | 249 | } |
250 | 250 | |
251 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
251 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
252 | 252 | |
253 | 253 | //Check if table exists |
254 | - $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'") !== $tableName; |
|
254 | + $tableExists = $wpdb->get_var("SHOW TABLES LIKE '$tableName'")!==$tableName; |
|
255 | 255 | if ($tableExists) { |
256 | 256 | $charset_collate = $wpdb->get_charset_collate(); |
257 | 257 | $sql = "CREATE TABLE IF NOT EXISTS $tableName ( |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | value varchar(1000) NOT NULL, |
261 | 261 | UNIQUE KEY id(id)) $charset_collate"; |
262 | 262 | |
263 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
263 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
264 | 264 | dbDelta($sql); |
265 | 265 | } else { |
266 | 266 | //Updated value field to adapt to new length < v8.0.1 |
267 | 267 | $query = |
268 | 268 | "select COLUMN_TYPE FROM information_schema.COLUMNS where TABLE_NAME='$tableName' AND COLUMN_NAME='value'"; |
269 | 269 | $results = $wpdb->get_results($query, ARRAY_A); |
270 | - if ($results['0']['COLUMN_TYPE'] === 'varchar(100)') { |
|
270 | + if ($results['0']['COLUMN_TYPE']==='varchar(100)') { |
|
271 | 271 | $sql = "ALTER TABLE $tableName MODIFY value varchar(1000)"; |
272 | 272 | $wpdb->query($sql); |
273 | 273 | } |
@@ -277,15 +277,15 @@ discard block |
||
277 | 277 | or config='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'"; |
278 | 278 | $dbCurrentConfig = $wpdb->get_results($query, ARRAY_A); |
279 | 279 | foreach ($dbCurrentConfig as $item) { |
280 | - if ($item['config'] === 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
280 | + if ($item['config']==='PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR') { |
|
281 | 281 | $css_price_selector = $this->preparePriceSelector($item['value']); |
282 | - if ($item['value'] !== $css_price_selector) { |
|
282 | + if ($item['value']!==$css_price_selector) { |
|
283 | 283 | $wpdb->update($tableName, array('value' => stripslashes($css_price_selector)), |
284 | 284 | array('config' => 'PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR'), array('%s'), array('%s')); |
285 | 285 | } |
286 | - } elseif ($item['config'] === 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
286 | + } elseif ($item['config']==='PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR') { |
|
287 | 287 | $css_quantity_selector = $this->prepareQuantitySelector($item['value']); |
288 | - if ($item['value'] !== $css_quantity_selector) { |
|
288 | + if ($item['value']!==$css_quantity_selector) { |
|
289 | 289 | $wpdb->update($tableName, array('value' => stripslashes($css_quantity_selector)), |
290 | 290 | array('config' => 'PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR'), array('%s'), array('%s')); |
291 | 291 | } |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | } |
295 | 295 | |
296 | 296 | //Adapting selector to array < v8.2.2 |
297 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
297 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
298 | 298 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR'"; |
299 | 299 | $results = $wpdb->get_results($query, ARRAY_A); |
300 | - if (count($results) === 0) { |
|
300 | + if (count($results)===0) { |
|
301 | 301 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_THOUSANDS_SEPARATOR', 'value' => '.'), |
302 | 302 | array('%s', '%s')); |
303 | 303 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DECIMAL_SEPARATOR', 'value' => ','), |
@@ -305,19 +305,19 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | //Adding new selector < v8.3.0 |
308 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
308 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
309 | 309 | $query = "select * from $tableName where config='PAGANTIS_DISPLAY_MAX_AMOUNT'"; |
310 | 310 | $results = $wpdb->get_results($query, ARRAY_A); |
311 | - if (count($results) === 0) { |
|
311 | + if (count($results)===0) { |
|
312 | 312 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_DISPLAY_MAX_AMOUNT', 'value' => '0'), |
313 | 313 | array('%s', '%s')); |
314 | 314 | } |
315 | 315 | |
316 | 316 | //Adding new selector < v8.3.2 |
317 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
317 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
318 | 318 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_SITUATION'"; |
319 | 319 | $results = $wpdb->get_results($query, ARRAY_A); |
320 | - if (count($results) === 0) { |
|
320 | + if (count($results)===0) { |
|
321 | 321 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_DISPLAY_SITUATION', 'value' => 'default'), |
322 | 322 | array('%s', '%s')); |
323 | 323 | $wpdb->insert($tableName, array('config' => 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION', 'value' => 'default'), |
@@ -325,10 +325,10 @@ discard block |
||
325 | 325 | } |
326 | 326 | |
327 | 327 | //Adding new selector < v8.3.3 |
328 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
328 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
329 | 329 | $query = "select * from $tableName where config='PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT'"; |
330 | 330 | $results = $wpdb->get_results($query, ARRAY_A); |
331 | - if (count($results) === 0) { |
|
331 | + if (count($results)===0) { |
|
332 | 332 | $wpdb->insert($tableName, array( |
333 | 333 | 'config' => 'PAGANTIS_SIMULATOR_DISPLAY_TYPE_CHECKOUT', |
334 | 334 | 'value' => 'sdk.simulator.types.CHECKOUT_PAGE', |
@@ -340,11 +340,11 @@ discard block |
||
340 | 340 | //Adapting to variable selector < v8.3.6 |
341 | 341 | $variableSelector = |
342 | 342 | 'div.summary div.woocommerce-variation.single_variation > div.woocommerce-variation-price span.price'; |
343 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
343 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
344 | 344 | $query = |
345 | 345 | "select * from $tableName where config='PAGANTIS_SIMULATOR_SELECTOR_VARIATION' and value='default'"; |
346 | 346 | $results = $wpdb->get_results($query, ARRAY_A); |
347 | - if (count($results) === 0) { |
|
347 | + if (count($results)===0) { |
|
348 | 348 | $wpdb->update($tableName, array('value' => $variableSelector), |
349 | 349 | array('config' => 'PAGANTIS_SIMULATOR_SELECTOR_VARIATION'), array('%s'), array('%s')); |
350 | 350 | } |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $simpleDbConfigs[$config['config']] = $config['value']; |
358 | 358 | } |
359 | 359 | $newConfigs = array_diff_key(WC_Pagantis_Config::getDefaultConfig(), $simpleDbConfigs); |
360 | - if ( ! empty($newConfigs)) { |
|
360 | + if (!empty($newConfigs)) { |
|
361 | 361 | foreach ($newConfigs as $key => $value) { |
362 | 362 | $wpdb->insert($tableName, array('config' => $key, 'value' => $value), array('%s', '%s')); |
363 | 363 | } |
@@ -366,12 +366,12 @@ discard block |
||
366 | 366 | //Current plugin config: pagantis_public_key => New field --- public_key => Old field |
367 | 367 | $settings = get_option('woocommerce_pagantis_settings'); |
368 | 368 | |
369 | - if ( ! isset($settings['pagantis_public_key']) && $settings['public_key']) { |
|
369 | + if (!isset($settings['pagantis_public_key']) && $settings['public_key']) { |
|
370 | 370 | $settings['pagantis_public_key'] = $settings['public_key']; |
371 | 371 | unset($settings['public_key']); |
372 | 372 | } |
373 | 373 | |
374 | - if ( ! isset($settings['pagantis_private_key']) && $settings['secret_key']) { |
|
374 | + if (!isset($settings['pagantis_private_key']) && $settings['secret_key']) { |
|
375 | 375 | $settings['pagantis_private_key'] = $settings['secret_key']; |
376 | 376 | unset($settings['secret_key']); |
377 | 377 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | |
383 | 383 | public function enqueue_simulator_scripts() |
384 | 384 | { |
385 | - if ( ! pg_isPluginActive()) { |
|
385 | + if (!pg_isPluginActive()) { |
|
386 | 386 | return; |
387 | 387 | } |
388 | 388 | |
@@ -461,11 +461,11 @@ discard block |
||
461 | 461 | $minAmount = $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']; |
462 | 462 | $maxAmount = $this->extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT']; |
463 | 463 | $totalPrice = $product->get_price(); |
464 | - $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount === '0')); |
|
465 | - if ($cfg['enabled'] !== 'yes' || $cfg['pagantis_public_key'] === '' || $cfg['pagantis_private_key'] === '' |
|
466 | - || $cfg['simulator'] !== 'yes' |
|
467 | - || ! $allowedCountry |
|
468 | - || ! $validAmount |
|
464 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount==='0')); |
|
465 | + if ($cfg['enabled']!=='yes' || $cfg['pagantis_public_key']==='' || $cfg['pagantis_private_key']==='' |
|
466 | + || $cfg['simulator']!=='yes' |
|
467 | + || !$allowedCountry |
|
468 | + || !$validAmount |
|
469 | 469 | ) { |
470 | 470 | return; |
471 | 471 | } |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function add_pagantis_gateway($methods) |
509 | 509 | { |
510 | - if ( ! class_exists('WC_Payment_Gateway')) { |
|
510 | + if (!class_exists('WC_Payment_Gateway')) { |
|
511 | 511 | return $methods; |
512 | 512 | } |
513 | 513 | |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | public function check_if_pg_is_in_available_gateways($methods) |
528 | 528 | { |
529 | 529 | $pagantis = new WC_Pagantis_Gateway(); |
530 | - if ( ! $pagantis->is_available()) { |
|
530 | + if (!$pagantis->is_available()) { |
|
531 | 531 | unset($methods['pagantis']); |
532 | 532 | } |
533 | 533 | |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | { |
547 | 547 | $setting_link = $this->get_setting_link(); |
548 | 548 | $plugin_links = array( |
549 | - '<a href="' . $setting_link . '">' . __('Settings', 'pagantis') . '</a>', |
|
549 | + '<a href="'.$setting_link.'">'.__('Settings', 'pagantis').'</a>', |
|
550 | 550 | ); |
551 | 551 | |
552 | 552 | return array_merge($plugin_links, $links); |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | { |
558 | 558 | $section_slug = 'pagantis'; |
559 | 559 | |
560 | - return admin_url('admin.php?page=wc-settings&tab=checkout§ion=' . $section_slug); |
|
560 | + return admin_url('admin.php?page=wc-settings&tab=checkout§ion='.$section_slug); |
|
561 | 561 | } |
562 | 562 | |
563 | 563 | /** |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | */ |
572 | 572 | public function get_plugin_row_meta_links($links, $file) |
573 | 573 | { |
574 | - if ($file === plugin_basename(__FILE__)) { |
|
574 | + if ($file===plugin_basename(__FILE__)) { |
|
575 | 575 | $links[] = |
576 | - '<a href="' . PAGANTIS_GIT_HUB_URL . '" target="_blank">' . __('Documentation', 'pagantis') . '</a>'; |
|
576 | + '<a href="'.PAGANTIS_GIT_HUB_URL.'" target="_blank">'.__('Documentation', 'pagantis').'</a>'; |
|
577 | 577 | $links[] = |
578 | - '<a href="' . PAGANTIS_DOC_URL . '" target="_blank">' . __('API documentation', 'pagantis') . '</a>'; |
|
579 | - $links[] = '<a href="' . PAGANTIS_SUPPORT_EMAIL . '">' . __('Support', 'pagantis') . '</a>'; |
|
578 | + '<a href="'.PAGANTIS_DOC_URL.'" target="_blank">'.__('API documentation', 'pagantis').'</a>'; |
|
579 | + $links[] = '<a href="'.PAGANTIS_SUPPORT_EMAIL.'">'.__('Support', 'pagantis').'</a>'; |
|
580 | 580 | |
581 | 581 | return $links; |
582 | 582 | } |
@@ -601,10 +601,10 @@ discard block |
||
601 | 601 | $to = $filters['to']; |
602 | 602 | $cfg = get_option('woocommerce_pagantis_settings'); |
603 | 603 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
604 | - $tableName = $wpdb->prefix . PAGANTIS_LOGS_TABLE; |
|
604 | + $tableName = $wpdb->prefix.PAGANTIS_LOGS_TABLE; |
|
605 | 605 | $query = "SELECT * FROM $tableName WHERE createdAt>$from AND createdAt<$to ORDER BY createdAt DESC"; |
606 | 606 | $results = $wpdb->get_results($query); |
607 | - if (isset($results) && $privateKey === $secretKey) { |
|
607 | + if (isset($results) && $privateKey===$secretKey) { |
|
608 | 608 | foreach ($results as $key => $result) { |
609 | 609 | $response[$key]['timestamp'] = $result->createdAt; |
610 | 610 | $response[$key]['log'] = json_decode($result->log); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $response = json_encode($response); |
616 | 616 | header('HTTP/1.1 200', true, 200); |
617 | 617 | header('Content-Type: application/json', true); |
618 | - header('Content-Length: ' . strlen($response)); |
|
618 | + header('Content-Length: '.strlen($response)); |
|
619 | 619 | echo($response); |
620 | 620 | exit(); |
621 | 621 | } |
@@ -628,20 +628,20 @@ discard block |
||
628 | 628 | public function updateExtraConfig($data) |
629 | 629 | { |
630 | 630 | global $wpdb; |
631 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
631 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
632 | 632 | $response = array('status' => null); |
633 | 633 | |
634 | 634 | $filters = ($data->get_params()); |
635 | 635 | $secretKey = $filters['secret']; |
636 | 636 | $cfg = get_option('woocommerce_pagantis_settings'); |
637 | 637 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
638 | - if ($privateKey !== $secretKey) { |
|
638 | + if ($privateKey!==$secretKey) { |
|
639 | 639 | $response['status'] = 401; |
640 | 640 | $response['result'] = 'Unauthorized'; |
641 | - } elseif ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
641 | + } elseif ($_SERVER['REQUEST_METHOD']==='POST') { |
|
642 | 642 | if (count($_POST)) { |
643 | 643 | foreach ($_POST as $config => $value) { |
644 | - if (isset($this->initialConfig[$config]) && $response['status'] === null) { |
|
644 | + if (isset($this->initialConfig[$config]) && $response['status']===null) { |
|
645 | 645 | $wpdb->update($tableName, array('value' => stripslashes($value)), array('config' => $config), |
646 | 646 | array('%s'), array('%s')); |
647 | 647 | } else { |
@@ -655,8 +655,8 @@ discard block |
||
655 | 655 | } |
656 | 656 | } |
657 | 657 | |
658 | - if ($response['status'] === null) { |
|
659 | - $tableName = $wpdb->prefix . PAGANTIS_CONFIG_TABLE; |
|
658 | + if ($response['status']===null) { |
|
659 | + $tableName = $wpdb->prefix.PAGANTIS_CONFIG_TABLE; |
|
660 | 660 | $dbResult = $wpdb->get_results("select config, value from $tableName", ARRAY_A); |
661 | 661 | foreach ($dbResult as $value) { |
662 | 662 | $formattedResult[$value['config']] = $value['value']; |
@@ -665,9 +665,9 @@ discard block |
||
665 | 665 | } |
666 | 666 | |
667 | 667 | $result = json_encode($response['result']); |
668 | - header('HTTP/1.1 ' . $response['status'], true, $response['status']); |
|
668 | + header('HTTP/1.1 '.$response['status'], true, $response['status']); |
|
669 | 669 | header('Content-Type: application/json', true); |
670 | - header('Content-Length: ' . strlen($result)); |
|
670 | + header('Content-Length: '.strlen($result)); |
|
671 | 671 | echo($result); |
672 | 672 | exit(); |
673 | 673 | } |
@@ -688,14 +688,14 @@ discard block |
||
688 | 688 | $method = ($filters['method']) ? ($filters['method']) : 'Pagantis'; |
689 | 689 | $cfg = get_option('woocommerce_pagantis_settings'); |
690 | 690 | $privateKey = isset($cfg['pagantis_private_key']) ? $cfg['pagantis_private_key'] : null; |
691 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
692 | - $tableNameInner = $wpdb->prefix . 'postmeta'; |
|
691 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
692 | + $tableNameInner = $wpdb->prefix.'postmeta'; |
|
693 | 693 | $query = "SELECT * FROM $tableName tn INNER JOIN $tableNameInner tn2 ON tn2.post_id = tn.id |
694 | - WHERE tn.post_type='shop_order' AND tn.post_date>'" . $from->format('Y-m-d') . "' |
|
695 | - AND tn.post_date<'" . $to->format('Y-m-d') . "' ORDER BY tn.post_date DESC"; |
|
694 | + WHERE tn.post_type='shop_order' AND tn.post_date>'".$from->format('Y-m-d')."' |
|
695 | + AND tn.post_date<'" . $to->format('Y-m-d')."' ORDER BY tn.post_date DESC"; |
|
696 | 696 | $results = $wpdb->get_results($query); |
697 | 697 | |
698 | - if (isset($results) && $privateKey === $secretKey) { |
|
698 | + if (isset($results) && $privateKey===$secretKey) { |
|
699 | 699 | foreach ($results as $result) { |
700 | 700 | $key = $result->ID; |
701 | 701 | $response['message'][$key]['timestamp'] = $result->post_date; |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $response = json_encode($response); |
709 | 709 | header('HTTP/1.1 200', true, 200); |
710 | 710 | header('Content-Type: application/json', true); |
711 | - header('Content-Length: ' . strlen($response)); |
|
711 | + header('Content-Length: '.strlen($response)); |
|
712 | 712 | echo($response); |
713 | 713 | exit(); |
714 | 714 | } |
@@ -753,9 +753,9 @@ discard block |
||
753 | 753 | */ |
754 | 754 | private function prepareQuantitySelector($css_quantity_selector) |
755 | 755 | { |
756 | - if ($css_quantity_selector === 'default' || $css_quantity_selector === '') { |
|
756 | + if ($css_quantity_selector==='default' || $css_quantity_selector==='') { |
|
757 | 757 | $css_quantity_selector = $this->initialConfig['PAGANTIS_SIMULATOR_CSS_QUANTITY_SELECTOR']; |
758 | - } elseif ( ! unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
|
758 | + } elseif (!unserialize($css_quantity_selector)) { //in the case of a custom string selector, we keep it |
|
759 | 759 | $css_quantity_selector = serialize(array($css_quantity_selector)); |
760 | 760 | } |
761 | 761 | |
@@ -769,9 +769,9 @@ discard block |
||
769 | 769 | */ |
770 | 770 | private function preparePriceSelector($css_price_selector) |
771 | 771 | { |
772 | - if ($css_price_selector === 'default' || $css_price_selector === '') { |
|
772 | + if ($css_price_selector==='default' || $css_price_selector==='') { |
|
773 | 773 | $css_price_selector = $this->initialConfig['PAGANTIS_SIMULATOR_CSS_PRICE_SELECTOR']; |
774 | - } elseif ( ! unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
|
774 | + } elseif (!unserialize($css_price_selector)) { //in the case of a custom string selector, we keep it |
|
775 | 775 | $css_price_selector = serialize(array($css_price_selector)); |
776 | 776 | } |
777 | 777 |
@@ -371,30 +371,30 @@ discard block |
||
371 | 371 | ->setAddress($shippingAddress['address_1'] . ' ' . $shippingAddress['address_2']); |
372 | 372 | $orderShippingAddress = new Address(); |
373 | 373 | $orderShippingAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'] |
374 | - . ' ' |
|
375 | - . $shippingAddress['last_name']) |
|
376 | - ->setCountryCode($shippingAddress['country'] !== '' |
|
374 | + . ' ' |
|
375 | + . $shippingAddress['last_name']) |
|
376 | + ->setCountryCode($shippingAddress['country'] !== '' |
|
377 | 377 | ? strtoupper($shippingAddress['country']) : strtoupper($this->language)) |
378 | - ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
|
379 | - . $shippingAddress['address_2']) |
|
380 | - ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
381 | - ->setNationalId($national_id)->setTaxId($tax_id); |
|
378 | + ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
|
379 | + . $shippingAddress['address_2']) |
|
380 | + ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
|
381 | + ->setNationalId($national_id)->setTaxId($tax_id); |
|
382 | 382 | $orderBillingAddress = new Address(); |
383 | 383 | $orderBillingAddress->setZipCode($billingAddress['postcode'])->setFullName($billingAddress['first_name'] |
384 | - . ' ' |
|
385 | - . $billingAddress['last_name']) |
|
384 | + . ' ' |
|
385 | + . $billingAddress['last_name']) |
|
386 | 386 | ->setCountryCode($billingAddress['country'] !== '' |
387 | 387 | ? strtoupper($billingAddress['country']) : strtoupper($this->language)) |
388 | 388 | ->setCity($billingAddress['city'])->setAddress($billingAddress['address_1'] . ' ' |
389 | - . $billingAddress['address_2']) |
|
389 | + . $billingAddress['address_2']) |
|
390 | 390 | ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
391 | 391 | ->setNationalId($national_id)->setTaxId($tax_id); |
392 | 392 | $orderUser = new User(); |
393 | 393 | $orderUser->setAddress($userAddress)->setFullName($billingAddress['first_name'] . ' ' |
394 | - . $billingAddress['last_name']) |
|
395 | - ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
396 | - ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
397 | - ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
394 | + . $billingAddress['last_name']) |
|
395 | + ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
|
396 | + ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
|
397 | + ->setShippingAddress($orderShippingAddress)->setNationalId($national_id)->setTaxId($tax_id); |
|
398 | 398 | |
399 | 399 | $previousOrders = $this->getOrders($order->get_user(), $billingAddress['email']); |
400 | 400 | foreach ($previousOrders as $previousOrder) { |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $orderElement = wc_get_order($previousOrder); |
403 | 403 | $orderCreated = $orderElement->get_date_created(); |
404 | 404 | $orderHistory->setAmount(intval(100 * $orderElement->get_total())) |
405 | - ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
405 | + ->setDate(new \DateTime($orderCreated->date('Y-m-d H:i:s'))); |
|
406 | 406 | $orderUser->addOrderHistory($orderHistory); |
407 | 407 | } |
408 | 408 | |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | |
452 | 452 | $orderShoppingCart = new ShoppingCart(); |
453 | 453 | $orderShoppingCart->setDetails($details)->setOrderReference($order->get_id()) |
454 | - ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
454 | + ->setPromotedAmount($promotedAmount)->setTotalAmount(intval(strval(100 * $order->total))); |
|
455 | 455 | $orderConfigurationUrls = new Urls(); |
456 | 456 | $cancelUrl = $this->getKoUrl($order); |
457 | 457 | $callback_arg = array( |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | $callback_url_notif = add_query_arg($callback_arg_notif, home_url('/')); |
471 | 471 | |
472 | 472 | $orderConfigurationUrls->setCancel($cancelUrl)->setKo($callback_url_user) |
473 | - ->setAuthorizedNotificationCallback($callback_url_notif) |
|
474 | - ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
473 | + ->setAuthorizedNotificationCallback($callback_url_notif) |
|
474 | + ->setRejectedNotificationCallback(null)->setOk($callback_url_user); |
|
475 | 475 | $orderChannel = new Channel(); |
476 | 476 | $orderChannel->setAssistedSale(false)->setType(Channel::ONLINE); |
477 | 477 | |
@@ -487,11 +487,11 @@ discard block |
||
487 | 487 | |
488 | 488 | $orderConfiguration = new Configuration(); |
489 | 489 | $orderConfiguration->setChannel($orderChannel)->setUrls($orderConfigurationUrls) |
490 | - ->setPurchaseCountry($purchaseCountry); |
|
490 | + ->setPurchaseCountry($purchaseCountry); |
|
491 | 491 | |
492 | 492 | $orderApiClient = new Order(); |
493 | 493 | $orderApiClient->setConfiguration($orderConfiguration)->setMetadata($metadataOrder) |
494 | - ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
494 | + ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
|
495 | 495 | |
496 | 496 | if ($this->pagantis_public_key === '' || $this->pagantis_private_key === '') { |
497 | 497 | throw new \Exception('Public and Secret Key not found'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | use Pagantis\OrdersApiClient\Model\Order; |
17 | 17 | use Pagantis\ModuleUtils\Model\Log\LogEntry; |
18 | 18 | |
19 | -if (! defined('ABSPATH')) { |
|
19 | +if (!defined('ABSPATH')) { |
|
20 | 20 | exit; |
21 | 21 | } |
22 | 22 | |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function __construct() |
56 | 56 | { |
57 | - require_once dirname(__FILE__) . '/../includes/class-wc-pagantis-config.php'; |
|
58 | - require_once dirname(__FILE__) . '/../includes/class-wc-pagantis-logger.php'; |
|
59 | - require_once dirname(__FILE__) . '/../includes/functions.php'; |
|
57 | + require_once dirname(__FILE__).'/../includes/class-wc-pagantis-config.php'; |
|
58 | + require_once dirname(__FILE__).'/../includes/class-wc-pagantis-logger.php'; |
|
59 | + require_once dirname(__FILE__).'/../includes/functions.php'; |
|
60 | 60 | //Mandatory vars for plugin |
61 | 61 | $this->id = PAGANTIS_PLUGIN_ID; |
62 | 62 | $this->has_fields = true; |
63 | 63 | $this->method_title = ucfirst($this->id); |
64 | 64 | //Useful vars |
65 | - $this->template_path = plugin_dir_path(__FILE__) . '../templates/'; |
|
65 | + $this->template_path = plugin_dir_path(__FILE__).'../templates/'; |
|
66 | 66 | |
67 | 67 | $this->allowed_currencies = array('EUR'); |
68 | 68 | $this->language = strstr(get_locale(), '_', true); |
69 | - if ($this->language === '') { |
|
69 | + if ($this->language==='') { |
|
70 | 70 | $this->language = 'ES'; |
71 | 71 | } |
72 | 72 | $this->icon = 'https://cdn.digitalorigin.com/assets/master/logos/pg-130x30.svg'; |
@@ -84,18 +84,18 @@ discard block |
||
84 | 84 | $this->set_payment_urls(); |
85 | 85 | //Hooks |
86 | 86 | add_action( |
87 | - 'woocommerce_update_options_payment_gateways_' . $this->id, |
|
87 | + 'woocommerce_update_options_payment_gateways_'.$this->id, |
|
88 | 88 | array($this, 'process_admin_options') |
89 | 89 | ); //Save plugin options |
90 | 90 | add_action( |
91 | 91 | 'admin_notices', |
92 | 92 | array($this, 'check_plugin_settings') |
93 | - ); //Check config fields |
|
93 | + ); //Check config fields |
|
94 | 94 | add_action( |
95 | - 'woocommerce_receipt_' . $this->id, |
|
95 | + 'woocommerce_receipt_'.$this->id, |
|
96 | 96 | array($this, 'get_wc_order_received_page') |
97 | - ); //Pagantis form |
|
98 | - add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
97 | + ); //Pagantis form |
|
98 | + add_action('woocommerce_api_wcpagantisgateway', array($this, 'pagantisNotification')); //Json Notification |
|
99 | 99 | add_filter('woocommerce_payment_complete_order_status', array($this, 'pagantisCompleteStatus'), 10, 3); |
100 | 100 | add_filter('load_textdomain_mofile', array($this, 'loadPagantisTranslation'), 10, 2); |
101 | 101 | //add_action('wp_enqueue_scripts', array($this, 'enqueue_ajax_scripts')); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | public function enqueue_ajax_scripts() |
105 | 105 | { |
106 | - if ($this->enabled !== 'yes' || ! is_checkout() || is_order_received_page() |
|
106 | + if ($this->enabled!=='yes' || !is_checkout() || is_order_received_page() |
|
107 | 107 | || is_wc_endpoint_url('order-pay') |
108 | 108 | ) { |
109 | 109 | return; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function loadPagantisTranslation($mofile, $domain) |
140 | 140 | { |
141 | - if ('pagantis' === $domain) { |
|
142 | - $mofile = WP_LANG_DIR . '/../plugins/pagantis/languages/pagantis-' . get_locale() . '.mo'; |
|
141 | + if ('pagantis'===$domain) { |
|
142 | + $mofile = WP_LANG_DIR.'/../plugins/pagantis/languages/pagantis-'.get_locale().'.mo'; |
|
143 | 143 | } |
144 | 144 | |
145 | 145 | return $mofile; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function init_form_fields() |
154 | 154 | { |
155 | - $this->form_fields = include(plugin_dir_path(__FILE__) . '../includes/settings-pagantis.php'); |
|
155 | + $this->form_fields = include(plugin_dir_path(__FILE__).'../includes/settings-pagantis.php'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /*********** |
@@ -167,13 +167,13 @@ discard block |
||
167 | 167 | */ |
168 | 168 | public function check_plugin_settings() |
169 | 169 | { |
170 | - if (! pg_wc_is_screen_correct()) { |
|
170 | + if (!pg_wc_is_screen_correct()) { |
|
171 | 171 | return; |
172 | 172 | } |
173 | 173 | |
174 | - if ($this->settings['enabled'] !== 'yes') { |
|
174 | + if ($this->settings['enabled']!=='yes') { |
|
175 | 175 | WC_Admin_Notices::add_custom_notice( |
176 | - PAGANTIS_PLUGIN_ID . 'first_setup', |
|
176 | + PAGANTIS_PLUGIN_ID.'first_setup', |
|
177 | 177 | sprintf(// translators: 1: URL to WP plugin page. |
178 | 178 | __( |
179 | 179 | 'Activate Pagantis to start offering comfortable payments in installments to your clients. <a class="button button-primary" href="%1$s">Activate Pagantis now!</a>', |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | ) |
184 | 184 | ); |
185 | 185 | } |
186 | - if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID . 'first_setup') && $this->settings['enabled'] === 'yes') { |
|
187 | - WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID . 'first_setup'); |
|
186 | + if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID.'first_setup') && $this->settings['enabled']==='yes') { |
|
187 | + WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID.'first_setup'); |
|
188 | 188 | } |
189 | 189 | |
190 | - if ($this->settings['pagantis_public_key'] === '' xor $this->settings['pagantis_private_key'] === '' |
|
191 | - && $this->settings['enabled'] === 'yes' |
|
190 | + if ($this->settings['pagantis_public_key']==='' xor $this->settings['pagantis_private_key']==='' |
|
191 | + && $this->settings['enabled']==='yes' |
|
192 | 192 | ) { |
193 | 193 | WC_Admin_Notices::add_custom_notice( |
194 | - PAGANTIS_PLUGIN_ID . 'keys_setup', |
|
194 | + PAGANTIS_PLUGIN_ID.'keys_setup', |
|
195 | 195 | sprintf(// translators: 1: URL to WP plugin page. |
196 | 196 | __( |
197 | 197 | 'Set your Pagantis merchant keys to start offering comfortable payments in installments <a class="button button-primary" href="%1$s">Go to keys setup</a></p>', |
@@ -202,11 +202,11 @@ discard block |
||
202 | 202 | ); |
203 | 203 | } |
204 | 204 | |
205 | - if ($this->settings['pagantis_public_key'] === '' xor $this->settings['pagantis_private_key'] === '' |
|
206 | - || $this->settings['enabled'] === 'yes' |
|
205 | + if ($this->settings['pagantis_public_key']==='' xor $this->settings['pagantis_private_key']==='' |
|
206 | + || $this->settings['enabled']==='yes' |
|
207 | 207 | ) { |
208 | 208 | WC_Admin_Notices::add_custom_notice( |
209 | - PAGANTIS_PLUGIN_ID . 'keys_check', |
|
209 | + PAGANTIS_PLUGIN_ID.'keys_check', |
|
210 | 210 | sprintf(// translators: 1: URL to WP plugin page. |
211 | 211 | __( |
212 | 212 | 'Set your Pagantis merchant Api keys to start offering comfortable payments in installments. <a class="button button-primary" href="%1$s">Go to keys setup</a>', |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | ); |
218 | 218 | } |
219 | 219 | |
220 | - if ($this->settings['pagantis_public_key'] !== '' && $this->settings['pagantis_private_key'] !== '' |
|
221 | - || $this->settings['enabled'] === 'no' |
|
220 | + if ($this->settings['pagantis_public_key']!=='' && $this->settings['pagantis_private_key']!=='' |
|
221 | + || $this->settings['enabled']==='no' |
|
222 | 222 | ) { |
223 | 223 | WC_Admin_Notices::add_custom_notice( |
224 | - PAGANTIS_PLUGIN_ID . 'finish_setup', |
|
224 | + PAGANTIS_PLUGIN_ID.'finish_setup', |
|
225 | 225 | sprintf(// translators: 1: URL to WP plugin page. |
226 | 226 | __( |
227 | 227 | 'It seems that your merchant keys are setup but the plugin is not active Activate the Pagantis plugin to start offering comfortable payments in installments to your clients. <a class="button button-primary" href="%1$s">Go to Pagantis settings</a>', |
@@ -231,33 +231,33 @@ discard block |
||
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | } |
234 | - if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID . 'keys_check' |
|
235 | - && $this->settings['pagantis_public_key'] !== '' |
|
236 | - && $this->settings['pagantis_private_key'] !== '' |
|
237 | - && $this->settings['enabled'] === 'yes') |
|
234 | + if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID.'keys_check' |
|
235 | + && $this->settings['pagantis_public_key']!=='' |
|
236 | + && $this->settings['pagantis_private_key']!=='' |
|
237 | + && $this->settings['enabled']==='yes') |
|
238 | 238 | ) { |
239 | - WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID . 'keys_setup'); |
|
239 | + WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID.'keys_setup'); |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | |
243 | - if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID . 'first_setup' |
|
244 | - && $this->settings['pagantis_public_key'] === '' |
|
245 | - && $this->settings['pagantis_private_key'] === '') |
|
243 | + if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID.'first_setup' |
|
244 | + && $this->settings['pagantis_public_key']==='' |
|
245 | + && $this->settings['pagantis_private_key']==='') |
|
246 | 246 | ) { |
247 | - WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID . 'keys_setup'); |
|
247 | + WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID.'keys_setup'); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | |
251 | - if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID . 'keys_check') |
|
252 | - xor WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID . 'first_setup') |
|
253 | - && $this->settings['pagantis_public_key'] !== '' |
|
254 | - || $this->settings['pagantis_private_key'] !== '' |
|
251 | + if (WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID.'keys_check') |
|
252 | + xor WC_Admin_Notices::has_notice(PAGANTIS_PLUGIN_ID.'first_setup') |
|
253 | + && $this->settings['pagantis_public_key']!=='' |
|
254 | + || $this->settings['pagantis_private_key']!=='' |
|
255 | 255 | ) { |
256 | - WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID . 'first_setup'); |
|
257 | - WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID . 'keys_check'); |
|
256 | + WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID.'first_setup'); |
|
257 | + WC_Admin_Notices::remove_notice(PAGANTIS_PLUGIN_ID.'keys_check'); |
|
258 | 258 | } |
259 | 259 | |
260 | - if (! in_array(get_woocommerce_currency(), $this->allowed_currencies, true)) { |
|
260 | + if (!in_array(get_woocommerce_currency(), $this->allowed_currencies, true)) { |
|
261 | 261 | WC_Admin_Settings::add_error(__('Error: Pagantis only can be used in Euros.', 'pagantis')); |
262 | 262 | $this->settings['enabled'] = 'no'; |
263 | 263 | } |
@@ -344,19 +344,19 @@ discard block |
||
344 | 344 | public function get_wc_order_received_page($order_id) |
345 | 345 | { |
346 | 346 | try { |
347 | - require_once(__ROOT__ . '/vendor/autoload.php'); |
|
347 | + require_once(__ROOT__.'/vendor/autoload.php'); |
|
348 | 348 | global $woocommerce; |
349 | 349 | $order = wc_get_order($order_id); |
350 | 350 | $order->set_payment_method(ucfirst($this->id)); |
351 | 351 | $order->save(); |
352 | 352 | |
353 | - if (! isset($order)) { |
|
353 | + if (!isset($order)) { |
|
354 | 354 | throw new Exception(__('Order not found', 'pagantis')); |
355 | 355 | } |
356 | 356 | |
357 | 357 | $shippingAddress = $order->get_address('shipping'); |
358 | 358 | $billingAddress = $order->get_address('billing'); |
359 | - if ($shippingAddress['address_1'] === '') { |
|
359 | + if ($shippingAddress['address_1']==='') { |
|
360 | 360 | $shippingAddress = $billingAddress; |
361 | 361 | } |
362 | 362 | |
@@ -364,18 +364,18 @@ discard block |
||
364 | 364 | $tax_id = $this->getTaxId($order); |
365 | 365 | |
366 | 366 | $userAddress = new Address(); |
367 | - $userAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'] . ' ' |
|
367 | + $userAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'].' ' |
|
368 | 368 | . $shippingAddress['last_name']) |
369 | - ->setCountryCode($shippingAddress['country'] !== '' ? strtoupper($shippingAddress['country']) |
|
369 | + ->setCountryCode($shippingAddress['country']!=='' ? strtoupper($shippingAddress['country']) |
|
370 | 370 | : strtoupper($this->language))->setCity($shippingAddress['city']) |
371 | - ->setAddress($shippingAddress['address_1'] . ' ' . $shippingAddress['address_2']); |
|
371 | + ->setAddress($shippingAddress['address_1'].' '.$shippingAddress['address_2']); |
|
372 | 372 | $orderShippingAddress = new Address(); |
373 | 373 | $orderShippingAddress->setZipCode($shippingAddress['postcode'])->setFullName($shippingAddress['first_name'] |
374 | 374 | . ' ' |
375 | 375 | . $shippingAddress['last_name']) |
376 | - ->setCountryCode($shippingAddress['country'] !== '' |
|
376 | + ->setCountryCode($shippingAddress['country']!=='' |
|
377 | 377 | ? strtoupper($shippingAddress['country']) : strtoupper($this->language)) |
378 | - ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'] . ' ' |
|
378 | + ->setCity($shippingAddress['city'])->setAddress($shippingAddress['address_1'].' ' |
|
379 | 379 | . $shippingAddress['address_2']) |
380 | 380 | ->setFixPhone($shippingAddress['phone'])->setMobilePhone($shippingAddress['phone']) |
381 | 381 | ->setNationalId($national_id)->setTaxId($tax_id); |
@@ -383,14 +383,14 @@ discard block |
||
383 | 383 | $orderBillingAddress->setZipCode($billingAddress['postcode'])->setFullName($billingAddress['first_name'] |
384 | 384 | . ' ' |
385 | 385 | . $billingAddress['last_name']) |
386 | - ->setCountryCode($billingAddress['country'] !== '' |
|
386 | + ->setCountryCode($billingAddress['country']!=='' |
|
387 | 387 | ? strtoupper($billingAddress['country']) : strtoupper($this->language)) |
388 | - ->setCity($billingAddress['city'])->setAddress($billingAddress['address_1'] . ' ' |
|
388 | + ->setCity($billingAddress['city'])->setAddress($billingAddress['address_1'].' ' |
|
389 | 389 | . $billingAddress['address_2']) |
390 | 390 | ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
391 | 391 | ->setNationalId($national_id)->setTaxId($tax_id); |
392 | 392 | $orderUser = new User(); |
393 | - $orderUser->setAddress($userAddress)->setFullName($billingAddress['first_name'] . ' ' |
|
393 | + $orderUser->setAddress($userAddress)->setFullName($billingAddress['first_name'].' ' |
|
394 | 394 | . $billingAddress['last_name']) |
395 | 395 | ->setBillingAddress($orderBillingAddress)->setEmail($billingAddress['email']) |
396 | 396 | ->setFixPhone($billingAddress['phone'])->setMobilePhone($billingAddress['phone']) |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | $details->addProduct($product); |
440 | 440 | |
441 | 441 | $promotedProduct = $this->isPromoted($item->get_product_id()); |
442 | - if ($promotedProduct === 'true') { |
|
443 | - $promotedAmount += $product->getAmount(); |
|
442 | + if ($promotedProduct==='true') { |
|
443 | + $promotedAmount += $product->getAmount(); |
|
444 | 444 | $promotedMessage = |
445 | - 'Promoted Item: ' . $wcProduct->get_name() . ' - Price: ' . $item->get_total() . ' - Qty: ' |
|
446 | - . $product->getQuantity() . ' - Item ID: ' . $item['id_product']; |
|
445 | + 'Promoted Item: '.$wcProduct->get_name().' - Price: '.$item->get_total().' - Qty: ' |
|
446 | + . $product->getQuantity().' - Item ID: '.$item['id_product']; |
|
447 | 447 | $promotedMessage = substr($promotedMessage, 0, 999); |
448 | 448 | $metadataOrder->addMetadata('promotedProduct', $promotedMessage); |
449 | 449 | } |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $orderApiClient->setConfiguration($orderConfiguration)->setMetadata($metadataOrder) |
494 | 494 | ->setShoppingCart($orderShoppingCart)->setUser($orderUser); |
495 | 495 | |
496 | - if ($this->pagantis_public_key === '' || $this->pagantis_private_key === '') { |
|
496 | + if ($this->pagantis_public_key==='' || $this->pagantis_private_key==='') { |
|
497 | 497 | throw new \Exception('Public and Secret Key not found'); |
498 | 498 | } |
499 | 499 | $orderClient = new Client($this->pagantis_public_key, $this->pagantis_private_key); |
@@ -505,9 +505,9 @@ discard block |
||
505 | 505 | throw new OrderNotFoundException(); |
506 | 506 | } |
507 | 507 | |
508 | - if ($url === '') { |
|
508 | + if ($url==='') { |
|
509 | 509 | throw new Exception(__('No ha sido posible obtener una respuesta de Pagantis', 'pagantis')); |
510 | - } elseif ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE'] === '0') { |
|
510 | + } elseif ($this->extraConfig['PAGANTIS_FORM_DISPLAY_TYPE']==='0') { |
|
511 | 511 | wp_redirect($url); |
512 | 512 | exit; |
513 | 513 | } else { |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | wc_get_template('iframe.php', $template_fields, '', $this->template_path); |
519 | 519 | } |
520 | 520 | } catch (\Exception $exception) { |
521 | - wc_add_notice(__('Payment error ', 'pagantis') . $exception->getMessage(), 'error'); |
|
521 | + wc_add_notice(__('Payment error ', 'pagantis').$exception->getMessage(), 'error'); |
|
522 | 522 | WC_Pagantis_Logger::insert_log_entry_in_wpdb($exception); |
523 | 523 | $checkout_url = get_permalink(wc_get_page_id('checkout')); |
524 | 524 | wp_redirect($checkout_url); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | public function pagantisNotification() |
533 | 533 | { |
534 | 534 | try { |
535 | - $origin = ($_SERVER['REQUEST_METHOD'] === 'POST') ? 'Notify' : 'Order'; |
|
535 | + $origin = ($_SERVER['REQUEST_METHOD']==='POST') ? 'Notify' : 'Order'; |
|
536 | 536 | |
537 | 537 | include_once('class-pg-notification-handler.php'); |
538 | 538 | $notify = new WC_PG_Notification_Handler(); |
@@ -575,10 +575,10 @@ discard block |
||
575 | 575 | */ |
576 | 576 | public function pagantisCompleteStatus($status, $order_id, $order) |
577 | 577 | { |
578 | - if ($order->get_payment_method() === PAGANTIS_PLUGIN_ID) { |
|
579 | - if ($order->get_status() === 'failed') { |
|
578 | + if ($order->get_payment_method()===PAGANTIS_PLUGIN_ID) { |
|
579 | + if ($order->get_status()==='failed') { |
|
580 | 580 | $status = 'processing'; |
581 | - } elseif ($order->get_status() === 'pending' && $status === 'completed') { |
|
581 | + } elseif ($order->get_status()==='pending' && $status==='completed') { |
|
582 | 582 | $status = 'processing'; |
583 | 583 | } |
584 | 584 | } |
@@ -602,9 +602,9 @@ discard block |
||
602 | 602 | $allowedCountry = (in_array(strtolower($locale), $allowedCountries, true)); |
603 | 603 | $minAmount = $this->extraConfig['PAGANTIS_DISPLAY_MIN_AMOUNT']; |
604 | 604 | $maxAmount = $this->extraConfig['PAGANTIS_DISPLAY_MAX_AMOUNT']; |
605 | - $totalPrice = (int)$this->get_order_total(); |
|
606 | - $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount === '0')); |
|
607 | - if ($this->enabled === 'yes' && $this->pagantis_public_key !== '' && $this->pagantis_private_key !== '' |
|
605 | + $totalPrice = (int) $this->get_order_total(); |
|
606 | + $validAmount = ($totalPrice >= $minAmount && ($totalPrice <= $maxAmount || $maxAmount==='0')); |
|
607 | + if ($this->enabled==='yes' && $this->pagantis_public_key!=='' && $this->pagantis_private_key!=='' |
|
608 | 608 | && $validAmount |
609 | 609 | && $allowedCountry |
610 | 610 | ) { |
@@ -637,8 +637,8 @@ discard block |
||
637 | 637 | $order = new WC_Order($order_id); |
638 | 638 | |
639 | 639 | $redirectUrl = $order->get_checkout_payment_url(true); //pagantisReceiptPage function |
640 | - if (strpos($redirectUrl, 'order-pay=') === false) { |
|
641 | - $redirectUrl .= '&order-pay=' . $order_id; |
|
640 | + if (strpos($redirectUrl, 'order-pay=')===false) { |
|
641 | + $redirectUrl .= '&order-pay='.$order_id; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | return array( |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | 'redirect' => $redirectUrl, |
647 | 647 | ); |
648 | 648 | } catch (Exception $e) { |
649 | - wc_add_notice(__('Payment error ', 'pagantis') . $e->getMessage(), 'error'); |
|
649 | + wc_add_notice(__('Payment error ', 'pagantis').$e->getMessage(), 'error'); |
|
650 | 650 | |
651 | 651 | return array(); |
652 | 652 | } |
@@ -696,10 +696,10 @@ discard block |
||
696 | 696 | private function set_payment_urls() |
697 | 697 | { |
698 | 698 | $this->settings['ok_url'] = |
699 | - ($this->extraConfig['PAGANTIS_URL_OK'] !== '') ? $this->extraConfig['PAGANTIS_URL_OK'] |
|
699 | + ($this->extraConfig['PAGANTIS_URL_OK']!=='') ? $this->extraConfig['PAGANTIS_URL_OK'] |
|
700 | 700 | : $this->generateOkUrl(); |
701 | 701 | $this->settings['ko_url'] = |
702 | - ($this->extraConfig['PAGANTIS_URL_KO'] !== '') ? $this->extraConfig['PAGANTIS_URL_KO'] |
|
702 | + ($this->extraConfig['PAGANTIS_URL_KO']!=='') ? $this->extraConfig['PAGANTIS_URL_KO'] |
|
703 | 703 | : $this->generateKoUrl(); |
704 | 704 | foreach ($this->settings as $setting_key => $setting_value) { |
705 | 705 | $this->$setting_key = $setting_value; |
@@ -733,12 +733,12 @@ discard block |
||
733 | 733 | private function generateUrl($url) |
734 | 734 | { |
735 | 735 | $parsed_url = parse_url($url); |
736 | - if ($parsed_url !== false) { |
|
737 | - $parsed_url['query'] = ! isset($parsed_url['query']) ? '' : $parsed_url['query']; |
|
736 | + if ($parsed_url!==false) { |
|
737 | + $parsed_url['query'] = !isset($parsed_url['query']) ? '' : $parsed_url['query']; |
|
738 | 738 | parse_str($parsed_url['query'], $arrayParams); |
739 | 739 | foreach ($arrayParams as $keyParam => $valueParam) { |
740 | - if ($valueParam === '') { |
|
741 | - $arrayParams[$keyParam] = '{{' . $keyParam . '}}'; |
|
740 | + if ($valueParam==='') { |
|
741 | + $arrayParams[$keyParam] = '{{'.$keyParam.'}}'; |
|
742 | 742 | } |
743 | 743 | } |
744 | 744 | $parsed_url['query'] = http_build_query($arrayParams); |
@@ -784,13 +784,13 @@ discard block |
||
784 | 784 | */ |
785 | 785 | private function getKeysUrl($order, $url) |
786 | 786 | { |
787 | - $defaultFields = (get_class($order) === 'WC_Order') ? array( |
|
787 | + $defaultFields = (get_class($order)==='WC_Order') ? array( |
|
788 | 788 | 'order-received' => $order->get_id(), |
789 | 789 | 'key' => $order->get_order_key() |
790 | 790 | ) : array(); |
791 | 791 | |
792 | 792 | $parsedUrl = parse_url($url); |
793 | - if ($parsedUrl !== false) { |
|
793 | + if ($parsedUrl!==false) { |
|
794 | 794 | //Replace parameters from url |
795 | 795 | $parsedUrl['query'] = $this->getKeysParametersUrl($parsedUrl['query'], $defaultFields); |
796 | 796 | |
@@ -858,14 +858,14 @@ discard block |
||
858 | 858 | */ |
859 | 859 | private function get_unparsed_url($parsed_url) |
860 | 860 | { |
861 | - $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; |
|
861 | + $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'].'://' : ''; |
|
862 | 862 | $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; |
863 | - $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; |
|
864 | - $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; |
|
865 | - $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; |
|
863 | + $port = isset($parsed_url['port']) ? ':'.$parsed_url['port'] : ''; |
|
864 | + $query = isset($parsed_url['query']) ? '?'.$parsed_url['query'] : ''; |
|
865 | + $fragment = isset($parsed_url['fragment']) ? '#'.$parsed_url['fragment'] : ''; |
|
866 | 866 | $path = $parsed_url['path']; |
867 | 867 | |
868 | - return $scheme . $host . $port . $path . $query . $fragment; |
|
868 | + return $scheme.$host.$port.$path.$query.$fragment; |
|
869 | 869 | } |
870 | 870 | |
871 | 871 | /** |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | 'post_status' => array('wc-completed', 'wc-processing', 'wc-refunded'), |
905 | 905 | )); |
906 | 906 | foreach ($customer_orders as $customer_order) { |
907 | - if (trim($sign_up) === '' |
|
907 | + if (trim($sign_up)==='' |
|
908 | 908 | || strtotime(substr($customer_order->post_date, 0, 10)) <= strtotime($sign_up) |
909 | 909 | ) { |
910 | 910 | $sign_up = substr($customer_order->post_date, 0, 10); |
@@ -928,12 +928,12 @@ discard block |
||
928 | 928 | { |
929 | 929 | global $wpdb; |
930 | 930 | $this->check_if_wc_orders_db_table_exist(); |
931 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
931 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
932 | 932 | |
933 | 933 | //Check if id exists |
934 | 934 | $resultsSelect = $wpdb->get_results("SELECT * FROM $tableName WHERE id='$wc_order_id'"); |
935 | 935 | $countResults = count($resultsSelect); |
936 | - if ($countResults === 0) { |
|
936 | + if ($countResults===0) { |
|
937 | 937 | $wpdb->insert($tableName, array('id' => $wc_order_id, 'order_id' => $pg_order_id), array('%d', '%s')); |
938 | 938 | } else { |
939 | 939 | $wpdb->update( |
@@ -954,14 +954,14 @@ discard block |
||
954 | 954 | private function check_if_wc_orders_db_table_exist() |
955 | 955 | { |
956 | 956 | global $wpdb; |
957 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
957 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
958 | 958 | |
959 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") !== $tableName) { |
|
959 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!==$tableName) { |
|
960 | 960 | $charset_collate = $wpdb->get_charset_collate(); |
961 | 961 | $sql = "CREATE TABLE $tableName ( id int, order_id varchar(50), wc_order_id varchar(50), |
962 | 962 | UNIQUE KEY id (id)) $charset_collate"; |
963 | 963 | |
964 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
964 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
965 | 965 | dbDelta($sql); |
966 | 966 | } |
967 | 967 | } |
@@ -974,9 +974,9 @@ discard block |
||
974 | 974 | */ |
975 | 975 | private function getNationalId($order) |
976 | 976 | { |
977 | - foreach ((array)$order->get_meta_data() as $mdObject) { |
|
977 | + foreach ((array) $order->get_meta_data() as $mdObject) { |
|
978 | 978 | $data = $mdObject->get_data(); |
979 | - if ($data['key'] === 'vat_number') { |
|
979 | + if ($data['key']==='vat_number') { |
|
980 | 980 | return $data['value']; |
981 | 981 | } |
982 | 982 | } |
@@ -991,9 +991,9 @@ discard block |
||
991 | 991 | */ |
992 | 992 | private function getTaxId($order) |
993 | 993 | { |
994 | - foreach ((array)$order->get_meta_data() as $mdObject) { |
|
994 | + foreach ((array) $order->get_meta_data() as $mdObject) { |
|
995 | 995 | $data = $mdObject->get_data(); |
996 | - if ($data['key'] === 'billing_cfpiva') { |
|
996 | + if ($data['key']==='billing_cfpiva') { |
|
997 | 997 | return $data['value']; |
998 | 998 | } |
999 | 999 | } |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $metaProduct = get_post_meta($product_id); |
1038 | 1038 | |
1039 | 1039 | return (array_key_exists('custom_product_pagantis_promoted', $metaProduct) |
1040 | - && $metaProduct['custom_product_pagantis_promoted']['0'] === 'yes') ? 'true' : 'false'; |
|
1040 | + && $metaProduct['custom_product_pagantis_promoted']['0']==='yes') ? 'true' : 'false'; |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | /** |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | $promotedAmount = 0; |
1051 | 1051 | foreach ($items as $key => $item) { |
1052 | 1052 | $promotedProduct = $this->isPromoted($item['product_id']); |
1053 | - if ($promotedProduct === 'true') { |
|
1053 | + if ($promotedProduct==='true') { |
|
1054 | 1054 | $promotedAmount += $item['line_total'] + $item['line_tax']; |
1055 | 1055 | } |
1056 | 1056 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | use Pagantis\ModuleUtils\Model\Log\LogEntry; |
16 | 16 | use Pagantis\OrdersApiClient\Model\Order; |
17 | 17 | |
18 | -if (! defined('ABSPATH')) { |
|
18 | +if (!defined('ABSPATH')) { |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
@@ -85,12 +85,12 @@ discard block |
||
85 | 85 | */ |
86 | 86 | public function processInformation() |
87 | 87 | { |
88 | - require_once dirname(__FILE__) . '/../includes/class-wc-pagantis-logger.php'; |
|
89 | - require_once dirname(__FILE__) . '/../includes/functions.php'; |
|
88 | + require_once dirname(__FILE__).'/../includes/class-wc-pagantis-logger.php'; |
|
89 | + require_once dirname(__FILE__).'/../includes/functions.php'; |
|
90 | 90 | try { |
91 | - require_once(__ROOT__ . '/vendor/autoload.php'); |
|
91 | + require_once(__ROOT__.'/vendor/autoload.php'); |
|
92 | 92 | try { |
93 | - if ($_SERVER['REQUEST_METHOD'] === 'GET' && $_GET['origin'] === 'notification') { |
|
93 | + if ($_SERVER['REQUEST_METHOD']==='GET' && $_GET['origin']==='notification') { |
|
94 | 94 | return $this->buildResponse(); |
95 | 95 | } |
96 | 96 | $this->checkConcurrency(); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | private function checkConcurrency() |
140 | 140 | { |
141 | 141 | $this->woocommerceOrderId = $_GET['order-received']; |
142 | - if ($this->woocommerceOrderId === '') { |
|
142 | + if ($this->woocommerceOrderId==='') { |
|
143 | 143 | throw new QuoteNotFoundException(); |
144 | 144 | } |
145 | 145 | |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | { |
168 | 168 | global $wpdb; |
169 | 169 | $this->checkDbTable(); |
170 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
170 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
171 | 171 | $queryResult = |
172 | - $wpdb->get_row("select order_id from $tableName where id='" . $this->woocommerceOrderId . "'"); |
|
172 | + $wpdb->get_row("select order_id from $tableName where id='".$this->woocommerceOrderId."'"); |
|
173 | 173 | $this->pagantisOrderId = $queryResult->order_id; |
174 | 174 | |
175 | - if ($this->pagantisOrderId === '') { |
|
175 | + if ($this->pagantisOrderId==='') { |
|
176 | 176 | throw new NoIdentificationException(); |
177 | 177 | } |
178 | 178 | } |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | $status = '-'; |
207 | 207 | } |
208 | 208 | |
209 | - if ($status === Order::STATUS_CONFIRMED) { |
|
209 | + if ($status===Order::STATUS_CONFIRMED) { |
|
210 | 210 | return true; |
211 | 211 | } |
212 | 212 | throw new WrongStatusException($status); |
@@ -222,11 +222,11 @@ discard block |
||
222 | 222 | $validStatus = array('on-hold', 'pending', 'failed', 'processing', 'completed'); |
223 | 223 | $isValidStatus = apply_filters('woocommerce_valid_order_statuses_for_payment_complete', $validStatus, $this); |
224 | 224 | |
225 | - if (! $this->woocommerceOrder->has_status($isValidStatus)) { // TO CONFIRM |
|
225 | + if (!$this->woocommerceOrder->has_status($isValidStatus)) { // TO CONFIRM |
|
226 | 226 | $logMessage = |
227 | - 'WARNING checkMerchantOrderStatus.' . ' Merchant order id:' . $this->woocommerceOrder->get_id() |
|
228 | - . ' Merchant order status:' . $this->woocommerceOrder->get_status() . ' Pagantis order id:' |
|
229 | - . $this->pagantisOrder->getStatus() . ' Pagantis order status:' . $this->pagantisOrder->getId(); |
|
227 | + 'WARNING checkMerchantOrderStatus.'.' Merchant order id:'.$this->woocommerceOrder->get_id() |
|
228 | + . ' Merchant order status:'.$this->woocommerceOrder->get_status().' Pagantis order id:' |
|
229 | + . $this->pagantisOrder->getStatus().' Pagantis order status:'.$this->pagantisOrder->getId(); |
|
230 | 230 | |
231 | 231 | WC_Pagantis_Logger::insert_log_entry_in_wpdb(null, $logMessage); |
232 | 232 | $this->woocommerceOrder->add_order_note($logMessage); |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | { |
246 | 246 | $pagantisAmount = $this->pagantisOrder->getShoppingCart()->getTotalAmount(); |
247 | 247 | $wcAmount = intval(strval(100 * $this->woocommerceOrder->get_total())); |
248 | - if ($pagantisAmount != $wcAmount) { |
|
248 | + if ($pagantisAmount!=$wcAmount) { |
|
249 | 249 | throw new AmountMismatchException($pagantisAmount, $wcAmount); |
250 | 250 | } |
251 | 251 | } |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | $this->pagantisOrder = $this->orderClient->confirmOrder($this->pagantisOrderId); |
270 | 270 | } catch (\Exception $e) { |
271 | 271 | $this->pagantisOrder = $this->orderClient->getOrder($this->pagantisOrderId); |
272 | - if ($this->pagantisOrder->getStatus() !== Order::STATUS_CONFIRMED) { |
|
272 | + if ($this->pagantisOrder->getStatus()!==Order::STATUS_CONFIRMED) { |
|
273 | 273 | throw new UnknownException($e->getMessage()); |
274 | 274 | } else { |
275 | 275 | $logMessage = |
276 | - 'Concurrency issue: Order_id ' . $this->pagantisOrderId . ' was confirmed by other process'; |
|
276 | + 'Concurrency issue: Order_id '.$this->pagantisOrderId.' was confirmed by other process'; |
|
277 | 277 | WC_Pagantis_Logger::insert_log_entry_in_wpdb(null, $logMessage); |
278 | 278 | } |
279 | 279 | } |
@@ -295,14 +295,14 @@ discard block |
||
295 | 295 | private function checkDbTable() |
296 | 296 | { |
297 | 297 | global $wpdb; |
298 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
298 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
299 | 299 | |
300 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
300 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
301 | 301 | $charset_collate = $wpdb->get_charset_collate(); |
302 | 302 | $sql = "CREATE TABLE $tableName (id int, order_id varchar(50), wc_order_id varchar(50), |
303 | 303 | UNIQUE KEY id (id)) $charset_collate"; |
304 | 304 | |
305 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
305 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
306 | 306 | dbDelta($sql); |
307 | 307 | } |
308 | 308 | } |
@@ -313,14 +313,14 @@ discard block |
||
313 | 313 | private function checkDbLogTable() |
314 | 314 | { |
315 | 315 | global $wpdb; |
316 | - $tableName = $wpdb->prefix . PAGANTIS_LOGS_TABLE; |
|
316 | + $tableName = $wpdb->prefix.PAGANTIS_LOGS_TABLE; |
|
317 | 317 | |
318 | - if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'") != $tableName) { |
|
318 | + if ($wpdb->get_var("SHOW TABLES LIKE '$tableName'")!=$tableName) { |
|
319 | 319 | $charset_collate = $wpdb->get_charset_collate(); |
320 | 320 | $sql = "CREATE TABLE $tableName ( id int NOT NULL AUTO_INCREMENT, log text NOT NULL, |
321 | 321 | createdAt timestamp DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY id (id)) $charset_collate"; |
322 | 322 | |
323 | - require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
323 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
324 | 324 | dbDelta($sql); |
325 | 325 | } |
326 | 326 | |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | if ($this->pagantisOrder instanceof Order) { |
356 | 356 | $payed = in_array($this->pagantisOrder->getStatus(), $pagantisStatus); |
357 | - if (! $payed) { |
|
357 | + if (!$payed) { |
|
358 | 358 | if ($this->pagantisOrder instanceof Order) { |
359 | 359 | $status = $this->pagantisOrder->getStatus(); |
360 | 360 | } else { |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | $metadataOrder = $this->pagantisOrder->getMetadata(); |
388 | 388 | $metadataInfo = null; |
389 | 389 | foreach ($metadataOrder as $metadataKey => $metadataValue) { |
390 | - if ($metadataKey === 'promotedProduct') { |
|
390 | + if ($metadataKey==='promotedProduct') { |
|
391 | 391 | $metadataInfo .= "/Producto promocionado = $metadataValue"; |
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
395 | - if ($metadataInfo != null) { |
|
395 | + if ($metadataInfo!=null) { |
|
396 | 396 | $this->woocommerceOrder->add_order_note($metadataInfo); |
397 | 397 | } |
398 | 398 | |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | global $wpdb; |
416 | 416 | |
417 | 417 | $this->checkDbTable(); |
418 | - $tableName = $wpdb->prefix . PAGANTIS_WC_ORDERS_TABLE; |
|
418 | + $tableName = $wpdb->prefix.PAGANTIS_WC_ORDERS_TABLE; |
|
419 | 419 | |
420 | 420 | $wpdb->update( |
421 | 421 | $tableName, |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $logEntry = $logEntry->info($message); |
454 | 454 | } |
455 | 455 | |
456 | - $tableName = $wpdb->prefix . PAGANTIS_LOGS_TABLE; |
|
456 | + $tableName = $wpdb->prefix.PAGANTIS_LOGS_TABLE; |
|
457 | 457 | $wpdb->insert($tableName, array('log' => $logEntry->toJson())); |
458 | 458 | } |
459 | 459 | |
@@ -465,15 +465,15 @@ discard block |
||
465 | 465 | private function unblockConcurrency($orderId = null) |
466 | 466 | { |
467 | 467 | global $wpdb; |
468 | - $tableName = $wpdb->prefix . PAGANTIS_CONCURRENCY_TABLE; |
|
469 | - if ($orderId === null) { |
|
468 | + $tableName = $wpdb->prefix.PAGANTIS_CONCURRENCY_TABLE; |
|
469 | + if ($orderId===null) { |
|
470 | 470 | $query = |
471 | - "DELETE FROM $tableName WHERE createdAt<(NOW()- INTERVAL " . self::CONCURRENCY_TIMEOUT . ' SECOND)'; |
|
471 | + "DELETE FROM $tableName WHERE createdAt<(NOW()- INTERVAL ".self::CONCURRENCY_TIMEOUT.' SECOND)'; |
|
472 | 472 | } else { |
473 | 473 | $query = "DELETE FROM $tableName WHERE order_id = $orderId"; |
474 | 474 | } |
475 | 475 | $resultDelete = $wpdb->query($query); |
476 | - if ($resultDelete === false) { |
|
476 | + if ($resultDelete===false) { |
|
477 | 477 | throw new ConcurrencyException(); |
478 | 478 | } |
479 | 479 | } |
@@ -486,13 +486,13 @@ discard block |
||
486 | 486 | private function blockConcurrency($orderId) |
487 | 487 | { |
488 | 488 | global $wpdb; |
489 | - $tableName = $wpdb->prefix . PAGANTIS_CONCURRENCY_TABLE; |
|
489 | + $tableName = $wpdb->prefix.PAGANTIS_CONCURRENCY_TABLE; |
|
490 | 490 | $insertResult = $wpdb->insert($tableName, array('order_id' => $orderId)); |
491 | - if ($insertResult === false) { |
|
492 | - if ($this->getOrigin() === 'Notify') { |
|
491 | + if ($insertResult===false) { |
|
492 | + if ($this->getOrigin()==='Notify') { |
|
493 | 493 | throw new ConcurrencyException(); |
494 | 494 | } else { |
495 | - $query = |
|
495 | + $query = |
|
496 | 496 | sprintf( |
497 | 497 | 'SELECT TIMESTAMPDIFF(SECOND,NOW()-INTERVAL %s SECOND, createdAt) as rest FROM %s WHERE %s', |
498 | 498 | self::CONCURRENCY_TIMEOUT, |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | { |
527 | 527 | $this->unblockConcurrency($this->woocommerceOrderId); |
528 | 528 | |
529 | - if ($exception === null) { |
|
529 | + if ($exception===null) { |
|
530 | 530 | $jsonResponse = new JsonSuccessResponse(); |
531 | 531 | } else { |
532 | 532 | $jsonResponse = new JsonExceptionResponse(); |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $jsonResponse->setMerchantOrderId($this->woocommerceOrderId); |
537 | 537 | $jsonResponse->setPagantisOrderId($this->pagantisOrderId); |
538 | 538 | |
539 | - if ($_SERVER['REQUEST_METHOD'] === 'POST') { |
|
539 | + if ($_SERVER['REQUEST_METHOD']==='POST') { |
|
540 | 540 | $jsonResponse->printResponse(); |
541 | 541 | } else { |
542 | 542 | return $jsonResponse; |