Skip to content

Commit

Permalink
feat: update dependencies, update vcr cassettes (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
rindek authored Aug 16, 2023
1 parent 46e3dd9 commit ce4de36
Show file tree
Hide file tree
Showing 14 changed files with 114 additions and 79 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add `viex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[{:viex, "~> 0.1.0"}]
[{:viex, "~> 0.3.0"}]
end
```

Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/lookup.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>854265259B01</vatNumber><requestDate>2017-01-28+01:00</requestDate><valid>true</valid><name>GITHUB B.V.</name><address>\nPRINS BERNHARDPLEIN 00200\n1097JB AMSTERDAM\n</address></checkVatResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>854265259B01</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>true</ns2:valid><ns2:name>GITHUB B.V.</ns2:name><ns2:address>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</ns2:address></ns2:checkVatResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:38:49 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:10 GMT",
"Content-Length": "480",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/lookup_invalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>9999999</vatNumber><requestDate>2017-01-28+01:00</requestDate><valid>false</valid><name>---</name><address>---</address></checkVatResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>9999999</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>false</ns2:valid><ns2:name>---</ns2:name><ns2:address>---</ns2:address></ns2:checkVatResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:39:58 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:11 GMT",
"Content-Length": "434",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/lookup_invalid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatApproxResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>9999999</vatNumber><requestDate>2018-08-25+02:00</requestDate><valid>false</valid><traderName>---</traderName><traderCompanyType>---</traderCompanyType><traderAddress>---</traderAddress><requestIdentifier></requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatApproxResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>9999999</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>false</ns2:valid><ns2:traderName>---</ns2:traderName><ns2:traderCompanyType>---</ns2:traderCompanyType><ns2:traderAddress>---</ns2:traderAddress><ns2:requestIdentifier></ns2:requestIdentifier></ns2:checkVatApproxResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:21:45 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:11 GMT",
"Content-Length": "567",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/lookup_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatApproxResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>854265259B01</vatNumber><requestDate>2018-08-25+02:00</requestDate><valid>true</valid><traderName>GITHUB B.V.</traderName><traderCompanyType>---</traderCompanyType><traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</traderAddress><requestIdentifier>WAPIAAAAWVyvkfTw</requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatApproxResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>854265259B01</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>true</ns2:valid><ns2:traderName>GITHUB B.V.</ns2:traderName><ns2:traderCompanyType>---</ns2:traderCompanyType><ns2:traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</ns2:traderAddress><ns2:requestIdentifier>WAPIAAAAYnkVx97D</ns2:requestIdentifier></ns2:checkVatApproxResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:19:57 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:24:22 GMT",
"Content-Length": "629",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>854265259B01</vatNumber><requestDate>2017-01-28+01:00</requestDate><valid>true</valid><name>GITHUB B.V.</name><address>\nPRINS BERNHARDPLEIN 00200\n1097JB AMSTERDAM\n</address></checkVatResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>854265259B01</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>true</ns2:valid><ns2:name>GITHUB B.V.</ns2:name><ns2:address>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</ns2:address></ns2:checkVatResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:41:51 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:11 GMT",
"Content-Length": "480",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/valid_invalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>9999999</vatNumber><requestDate>2017-01-28+01:00</requestDate><valid>false</valid><name>---</name><address>---</address></checkVatResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>9999999</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>false</ns2:valid><ns2:name>---</ns2:name><ns2:address>---</ns2:address></ns2:checkVatResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:41:51 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:10 GMT",
"Content-Length": "434",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/valid_invalid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatApproxResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>9999999</vatNumber><requestDate>2018-08-25+02:00</requestDate><valid>false</valid><traderName>---</traderName><traderCompanyType>---</traderCompanyType><traderAddress>---</traderAddress><requestIdentifier></requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatApproxResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>9999999</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>false</ns2:valid><ns2:traderName>---</ns2:traderName><ns2:traderCompanyType>---</ns2:traderCompanyType><ns2:traderAddress>---</ns2:traderAddress><ns2:requestIdentifier></ns2:requestIdentifier></ns2:checkVatApproxResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:24:36 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:10 GMT",
"Content-Length": "567",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
13 changes: 8 additions & 5 deletions fixture/vcr_cassettes/valid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
"method": "post",
"options": [],
"request_body": "",
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService?"
"url": "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"
},
"response": {
"body": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><checkVatApproxResponse xmlns=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><countryCode>NL</countryCode><vatNumber>854265259B01</vatNumber><requestDate>2018-08-25+02:00</requestDate><valid>true</valid><traderName>GITHUB B.V.</traderName><traderCompanyType>---</traderCompanyType><traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</traderAddress><requestIdentifier>WAPIAAAAWVywouzi</requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"binary": false,
"body": "<env:Envelope xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\"><env:Header/><env:Body><ns2:checkVatApproxResponse xmlns:ns2=\"urn:ec.europa.eu:taxud:vies:services:checkVat:types\"><ns2:countryCode>NL</ns2:countryCode><ns2:vatNumber>854265259B01</ns2:vatNumber><ns2:requestDate>2023-08-11+02:00</ns2:requestDate><ns2:valid>true</ns2:valid><ns2:traderName>GITHUB B.V.</ns2:traderName><ns2:traderCompanyType>---</ns2:traderCompanyType><ns2:traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</ns2:traderAddress><ns2:requestIdentifier>WAPIAAAAYnkVgrqv</ns2:requestIdentifier></ns2:checkVatApproxResponse></env:Body></env:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:24:37 GMT",
"Transfer-Encoding": "chunked",
"Date": "Fri, 11 Aug 2023 11:23:11 GMT",
"Content-Length": "629",
"Content-Type": "text/xml; charset=UTF-8",
"SOAPAction": "\"\"",
"Accept": "text/xml",
"Server": "Europa",
"Proxy-Connection": "Keep-Alive",
"Connection": "Keep-Alive"
"Connection": "keep-alive"
},
"status_code": 200,
"type": "ok"
Expand Down
4 changes: 2 additions & 2 deletions lib/viex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ defmodule Viex do
Optionally accepts a `requester_vat` options that needs the VAT number of the entity
the request is made on behalf of. It returns a `Viex.ApproxResponse` in that case
"""
@spec lookup(String.t(), [requester_vat: String.t | nil]) :: map | {:error, String.t()}
@spec lookup(String.t(), requester_vat: String.t() | nil) :: map | {:error, String.t()}
def lookup(vat_number, opts \\ []) do
requester_vat = Keyword.get(opts, :requester_vat)

Expand All @@ -29,7 +29,7 @@ defmodule Viex do
@doc """
Check the validity of a European VAT number. Accepts a binary, returns a boolean.
"""
@spec valid?(String.t(), [requester_vat: String.t | nil]) :: boolean
@spec valid?(String.t(), requester_vat: String.t() | nil) :: boolean
def valid?(vat_number, opts \\ []) do
vat_number
|> lookup(opts)
Expand Down
1 change: 0 additions & 1 deletion lib/viex/approx_response.ex
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,4 @@ defmodule Viex.ApproxResponse do
request_identifier: Parser.parse_field(body, "requestidentifier")
}
end

end
4 changes: 2 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Viex.Mixfile do
def project do
[
app: :viex,
version: "0.2.0",
version: "0.3.0",
elixir: "~> 1.4",
description: "Elixir package to validate European VAT numbers with the VIES service.",
build_embedded: Mix.env() == :prod,
Expand Down Expand Up @@ -35,7 +35,7 @@ defmodule Viex.Mixfile do

defp deps do
[
{:httpoison, "~> 0.11"},
{:httpoison, "~> 1.0"},
{:floki, "~> 0.13"},
{:exvcr, "~> 0.8", only: :test},
{:excoveralls, "~> 0.5", only: :test},
Expand Down
Loading

0 comments on commit ce4de36

Please sign in to comment.