Plugin Directory

Changeset 2602846


Ignore:
Timestamp:
09/22/2021 08:47:30 AM (5 years ago)
Author:
bjorntech
Message:

tagging version 7.4.2

Location:
woo-izettle-integration
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • woo-izettle-integration/tags/7.4.2/README.txt

    r2593568 r2602846  
    55Tested up to: 5.8
    66Requires PHP: 7.3
    7 Stable tag: 7.4.1
     7Stable tag: 7.4.2
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    118118
    119119== 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
    120124= 7.4.1 =
    121125* Fix: Purchases did not update when using debug mode.
  • woo-izettle-integration/tags/7.4.2/includes/admin/izettle-integration-helper.php

    r2568813 r2602846  
    878878        private static function get_rates()
    879879        {
     880
    880881            try {
    881882
     
    884885                if (false === $tax_rates) {
    885886                    $tax_rates = izettle_api()->get_tax_rates();
     887                    WC_IZ()->logger->add(sprintf('get_rates: "%s"', json_encode($tax_rates)));
    886888                    set_site_transient('zettle_tax_rates', $tax_rates, DAY_IN_SECONDS);
    887889                }
    888890
     891                return $tax_rates === 'false' ? false : $tax_rates;
     892
    889893            } catch (IZ_Integration_API_Exception $e) {
    890894
    891895                $error_code = $e->getCode();
    892                 if ($error_code == 403 || $error_code == 404) {
     896                if ($error_code == 403) {
    893897                    set_site_transient('zettle_tax_rates', 'false', DAY_IN_SECONDS);
    894898                    return false;
     
    899903            }
    900904
    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            );
    902920
    903921        }
     
    930948
    931949        }
     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
    932980    }
    933981
  • woo-izettle-integration/tags/7.4.2/includes/admin/settings/wc-settings-page-izettle.php

    r2592459 r2602846  
    183183            } elseif ($connection_status == 'expired') {
    184184                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>';
    186185            } elseif ($connection_status == 'trial') {
    187186                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  
    2424                    try {
    2525
     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
    2643                        $response = $this->post(
    2744                            '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,
    4346                            false,
    4447                            array('Content-Type' => 'application/x-www-form-urlencoded'),
     
    7881        }
    7982
     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
    8095        public function start_tracking_inventory($product_uuid)
    8196        {
     
    329344            $this->connect_to_service();
    330345            $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,
    332371                true,
    333372                'products'
  • woo-izettle-integration/tags/7.4.2/includes/api/izettle-integration-api.php

    r2593568 r2602846  
    167167                if (($http_code = wp_remote_retrieve_response_code($response)) > 299) {
    168168                    $message = isset($data->developerMessage) ? $data->developerMessage : 'Error when connecting to Zettle';
    169                     WC_IZ()->logger->add(sprintf('execute: %s - %s', $http_code, $message));
    170169                    throw new IZ_Integration_API_Exception($message, $http_code);
    171170                }
  • woo-izettle-integration/tags/7.4.2/includes/izettle-integration-iz-products.php

    r2592459 r2602846  
    626626                                 * Import variant images, only used for iZettle web-users using 'izettle_import_variant_images'
    627627                                 */
    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)) {
    629629
    630630                                    do_action('izettle_handle_variant_images', $variation, $this->maybe_add_jpeg($variant->presentation->imageUrl));
     
    12531253        }
    12541254
    1255         public function handle_variant_images_action($product_id, $image, $image_id)
     1255        public function handle_variant_images_action($product_id, $url, $image_id)
    12561256        {
    12571257
     
    12641264                if (($image_id || ($image_id = $this->get_product_image($product, $url))) && (!$this->is_image_on_product($product, $image_id))) {
    12651265                    $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);
    12671267                    $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));
    12691269                }
    12701270
     
    12791279
    12801280            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));
    12811282                as_schedule_single_action(as_get_datetime_object(), 'izettle_handle_variant_images_action', array($product->get_id(), $url, $image_id), 'izettle-iz-images');
    12821283            }
  • woo-izettle-integration/tags/7.4.2/includes/izettle-integration-product-handler.php

    r2592459 r2602846  
    298298            $tax_rate = WC_Zettle_Helper::get_tax_rate($product, $existing_product);
    299299            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))) {
    301303                    $iz_product["taxRates"] = [$tax_rate_id];
    302                 } else {
    303                     $iz_product["vatPercentage"] = $tax_rate;
    304304                }
    305305            }
  • woo-izettle-integration/tags/7.4.2/woo-izettle-integration.php

    r2593568 r2602846  
    1515 * Plugin URI:        https://www.bjorntech.com/woocommerce-zettle/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product
    1616 * Description:       Syncronizes products, purchases and stock-levels.
    17  * Version:           7.4.1
     17 * Version:           7.4.2
    1818 * Author:            BjornTech AB
    1919 * Author URI:        https://www.bjorntech.com/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product
     
    2121 *
    2222 * WC requires at least: 4.0
    23  * WC tested up to: 5.6
     23 * WC tested up to: 5.7
    2424 *
    2525 * Copyright:         2017-2020 BjornTech AB
     
    7373     */
    7474    const NAME = 'WooCommerce Zettle Integration';
    75     const VERSION = '7.4.1';
     75    const VERSION = '7.4.2';
    7676    const SCRIPT_HANDLE = 'wc-izettle-integration';
    7777    const PLUGIN_FILE = __FILE__;
     
    124124            delete_site_transient('izettle_last_purchase_sync');
    125125            delete_site_transient('izettle_last_product_sync');
     126            delete_site_transient('zettle_tax_rates');
     127            delete_site_transient('zettle_tax_settings');
    126128            try {
    127129                IZ_Notice::clear();
     
    472474            delete_site_transient('izettle_last_purchase_sync');
    473475            delete_site_transient('izettle_last_product_sync');
     476            delete_site_transient('zettle_tax_rates');
     477            delete_site_transient('zettle_tax_settings');
    474478            IZ_Notice::add('Zettle: New token requested from service', 'success');
    475479
     
    575579        delete_site_transient('izettle_did_show_trial_info');
    576580        delete_site_transient('izettle_did_show_avaliable_info');
     581        delete_site_transient('zettle_tax_rates');
     582        delete_site_transient('zettle_tax_settings');
    577583        do_action('izettle_force_connection');
    578584
     
    616622    private function sign(string $timestamp, string $payload): string
    617623    {
     624        $webhook_signing_key = izettle_api()->get_webhook_signing_key();
     625        WC_IZ()->logger->add(sprintf('Webhook signing key %s',$webhook_signing_key));
    618626        return hash_hmac(
    619627            'sha256',
    620628            "{$timestamp}.{$payload}",
    621             izettle_api()->get_webhook_signing_key()
     629            $webhook_signing_key
    622630        );
    623631    }
  • woo-izettle-integration/trunk/README.txt

    r2593568 r2602846  
    55Tested up to: 5.8
    66Requires PHP: 7.3
    7 Stable tag: 7.4.1
     7Stable tag: 7.4.2
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    118118
    119119== 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
    120124= 7.4.1 =
    121125* Fix: Purchases did not update when using debug mode.
  • woo-izettle-integration/trunk/includes/admin/izettle-integration-helper.php

    r2568813 r2602846  
    878878        private static function get_rates()
    879879        {
     880
    880881            try {
    881882
     
    884885                if (false === $tax_rates) {
    885886                    $tax_rates = izettle_api()->get_tax_rates();
     887                    WC_IZ()->logger->add(sprintf('get_rates: "%s"', json_encode($tax_rates)));
    886888                    set_site_transient('zettle_tax_rates', $tax_rates, DAY_IN_SECONDS);
    887889                }
    888890
     891                return $tax_rates === 'false' ? false : $tax_rates;
     892
    889893            } catch (IZ_Integration_API_Exception $e) {
    890894
    891895                $error_code = $e->getCode();
    892                 if ($error_code == 403 || $error_code == 404) {
     896                if ($error_code == 403) {
    893897                    set_site_transient('zettle_tax_rates', 'false', DAY_IN_SECONDS);
    894898                    return false;
     
    899903            }
    900904
    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            );
    902920
    903921        }
     
    930948
    931949        }
     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
    932980    }
    933981
  • woo-izettle-integration/trunk/includes/admin/settings/wc-settings-page-izettle.php

    r2592459 r2602846  
    183183            } elseif ($connection_status == 'expired') {
    184184                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>';
    186185            } elseif ($connection_status == 'trial') {
    187186                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  
    2424                    try {
    2525
     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
    2643                        $response = $this->post(
    2744                            '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,
    4346                            false,
    4447                            array('Content-Type' => 'application/x-www-form-urlencoded'),
     
    7881        }
    7982
     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
    8095        public function start_tracking_inventory($product_uuid)
    8196        {
     
    329344            $this->connect_to_service();
    330345            $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,
    332371                true,
    333372                'products'
  • woo-izettle-integration/trunk/includes/api/izettle-integration-api.php

    r2593568 r2602846  
    167167                if (($http_code = wp_remote_retrieve_response_code($response)) > 299) {
    168168                    $message = isset($data->developerMessage) ? $data->developerMessage : 'Error when connecting to Zettle';
    169                     WC_IZ()->logger->add(sprintf('execute: %s - %s', $http_code, $message));
    170169                    throw new IZ_Integration_API_Exception($message, $http_code);
    171170                }
  • woo-izettle-integration/trunk/includes/izettle-integration-iz-products.php

    r2592459 r2602846  
    626626                                 * Import variant images, only used for iZettle web-users using 'izettle_import_variant_images'
    627627                                 */
    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)) {
    629629
    630630                                    do_action('izettle_handle_variant_images', $variation, $this->maybe_add_jpeg($variant->presentation->imageUrl));
     
    12531253        }
    12541254
    1255         public function handle_variant_images_action($product_id, $image, $image_id)
     1255        public function handle_variant_images_action($product_id, $url, $image_id)
    12561256        {
    12571257
     
    12641264                if (($image_id || ($image_id = $this->get_product_image($product, $url))) && (!$this->is_image_on_product($product, $image_id))) {
    12651265                    $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);
    12671267                    $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));
    12691269                }
    12701270
     
    12791279
    12801280            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));
    12811282                as_schedule_single_action(as_get_datetime_object(), 'izettle_handle_variant_images_action', array($product->get_id(), $url, $image_id), 'izettle-iz-images');
    12821283            }
  • woo-izettle-integration/trunk/includes/izettle-integration-product-handler.php

    r2592459 r2602846  
    298298            $tax_rate = WC_Zettle_Helper::get_tax_rate($product, $existing_product);
    299299            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))) {
    301303                    $iz_product["taxRates"] = [$tax_rate_id];
    302                 } else {
    303                     $iz_product["vatPercentage"] = $tax_rate;
    304304                }
    305305            }
  • woo-izettle-integration/trunk/woo-izettle-integration.php

    r2593568 r2602846  
    1515 * Plugin URI:        https://www.bjorntech.com/woocommerce-zettle/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product
    1616 * Description:       Syncronizes products, purchases and stock-levels.
    17  * Version:           7.4.1
     17 * Version:           7.4.2
    1818 * Author:            BjornTech AB
    1919 * Author URI:        https://www.bjorntech.com/?utm_source=wp-izettle&utm_medium=plugin&utm_campaign=product
     
    2121 *
    2222 * WC requires at least: 4.0
    23  * WC tested up to: 5.6
     23 * WC tested up to: 5.7
    2424 *
    2525 * Copyright:         2017-2020 BjornTech AB
     
    7373     */
    7474    const NAME = 'WooCommerce Zettle Integration';
    75     const VERSION = '7.4.1';
     75    const VERSION = '7.4.2';
    7676    const SCRIPT_HANDLE = 'wc-izettle-integration';
    7777    const PLUGIN_FILE = __FILE__;
     
    124124            delete_site_transient('izettle_last_purchase_sync');
    125125            delete_site_transient('izettle_last_product_sync');
     126            delete_site_transient('zettle_tax_rates');
     127            delete_site_transient('zettle_tax_settings');
    126128            try {
    127129                IZ_Notice::clear();
     
    472474            delete_site_transient('izettle_last_purchase_sync');
    473475            delete_site_transient('izettle_last_product_sync');
     476            delete_site_transient('zettle_tax_rates');
     477            delete_site_transient('zettle_tax_settings');
    474478            IZ_Notice::add('Zettle: New token requested from service', 'success');
    475479
     
    575579        delete_site_transient('izettle_did_show_trial_info');
    576580        delete_site_transient('izettle_did_show_avaliable_info');
     581        delete_site_transient('zettle_tax_rates');
     582        delete_site_transient('zettle_tax_settings');
    577583        do_action('izettle_force_connection');
    578584
     
    616622    private function sign(string $timestamp, string $payload): string
    617623    {
     624        $webhook_signing_key = izettle_api()->get_webhook_signing_key();
     625        WC_IZ()->logger->add(sprintf('Webhook signing key %s',$webhook_signing_key));
    618626        return hash_hmac(
    619627            'sha256',
    620628            "{$timestamp}.{$payload}",
    621             izettle_api()->get_webhook_signing_key()
     629            $webhook_signing_key
    622630        );
    623631    }
Note: See TracChangeset for help on using the changeset viewer.