Changeset 2520555
- Timestamp:
- 04/23/2021 06:20:13 PM (5 years ago)
- File:
-
- 1 edited
-
axima-payment-gateway/trunk/src/Plugin.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
axima-payment-gateway/trunk/src/Plugin.php
r2473231 r2520555 28 28 29 29 $checks = array( 30 'Your Wordpress version is not compatible with Smartlook plugin which requires at least version 3.1. Please update your Wordpress or insert Smartlook chat code into your website manually (you will find the chat code in the email we have sent you upon registration)' => version_compare($wp_version, '3.1', '<'),30 'Your Wordpress version is not compatible with Pays plugin which requires at least version 3.1.)' => version_compare($wp_version, '3.1', '<'), 31 31 'This plugin requires at least PHP version 5.5.0, your version: ' . PHP_VERSION . '. Please ask your hosting company to bring your PHP version up to date.' => version_compare(PHP_VERSION, '5.5.0', '<'), 32 32 'You need WooCommerce plugin installed and activated to run this plugin.' => !in_array('woocommerce/woocommerce.php', apply_filters('active_plugins', get_option('active_plugins')), TRUE), … … 268 268 269 269 add_action('plugins_loaded', function () use ($that) { 270 $handler = array($that, 'confirmPayment'); 271 add_action('wp_ajax_nopriv_pays-confirmation', $handler); 272 add_action('wp_ajax_pays-confirmation', $handler); 270 $handlerConfirm = array($that, 'confirmPayment'); 271 $handlerSuccess = array($that, 'successPayment'); 272 $handlerError = array($that, 'errorPayment'); 273 274 add_action('wp_ajax_nopriv_pays-confirmation', $handlerConfirm); 275 add_action('wp_ajax_pays-confirmation', $handlerConfirm); 276 277 add_action('wp_ajax_nopriv_pays-success', $handlerSuccess); 278 add_action('wp_ajax_pays-success', $handlerSuccess); 279 280 add_action('wp_ajax_nopriv_pays-error', $handlerError); 281 add_action('wp_ajax_pays-error', $handlerError); 273 282 274 283 call_user_func(function () { … … 283 292 } 284 293 285 286 public function confirmPayment() 294 private function getOrderFromParams() 287 295 { 288 296 $get = function ($name, $default = NULL) { … … 300 308 wp_die('ERR: MerchantOrderNumber not in database', '', 400); 301 309 } 302 $order = wc_get_order($item->order); 310 return wc_get_order($item->order); 311 } 312 313 public function confirmPayment() 314 { 315 $get = function ($name, $default = NULL) { 316 return isset($_GET[$name]) ? $_GET[$name] : $default; 317 }; 318 319 $order = $this->getOrderFromParams(); 303 320 304 321 $status = $get('PaymentOrderStatusID', 2); … … 327 344 } 328 345 346 public function successPayment() 347 { 348 $order = $this->getOrderFromParams(); 349 wp_redirect($order->get_checkout_order_received_url()); 350 exit; 351 } 352 353 public function errorPayment() 354 { 355 $order = $this->getOrderFromParams(); 356 wp_redirect($order->get_checkout_payment_url(false)); 357 exit; 358 } 329 359 330 360 private function render($template, $vars = array())
Note: See TracChangeset
for help on using the changeset viewer.