From 02f4211f12a0485fdcc6f7e841e9cad92dd92bd9 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Thu, 28 Jan 2010 10:39:40 +0100 Subject: [PATCH] Typo caused EU TaxDriver to not charge taxes for shipping addresses in France. --- docs/changelog/7.x.x.txt | 2 ++ lib/WebGUI/Shop/TaxDriver/EU.pm | 2 +- t/Shop/TaxDriver/EU.t | 19 +++++++++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index ba236f919..726a48e91 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,8 @@ - fixed #11044: Optionally include hidden pages in sitemap.xml - fixed #11379: Certain fields in some Assets cannot be overridden in the config file - fixed #11380: "Use this Address" button in Shop needs to be green! + - fixed: Due to a typo France was not considered part of the EU by the EU + TaxDriver. ( Martin Kamerbeek / Oqapi ) 7.8.10 - fixed #11332: Pagination in webgui.org forum urls diff --git a/lib/WebGUI/Shop/TaxDriver/EU.pm b/lib/WebGUI/Shop/TaxDriver/EU.pm index a46af2b18..76207aa66 100644 --- a/lib/WebGUI/Shop/TaxDriver/EU.pm +++ b/lib/WebGUI/Shop/TaxDriver/EU.pm @@ -62,7 +62,7 @@ tie my %EU_COUNTRIES, 'Tie::IxHash', ( EL => 'Greece', ES => 'Spain', FI => 'Finland', - FR => 'France ', + FR => 'France', GB => 'United Kingdom', HU => 'Hungary', IE => 'Ireland', diff --git a/t/Shop/TaxDriver/EU.t b/t/Shop/TaxDriver/EU.t index 5f6c77359..f3dbbf917 100644 --- a/t/Shop/TaxDriver/EU.t +++ b/t/Shop/TaxDriver/EU.t @@ -44,6 +44,14 @@ my $noServiceVAT= 'NotGonnaWork'; my $invalidVAT = 'ByNoMeansAllowed'; my $visitorUser = WebGUI::User->new( $session, 1 ); +my @EU_COUNTRIES = ( + 'Austria', 'Belgium', 'Bulgaria', 'Cyprus', 'Czech Republic', + 'Germany', 'Denmark', 'Estonia', 'Greece', 'Spain', 'Finland', + 'France', 'United Kingdom', 'Hungary', 'Ireland', 'Italy', + 'Lithuania', 'Luxembourg', 'Latvia', 'Malta', 'Netherlands', + 'Poland', 'Portugal', 'Romania', 'Sweden', 'Slovenia', 'Slovakia', +); + # Test SKU my $sku = WebGUI::Asset->getRoot($session)->addChild( { className => 'WebGUI::Asset::Sku::Donation', @@ -79,7 +87,7 @@ my $cart; #---------------------------------------------------------------------------- # Tests -my $tests = 317; +my $tests = 342; plan tests => 1 + $tests; #---------------------------------------------------------------------------- @@ -428,8 +436,15 @@ SKIP: { $taxer->deleteVATNumber( $testVAT_BE, $taxUser ); # Addresses inside EU without VAT number - is( $taxer->getTaxRate( $sku, $beAddress ), 100, 'getTaxRate: shipping addresses inside EU w/o VAT number pay tax' ); + foreach my $country ( @EU_COUNTRIES ) { + next if $country eq $nlAddress->get('country'); # Residents of merchant country should be checked separately. + + $beAddress->update( { country => $country } ); + is( $taxer->getTaxRate( $sku, $beAddress ), 100, "getTaxRate: shipping addresses in $country w/o VAT number pay tax" ); + } + $beAddress->update( { country => 'Belgium' } ); is( $taxer->getTaxRate( $sku, $nlAddress ), 100, 'getTaxRate: shipping addresses in country of merchant w/o VAT number pay tax' ); + # Address outside EU is( $taxer->getTaxRate( $sku, $usAddress ), 0, 'getTaxRate: shipping addresses outside EU are tax exempt' );