Plugin Directory

Changeset 3837202


Ignore:
Timestamp:
12/01/2026 09:50:44 AM (less than one hour ago)
Author:
collectorbank
Message:

Update to version 5.1.2 from GitHub

Location:
collector-checkout-for-woocommerce
Files:
18 edited
1 copied

Legend:

Unmodified
Added
Removed
  • collector-checkout-for-woocommerce/tags/5.1.2/assets/js/walley-checkout-for-woocommerce.js

    r3696602 r3837202  
    394394                                error: function( data ) {},
    395395                                complete: function( data ) {
    396                                         window.location.href = data.responseJSON.data.redirect;
     396                                        walleyCheckoutWc.redirectOrReload( data );
    397397                                }
    398398                        });
    … …  
    423423                                                error: function( data ) {},
    424424                                                complete: function( data ) {
    425                                                         console.log('maybeChangeToWalleyCheckout', data);
    426                                                         window.location.href = data.responseJSON.data.redirect;
     425                                                        walleyCheckoutWc.redirectOrReload( data );
    427426                                                }
    428427                                        });
    429428                                }
     429                        }
     430                },
     431                /**
     432                 * Follows the redirect from a payment method change, or reloads when there is none.
     433                 *
     434                 * @param {jqXHR} data
     435                 */
     436                redirectOrReload: function( data ) {
     437                        const redirect = data.responseJSON?.data?.redirect;
     438                        if ( redirect ) {
     439                                window.location.href = redirect;
     440                        } else {
     441                                window.location.reload();
    430442                        }
    431443                },
    … …  
    697709                                        console.log(data.data);
    698710                                }
     711                        }).fail(function (jqXHR) {
     712                                // Not JSON, e.g. maintenance mode or a PHP error. Tell the customer instead of leaving an empty checkout.
     713                                $('#collector-container').empty().append(
     714                                        $('<ul class="woocommerce-error" role="alert"></ul>').append( $('<li></li>').text( walleyParams.checkout_load_error_message ) )
     715                                );
     716                                walleyCheckoutWc.logToFile( 'Could not get a new Walley checkout when changing customer type | HTTP status ' + jqXHR.status );
    699717                        });
    700718                },
  • collector-checkout-for-woocommerce/tags/5.1.2/classes/class-collector-checkout-ajax-calls.php

    r3792152 r3837202  
    191191                                WC()->session->set( 'collector_currency', get_woocommerce_currency() );
    192192                                WC()->session->set( 'collector_billing_country', WC()->customer->get_billing_country() );
     193                                WC()->session->set( 'collector_plugin_version', COLLECTOR_BANK_VERSION );
    193194
    194195                                wp_send_json_success( $return );
  • collector-checkout-for-woocommerce/tags/5.1.2/classes/class-walley-checkout-assets.php

    r3718909 r3837202  
    173173                                'process_order_text'          => __( 'Please wait while we process your order.', 'collector-checkout-for-woocommerce' ),
    174174                                'generic_error_message'       => __( 'Something went wrong when placing your order. Please try again, or contact us if the problem persists.', 'collector-checkout-for-woocommerce' ),
     175                                'checkout_load_error_message' => __( 'Could not load the Walley checkout. Please reload the page and try again.', 'collector-checkout-for-woocommerce' ),
    175176                                'no_shipping_message'         => apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
    176177                        )
  • collector-checkout-for-woocommerce/tags/5.1.2/classes/class-walley-checkout.php

    r3718909 r3837202  
    104104                        }
    105105
     106                        return;
     107                }
     108
     109                if ( walley_session_is_from_another_version() && in_array( get_walley_purchase_status( $this->collector_order ), walley_payment_status_approved_for_update_request(), true ) ) {
     110                        CCO_WC()->logger::log( "Walley session $private_id was created by another plugin version. Reloading the checkout." );
     111                        WC()->session->set( 'reload_checkout', true );
     112                        $this->reload_checkout = true;
    106113                        return;
    107114                }
  • collector-checkout-for-woocommerce/tags/5.1.2/collector-checkout-for-woocommerce.php

    r3792152 r3837202  
    99 * Plugin URI: https://krokedil.se/produkt/walley-checkout/
    1010 * Description: Extends WooCommerce. Provides a <a href="https://www.walley.se/foretag/checkout/" target="_blank">Walley Checkout</a> checkout for WooCommerce.
    11  * Version: 5.1.1
     11 * Version: 5.1.2
    1212 * Author: Krokedil
    1313 * Author URI: https://krokedil.se/
    … …  
    1717 *
    1818 * WC requires at least: 6.0.0
    19  * WC tested up to: 11.2.2
     19 * WC tested up to: 11.3.1
    2020 *
    2121 * Copyright: © 2017-2026 Krokedil.
    … …  
    3030define( 'COLLECTOR_BANK_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    3131define( 'COLLECTOR_BANK_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
    32 define( 'COLLECTOR_BANK_VERSION', '5.1.1' );
     32define( 'COLLECTOR_BANK_VERSION', '5.1.2' );
    3333
    3434if ( ! class_exists( 'Collector_Checkout' ) ) {
  • collector-checkout-for-woocommerce/tags/5.1.2/dependencies/composer/installed.php

    r3792152 r3837202  
    33namespace KrokedilWalleyDeps;
    44
    5 return array('root' => array('name' => '__root__', 'pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('__root__' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'krokedil/wp-api' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '3473dd2fb6b31ed5060ecd69877c98b5287ebe48', 'type' => 'library', 'install_path' => __DIR__ . '/../krokedil/wp-api', 'aliases' => array(), 'dev_requirement' => \false)));
     5return array('root' => array('name' => '__root__', 'pretty_version' => '5.1.2', 'version' => '5.1.2.0', 'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('__root__' => array('pretty_version' => '5.1.2', 'version' => '5.1.2.0', 'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'krokedil/wp-api' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '3473dd2fb6b31ed5060ecd69877c98b5287ebe48', 'type' => 'library', 'install_path' => __DIR__ . '/../krokedil/wp-api', 'aliases' => array(), 'dev_requirement' => \false)));
  • collector-checkout-for-woocommerce/tags/5.1.2/includes/collector-checkout-for-woocommerce-functions.php

    r3792152 r3837202  
    122122                        }
    123123
    124                         $output = array(
    125                                 'publicToken'   => $public_token,
    126                                 'test_mode'     => $test_mode,
    127                                 'customer_type' => $customer_type,
    128                         );
    129                         echo( "<script>console.log('Collector: " . wp_json_encode( $output ) . "');</script>" );
    130                         $return = '<div id="collector-container"><script src="' . $url . '" data-lang="' . $locale . '" data-token="' . $public_token . '" data-variant="' . $customer_type . '"' . $data_action_color_button . ' ></script></div>'; // phpcs:ignore
     124                        if ( walley_session_is_from_another_version() && in_array( $status, walley_payment_status_approved_for_update_request(), true ) ) {
     125                                $session_version = WC()->session->get( 'collector_plugin_version' );
     126                                CCO_WC()->logger::log( sprintf( 'Walley session %s was created by plugin version %s, current version is %s. Initializing a new checkout.', $private_id, empty( $session_version ) ? '(unknown)' : $session_version, COLLECTOR_BANK_VERSION ) );
     127
     128                                wc_collector_unset_sessions();
     129                                $initialize_checkout = true;
     130                        } else {
     131                                $output = array(
     132                                        'publicToken'   => $public_token,
     133                                        'test_mode'     => $test_mode,
     134                                        'customer_type' => $customer_type,
     135                                );
     136                                echo( "<script>console.log('Collector: " . wp_json_encode( $output ) . "');</script>" );
     137                                $return = '<div id="collector-container"><script src="' . $url . '" data-lang="' . $locale . '" data-token="' . $public_token . '" data-variant="' . $customer_type . '"' . $data_action_color_button . ' ></script></div>'; // phpcs:ignore
     138                        }
    131139                }
    132140        }
    … …  
    150158                        WC()->session->set( 'collector_billing_country', WC()->customer->get_billing_country() );
    151159                        WC()->session->set( 'collector_profile', $profile );
     160                        WC()->session->set( 'collector_plugin_version', COLLECTOR_BANK_VERSION );
    152161
    153162                        $public_token = $collector_order['data']['publicToken'];
    … …  
    185194
    186195                WC()->session->__unset( 'collector_billing_country' );
    187         }
     196                WC()->session->__unset( 'collector_plugin_version' );
     197        }
     198}
     199
     200/**
     201 * Whether the Walley session was created by another version of this plugin.
     202 *
     203 * @return bool
     204 */
     205function walley_session_is_from_another_version() {
     206        return COLLECTOR_BANK_VERSION !== WC()->session->get( 'collector_plugin_version' );
    188207}
    189208
  • collector-checkout-for-woocommerce/tags/5.1.2/readme.txt

    r3792152 r3837202  
    55Tested up to: 7.1
    66Requires PHP: 7.3
    7 Stable tag: 5.1.1
     7Stable tag: 5.1.2
    88WC requires at least: 6.0.0
    9 WC tested up to: 11.2.2
     9WC tested up to: 11.3.1
    1010License: GPLv3
    1111License URI: http://www.gnu.org/licenses/gpl-3.0.html
    … …  
    4040
    4141== CHANGELOG ==
     42= 2026-12-01    - version 5.1.2 =
     43* Fix           - Customers who had started a checkout before a plugin update now get a new Walley checkout instead of one that could not be completed. The checkout also no longer stays locked when switching payment method fails.
     44
    4245= 2026-11-09    - version 5.1.1 =
    4346* Fix           - Walley now stops a purchase if the WooCommerce order for the checkout has been cancelled, for example when the hold stock time has run out. The cancelled order was previously reopened as processing and stock was reduced again without a stock check.
  • collector-checkout-for-woocommerce/tags/5.1.2/vendor/composer/installed.php

    r3792152 r3837202  
    22    'root' => array(
    33        'name' => 'krokedil/walley-checkout-for-woocommerce',
    4         'pretty_version' => '5.1.1',
    5         'version' => '5.1.1.0',
    6         'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d',
     4        'pretty_version' => '5.1.2',
     5        'version' => '5.1.2.0',
     6        'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    2121        ),
    2222        'krokedil/walley-checkout-for-woocommerce' => array(
    23             'pretty_version' => '5.1.1',
    24             'version' => '5.1.1.0',
    25             'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d',
     23            'pretty_version' => '5.1.2',
     24            'version' => '5.1.2.0',
     25            'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a',
    2626            'type' => 'wordpress-plugin',
    2727            'install_path' => __DIR__ . '/../../',
  • collector-checkout-for-woocommerce/trunk/assets/js/walley-checkout-for-woocommerce.js

    r3696602 r3837202  
    394394                                error: function( data ) {},
    395395                                complete: function( data ) {
    396                                         window.location.href = data.responseJSON.data.redirect;
     396                                        walleyCheckoutWc.redirectOrReload( data );
    397397                                }
    398398                        });
    … …  
    423423                                                error: function( data ) {},
    424424                                                complete: function( data ) {
    425                                                         console.log('maybeChangeToWalleyCheckout', data);
    426                                                         window.location.href = data.responseJSON.data.redirect;
     425                                                        walleyCheckoutWc.redirectOrReload( data );
    427426                                                }
    428427                                        });
    429428                                }
     429                        }
     430                },
     431                /**
     432                 * Follows the redirect from a payment method change, or reloads when there is none.
     433                 *
     434                 * @param {jqXHR} data
     435                 */
     436                redirectOrReload: function( data ) {
     437                        const redirect = data.responseJSON?.data?.redirect;
     438                        if ( redirect ) {
     439                                window.location.href = redirect;
     440                        } else {
     441                                window.location.reload();
    430442                        }
    431443                },
    … …  
    697709                                        console.log(data.data);
    698710                                }
     711                        }).fail(function (jqXHR) {
     712                                // Not JSON, e.g. maintenance mode or a PHP error. Tell the customer instead of leaving an empty checkout.
     713                                $('#collector-container').empty().append(
     714                                        $('<ul class="woocommerce-error" role="alert"></ul>').append( $('<li></li>').text( walleyParams.checkout_load_error_message ) )
     715                                );
     716                                walleyCheckoutWc.logToFile( 'Could not get a new Walley checkout when changing customer type | HTTP status ' + jqXHR.status );
    699717                        });
    700718                },
  • collector-checkout-for-woocommerce/trunk/classes/class-collector-checkout-ajax-calls.php

    r3792152 r3837202  
    191191                                WC()->session->set( 'collector_currency', get_woocommerce_currency() );
    192192                                WC()->session->set( 'collector_billing_country', WC()->customer->get_billing_country() );
     193                                WC()->session->set( 'collector_plugin_version', COLLECTOR_BANK_VERSION );
    193194
    194195                                wp_send_json_success( $return );
  • collector-checkout-for-woocommerce/trunk/classes/class-walley-checkout-assets.php

    r3718909 r3837202  
    173173                                'process_order_text'          => __( 'Please wait while we process your order.', 'collector-checkout-for-woocommerce' ),
    174174                                'generic_error_message'       => __( 'Something went wrong when placing your order. Please try again, or contact us if the problem persists.', 'collector-checkout-for-woocommerce' ),
     175                                'checkout_load_error_message' => __( 'Could not load the Walley checkout. Please reload the page and try again.', 'collector-checkout-for-woocommerce' ),
    175176                                'no_shipping_message'         => apply_filters( 'woocommerce_no_shipping_available_html', __( 'There are no shipping options available. Please ensure that your address has been entered correctly, or contact us if you need any help.', 'woocommerce' ) ), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
    176177                        )
  • collector-checkout-for-woocommerce/trunk/classes/class-walley-checkout.php

    r3718909 r3837202  
    104104                        }
    105105
     106                        return;
     107                }
     108
     109                if ( walley_session_is_from_another_version() && in_array( get_walley_purchase_status( $this->collector_order ), walley_payment_status_approved_for_update_request(), true ) ) {
     110                        CCO_WC()->logger::log( "Walley session $private_id was created by another plugin version. Reloading the checkout." );
     111                        WC()->session->set( 'reload_checkout', true );
     112                        $this->reload_checkout = true;
    106113                        return;
    107114                }
  • collector-checkout-for-woocommerce/trunk/collector-checkout-for-woocommerce.php

    r3792152 r3837202  
    99 * Plugin URI: https://krokedil.se/produkt/walley-checkout/
    1010 * Description: Extends WooCommerce. Provides a <a href="https://www.walley.se/foretag/checkout/" target="_blank">Walley Checkout</a> checkout for WooCommerce.
    11  * Version: 5.1.1
     11 * Version: 5.1.2
    1212 * Author: Krokedil
    1313 * Author URI: https://krokedil.se/
    … …  
    1717 *
    1818 * WC requires at least: 6.0.0
    19  * WC tested up to: 11.2.2
     19 * WC tested up to: 11.3.1
    2020 *
    2121 * Copyright: © 2017-2026 Krokedil.
    … …  
    3030define( 'COLLECTOR_BANK_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
    3131define( 'COLLECTOR_BANK_PLUGIN_URL', untrailingslashit( plugin_dir_url( __FILE__ ) ) );
    32 define( 'COLLECTOR_BANK_VERSION', '5.1.1' );
     32define( 'COLLECTOR_BANK_VERSION', '5.1.2' );
    3333
    3434if ( ! class_exists( 'Collector_Checkout' ) ) {
  • collector-checkout-for-woocommerce/trunk/dependencies/composer/installed.php

    r3792152 r3837202  
    33namespace KrokedilWalleyDeps;
    44
    5 return array('root' => array('name' => '__root__', 'pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('__root__' => array('pretty_version' => '5.1.1', 'version' => '5.1.1.0', 'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'krokedil/wp-api' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '3473dd2fb6b31ed5060ecd69877c98b5287ebe48', 'type' => 'library', 'install_path' => __DIR__ . '/../krokedil/wp-api', 'aliases' => array(), 'dev_requirement' => \false)));
     5return array('root' => array('name' => '__root__', 'pretty_version' => '5.1.2', 'version' => '5.1.2.0', 'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev' => \true), 'versions' => array('__root__' => array('pretty_version' => '5.1.2', 'version' => '5.1.2.0', 'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => \false), 'krokedil/wp-api' => array('pretty_version' => '1.2.0', 'version' => '1.2.0.0', 'reference' => '3473dd2fb6b31ed5060ecd69877c98b5287ebe48', 'type' => 'library', 'install_path' => __DIR__ . '/../krokedil/wp-api', 'aliases' => array(), 'dev_requirement' => \false)));
  • collector-checkout-for-woocommerce/trunk/includes/collector-checkout-for-woocommerce-functions.php

    r3792152 r3837202  
    122122                        }
    123123
    124                         $output = array(
    125                                 'publicToken'   => $public_token,
    126                                 'test_mode'     => $test_mode,
    127                                 'customer_type' => $customer_type,
    128                         );
    129                         echo( "<script>console.log('Collector: " . wp_json_encode( $output ) . "');</script>" );
    130                         $return = '<div id="collector-container"><script src="' . $url . '" data-lang="' . $locale . '" data-token="' . $public_token . '" data-variant="' . $customer_type . '"' . $data_action_color_button . ' ></script></div>'; // phpcs:ignore
     124                        if ( walley_session_is_from_another_version() && in_array( $status, walley_payment_status_approved_for_update_request(), true ) ) {
     125                                $session_version = WC()->session->get( 'collector_plugin_version' );
     126                                CCO_WC()->logger::log( sprintf( 'Walley session %s was created by plugin version %s, current version is %s. Initializing a new checkout.', $private_id, empty( $session_version ) ? '(unknown)' : $session_version, COLLECTOR_BANK_VERSION ) );
     127
     128                                wc_collector_unset_sessions();
     129                                $initialize_checkout = true;
     130                        } else {
     131                                $output = array(
     132                                        'publicToken'   => $public_token,
     133                                        'test_mode'     => $test_mode,
     134                                        'customer_type' => $customer_type,
     135                                );
     136                                echo( "<script>console.log('Collector: " . wp_json_encode( $output ) . "');</script>" );
     137                                $return = '<div id="collector-container"><script src="' . $url . '" data-lang="' . $locale . '" data-token="' . $public_token . '" data-variant="' . $customer_type . '"' . $data_action_color_button . ' ></script></div>'; // phpcs:ignore
     138                        }
    131139                }
    132140        }
    … …  
    150158                        WC()->session->set( 'collector_billing_country', WC()->customer->get_billing_country() );
    151159                        WC()->session->set( 'collector_profile', $profile );
     160                        WC()->session->set( 'collector_plugin_version', COLLECTOR_BANK_VERSION );
    152161
    153162                        $public_token = $collector_order['data']['publicToken'];
    … …  
    185194
    186195                WC()->session->__unset( 'collector_billing_country' );
    187         }
     196                WC()->session->__unset( 'collector_plugin_version' );
     197        }
     198}
     199
     200/**
     201 * Whether the Walley session was created by another version of this plugin.
     202 *
     203 * @return bool
     204 */
     205function walley_session_is_from_another_version() {
     206        return COLLECTOR_BANK_VERSION !== WC()->session->get( 'collector_plugin_version' );
    188207}
    189208
  • collector-checkout-for-woocommerce/trunk/readme.txt

    r3792152 r3837202  
    55Tested up to: 7.1
    66Requires PHP: 7.3
    7 Stable tag: 5.1.1
     7Stable tag: 5.1.2
    88WC requires at least: 6.0.0
    9 WC tested up to: 11.2.2
     9WC tested up to: 11.3.1
    1010License: GPLv3
    1111License URI: http://www.gnu.org/licenses/gpl-3.0.html
    … …  
    4040
    4141== CHANGELOG ==
     42= 2026-12-01    - version 5.1.2 =
     43* Fix           - Customers who had started a checkout before a plugin update now get a new Walley checkout instead of one that could not be completed. The checkout also no longer stays locked when switching payment method fails.
     44
    4245= 2026-11-09    - version 5.1.1 =
    4346* Fix           - Walley now stops a purchase if the WooCommerce order for the checkout has been cancelled, for example when the hold stock time has run out. The cancelled order was previously reopened as processing and stock was reduced again without a stock check.
  • collector-checkout-for-woocommerce/trunk/vendor/composer/installed.php

    r3792152 r3837202  
    22    'root' => array(
    33        'name' => 'krokedil/walley-checkout-for-woocommerce',
    4         'pretty_version' => '5.1.1',
    5         'version' => '5.1.1.0',
    6         'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d',
     4        'pretty_version' => '5.1.2',
     5        'version' => '5.1.2.0',
     6        'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a',
    77        'type' => 'wordpress-plugin',
    88        'install_path' => __DIR__ . '/../../',
    … …  
    2121        ),
    2222        'krokedil/walley-checkout-for-woocommerce' => array(
    23             'pretty_version' => '5.1.1',
    24             'version' => '5.1.1.0',
    25             'reference' => 'ca7ee0faddbf7310d86a91498c0311bc0c89040d',
     23            'pretty_version' => '5.1.2',
     24            'version' => '5.1.2.0',
     25            'reference' => '620a2167b1c1544a5aa86d6b9f1004cf6b34e95a',
    2626            'type' => 'wordpress-plugin',
    2727            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.