Hi,

I tried to implement this "module" now for days and it's totally buggy:

The module has a option for specific roles to allow entering a VAT-number for orders within european states. But, this is not working. If the role gets the right to enter a VAT-number, the checkout requires the customer to enter a VAT-number. If the customer has no VAT-ID, then the checkout can not be completed. Very nice. Therefore it is false to say, it is "optionally" (as it should be). Instead this is buggy and ruins all professional shop-solutions.

Since there has never been any issue benig solved, it appears that noone in maintaining this module.

I'd suggest to delete this project.

Regards
Ced

Comments

attiks’s picture

Priority: Critical » Normal
Status: Active » Needs review
StatusFileSize
new4.22 KB

I made some changes to this module, because it's working for me:
- i added a new permission 'Is allowed to fill VAT number' which makes the number optional
- i disabled the inclusion of javascript the hide the vat number
- company field is only mandatory for the permission 'Have to fill VAT number'
- billing_vat_number is only mandatory for the permission 'Have to fill VAT number'
- i removed the leading zero's in the $european_countries array
- i added exception handling for the soap call

attiks’s picture

StatusFileSize
new4.74 KB

New patch added which doesn't require the vat number to be numeric

attiks’s picture

Title: this modules is totally buggy and crap. » Is there something wrong

Changed the title because it was a bit to harsh
@cedrix if you feel offended, feel free to change it back

wimh’s picture

StatusFileSize
new23.89 KB

I've been using (something based on) this module for some time, I've attached a patch -- it should apply against the latest dev release: Ubercart VAT Number 6.x-1.x-dev (2008-Nov-19)

