Plugin Directory

Changeset 3328213


Ignore:
Timestamp:
07/15/2025 12:25:44 PM (9 months ago)
Author:
thegeneration
Message:

Tagging version 3.3.3

Location:
svea-checkout-for-woocommerce
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • svea-checkout-for-woocommerce/tags/3.3.3/inc/Admin.php

    r3320066 r3328213  
    2525     */
    2626    const AWAITING_ORDER_STATUS_FULL = 'wc-awaiting-svea';
     27
     28    /**
     29     * Order items that have been removed in this request
     30     * This is used since Svea has a delay in updating their API
     31     *
     32     * @var array
     33     */
     34    protected $cancelled_order_items = [];
    2735
    2836    /**
     
    673681                $payment_admin->cancel_order_row( $svea_order_id, $svea_order_item_id );
    674682                wp_cache_delete( $svea_order_id, 'svea_co_admin_svea_orders' );
     683
     684                // Svea is slow to update the order rows so we make sure that we mark this order item as removed in our cache
     685                $this->cancelled_order_items[] = $svea_order_id . '_' . $svea_order_item_id;
    675686            } catch ( \Exception $e ) {
    676687                WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when removing order row in Svea admin: %s', $e->getMessage() ) );
     
    678689            }
    679690        }
     691
     692        // Removing an order item triggers a recount of the order totals and taxes so we need to make sure
     693        // that everything is in sync
     694        WC_Gateway_Svea_Checkout::log( 'Syncing order totals after item removal.' );
     695        add_action( 'woocommerce_order_after_calculate_totals', [ $this, 'admin_update_order' ], 10, 2 );
    680696    }
    681697
     
    691707        if ( did_action( 'wp_ajax_woocommerce_save_order_items' ) ) {
    692708            $this->admin_update_order( false, wc_get_order( $order_id ) );
    693 
    694709        } else {
    695710            // Recount the order totals and taxes
     
    825840        // Calculate diff for total
    826841        foreach ( $svea_order_items as $svea_order_item ) {
    827             if ( $svea_order_item['OrderRowId'] === $rounding_order_row_id || $svea_order_item['IsCancelled'] ) {
     842            if ( $svea_order_item['OrderRowId'] === $rounding_order_row_id || $svea_order_item['IsCancelled']
     843                || in_array( $svea_order_id . '_' . $svea_order_item['OrderRowId'], $this->cancelled_order_items, true ) ) {
    828844                continue;
    829845            }
  • svea-checkout-for-woocommerce/tags/3.3.3/readme.txt

    r3324844 r3328213  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.2
     12Stable tag: 3.3.3
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.3 =
     943.3.3 is a patch release
     95
    9396= 3.3.2 =
    94973.3.2 is a patch release
     
    390393
    391394== Changelog ==
     395
     396= 3.3.3 2025-07-15 =
     397- Sync all order rows when an order item is removed in admin. This ensures that taxes are updated when WooCommerce re-calculates totals triggered by an order item removal.
    392398
    393399= 3.3.2 2025-07-09 =
  • svea-checkout-for-woocommerce/tags/3.3.3/svea-checkout-for-woocommerce.php

    r3324844 r3328213  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.2
     16 * Version: 3.3.3
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.2';
     49        const VERSION = '3.3.3';
    5050
    5151        /**
  • svea-checkout-for-woocommerce/tags/3.3.3/vendor/composer/platform_check.php

    r3088414 r3328213  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
  • svea-checkout-for-woocommerce/trunk/inc/Admin.php

    r3320066 r3328213  
    2525     */
    2626    const AWAITING_ORDER_STATUS_FULL = 'wc-awaiting-svea';
     27
     28    /**
     29     * Order items that have been removed in this request
     30     * This is used since Svea has a delay in updating their API
     31     *
     32     * @var array
     33     */
     34    protected $cancelled_order_items = [];
    2735
    2836    /**
     
    673681                $payment_admin->cancel_order_row( $svea_order_id, $svea_order_item_id );
    674682                wp_cache_delete( $svea_order_id, 'svea_co_admin_svea_orders' );
     683
     684                // Svea is slow to update the order rows so we make sure that we mark this order item as removed in our cache
     685                $this->cancelled_order_items[] = $svea_order_id . '_' . $svea_order_item_id;
    675686            } catch ( \Exception $e ) {
    676687                WC_Gateway_Svea_Checkout::log( sprintf( 'Received error when removing order row in Svea admin: %s', $e->getMessage() ) );
     
    678689            }
    679690        }
     691
     692        // Removing an order item triggers a recount of the order totals and taxes so we need to make sure
     693        // that everything is in sync
     694        WC_Gateway_Svea_Checkout::log( 'Syncing order totals after item removal.' );
     695        add_action( 'woocommerce_order_after_calculate_totals', [ $this, 'admin_update_order' ], 10, 2 );
    680696    }
    681697
     
    691707        if ( did_action( 'wp_ajax_woocommerce_save_order_items' ) ) {
    692708            $this->admin_update_order( false, wc_get_order( $order_id ) );
    693 
    694709        } else {
    695710            // Recount the order totals and taxes
     
    825840        // Calculate diff for total
    826841        foreach ( $svea_order_items as $svea_order_item ) {
    827             if ( $svea_order_item['OrderRowId'] === $rounding_order_row_id || $svea_order_item['IsCancelled'] ) {
     842            if ( $svea_order_item['OrderRowId'] === $rounding_order_row_id || $svea_order_item['IsCancelled']
     843                || in_array( $svea_order_id . '_' . $svea_order_item['OrderRowId'], $this->cancelled_order_items, true ) ) {
    828844                continue;
    829845            }
  • svea-checkout-for-woocommerce/trunk/readme.txt

    r3324844 r3328213  
    1010License: Apache 2.0
    1111License URI: https://www.apache.org/licenses/LICENSE-2.0
    12 Stable tag: 3.3.2
     12Stable tag: 3.3.3
    1313
    1414Supercharge your WooCommerce Store with powerful features to pay via Svea Checkout!
     
    9191== Upgrade Notice ==
    9292
     93= 3.3.3 =
     943.3.3 is a patch release
     95
    9396= 3.3.2 =
    94973.3.2 is a patch release
     
    390393
    391394== Changelog ==
     395
     396= 3.3.3 2025-07-15 =
     397- Sync all order rows when an order item is removed in admin. This ensures that taxes are updated when WooCommerce re-calculates totals triggered by an order item removal.
    392398
    393399= 3.3.2 2025-07-09 =
  • svea-checkout-for-woocommerce/trunk/svea-checkout-for-woocommerce.php

    r3324844 r3328213  
    1414 * Plugin URI: https://wordpress.org/plugins/svea-checkout-for-woocommerce/
    1515 * Description: Process payments in WooCommerce via Svea Checkout.
    16  * Version: 3.3.2
     16 * Version: 3.3.3
    1717 * Requires Plugins: woocommerce
    1818 * Author: The Generation AB
     
    4747         * Version of plugin
    4848         */
    49         const VERSION = '3.3.2';
     49        const VERSION = '3.3.3';
    5050
    5151        /**
  • svea-checkout-for-woocommerce/trunk/vendor/composer/platform_check.php

    r3088414 r3328213  
    2020        }
    2121    }
    22     trigger_error(
    23         'Composer detected issues in your platform: ' . implode(' ', $issues),
    24         E_USER_ERROR
     22    throw new \RuntimeException(
     23        'Composer detected issues in your platform: ' . implode(' ', $issues)
    2524    );
    2625}
Note: See TracChangeset for help on using the changeset viewer.