Plugin Directory

Changeset 3385269


Ignore:
Timestamp:
10/27/2025 01:58:24 PM (5 months ago)
Author:
thegeneration
Message:

Tagging version 3.3.7

Location:
svea-checkout-for-woocommerce
Files:
4 edited
4 copied

Legend:

Unmodified
Added
Removed
  • svea-checkout-for-woocommerce/tags/3.3.7/inc/Models/Svea_Checkout.php

    r3320066 r3385269  
    354354        $rounded_time = round( time() / 10 ) * 10;
    355355
    356         $id = WC()->session->get_customer_id();
    357 
    358356        $temp_id_parts = [
    359             'sco_con',
    360357            $country_code,
    361358            get_woocommerce_currency(),
    362             substr( $id, 0, 5 ),
     359            WC()->session->get_customer_id(),
    363360            $rounded_time,
    364361        ];
    365362
    366363        // This temp id is later changed into the actual order id
    367         $data['ClientOrderNumber'] = sanitize_text_field( apply_filters( 'woocommerce_sco_client_order_number', strtolower( implode( '_', $temp_id_parts ) ) ) );
     364        $temp_id = $this->create_temp_client_id( $temp_id_parts );
     365        $data['ClientOrderNumber'] = sanitize_text_field( apply_filters( 'woocommerce_sco_client_order_number', $temp_id ) );
    368366        $data['CountryCode'] = $country_code;
    369367
     
    536534
    537535    /**
     536     * Create 32 character long hash of the data
     537     *
     538     * @param array|string $data Array data to hash
     539     * @return string
     540     */
     541    public function create_temp_client_id( $data ): string {
     542        $string = is_array( $data ) ? implode( '', $data ) : $data;
     543
     544        $full_hash = hash( 'sha256', $string, true );
     545        $digest_24_chars = substr( $full_hash, 0, 24 );
     546
     547        // base64 encode to get a-z, A-Z, 0-9, - and _ characters. This will give 32 characters.
     548        $hash_string = rtrim( strtr( base64_encode( $digest_24_chars ), '+/', '-_' ), '=' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
     549
     550        return $hash_string;
     551    }
     552
     553    /**
    538554     * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens.
    539555     *
  • svea-checkout-for-woocommerce/tags/3.3.7/readme.txt

    r3379470 r3385269  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.6
     12Stable tag: 3.3.7
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.7 =
     943.3.7 is a patch release
     95
    9396= 3.3.6 =
    94973.3.6 is a patch release
     
    402405
    403406== Changelog ==
     407
     408= 3.3.7 2025-10-27 =
     409- Better handling of the temporary client ID preventing issues with multiple orders being created.
    404410
    405411= 3.3.6 2025-10-16 =
  • svea-checkout-for-woocommerce/tags/3.3.7/svea-checkout-for-woocommerce.php

    r3379470 r3385269  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.6
     16 * Version: 3.3.7
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.6';
     49        const VERSION = '3.3.7';
    5050
    5151        /**
  • svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php

    r3320066 r3385269  
    354354        $rounded_time = round( time() / 10 ) * 10;
    355355
    356         $id = WC()->session->get_customer_id();
    357 
    358356        $temp_id_parts = [
    359             'sco_con',
    360357            $country_code,
    361358            get_woocommerce_currency(),
    362             substr( $id, 0, 5 ),
     359            WC()->session->get_customer_id(),
    363360            $rounded_time,
    364361        ];
    365362
    366363        // This temp id is later changed into the actual order id
    367         $data['ClientOrderNumber'] = sanitize_text_field( apply_filters( 'woocommerce_sco_client_order_number', strtolower( implode( '_', $temp_id_parts ) ) ) );
     364        $temp_id = $this->create_temp_client_id( $temp_id_parts );
     365        $data['ClientOrderNumber'] = sanitize_text_field( apply_filters( 'woocommerce_sco_client_order_number', $temp_id ) );
    368366        $data['CountryCode'] = $country_code;
    369367
     
    536534
    537535    /**
     536     * Create 32 character long hash of the data
     537     *
     538     * @param array|string $data Array data to hash
     539     * @return string
     540     */
     541    public function create_temp_client_id( $data ): string {
     542        $string = is_array( $data ) ? implode( '', $data ) : $data;
     543
     544        $full_hash = hash( 'sha256', $string, true );
     545        $digest_24_chars = substr( $full_hash, 0, 24 );
     546
     547        // base64 encode to get a-z, A-Z, 0-9, - and _ characters. This will give 32 characters.
     548        $hash_string = rtrim( strtr( base64_encode( $digest_24_chars ), '+/', '-_' ), '=' ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
     549
     550        return $hash_string;
     551    }
     552
     553    /**
    538554     * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens.
    539555     *
  • svea-checkout-for-woocommerce/trunk/readme.txt

    r3379470 r3385269  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.6
     12Stable tag: 3.3.7
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.7 =
     943.3.7 is a patch release
     95
    9396= 3.3.6 =
    94973.3.6 is a patch release
     
    402405
    403406== Changelog ==
     407
     408= 3.3.7 2025-10-27 =
     409- Better handling of the temporary client ID preventing issues with multiple orders being created.
    404410
    405411= 3.3.6 2025-10-16 =
  • svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php

    r3379470 r3385269  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.6
     16 * Version: 3.3.7
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.6';
     49        const VERSION = '3.3.7';
    5050
    5151        /**
Note: See TracChangeset for help on using the changeset viewer.