Skip to content

Commit

Permalink
v2.12.6
Browse files Browse the repository at this point in the history
  • Loading branch information
kousikmukherjee committed Jul 28, 2024
1 parent 6c2e236 commit a41ecc3
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 41 deletions.
6 changes: 3 additions & 3 deletions eu-vat-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Plugin Name: EU/UK VAT for WooCommerce
Plugin URI: https://wpfactory.com/item/eu-vat-for-woocommerce/
Description: Manage EU VAT in WooCommerce. Beautifully.
Version: 2.12.5
Version: 2.12.6
Author: WPFactory
Author URI: https://wpfactory.com/
Text Domain: eu-vat-for-woocommerce
Domain Path: /langs
Copyright: © 2023 WPFactory
WC tested up to: 9.0
WC tested up to: 9.1
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
Expand All @@ -33,7 +33,7 @@ final class Alg_WC_EU_VAT {
* @var string
* @since 1.0.0
*/
public $version = '2.12.5';
public $version = '2.12.6';
public $core = null;
public $settings = array();

Expand Down
24 changes: 14 additions & 10 deletions includes/admin/class-alg-wc-eu-vat-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* EU VAT for WooCommerce - Admin Class
*
* @version 2.11.11
* @version 2.12.6
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -377,18 +377,22 @@ function add_to_ajax_get_customer_details( $data, $customer, $user_id ) {
/**
* add_meta_box.
*
* @version 1.0.0
* @version 2.12.6
* @since 1.0.0
*/
function add_meta_box() {
add_meta_box(
'alg-wc-eu-vat',
__( 'EU VAT', 'eu-vat-for-woocommerce' ),
array( $this, 'create_meta_box' ),
'shop_order',
'side',
'low'
);
$current_screen = get_current_screen()->id;

if($current_screen=='shop_order' || $current_screen=='woocommerce_page_wc-orders') {
add_meta_box(
'alg-wc-eu-vat',
__( 'EU VAT', 'eu-vat-for-woocommerce' ),
array( $this, 'create_meta_box' ),
$current_screen,
'side',
'low'
);
}
}

/**
Expand Down
8 changes: 6 additions & 2 deletions includes/class-alg-wc-eu-vat-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* EU VAT for WooCommerce - AJAX Class
*
* @version 2.11.12
* @version 2.12.6
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -96,7 +96,7 @@ function alg_wc_eu_vat_validate_action_first_load( $param ) {
/**
* alg_wc_eu_vat_validate_action.
*
* @version 2.11.12
* @version 2.12.6
* @since 1.0.0
* @todo [dev] (maybe) better codes (i.e. not 0, 1, 2, 3)
* @todo [dev] (maybe) `if ( ! isset( $_POST['alg_wc_eu_vat_validate_action'] ) ) return;`
Expand Down Expand Up @@ -164,6 +164,10 @@ function alg_wc_eu_vat_validate_action( $param ) {
}
}

if ( 'yes' != get_option( 'alg_wc_eu_vat_validate_enable_preserve_message', 'no' ) ) {
$is_preserv = false;
}

if($is_preserv) {
$is_valid = null;
}
Expand Down
21 changes: 19 additions & 2 deletions includes/functions/alg-wc-eu-vat-functions-validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* EU VAT for WooCommerce - Functions - Validation
*
* @version 2.11.4
* @version 2.12.6
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -150,7 +150,7 @@ function alg_wc_eu_vat_validate_vat_no_soap( $country_code, $vat_number, $billin
/**
* alg_wc_eu_vat_validate_vat_soap.
*
* @version 2.11.12
* @version 2.12.6
* @since 1.0.0
* @return mixed: bool on successful checking, null otherwise
*/
Expand Down Expand Up @@ -242,6 +242,23 @@ function alg_wc_eu_vat_validate_vat_soap( $country_code, $vat_number, $billing_c

return null;

} catch (SoapFault $fault) {

alg_wc_eu_vat_maybe_log( $country_code, $vat_number, $billing_company, 'soap',
sprintf( __( 'Error: SoapFault: %s', 'eu-vat-for-woocommerce' ), $fault->getMessage() ) );

if ($fault->faultcode >= 500 && $fault->faultcode < 600) {
// Custom handling for 5xx errors
// ACCEPT THE VAT BECAUSE VIES IS DOWN

if('yes' === get_option( 'alg_wc_eu_vat_validate_vies_not_available', 'no' )) {

alg_wc_eu_vat_session_set( 'alg_wc_eu_vat_vies_error_message', $fault->getMessage() );

return false;

}
}
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions includes/settings/class-alg-wc-eu-vat-settings-validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ function get_settings() {
'css' => 'width:100%;',
),

array(
'title' => __( 'Enable country preserve message', 'eu-vat-for-woocommerce' ),
'desc_tip' => __( 'Enabled/disables country preserve validation message.', 'eu-vat-for-woocommerce' ),
'desc' => __( 'Yes', 'eu-vat-for-woocommerce' ),
'id' => 'alg_wc_eu_vat_validate_enable_preserve_message',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Country preserved', 'eu-vat-for-woocommerce' ),
'desc_tip' => __( 'Message on billing country preserved for VAT. If you want to customize the message using CSS, please use class <code>alg-wc-eu-vat-not-valid-country-preserved</code>', 'eu-vat-for-woocommerce' ),
Expand Down
59 changes: 36 additions & 23 deletions langs/eu-vat-for-woocommerce.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GNU General Public License v3.0.
msgid ""
msgstr ""
"Project-Id-Version: eu-vat-for-woocommerce 2.12.5\n"
"Project-Id-Version: eu-vat-for-woocommerce 2.12.6\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/eu-vat-for-woocommerce\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"POT-Creation-Date: 2024-07-18T12:05:50+02:00\n"
"POT-Creation-Date: 2024-07-28T18:39:47+02:00\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"X-Generator: WP-CLI 2.9.0\n"
"X-Domain: eu-vat-for-woocommerce\n"
Expand Down Expand Up @@ -72,7 +72,7 @@ msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:116
#: includes/admin/class-alg-wc-eu-vat-admin.php:321
#: includes/admin/class-alg-wc-eu-vat-admin.php:386
#: includes/admin/class-alg-wc-eu-vat-admin.php:389
#: includes/settings/class-alg-wc-eu-vat-settings.php:24
msgid "EU VAT"
msgstr ""
Expand All @@ -85,23 +85,23 @@ msgstr ""
msgid "Table is sorted by total tax value."
msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:430
#: includes/admin/class-alg-wc-eu-vat-admin.php:434
msgid "Customer IP"
msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:434
#: includes/admin/class-alg-wc-eu-vat-admin.php:438
msgid "Country by IP"
msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:438
#: includes/admin/class-alg-wc-eu-vat-admin.php:442
msgid "Customer EU VAT Number"
msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:442
#: includes/admin/class-alg-wc-eu-vat-admin.php:446
msgid "Taxes"
msgstr ""

#: includes/admin/class-alg-wc-eu-vat-admin.php:450
#: includes/admin/class-alg-wc-eu-vat-admin.php:454
msgid "Validate VAT and remove taxes"
msgstr ""

Expand Down Expand Up @@ -248,7 +248,8 @@ msgstr ""
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:169
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:218
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:227
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:322
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:304
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:330
msgid "Yes"
msgstr ""

Expand Down Expand Up @@ -288,34 +289,34 @@ msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:65
#: includes/functions/alg-wc-eu-vat-functions-validation.php:78
#: includes/functions/alg-wc-eu-vat-functions-validation.php:368
#: includes/functions/alg-wc-eu-vat-functions-validation.php:380
#: includes/functions/alg-wc-eu-vat-functions-validation.php:385
#: includes/functions/alg-wc-eu-vat-functions-validation.php:397
msgid "Error: %s is disabled"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:86
#: includes/functions/alg-wc-eu-vat-functions-validation.php:389
#: includes/functions/alg-wc-eu-vat-functions-validation.php:406
msgid "Error: No response"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:94
#: includes/functions/alg-wc-eu-vat-functions-validation.php:139
#: includes/functions/alg-wc-eu-vat-functions-validation.php:212
#: includes/functions/alg-wc-eu-vat-functions-validation.php:321
#: includes/functions/alg-wc-eu-vat-functions-validation.php:444
#: includes/functions/alg-wc-eu-vat-functions-validation.php:338
#: includes/functions/alg-wc-eu-vat-functions-validation.php:461
msgid "Success: VAT ID is valid"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:102
#: includes/functions/alg-wc-eu-vat-functions-validation.php:135
#: includes/functions/alg-wc-eu-vat-functions-validation.php:204
#: includes/functions/alg-wc-eu-vat-functions-validation.php:440
#: includes/functions/alg-wc-eu-vat-functions-validation.php:457
msgid "Error: VAT ID not valid"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:132
#: includes/functions/alg-wc-eu-vat-functions-validation.php:197
#: includes/functions/alg-wc-eu-vat-functions-validation.php:433
#: includes/functions/alg-wc-eu-vat-functions-validation.php:450
msgid "Error: Company name does not match (%s)"
msgstr ""

Expand All @@ -331,7 +332,11 @@ msgstr ""
msgid "Error: Exception: %s"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:309
#: includes/functions/alg-wc-eu-vat-functions-validation.php:248
msgid "Error: SoapFault: %s"
msgstr ""

#: includes/functions/alg-wc-eu-vat-functions-validation.php:326
msgid "Success: VAT ID valid. Matched with prevalidated VAT numbers."
msgstr ""

Expand Down Expand Up @@ -1101,30 +1106,38 @@ msgid "VAT is valid, but registered to %company_name%."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:302
msgid "Country preserved"
msgid "Enable country preserve message"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:303
msgid "Enabled/disables country preserve validation message."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:310
msgid "Country preserved"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:311
msgid "Message on billing country preserved for VAT. If you want to customize the message using CSS, please use class <code>alg-wc-eu-vat-not-valid-country-preserved</code>"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:305
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:313
msgid "VAT preserved for this billing country."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:311
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:319
msgid "VIES error message"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:312
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:320
msgid "Message on VIES error. If you want to customize the message using CSS, please use class <code>alg-wc-eu-vat-not-valid-vies-error</code>"
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:314
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:322
msgid "VAT accepted due to VIES error: %vies_error%. The admin will check the VAT validation again and proceed accordingly."
msgstr ""

#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:320
#: includes/settings/class-alg-wc-eu-vat-settings-validation.php:328
msgid "Hide messages on preserved countries list"
msgstr ""

Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: wpcodefactory, omardabbas, karzin, anbinder, algoritmika, kousikmu
Tags: EU VAT, UK VAT, tax, vat validation, VAT
Requires at least: 6.1
Tested up to: 6.5
Stable tag: 2.12.5
Stable tag: 2.12.6
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -290,6 +290,10 @@ Once activated, access the plugin's settings by navigating to “WooCommerce > S

== Changelog ==

= 2.12.6 - 29/07/2024 =
* WC tested up to: 9.1
* Accept VAT when VIES is down (extra catch soapFault).

= 2.12.5 - 18/07/2024 =
* Add - Admin & Advanced > VAT Validation for Orders Created Manually from the Admin Side.
* WC tested up to: 9.0.
Expand Down

0 comments on commit a41ecc3

Please sign in to comment.