Some changes that are in my patch:
- cache result of succesful validations for one day
- use the SOAPClient library (although only the nuSOAP client seems to work, 'SOAP Extension on PHP5' and the EU VAT validation service don't seem to want to work together)
- autocomplete on VAT field (taken from the current user's previous orders)
- removed the 'Have to fill in VAT' permission
- added VAT field to admin order interface
- set Ubercart conditions, which can be used by Tax rules for conditional VAT application (using ICV / intra-community rules)
- VAT number and company are never required
- VAT number is in its own fieldset, so the JS showing/hiding of the billing address doesn't pose problems anymore
- And of course the leading 0 was removed, I also had the JS version of the countries array generated from the PHP one so there's no duplication

Feel free to experiment using this. It's working fine for me.

Not sure how to continue with this module though. The last thing I heard from zmove (the maintainer) was that he didn't have an Ubercart shop anymore and was looking for a co-maintainer, but that was back in August. If he's not interested anymore it would be best if someone took over this module, alternatively we can start a new module but only as a very last resort -- there's enough confusion already with overlapping modules (see f.i. uc_discount/uc_discounts/uc_discounts_alt).

longwave’s picture

I guess people are using this module alongside uc_vat? For full B2B support in uc_vat, it seems to make sense to merge the two modules.

grub3’s picture

Cool, I will testing and getting back to you.

freatida’s picture

wimh's patch (#4) works great for me. The ubercart conditions are super useful. Thanks for saving me many hours of fumbling around.

victorcoder’s picture

Someone willing to take over on this module?

wimh’s picture

I wouldn't mind, but the current maintainer isn't even answering to that...

Rob B’s picture

Thanks wimh for your patch, I've managed to get everything working complete with permissions (i.e. not to charge VAT if they have a valid VAT number). At the moment however it seems to be compulsory for users to fill in the VAT number, is there a way of making it non-compulsory?

Also, even though it's hidden when you select another country, because it's a required field it still says "VAT number is required" when you try and proceed through the checkout. Thanks for your help.

wimh’s picture

Hi Rob, Looking through my code again, it looks like the "Have to fill VAT number" permission is still there (so if your role has this permission, the VAT number is mandatory). Can you have a look at Users>Permissions, and see if it is enabled for the user type you're using? Mind that the admin user automatically has *all* permissions, including this one, and thus always needs to fill in a VAT number.

Rob B’s picture

Thank you so much wimh, it looks like this permission was set for the role I was using! Brilliant work with the module, everything is now working as it should (using SOAPclient module for the nuSOAP library) - the conditional actions are simply awesome.

guykit’s picture

Priority: Normal » Critical

I was using this module fine and then I started getting an error saying the VAT checking service could not be found. I emailed the service providers and they responded to say that the wsdl page had moved from

http://ec.europa.eu/taxation_customs/vies/api/checkVatPort
to
http://ec.europa.eu/taxation_customs/vies/services/checkVatService

but replacing this string in the module file produces an error:

Error when contacting the VAT Number verification service: Service return error - wsdl error: urn:ec.europa.eu:taxud:vies:services:checkVat:types:checkVat^ (checkVat^) is not a supported type

Can you help please?

btw they also said: If you experience any problems then reloading the WSDL from here
http://ec.europa.eu/taxation_customs/vies/services/checkVatService?wsdl
should fix your problem; if not please let us know.

but this doesn't mean much to me

wimh’s picture

The WSDL file they're currently sending out seems to be missing most of its wsdl:types declaration. I got an older one from Google's cache and put it at http://www.grandtrunk.net/tmp/checkVatService.wsdl - which seems to work (for now, I don't plan to keep that file hosted there).

desh’s picture

I also e-mailed them, and they stated that

http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl

could be used. That works for me.

Moving on, I had some troubles as of running PostgreSQL instead of MySQL. For example, I had to change one MySQL-specific UNIX_TIMESTAMP query to

db_query("INSERT INTO {uc_vat_validation} (vat_number, fetched, response) VALUES ('%s', %d, '%s')",
                 array("{$countryCode}{$vatNumber}", time(), serialize($result)));

Is the project maintained, so that it can be merged into HEAD?

zmove’s picture

Hello all,

Long time I didn't maintain this module, sorry guys.

In fact, I don't have drupal project anymore ATM. I think I will be able to reinvest some times when Drupal 7 will comes out.

By waiting this moment, wimh proposed his services as a co-maintainer and I accepted. He have to have a CVS account and I will be able to add him.

guykit’s picture

hi desh

Do you mean replace the "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl" in the module with "http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl" , because I just get this message returned: "Error when contacting the VAT Number verification service: Fault :"

Same if I use http://www.grandtrunk.net/tmp/checkVatService.wsdl

I am using the patched module from #4.

Anyone got any ideas or help?? thanks

wimh’s picture

The replacement you did looks OK. Are you using the nuSOAP or PHP-builtin SOAP library? (see Site configuration > Soap client > Configure). The VAT service only seems to work with nuSOAP. When using the PHP extension, you get a variety of errors (I don't recognize yours, but it could be related).

guykit’s picture

wimh, thanks for your help but I am using nusoap.

This is very frustrating - the module was working fine then the EC people change the wsdl and the new dynamic service gives me one set of errors and using the static wsdl gives me another.

It would be very useful if the latest version of the module incorporated your patch and the new wsdl address, then at least I could be sure I was starting with a module that worked for other people, and I could try reinstalling from scratch.

wimh’s picture

StatusFileSize
new10.63 KB

I've attached the complete module as I have it now on my hard drive, which has all my patches and is working.

My request for commit access is running, hopefully the Drupal admins can accept it in a few days and I'll be able to check all these changes in...

rlange77’s picture

Hello,
it still habe a problem with the latest update from March 12, 2010 - 11:39

If I activate "Check the validity on the customer VAT Number via Europa VAT Number validation webservice"
I always get an internal error 500.

And another thing I need to get working.

If the country of the billing address is
- different to the store country (in my case Germany)
- is a customer no applied the invoice has to be without vat.

can someone implement this part as well?

gives me a lot of headaches to deal with it at the moment.

thanks a lot.
/rob

wimh’s picture

@rob:

Who's giving the 500 error? Your server or the VAT service? If it's your own server, can you find anything in the logs to track this down?

To implement the correct VAT rules, the module implements some conditions which you can use as a conditional tax rule. The "Order should have VAT applied" normally takes care of everything: i.e. apply VAT when the billing address is in the store country, or it's inside Europe and the customer did not provide a VAT number. If you need another rule, there are some other conditions provided ("Order has a billing country in Europe" and "Order has a valid VAT number") which you can AND/OR/NOT together to create your own.

guykit’s picture

wimh

thanks very much for that - it is working fine again for me now.

rlange77’s picture

It is my server but unfortunately I can't find any log details for this problem.

You can check it on your own if you want:
http://test.iphone-infos.net

What I figured out so far:
If you have a VAT number from Austria (ATU0123456789) you get a syntax error.
If I use my own VAT number I run in the error 500 :(

For the rules...
I look into it right now to work this out :)
Thanks for the hint.
/rob

wimh’s picture

@everyone: zmove accepted me as co-maintainer for this module. I have committed my patch from #4 above, if I understand drupal.org's packaging mechanism there should be a new downloadable version of this module in a few hours...

For further bug reports: please create a new issue!

@rlange77: the module currently only accepts digits after the country code (which is true for most country's VAT codes, but not for Austria, Spain and some others). The U after AT breaks this. I'll change the validation code to allow it.

For the 500 error: could you add some drupal_set_message() calls in uc_vat_number.module (in the uc_vat_number_validate_vat function, near line 300) to see where exactly this happens?

rlange77’s picture

@wimh: if you tell me the right drupal_set_message() calls i will add them asap. dont know the right syntax and parameters :(

i have worked out some issues with the right rules.

here a table how it should work correctly:

EU Country EU country and store country are the same VAT number applied result

YES YES YES TAX will be charged
YES YES NO TAX will be charged
YES NO YES TAX will NOT be charged
YES NO NO TAX will be charged
NO NO NO TAX will NOT be charged

With the current rule is doesnt work this way and i get different pricing display through the checkout and later in the invoice.

will supply you with more details as soon i work them out

desh’s picture

Tips for everyone:

To get it to work, I did the following:

* Un-installed the uc_vat module; it is not needed.
* Installed wimh's uc_vat_number module
* Applied my patch, since I'm using PostgreSQL
* Create a ubercart Tax named "VAT"
* Used conditional actions in order to only remove tax (VAT) for customers inside EU, with valid VAT number, which is not in my country (Sweden).

Anyone who has a different approach?

wimh’s picture

StatusFileSize
new1.68 KB

@rlange77:

You can just put drupal_set_message("foo"); in the code, if that gets printed you know that part of the code was reached before the crash. Note that on the page giving the HTTP 500 error you won't see this message, but it's stored in your session so a page reload anywhere else on your site will show you all pending messages.
You can also use drupal_set_message(print_r($var, 1)); to get a representation of the contents of variable $var.

Regarding your Tax rules: this is exactly as my understanding, and it should be what the "Order should have VAT applied" rule does, on two conditions:
- your store country is set correctly (/admin/store/settings/store/edit)
- the conditional tax rule knows that you have filled in your VAT number

This last condition should be OK on the order review page and in the invoice. In the AJAX box on the checkout page, this is by default NOT the case though. I just remembered about the patch I had to make to Ubercart core (attached): normally, when you change the shipping/billing address, and AJAX query is made to update the taxes. This query includes the new address, but not the VAT field (since it's done by uc_taxes/uc_payment, which obviously don't know about VAT). My patch includes the VAT number in the query, so the tax rule knows it's there...

Hitby’s picture

Hi, I'm having some issues getting this working correctly.

Now, as I see it, I need the following rules to apply.

If you're in the UK and VAT registered: You pay tax
If you're in the UK and Non VAT registered: You pay tax
If you're in the EU and Non VAT registered:: You pay tax

If you're in the EU and VAT registered:: You pay no tax

I have installed the module and I have setup a tax rate (VAT). I have setup the conditions so that it will apply in the first three scenarios above.

However, When I select a european address and put in a valid VAT number the tax is still applying? I've tried several ways of inputting it GB 123456789, GB123456789, GB 123.456.789

What am I missing?
Thanks,

wimh’s picture

Is the VAT being added wrongly in the Order total preview on the checkout page, or also in the order confirmation page? If just the first one, try applying my patch in comment #28.
When submitting your order, do you get a message about the VAT number being invalid?

Hitby’s picture

Applying your patch in 28 to drupal core has fixed the issue although I don't really like the idea of patching core? What happens when an update is needed?

Thanks for your help though! Was much appreciated.

wimh’s picture

Rest assured, I very much dislike patching core too!! I just didn't have time yet to try out alternate solutions. If you would have any suggestions, they'd be much appreciated...

Hitby’s picture

whoops. it appears all is not as it seems. If I put in an incomplete or wrong VAT number it still removes the vat so it seems that it's not validating against anything?

edit: forgive me - it does validate when you press verify order. I then get a safe mode error though but that's another issue.

Thanks,

wimh’s picture

The actual validation only happens when you submit the order, not when building the order total preview through AJAX (as this would mean the VAT server is continuously queried while you're typing in the VAT number).

wimh’s picture

I was able to integrate the required Javascript code into the uc_vat_module itself, so the patch from comment #28 should no longer be necessary.

rlange77’s picture

@wimh:

i have played around with the drupal_set_message() for a bit and it seems I get the error from line 320 as

drupal_set_message("foo0");
$client = soapclient_init_client("http://ec.europa.eu/taxation_customs/vies/services/checkVatService.wsdl", TRUE);
drupal_set_message("foo1");

gives me back foo0 on my next page after error 500.

edit: fixed it by installing the soapclient
may a good idea to check it within the installation that the soapclient is installed

for the rules i have to set i'm still stucked.
It may cause because I also use uc_vat and i need it.

if anyone can tell me how to set the rules to get it working would be great.

thx for all your help guys.
/rob

wimh’s picture

@rlange77

soapclient_init_client is from the SOAP Client module. Can you confirm that it's using the nuSOAP library (Site configuration > SOAP Client > Configure)? The "SOAP Extension on PHP5" option doesn't play nice with the EU VAT service. If that's not it, I don't know, could you try asking the SOAPClient people? (see http://drupal.org/project/soapclient )

For the conditional Tax rules:
- go to Store administration > Configuration > Tax rates and settings
- If you don't have one, add a tax rate for VAT
- In the Operations column, click "conditions"
- Add the condition "Order should have VAT applied"

That should be it. Also make sure to update to the latest version of this module, there should be a version of "2010-Mar-17" (should come online in a few hours) which adds the Javascript to also apply VAT correctly in the order preview page (cf. comment #28).

Mind that I'm not using uc_vat myself. If you think there are any conflicts between uc_vat and uc_vat_number let me know and I'll see if I can install it for further testing.

rlange77’s picture

@wimh
I hadnt the the soapclient installed at all as I didnnt know that it necessary.

For the tax rules.
I have a "19% MwSt" tax rule created by the uc_vat.
I would be glade if you could install it to see if there are any problems.
If you like you can use my test installation and play around.

edit:
For the syntax check of the VAT number.
Can you change it so it accept letters right after the country code?
Thanks a lot

/rob

wimh’s picture

Hi Rob,

I've added soapclient as a dependency. Still have to think of something to force it / have you set it to use nuSOAP and not the PHP extension though

I also installed uc_vat. The total price calculation seems to work in all cases. The product prices, both in the Checkout and Order review pages, always include VAT though, even when it's not applied. (This has the funny result that the subtotal, which uc_vat modifies to VAT, is higher than the actual order total which has no VAT). This probably needs a patch in uc_vat.

Re: your conditional settings: what conditions do you currently have enabled on your MwST tax?

Wim

longwave’s picture

I've been keeping an eye on this thread as I would like uc_vat to work together with uc_vat_number so people can have full B2B and B2C VAT support for EU stores.

To force SOAP Client to use nuSOAP you can check the configuration variable that SOAP Client uses and drupal_set_message() somewhere to tell the user to switch if it is the wrong one. It would however be better to fix either uc_vat_number or SOAP Client so this works with the PHP extension, there is no good reason why it shouldn't work with either as far as I know.

Regarding the product prices being wrong at checkout and order review, were you running uc_vat 6.x-1.0 or 6.x-1.x-dev? The -dev release contains a number of fixes and new features, but also increases the use of AJAX during checkout so the entire page can have VAT added or removed as necessary - perhaps I need to add some extra code to fully support uc_vat_number, if so please post an issue in uc_vat's queue.

wimh’s picture

Hi Dave,
Thanks for the interest. I was using uc_vat 6.x-1.0. Now with -dev, the product price in the cart contents block is still always with VAT, but the Order total preview in Payment method is now correct, with all required AJAXy updates, nice!

I'll have a further look at why the SOAP thing fails...

@Rob: the current -dev version does support letters in the VAT code, so Austrian/Spanish/... numbers are considered syntactically valid.

longwave’s picture

The default cart contents block shows prices including VAT, but uc_vat 6.x-1.x-dev now provides an alternative AJAX-enabled pane that can be enabled in the checkout pane settings or by checking "Show cart contents with VAT details at checkout" in VAT settings, that should make the checkout show full correct figures.

I will try to find time to do some tests with uc_vat_number myself, and then hopefully will release uc_vat 6.x-1.1 soon and include a link to this project from uc_vat's page for people who need full B2B VAT support.

rlange77’s picture

Hi wimh,
my soapclient is on autodetection for now and it works.
edit: Current SOAP Client Library is nuSOAP Library

for the rules:
my 19% MwSt rule has the Condition: Check an order's shipping country
edit: and the action: apply 19% MwST
to check for states are in the european union.

i had the same result like you with the funny pricing for the tax higher than the actually price was.

Will test the latest dev-version asap.

Thanks again
/rob

rlange77’s picture

Hi Wim,
the latest dev version works perfectly fine with uc_vat.
ORSM WORK!!!

Let me know if you could send me a bill for the work you have done.
You can find my contact details in my shop http://iphone-parts-discount.net

Send me an email and lets have a quick chat.

Thanks for the solution.

/rob

wimh’s picture

Status: Needs review » Fixed

I've made a 6.x-1.0-beta1 release, which contains all fixes described in this thread. I'm closing it as fixed. For further problems or requests, feel free to create new issues.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.