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 - Broken due to GSIS SOAP API upgrade to version 2 (RgWsPublic2).

Current section

Files

Jump to
vatchex_greece lib request.ex
Raw

lib/request.ex

defmodule VatchexGreece.Request do
# SPDX-FileCopyrightText: 2023 Isaak Tsalicoglou <isaak@waseigo.com>
# SPDX-License-Identifier: Apache-2.0
require EEx
@moduledoc """
Prepare and post a request to the SOAP web service.
"""
@moduledoc since: "0.2.0"
@gsis_wsdl_url "https://www1.gsis.gr/webtax2/wsgsis/RgWsPublic/RgWsPublicPort?wsdl"
@doc """
Prepare the request's XML template based on the VAT ID you call for),
and authentication settings (username, password, VAT ID you call from).
"""
# statically compile the XML request template and create a function to customize it
EEx.function_from_file(
:def,
:prepare,
"lib/request.xml.eex",
[:afm_called_for, :username, :password, :afm_called_by]
)
@doc """
POST the XML request with proper headers to the SOAP web service.
"""
def post(xml) do
HTTPoison.post(
@gsis_wsdl_url,
xml,
%{"Content-Type" => "application/soap+xml"}
)
end
end