Changeset 3385269
- Timestamp:
- 10/27/2025 01:58:24 PM (5 months ago)
- Location:
- svea-checkout-for-woocommerce
- Files:
-
- 4 edited
- 4 copied
-
tags/3.3.7 (copied) (copied from svea-checkout-for-woocommerce/trunk)
-
tags/3.3.7/inc/Models/Svea_Checkout.php (modified) (2 diffs)
-
tags/3.3.7/inc/Models/Svea_Item.php (copied) (copied from svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Item.php)
-
tags/3.3.7/readme.txt (copied) (copied from svea-checkout-for-woocommerce/trunk/readme.txt) (3 diffs)
-
tags/3.3.7/svea-checkout-for-woocommerce.php (copied) (copied from svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php) (2 diffs)
-
trunk/inc/Models/Svea_Checkout.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/svea-checkout-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
svea-checkout-for-woocommerce/tags/3.3.7/inc/Models/Svea_Checkout.php
r3320066 r3385269 354 354 $rounded_time = round( time() / 10 ) * 10; 355 355 356 $id = WC()->session->get_customer_id();357 358 356 $temp_id_parts = [ 359 'sco_con',360 357 $country_code, 361 358 get_woocommerce_currency(), 362 substr( $id, 0, 5),359 WC()->session->get_customer_id(), 363 360 $rounded_time, 364 361 ]; 365 362 366 363 // 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 ) ); 368 366 $data['CountryCode'] = $country_code; 369 367 … … 536 534 537 535 /** 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 /** 538 554 * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens. 539 555 * -
svea-checkout-for-woocommerce/tags/3.3.7/readme.txt
r3379470 r3385269 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.3. 612 Stable tag: 3.3.7 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.3.7 = 94 3.3.7 is a patch release 95 93 96 = 3.3.6 = 94 97 3.3.6 is a patch release … … 402 405 403 406 == Changelog == 407 408 = 3.3.7 2025-10-27 = 409 - Better handling of the temporary client ID preventing issues with multiple orders being created. 404 410 405 411 = 3.3.6 2025-10-16 = -
svea-checkout-for-woocommerce/tags/3.3.7/svea-checkout-for-woocommerce.php
r3379470 r3385269 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.3. 616 * Version: 3.3.7 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.3. 6';49 const VERSION = '3.3.7'; 50 50 51 51 /** -
svea-checkout-for-woocommerce/trunk/inc/Models/Svea_Checkout.php
r3320066 r3385269 354 354 $rounded_time = round( time() / 10 ) * 10; 355 355 356 $id = WC()->session->get_customer_id();357 358 356 $temp_id_parts = [ 359 'sco_con',360 357 $country_code, 361 358 get_woocommerce_currency(), 362 substr( $id, 0, 5),359 WC()->session->get_customer_id(), 363 360 $rounded_time, 364 361 ]; 365 362 366 363 // 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 ) ); 368 366 $data['CountryCode'] = $country_code; 369 367 … … 536 534 537 535 /** 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 /** 538 554 * Initiate a change of payment method in Svea. This returns an iframe where all the magic happens. 539 555 * -
svea-checkout-for-woocommerce/trunk/readme.txt
r3379470 r3385269 10 10 License: Apache 2.0 11 11 License URI: https://www.apache.org/licenses/LICENSE-2.0 12 Stable tag: 3.3. 612 Stable tag: 3.3.7 13 13 14 14 Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout! … … 91 91 == Upgrade Notice == 92 92 93 = 3.3.7 = 94 3.3.7 is a patch release 95 93 96 = 3.3.6 = 94 97 3.3.6 is a patch release … … 402 405 403 406 == Changelog == 407 408 = 3.3.7 2025-10-27 = 409 - Better handling of the temporary client ID preventing issues with multiple orders being created. 404 410 405 411 = 3.3.6 2025-10-16 = -
svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php
r3379470 r3385269 14 14 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/ 15 15 * Description: Process payments in WooCommerce via Svea Checkout. 16 * Version: 3.3. 616 * Version: 3.3.7 17 17 * Requires Plugins: woocommerce 18 18 * Author: The Generation AB … … 47 47 * Version of plugin 48 48 */ 49 const VERSION = '3.3. 6';49 const VERSION = '3.3.7'; 50 50 51 51 /**
Note: See TracChangeset
for help on using the changeset viewer.