PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.2.3
Pay with Vipps and MobilePay for WooCommerce v6.2.3
6.2.3 6.2.2 6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 5.4.1 5.4.0 All 185 releases
← All changes | payment/Vipps.class.php +34 -15 6.2.26.2.3 View file →
@@ -310,20 +310,10 @@
310 310
311 311
312 312 // We want this special page to have a certain title and maybe special scripts and so on,
313 313 // this gets run in template redirect for these pages.
314 - add_action('woo_vipps_before_handling_special_page', function ($action) {
315 - // Change title dynamically depending on action. LP 2026-09-02
316 - add_filter('the_title', [$this, 'vipps_special_page_endpoint_title'], 10, 2);
314 + add_action('woo_vipps_before_handling_special_page', array($this, 'pre_special_page_actions'));
317 315
318 - // If we are handling the 'wait for payment' action, we need to poll the order status before
319 - // we start producing content IOK 2026-09-21
320 - if ($action == 'wait_for_payment') {
321 - $this->handle_payment_poll_and_redirect();
322 - }
323 -
324 - });
325 -
326 316 // Add an admin interface for this page as well IOK 2026-09-11
327 317 add_action('woocommerce_settings_pages', array($this, 'woocommerce_settings_pages'));
328 318
329 319 }
@@ -2660,8 +2650,26 @@
2660 2650 do_action('woo_vipps_before_handling_special_page', ($_GET['action'] ?? ""));
2661 2651 }
2662 2652 }
2663 2653
2654 + // Ran in template redirect for the special page. IOK 2026-09-2
2655 + public function pre_special_page_actions ($action) {
2656 + // Change title dynamically depending on action. LP 2026-09-02
2657 + add_filter('the_title', [$this, 'vipps_special_page_endpoint_title'], 10, 2);
2658 +
2659 + // If we are handling the 'wait for payment' action, we need to poll the order status before
2660 + // we start producing content IOK 2026-09-21
2661 + if ($action == 'wait_for_payment') {
2662 + $this->handle_payment_poll_and_redirect();
2663 + }
2664 +
2665 + // Some validation is required for this action
2666 + if ($action == 'do_express_checkout') {
2667 + $this->vipps_express_checkout_consistency_check();
2668 + }
2669 + }
2670 +
2671 +
2664 2672 // Dynamic special page title depending on endpoint/action, only frontend. LP 2026-09-02
2665 2673 public function vipps_special_page_endpoint_title($title, $postid = 0) {
2666 2674 global $wp_query;
2667 2675 // Comment from woocommerce's wc_page_endpoint_title where this logic is from: LP 2026-09-02
@@ -4252,9 +4260,11 @@
4252 4260 if ( empty($_REQUEST['add-to-cart']) || ! is_numeric($_REQUEST['add-to-cart']) || empty($_REQUEST['vipps_compat_mode']) || !$_REQUEST['vipps_compat_mode']) {
4253 4261 return $url;
4254 4262 }
4255 4263 $url = $this->express_checkout_url();
4256 - $url = wp_nonce_url($url,'express','sec');
4264 + // At this point, there is always a query argument here. IOK 2026-09-21
4265 + $nonce = wp_create_nonce('express');
4266 + $url = $url . "&sec=$nonce";
4257 4267
4258 4268 return $url;
4259 4269 }
4260 4270
@@ -5396,15 +5406,13 @@
5396 5406
5397 5407 return $this->express_checkout_page_html(true,'do_single_product_express_checkout',$args);
5398 5408 }
5399 5409
5400 - // This is a landing page for the express checkout of then normal cart - it is done like this because this could take time on slower hosts.
5401 - public function vipps_express_checkout() {
5410 + public function vipps_express_checkout_consistency_check() {
5402 5411 // We need a nonce to get here, but we should only get here when we have a cart, so this will not be cached.
5403 5412 // IOK 2018-05-28
5404 5413 $ok = isset($_REQUEST['sec']) && wp_verify_nonce($_REQUEST['sec'],'express');
5405 5414
5406 -
5407 5415 $backurl = wp_validate_redirect(@$_SERVER['HTTP_REFERER']);
5408 5416 if (!$backurl) $backurl = home_url();
5409 5417
5410 5418 if (!$ok) {
@@ -5416,8 +5424,19 @@
5416 5424 if ( WC()->cart->get_cart_contents_count() == 0 ) {
5417 5425 wc_add_notice(__('Your shopping cart is empty','woo-vipps'),'error');
5418 5426 wp_redirect($backurl);
5419 5427 exit();
5428 + }
5429 +
5430 + add_filter('woo_vipps_express_checkout_consistent', '__return_true');
5431 + }
5432 +
5433 + // This is a landing page for the express checkout of then normal cart - it is done like this because this could take time on slower hosts.
5434 + public function vipps_express_checkout() {
5435 + // Some checks are made in template_redirect, we check here if they are ok IOK 2026-09-21
5436 + if (!apply_filters('woo_vipps_express_checkout_consistent', false)) {
5437 + $content = __('Link expired, please try again', 'woo-vipps');
5438 + return $content;
5420 5439 }
5421 5440
5422 5441 add_filter('body_class', function ($classes) {
5423 5442 $classes[] = 'vipps-express-checkout';