Changeset 2602846
- Timestamp:
- 09/22/2021 08:47:30 AM (5 years ago)
- Location:
- woo-izettle-integration
- Files:
-
- 16 edited
- 1 copied
-
tags/7.4.2 (copied) (copied from woo-izettle-integration/trunk)
-
tags/7.4.2/README.txt (modified) (2 diffs)
-
tags/7.4.2/includes/admin/izettle-integration-helper.php (modified) (4 diffs)
-
tags/7.4.2/includes/admin/settings/wc-settings-page-izettle.php (modified) (1 diff)
-
tags/7.4.2/includes/api/izettle-integration-api-transaction.php (modified) (3 diffs)
-
tags/7.4.2/includes/api/izettle-integration-api.php (modified) (1 diff)
-
tags/7.4.2/includes/izettle-integration-iz-products.php (modified) (4 diffs)
-
tags/7.4.2/includes/izettle-integration-product-handler.php (modified) (1 diff)
-
tags/7.4.2/woo-izettle-integration.php (modified) (7 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/includes/admin/izettle-integration-helper.php (modified) (4 diffs)
-
trunk/includes/admin/settings/wc-settings-page-izettle.php (modified) (1 diff)
-
trunk/includes/api/izettle-integration-api-transaction.php (modified) (3 diffs)
-
trunk/includes/api/izettle-integration-api.php (modified) (1 diff)
-
trunk/includes/izettle-integration-iz-products.php (modified) (4 diffs)
-
trunk/includes/izettle-integration-product-handler.php (modified) (1 diff)
-
trunk/woo-izettle-integration.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
woo-izettle-integration/tags/7.4.2/README.txt
r2593568 r2602846 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.3 7 Stable tag: 7.4. 17 Stable tag: 7.4.2 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 118 118 119 119 == Changelog == 120 = 7.4.2 = 121 * The plugin is verified to work with WooCommerce 5.7 122 * Fix: Tax was not handled correct for US Zettle installations if vat was not enabled in WooCommerce 123 * Fix: Variation images was not imported when importing products from Zettle 120 124 = 7.4.1 = 121 125 * Fix: Purchases did not update when using debug mode. -
woo-izettle-integration/tags/7.4.2/includes/admin/izettle-integration-helper.php
r2568813 r2602846 878 878 private static function get_rates() 879 879 { 880 880 881 try { 881 882 … … 884 885 if (false === $tax_rates) { 885 886 $tax_rates = izettle_api()->get_tax_rates(); 887 WC_IZ()->logger->add(sprintf('get_rates: "%s"', json_encode($tax_rates))); 886 888 set_site_transient('zettle_tax_rates', $tax_rates, DAY_IN_SECONDS); 887 889 } 888 890 891 return $tax_rates === 'false' ? false : $tax_rates; 892 889 893 } catch (IZ_Integration_API_Exception $e) { 890 894 891 895 $error_code = $e->getCode(); 892 if ($error_code == 403 || $error_code == 404) {896 if ($error_code == 403) { 893 897 set_site_transient('zettle_tax_rates', 'false', DAY_IN_SECONDS); 894 898 return false; … … 899 903 } 900 904 901 return $tax_rates === 'false' ? false : $tax_rates; 905 } 906 907 private static function create_tax_rate($label, $percentage, $default = false) 908 { 909 910 $payload = array( 911 "taxRates" => array( 912 array( 913 "uuid" => IZ_UUID::generate(IZ_UUID::UUID_TIME, IZ_UUID::FMT_STRING, WC_iZettle_Integration::UUID_NODE_ID), 914 "label" => $label, 915 "percentage" => $percentage, 916 "default" => $default, 917 ), 918 ), 919 ); 902 920 903 921 } … … 930 948 931 949 } 950 951 public static function get_tax_settings() 952 { 953 954 try { 955 956 $tax_settings = get_site_transient('zettle_tax_settings'); 957 958 if (false === $tax_settings) { 959 $tax_settings = izettle_api()->get_tax_settings(); 960 WC_IZ()->logger->add(sprintf('get_tax_settings: "%s"', json_encode($tax_settings))); 961 set_site_transient('zettle_tax_settings', $tax_settings, DAY_IN_SECONDS); 962 } 963 964 return $tax_settings === 'false' ? false : $tax_settings; 965 966 } catch (IZ_Integration_API_Exception $e) { 967 968 $error_code = $e->getCode(); 969 if ($error_code == 403) { 970 set_site_transient('zettle_tax_settings', 'false', DAY_IN_SECONDS); 971 return false; 972 } else { 973 throw new $e($e->getMessage(), $error_code, $e); 974 } 975 976 } 977 978 } 979 932 980 } 933 981 -
woo-izettle-integration/tags/7.4.2/includes/admin/settings/wc-settings-page-izettle.php
r2592459 r2602846 183 183 } elseif ($connection_status == 'expired') { 184 184 echo '<p>' . sprintf(__('This plugin is authorized with Zettle but your subscription expired %s.', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $valid_to)) . '</p>'; 185 echo '<p>' . sprintf(__('You can still do manual sync once a week. Next time you can do a manual sync is %s', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $next_sync)) . '</p>';186 185 } elseif ($connection_status == 'trial') { 187 186 echo '<p>' . sprintf(__('<strong>Congratulations!</strong> This plugin is authorized with Zettle and your trial is valid until %s', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $valid_to)) . '</p>'; -
woo-izettle-integration/tags/7.4.2/includes/api/izettle-integration-api-transaction.php
r2592459 r2602846 24 24 try { 25 25 26 27 $service_payload = array( 28 'client_id' => WC_IZ()->client_id, 29 'user_email' => get_option('izettle_username'), 30 'user_website' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $alternate_url : get_site_url(), 31 'client_version' => WC_IZ()->version, 32 'organization_uuid' => $this->get_organization_uuid(), 33 'purchases_sync' => get_option('izettle_purchase_sync_model'), 34 'connection_status' => apply_filters('izettle_connection_status', ''), 35 'barcode_status' => get_option('izettle_product_update_barcode'), 36 'php_version' => phpversion(), 37 'wc_version' => WC_Zettle_Helper::wc_version(), 38 'purchase_sync_function' => wc_string_to_bool(get_option('zettle_enable_purchase_processing')) ? 'purchases' : '', 39 'when_changed_in_izettle' => get_option('izettle_when_changed_in_izettle'), 40 'webhook_destination' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $this->construct_alternate_webhook_url($alternate_url,'izettle/webhook') : get_rest_url(null, 'izettle/webhook'), 41 ); 42 26 43 $response = $this->post( 27 44 'token', 28 array( 29 'client_id' => WC_IZ()->client_id, 30 'user_email' => get_option('izettle_username'), 31 'user_website' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $alternate_url : get_site_url(), 32 'client_version' => WC_IZ()->version, 33 'organization_uuid' => $this->get_organization_uuid(), 34 'purchases_sync' => get_option('izettle_purchase_sync_model'), 35 'connection_status' => apply_filters('izettle_connection_status', ''), 36 'barcode_status' => get_option('izettle_product_update_barcode'), 37 'php_version' => phpversion(), 38 'wc_version' => WC_Zettle_Helper::wc_version(), 39 'purchase_sync_function' => wc_string_to_bool(get_option('zettle_enable_purchase_processing')) ? 'purchases' : '', 40 'when_changed_in_izettle' => get_option('izettle_when_changed_in_izettle'), 41 'webhook_destination' => get_rest_url(null, 'izettle/webhook'), 42 ), 45 $service_payload, 43 46 false, 44 47 array('Content-Type' => 'application/x-www-form-urlencoded'), … … 78 81 } 79 82 83 public function construct_alternate_webhook_url($alternate_webhook_url, $rest_path) 84 { 85 $url = $alternate_webhook_url . '/'; 86 87 if(!is_null($rest_path)){ 88 $url .= 'wp-json/' . $rest_path ; 89 } 90 91 return $url; 92 93 } 94 80 95 public function start_tracking_inventory($product_uuid) 81 96 { … … 329 344 $this->connect_to_service(); 330 345 $response = $this->get( 331 '/v1/taxes/' . $uuid, 346 'v1/taxes/' . $uuid, 347 true, 348 'products' 349 ); 350 return $response; 351 } 352 353 public function get_tax_settings() 354 { 355 $this->connect_to_service(); 356 $response = $this->get( 357 'v1/taxes/settings', 358 true, 359 'products' 360 ); 361 return $response; 362 } 363 364 public function create_tax_rates($taxrates) 365 { 366 $this->connect_to_service(); 367 $response = $this->post( 368 'v1/taxes/', 369 $taxrates, 370 true, 332 371 true, 333 372 'products' -
woo-izettle-integration/tags/7.4.2/includes/api/izettle-integration-api.php
r2593568 r2602846 167 167 if (($http_code = wp_remote_retrieve_response_code($response)) > 299) { 168 168 $message = isset($data->developerMessage) ? $data->developerMessage : 'Error when connecting to Zettle'; 169 WC_IZ()->logger->add(sprintf('execute: %s - %s', $http_code, $message));170 169 throw new IZ_Integration_API_Exception($message, $http_code); 171 170 } -
woo-izettle-integration/tags/7.4.2/includes/izettle-integration-iz-products.php
r2592459 r2602846 626 626 * Import variant images, only used for iZettle web-users using 'izettle_import_variant_images' 627 627 */ 628 if ( 'yes' == get_option('izettle_import_variant_images') && isset($variant->presentation->imageUrl)) {628 if (wc_string_to_bool(get_option('izettle_import_variant_images')) && isset($variant->presentation->imageUrl)) { 629 629 630 630 do_action('izettle_handle_variant_images', $variation, $this->maybe_add_jpeg($variant->presentation->imageUrl)); … … 1253 1253 } 1254 1254 1255 public function handle_variant_images_action($product_id, $ image, $image_id)1255 public function handle_variant_images_action($product_id, $url, $image_id) 1256 1256 { 1257 1257 … … 1264 1264 if (($image_id || ($image_id = $this->get_product_image($product, $url))) && (!$this->is_image_on_product($product, $image_id))) { 1265 1265 $product->set_image_id($image_id); 1266 $product->update_meta_data('_izettle_variation_image_url', $ image);1266 $product->update_meta_data('_izettle_variation_image_url', $url); 1267 1267 $product->save(); 1268 $this->logger(sprintf('handle_variant_images_action (%s): Adding variant image %s with id %s', $product->get_id(), $ image, $image_id));1268 $this->logger(sprintf('handle_variant_images_action (%s): Adding variant image %s with id %s', $product->get_id(), $url, $image_id)); 1269 1269 } 1270 1270 … … 1279 1279 1280 1280 if (!$image_id || !$this->is_image_on_product($product, $image_id)) { 1281 $this->logger(sprintf('handle_variant_images (%s): Queuing variant adding of image %s', $product->get_id(), $url)); 1281 1282 as_schedule_single_action(as_get_datetime_object(), 'izettle_handle_variant_images_action', array($product->get_id(), $url, $image_id), 'izettle-iz-images'); 1282 1283 } -
woo-izettle-integration/tags/7.4.2/includes/izettle-integration-product-handler.php
r2592459 r2602846 298 298 $tax_rate = WC_Zettle_Helper::get_tax_rate($product, $existing_product); 299 299 if (false !== $tax_rate) { 300 if ($tax_rate_id = WC_Zettle_Helper::zettle_tax_id($tax_rate)) { 300 if (false === WC_Zettle_Helper::get_tax_settings()) { 301 $iz_product["vatPercentage"] = $tax_rate; 302 } elseif (wc_tax_enabled() && ($tax_rate_id = WC_Zettle_Helper::zettle_tax_id($tax_rate))) { 301 303 $iz_product["taxRates"] = [$tax_rate_id]; 302 } else {303 $iz_product["vatPercentage"] = $tax_rate;304 304 } 305 305 } -
woo-izettle-integration/tags/7.4.2/woo-izettle-integration.php
r2593568 r2602846 15 15 * Plugin URI: https://www.bjorntech.com/woocommerce-zettle/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product 16 16 * Description: Syncronizes products, purchases and stock-levels. 17 * Version: 7.4. 117 * Version: 7.4.2 18 18 * Author: BjornTech AB 19 19 * Author URI: https://www.bjorntech.com/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product … … 21 21 * 22 22 * WC requires at least: 4.0 23 * WC tested up to: 5. 623 * WC tested up to: 5.7 24 24 * 25 25 * Copyright: 2017-2020 BjornTech AB … … 73 73 */ 74 74 const NAME = 'WooCommerce Zettle Integration'; 75 const VERSION = '7.4. 1';75 const VERSION = '7.4.2'; 76 76 const SCRIPT_HANDLE = 'wc-izettle-integration'; 77 77 const PLUGIN_FILE = __FILE__; … … 124 124 delete_site_transient('izettle_last_purchase_sync'); 125 125 delete_site_transient('izettle_last_product_sync'); 126 delete_site_transient('zettle_tax_rates'); 127 delete_site_transient('zettle_tax_settings'); 126 128 try { 127 129 IZ_Notice::clear(); … … 472 474 delete_site_transient('izettle_last_purchase_sync'); 473 475 delete_site_transient('izettle_last_product_sync'); 476 delete_site_transient('zettle_tax_rates'); 477 delete_site_transient('zettle_tax_settings'); 474 478 IZ_Notice::add('Zettle: New token requested from service', 'success'); 475 479 … … 575 579 delete_site_transient('izettle_did_show_trial_info'); 576 580 delete_site_transient('izettle_did_show_avaliable_info'); 581 delete_site_transient('zettle_tax_rates'); 582 delete_site_transient('zettle_tax_settings'); 577 583 do_action('izettle_force_connection'); 578 584 … … 616 622 private function sign(string $timestamp, string $payload): string 617 623 { 624 $webhook_signing_key = izettle_api()->get_webhook_signing_key(); 625 WC_IZ()->logger->add(sprintf('Webhook signing key %s',$webhook_signing_key)); 618 626 return hash_hmac( 619 627 'sha256', 620 628 "{$timestamp}.{$payload}", 621 izettle_api()->get_webhook_signing_key()629 $webhook_signing_key 622 630 ); 623 631 } -
woo-izettle-integration/trunk/README.txt
r2593568 r2602846 5 5 Tested up to: 5.8 6 6 Requires PHP: 7.3 7 Stable tag: 7.4. 17 Stable tag: 7.4.2 8 8 License: GPLv3 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 118 118 119 119 == Changelog == 120 = 7.4.2 = 121 * The plugin is verified to work with WooCommerce 5.7 122 * Fix: Tax was not handled correct for US Zettle installations if vat was not enabled in WooCommerce 123 * Fix: Variation images was not imported when importing products from Zettle 120 124 = 7.4.1 = 121 125 * Fix: Purchases did not update when using debug mode. -
woo-izettle-integration/trunk/includes/admin/izettle-integration-helper.php
r2568813 r2602846 878 878 private static function get_rates() 879 879 { 880 880 881 try { 881 882 … … 884 885 if (false === $tax_rates) { 885 886 $tax_rates = izettle_api()->get_tax_rates(); 887 WC_IZ()->logger->add(sprintf('get_rates: "%s"', json_encode($tax_rates))); 886 888 set_site_transient('zettle_tax_rates', $tax_rates, DAY_IN_SECONDS); 887 889 } 888 890 891 return $tax_rates === 'false' ? false : $tax_rates; 892 889 893 } catch (IZ_Integration_API_Exception $e) { 890 894 891 895 $error_code = $e->getCode(); 892 if ($error_code == 403 || $error_code == 404) {896 if ($error_code == 403) { 893 897 set_site_transient('zettle_tax_rates', 'false', DAY_IN_SECONDS); 894 898 return false; … … 899 903 } 900 904 901 return $tax_rates === 'false' ? false : $tax_rates; 905 } 906 907 private static function create_tax_rate($label, $percentage, $default = false) 908 { 909 910 $payload = array( 911 "taxRates" => array( 912 array( 913 "uuid" => IZ_UUID::generate(IZ_UUID::UUID_TIME, IZ_UUID::FMT_STRING, WC_iZettle_Integration::UUID_NODE_ID), 914 "label" => $label, 915 "percentage" => $percentage, 916 "default" => $default, 917 ), 918 ), 919 ); 902 920 903 921 } … … 930 948 931 949 } 950 951 public static function get_tax_settings() 952 { 953 954 try { 955 956 $tax_settings = get_site_transient('zettle_tax_settings'); 957 958 if (false === $tax_settings) { 959 $tax_settings = izettle_api()->get_tax_settings(); 960 WC_IZ()->logger->add(sprintf('get_tax_settings: "%s"', json_encode($tax_settings))); 961 set_site_transient('zettle_tax_settings', $tax_settings, DAY_IN_SECONDS); 962 } 963 964 return $tax_settings === 'false' ? false : $tax_settings; 965 966 } catch (IZ_Integration_API_Exception $e) { 967 968 $error_code = $e->getCode(); 969 if ($error_code == 403) { 970 set_site_transient('zettle_tax_settings', 'false', DAY_IN_SECONDS); 971 return false; 972 } else { 973 throw new $e($e->getMessage(), $error_code, $e); 974 } 975 976 } 977 978 } 979 932 980 } 933 981 -
woo-izettle-integration/trunk/includes/admin/settings/wc-settings-page-izettle.php
r2592459 r2602846 183 183 } elseif ($connection_status == 'expired') { 184 184 echo '<p>' . sprintf(__('This plugin is authorized with Zettle but your subscription expired %s.', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $valid_to)) . '</p>'; 185 echo '<p>' . sprintf(__('You can still do manual sync once a week. Next time you can do a manual sync is %s', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $next_sync)) . '</p>';186 185 } elseif ($connection_status == 'trial') { 187 186 echo '<p>' . sprintf(__('<strong>Congratulations!</strong> This plugin is authorized with Zettle and your trial is valid until %s', 'woo-izettle-integration'), date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $valid_to)) . '</p>'; -
woo-izettle-integration/trunk/includes/api/izettle-integration-api-transaction.php
r2592459 r2602846 24 24 try { 25 25 26 27 $service_payload = array( 28 'client_id' => WC_IZ()->client_id, 29 'user_email' => get_option('izettle_username'), 30 'user_website' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $alternate_url : get_site_url(), 31 'client_version' => WC_IZ()->version, 32 'organization_uuid' => $this->get_organization_uuid(), 33 'purchases_sync' => get_option('izettle_purchase_sync_model'), 34 'connection_status' => apply_filters('izettle_connection_status', ''), 35 'barcode_status' => get_option('izettle_product_update_barcode'), 36 'php_version' => phpversion(), 37 'wc_version' => WC_Zettle_Helper::wc_version(), 38 'purchase_sync_function' => wc_string_to_bool(get_option('zettle_enable_purchase_processing')) ? 'purchases' : '', 39 'when_changed_in_izettle' => get_option('izettle_when_changed_in_izettle'), 40 'webhook_destination' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $this->construct_alternate_webhook_url($alternate_url,'izettle/webhook') : get_rest_url(null, 'izettle/webhook'), 41 ); 42 26 43 $response = $this->post( 27 44 'token', 28 array( 29 'client_id' => WC_IZ()->client_id, 30 'user_email' => get_option('izettle_username'), 31 'user_website' => ($alternate_url = get_option('bjorntech_alternate_webhook_url')) ? $alternate_url : get_site_url(), 32 'client_version' => WC_IZ()->version, 33 'organization_uuid' => $this->get_organization_uuid(), 34 'purchases_sync' => get_option('izettle_purchase_sync_model'), 35 'connection_status' => apply_filters('izettle_connection_status', ''), 36 'barcode_status' => get_option('izettle_product_update_barcode'), 37 'php_version' => phpversion(), 38 'wc_version' => WC_Zettle_Helper::wc_version(), 39 'purchase_sync_function' => wc_string_to_bool(get_option('zettle_enable_purchase_processing')) ? 'purchases' : '', 40 'when_changed_in_izettle' => get_option('izettle_when_changed_in_izettle'), 41 'webhook_destination' => get_rest_url(null, 'izettle/webhook'), 42 ), 45 $service_payload, 43 46 false, 44 47 array('Content-Type' => 'application/x-www-form-urlencoded'), … … 78 81 } 79 82 83 public function construct_alternate_webhook_url($alternate_webhook_url, $rest_path) 84 { 85 $url = $alternate_webhook_url . '/'; 86 87 if(!is_null($rest_path)){ 88 $url .= 'wp-json/' . $rest_path ; 89 } 90 91 return $url; 92 93 } 94 80 95 public function start_tracking_inventory($product_uuid) 81 96 { … … 329 344 $this->connect_to_service(); 330 345 $response = $this->get( 331 '/v1/taxes/' . $uuid, 346 'v1/taxes/' . $uuid, 347 true, 348 'products' 349 ); 350 return $response; 351 } 352 353 public function get_tax_settings() 354 { 355 $this->connect_to_service(); 356 $response = $this->get( 357 'v1/taxes/settings', 358 true, 359 'products' 360 ); 361 return $response; 362 } 363 364 public function create_tax_rates($taxrates) 365 { 366 $this->connect_to_service(); 367 $response = $this->post( 368 'v1/taxes/', 369 $taxrates, 370 true, 332 371 true, 333 372 'products' -
woo-izettle-integration/trunk/includes/api/izettle-integration-api.php
r2593568 r2602846 167 167 if (($http_code = wp_remote_retrieve_response_code($response)) > 299) { 168 168 $message = isset($data->developerMessage) ? $data->developerMessage : 'Error when connecting to Zettle'; 169 WC_IZ()->logger->add(sprintf('execute: %s - %s', $http_code, $message));170 169 throw new IZ_Integration_API_Exception($message, $http_code); 171 170 } -
woo-izettle-integration/trunk/includes/izettle-integration-iz-products.php
r2592459 r2602846 626 626 * Import variant images, only used for iZettle web-users using 'izettle_import_variant_images' 627 627 */ 628 if ( 'yes' == get_option('izettle_import_variant_images') && isset($variant->presentation->imageUrl)) {628 if (wc_string_to_bool(get_option('izettle_import_variant_images')) && isset($variant->presentation->imageUrl)) { 629 629 630 630 do_action('izettle_handle_variant_images', $variation, $this->maybe_add_jpeg($variant->presentation->imageUrl)); … … 1253 1253 } 1254 1254 1255 public function handle_variant_images_action($product_id, $ image, $image_id)1255 public function handle_variant_images_action($product_id, $url, $image_id) 1256 1256 { 1257 1257 … … 1264 1264 if (($image_id || ($image_id = $this->get_product_image($product, $url))) && (!$this->is_image_on_product($product, $image_id))) { 1265 1265 $product->set_image_id($image_id); 1266 $product->update_meta_data('_izettle_variation_image_url', $ image);1266 $product->update_meta_data('_izettle_variation_image_url', $url); 1267 1267 $product->save(); 1268 $this->logger(sprintf('handle_variant_images_action (%s): Adding variant image %s with id %s', $product->get_id(), $ image, $image_id));1268 $this->logger(sprintf('handle_variant_images_action (%s): Adding variant image %s with id %s', $product->get_id(), $url, $image_id)); 1269 1269 } 1270 1270 … … 1279 1279 1280 1280 if (!$image_id || !$this->is_image_on_product($product, $image_id)) { 1281 $this->logger(sprintf('handle_variant_images (%s): Queuing variant adding of image %s', $product->get_id(), $url)); 1281 1282 as_schedule_single_action(as_get_datetime_object(), 'izettle_handle_variant_images_action', array($product->get_id(), $url, $image_id), 'izettle-iz-images'); 1282 1283 } -
woo-izettle-integration/trunk/includes/izettle-integration-product-handler.php
r2592459 r2602846 298 298 $tax_rate = WC_Zettle_Helper::get_tax_rate($product, $existing_product); 299 299 if (false !== $tax_rate) { 300 if ($tax_rate_id = WC_Zettle_Helper::zettle_tax_id($tax_rate)) { 300 if (false === WC_Zettle_Helper::get_tax_settings()) { 301 $iz_product["vatPercentage"] = $tax_rate; 302 } elseif (wc_tax_enabled() && ($tax_rate_id = WC_Zettle_Helper::zettle_tax_id($tax_rate))) { 301 303 $iz_product["taxRates"] = [$tax_rate_id]; 302 } else {303 $iz_product["vatPercentage"] = $tax_rate;304 304 } 305 305 } -
woo-izettle-integration/trunk/woo-izettle-integration.php
r2593568 r2602846 15 15 * Plugin URI: https://www.bjorntech.com/woocommerce-zettle/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product 16 16 * Description: Syncronizes products, purchases and stock-levels. 17 * Version: 7.4. 117 * Version: 7.4.2 18 18 * Author: BjornTech AB 19 19 * Author URI: https://www.bjorntech.com/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product … … 21 21 * 22 22 * WC requires at least: 4.0 23 * WC tested up to: 5. 623 * WC tested up to: 5.7 24 24 * 25 25 * Copyright: 2017-2020 BjornTech AB … … 73 73 */ 74 74 const NAME = 'WooCommerce Zettle Integration'; 75 const VERSION = '7.4. 1';75 const VERSION = '7.4.2'; 76 76 const SCRIPT_HANDLE = 'wc-izettle-integration'; 77 77 const PLUGIN_FILE = __FILE__; … … 124 124 delete_site_transient('izettle_last_purchase_sync'); 125 125 delete_site_transient('izettle_last_product_sync'); 126 delete_site_transient('zettle_tax_rates'); 127 delete_site_transient('zettle_tax_settings'); 126 128 try { 127 129 IZ_Notice::clear(); … … 472 474 delete_site_transient('izettle_last_purchase_sync'); 473 475 delete_site_transient('izettle_last_product_sync'); 476 delete_site_transient('zettle_tax_rates'); 477 delete_site_transient('zettle_tax_settings'); 474 478 IZ_Notice::add('Zettle: New token requested from service', 'success'); 475 479 … … 575 579 delete_site_transient('izettle_did_show_trial_info'); 576 580 delete_site_transient('izettle_did_show_avaliable_info'); 581 delete_site_transient('zettle_tax_rates'); 582 delete_site_transient('zettle_tax_settings'); 577 583 do_action('izettle_force_connection'); 578 584 … … 616 622 private function sign(string $timestamp, string $payload): string 617 623 { 624 $webhook_signing_key = izettle_api()->get_webhook_signing_key(); 625 WC_IZ()->logger->add(sprintf('Webhook signing key %s',$webhook_signing_key)); 618 626 return hash_hmac( 619 627 'sha256', 620 628 "{$timestamp}.{$payload}", 621 izettle_api()->get_webhook_signing_key()629 $webhook_signing_key 622 630 ); 623 631 }
Note: See TracChangeset
for help on using the changeset viewer.