redrick / vat_payer_cz

Ruby wrapper for web service providing info about Czech VAT payers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VAT payer info CZ

This is Ruby wrapper for web service for "searching information about reliability of VAT payers and their bank accounts" of Czech Republic Ministry of finance.

Installation

gem install 'vat_payer_cz'

Usage

The web service has the following three end-points:

require 'vat_info'

vat_ids = %w(CZ27169278 CZ26168685)
VatInfo.unreliable_payer(*vat_ids)

Compared to Standard VAT payer info, the response is enriched by other VAT payer data, such as name and address. The library normalizes some of the VAT payer attributes which are supplied in capitals (company name and address attributes).

require 'vat_info'

vat_ids = %w(CZ27169278 CZ26168685)
VatInfo.unreliable_payer_extended(*vat_ids)

Lists all unreliable VAT payers, but only their status as payer (reliable/unreliable), their VAT number, financial office they belong to and date on which they became unreliable

require 'vat_info'

VatInfo.unreliable_payer_list

Response

Object VatInfo::Response

Example

=> #<VatInfo::Response:0x0000000001ff61e8
 @body=
  {:status=>{:status_code=>"0", :status_text=>"OK", :odpoved_generovana=>"2018-02-08"},
   :platci=>
    [{:nespolehlivy_platce=>"NE",
      :datum_zverejneni=>nil,
      :dic=>"CZ27169278",
      :cislo_fu=>"451",
      :ucty=>
       [{:predcisli=>nil, :cislo=>"1041150202", :kod_banky=>"5500", :iban=>nil, :datum_zverejneni=>"2013-04-01"},
        {:predcisli=>nil, :cislo=>"6021446666", :kod_banky=>"6000", :iban=>nil, :datum_zverejneni=>"2013-12-05"},
        {:predcisli=>nil, :cislo=>"2400915487", :kod_banky=>"2010", :iban=>nil, :datum_zverejneni=>"2016-05-05"}]},
...

.status_code

VatInfo::Response.status_code => String 200 - OK: Valid response was received. 408 - Request Timeout: the web service timed out. 503 - Service Unavailable: there was another error fetching the response.

.body

Empty attributes have nil value.

VatInfo::Response.body => Hash

{
  status: { Status }
  platci: [ { Payer | PayerExtended }, .. ]
}

.raw

Raw data returned by the web service.

Status

See official docs for explanation.

{
  status_code: String,
  status_text: String,
  odpoved_generovana: String # ISO 8601 Date
}

Payer

{
  nespolehlivy_platce: String, # "ANO" | "NE" | "NENALEZEN"
  datum_zverejneni: String, # ISO 8601 Date
  dic: String,
  cislo_fu: String,
  ucty: [ { Account }, .. ]
}

PayerExtended

{
  nespolehlivy_platce: String, # "ANO" | "NE" | "NENALEZEN"
  datum_zverejneni: String, # ISO 8601 Date
  dic: String,
  cislo_fu: String,
  ucty: [ { Account }, .. ]
  
  #Extended info
  nazev_subjektu: String,
  ulice_cislo: String,
  cast_obce: String,
  mesto: String,
  psc: String,
  stat: String
}

Account

{
  predcisli: String, # only Czech accounts
  cislo: String, # only Czech accounts
  kod_banky: String, # only Czech accounts
  iban: String # Czech and foreign accounts
}

Schema changes

The client will raise VatInfo::SchemaError exception if it thinks the schema have changed.

Official web service docs

In Czech: https://adisspr.mfcr.cz/adistc/adis/idpr_pub/dpr_info/ws_spdph.faces

About

Ruby wrapper for web service providing info about Czech VAT payers.

License:MIT License


Languages

Language:Ruby 98.5%Language:Dockerfile 0.9%Language:Shell 0.6%