Packages
An Elixir library to easily pull company information from the `RgWsPublic2` SOAP web service (new since 2023-04-20) of the Greek General Secretariat of Information Systems for Public Administration (GSIS) using the VAT ID (Αριθμός Φορολογικού Μητρώου, abbreviated as "ΑΦ...
Retired package: Release invalid - Package does not work due to config.exs issues
Current section
Files
Jump to
Current section
Files
lib/request.ex
defmodule VatchexGreece.Request do
require EEx
@moduledoc """
Prepare and post a request to the SOAP web service.
"""
@moduledoc since: "0.2.0"
@settings Application.compile_env(:vatchex_greece, :globals) |> Map.new()
@xml_template File.read!(@settings.xml_template)
@doc """
Prepare the request's XML template based on the settings (username, password,
VAT ID you call from) and the input (VAT ID you call for).
"""
def prepare(afmCalledFor) do
EEx.eval_string(@xml_template,
username: @settings.username,
password: @settings.password,
afmCalledBy: @settings.afmCalledBy,
afmCalledFor: afmCalledFor
)
end
@doc """
POST the XML request with proper headers to the SOAP web service.
"""
def post(xml) do
wsdl_url = @settings.gsis_wsdl_url
headers = %{"Content-Type" => "application/soap+xml"}
HTTPoison.post(wsdl_url, xml, headers)
end
end