yolk / valvat

Validates european vat numbers. Standalone or as a ActiveModel validator.
MIT License
321 stars 80 forks source link

No response returned as of 2022 #109

Closed JensDebergh closed 2 years ago

JensDebergh commented 2 years ago

Hi!

I'm using this gem in a small project, but some of my users notified me no responses are returned as of 2022.

I verified this by running some of the examples locally and trying to get my personal details from VIES but nothing works. Any idea as to why this is happening?

I'd be happy to whip up a merge request for a fix.

VIES webservice is online but I keep getting nil responses.

Screenshot 2022-01-25 at 09 14 49

Edit:

I checked the error with the raise_error flag and I'm getting following error.

Savon::SOAPFault: (soap:Server) The given SOAPAction checkVatApprox does not match an operation.

I'm not that familiar with SOAP but the checkVatApprox actions is available inside of the webservice which seems really weird that it doesn't work.

Kind regards Jens

yolk commented 2 years ago

Hi Jens,

thanks for reporting the issue. I also see errors with current versions of the dependency wasabi. Could you try to install wasabi 3.5.0 an rerun your code? There seems to be a regression in the current version of the gem (3.6.1) that is effecting valvat.

Thanks again, Sebastian.

JensDebergh commented 2 years ago

Hi @yolk

I'm unable to downgrade to 3.5.0 due to my ruby version and some methods being deprecated in ruby 3.0.0.

Screenshot 2022-01-25 at 14 33 01

The escape module which was previously inside of the URI module has been deprecated and moved to a seperate module.

Replacements are: CGI.escape, URI.encode_www_form or URI.encode_www_form_component

But I guess this should be done on the savon gem and nothing is really wrong with the valvat gem except for the dependency with savon where the actual problem sits.

yolk commented 2 years ago

Wasabi just released an new version (3.7.0) with a fix for https://github.com/savonrb/wasabi/pull/103 ... this should work with ruby 3.0 and current savon versions. Could you give it a try?

JensDebergh commented 2 years ago

@yolk Thanks for the suggestion.

I'm not really sure how I'm able to run valvat with different dependencies then those locked inside of the dependencies.

When manually installing wasabi 3.7.0 the underlying library still resorts to the one locked inside of the dependencies of valvat > savon > wasabi

yolk commented 2 years ago

savon requires wasabi in a version matching '~> 3.4'; so you should be able to add a requirement for wasabi v3.7.0 into the Gemfile of your project (besides valvat). Alternativly try to uninstall any version of wasabi from your rubygems below 3.7.

Hope this helps.

JensDebergh commented 2 years ago

Managed to get the wasabi version fixed to 3.7.0 but the error still persists.

Screenshot 2022-01-25 at 16 40 35
yolk commented 2 years ago

That's strange. Could you try to run the same command with the following options:

Valvat.new(...).exists?(raise_error: true, savon: {log: true})
JensDebergh commented 2 years ago

This does not add any additional logging i'm afraid.

Screenshot 2022-01-25 at 17 15 05
yolk commented 2 years ago

I don't know your environment, but savon logs to STDOUT by default. Maybe this is redirected to a log file?

Savon::Client set its default logger here: https://github.com/savonrb/savon/blob/master/lib/savon/options.rb#L80

yolk commented 2 years ago

Take a look #100. Seems to be the same error.

yolk commented 2 years ago

Which version of valvat do you use? v1.1.2 should fix a similar error.

JensDebergh commented 2 years ago

Hi @yolk

You are completely right! I was running on an older version of Valvat which was locked to ~> 0.9.1

Ruby version 3.0.3 and valvat ~> 0.9.1.

Upgrading to v1.1.2 works perfectly.

Thanks for the responsiveness!

How do I buy you a beer (or coffee)?

yolk commented 2 years ago

Glad, we could resolve this!