Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/lookup.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>true</valid><name>GITHUB B.V.</name><address>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</address></checkVatResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:38:49 GMT",
"Date": "Wed, 13 Oct 2021 09:55:42 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/lookup_invalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>false</valid><name>---</name><address>---</address></checkVatResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:39:58 GMT",
"Date": "Wed, 13 Oct 2021 09:55:46 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/lookup_invalid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>false</valid><traderName>---</traderName><traderCompanyType>---</traderCompanyType><traderAddress>---</traderAddress><requestIdentifier></requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:21:45 GMT",
"Date": "Wed, 13 Oct 2021 09:55:47 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/lookup_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>true</valid><traderName>GITHUB B.V.</traderName><traderCompanyType>---</traderCompanyType><traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</traderAddress><requestIdentifier>WAPIAAAAXx5FSE-t</requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:19:57 GMT",
"Date": "Wed, 13 Oct 2021 09:56:40 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/valid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>true</valid><name>GITHUB B.V.</name><address>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</address></checkVatResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:41:51 GMT",
"Date": "Wed, 13 Oct 2021 09:55:44 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/valid_invalid.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>false</valid><name>---</name><address>---</address></checkVatResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 28 Jan 2017 21:41:51 GMT",
"Date": "Wed, 13 Oct 2021 09:55:43 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/valid_invalid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>false</valid><traderName>---</traderName><traderCompanyType>---</traderCompanyType><traderAddress>---</traderAddress><requestIdentifier></requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:24:36 GMT",
"Date": "Wed, 13 Oct 2021 09:55:43 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
7 changes: 4 additions & 3 deletions fixture/vcr_cassettes/valid_with_requester_vat.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
"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": "<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>2021-10-13+02:00</requestDate><valid>true</valid><traderName>GITHUB B.V.</traderName><traderCompanyType>---</traderCompanyType><traderAddress>\nVIJZELSTRAAT 00068\n1017HL AMSTERDAM\n</traderAddress><requestIdentifier>WAPIAAAAXx5FEsSi</requestIdentifier></checkVatApproxResponse></soap:Body></soap:Envelope>",
"headers": {
"Date": "Sat, 25 Aug 2018 20:24:37 GMT",
"Date": "Wed, 13 Oct 2021 09:55:45 GMT",
"Transfer-Encoding": "chunked",
"Content-Type": "text/xml; charset=UTF-8",
"Server": "Europa",
Expand Down
2 changes: 2 additions & 0 deletions lib/viex/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ defmodule Viex.Parser do
def parse_validity(body) do
valid =
body
|> Floki.parse_document!()
|> Floki.find("valid")
|> Floki.text()
|> String.trim()
Expand All @@ -17,6 +18,7 @@ defmodule Viex.Parser do

def parse_field(body, field) do
body
|> Floki.parse_document!()
|> Floki.find(field)
|> Floki.text()
|> String.trim()
Expand Down
16 changes: 8 additions & 8 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.2.1",
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,13 +35,13 @@ defmodule Viex.Mixfile do

defp deps do
[
{:httpoison, "~> 0.11"},
{:floki, "~> 0.13"},
{:exvcr, "~> 0.8", only: :test},
{:excoveralls, "~> 0.5", only: :test},
{:ex_doc, "~> 0.14", only: :dev},
{:earmark, "~> 1.1", only: :dev},
{:credo, "~> 0.5", only: [:dev, :test]}
{:httpoison, "~> 1.8"},
{:floki, "~> 0.31"},
{:exvcr, "~> 0.13", only: :test},
{:excoveralls, "~> 0.14", only: :test},
{:ex_doc, "~> 0.25", only: :dev},
{:earmark, "~> 1.4", only: :dev},
{:credo, "~> 1.5", only: [:dev, :test]}
]
end

Expand Down
Loading