fiscalizer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b43870b32c90984a5db5c7583c2f70df01916d8d
4
+ data.tar.gz: ead8268033ac53e50d2a898d346b0ea94f4fed33
5
+ SHA512:
6
+ metadata.gz: 5678038340e62778d4541a91494311be302d4ef8e56ca69de343b34d95ce3b0b330f04dfad7d3192b298b5bc1a52e89f7f07436fe798ffc22fc2beed846bf373
7
+ data.tar.gz: 5dc37bd0a1437c40a445a4039f6595fec9fe21711bdc0c3c59a9cd571430cd31564910f419814288657dd8b4c661a5cdad11ac94aed0d0efebc20233b9c9e416
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ lib/bundler/man
11
+ pkg
12
+ rdoc
13
+ spec/reports
14
+ test/tmp
15
+ test/version_tmp
16
+ tmp
17
+ test/assets/*
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in fiscalizer_ruby.gemspec
4
+ gemspec
5
+ gem 'nokogiri'
6
+ gem 'xmldsig', github: 'infinum/xmldsig', branch: 'allcase-reference-id'
7
+ #gem 'pry-debugger'
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Stanko Krtalić
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,209 @@
1
+ # Fiscalizer
2
+
3
+ ## Introduction
4
+
5
+ Fiscalization is the process of transfering various document types from a business entity to the tax authorities with the goal of reducing tax fraud. In Croatia this process can be executed over the Internet, this gem is intended to automate this process.
6
+
7
+ ## Documentation
8
+
9
+ Every folder has it's own README file which explanes in detail the files in it.
10
+
11
+ Examples are located in the `example` folder. Basic setup and fiscalization are demonstrated here.
12
+
13
+ Tests are located in the `test` folder. Test setup is explaned there.
14
+
15
+ All classes, in their separate files, are located in the `fiscalizer` folder.
16
+
17
+ ## Instalation
18
+
19
+ Add this line to your application's Gemfile:
20
+
21
+ gem 'fiscalizer'
22
+
23
+ And then execute:
24
+
25
+ $ bundle
26
+
27
+ Or install it yourself as:
28
+
29
+ $ gem install fiscalizer
30
+
31
+ ## Usage
32
+ ### Setup
33
+ To use Fiscalizer in your projects simply call `fiscalizer = Fiscalizer.new`, this will create a new fiscalizer object for you to interact with.
34
+
35
+ Necessary parameters, that have to be set before any fiscalization occures are:
36
+
37
+ * `certificate_p12_path` : Path to your fiscal certificate (usually "FISCAL 1.p12" or "fiscal1.pfx")
38
+ * `password` : Password that unlocks the certificate
39
+
40
+ Alternatively you can set these three parameters:
41
+
42
+ * `key_public_path` : Path to the public key ( "fiskal1.cert" )
43
+ * `key_private_path` : Path to the private key ( "privateKey.key" )
44
+ * `certificate_path` : Path to the certificate ( "certificate.pem" )
45
+
46
+ __NOTE:__ Thise parameters will override the parameters extracted from the P12 certificate!
47
+
48
+ Parameters that can also be set:
49
+
50
+ * `url` : Specifies the URL to which the requests will be sent ( defaults to "https://cis.porezna-uprava.hr:8449/FiskalizacijaService")
51
+ * `tns` : Specifies the XML namespaces to use when parsing and encoding objects ( defaults to "http://www.apis-it.hr/fin/2012/types/f73")
52
+ * `schemaLocation` : Specifies the XML schema to be used for XML parsing ( defualts to "http://www.apis-it.hr/fin/2012/types/f73 FiskalizacijaSchema.xsd")
53
+ * `certificate_issued_by` : Certificate issuer identifier to be used in the signature ( defaults to "OU=RDC,O=FINA,C=HR")
54
+
55
+ ### Fiscalization
56
+
57
+ This gem offers two types of fiscalization, _Office space_ and _Invoice_ fiscalization. _Echo_ requests are also possible.
58
+
59
+ All these methods return an `Fiscalizer::Response` object, which is explaned below.
60
+
61
+ #### Invoices
62
+
63
+ To fiscalize an invoice call `fiscalizer.fiscalize_invoice` and pass it an `Fiscalizer::Invoice` object.
64
+
65
+ Alternatively it is possible to pass all the arguments needed to build an invoice, this will build an invoice
66
+ and fiscalize it automatically.
67
+
68
+ Arguments that can be passed to `fiscalizer.fiscalize_invoice`:
69
+
70
+ * `uuid` : Universally Unique Identifier (String)
71
+ * `time_sent` : Time the invoice fiscalization request was sent (Time)
72
+ * `pin` : The fiscal entitie's PIN number (String)
73
+ * `in_vat_system` : Specifies if the fical entity is in the VAT system (Boolean)
74
+ * `time_issued` : Time the invoice was created (Time)
75
+ * `consistance_mark` : Character that specifes where the invoice was issued, "P" for _Office space_ or "N" for _Payment machine_ (String)
76
+ * `issued_number` : Nummerical invoice identifier (String ot Integer)
77
+ * `issued_office` : Office space identifier where the invoice was issued (String)
78
+ * `issued_machine` : Numerical payment machine identifier (String or Integer)
79
+ * `tax_vat` : Array containing all VAT taxes (Array containing _Fiscalizer::Tax_ objects)
80
+ * `tax_spending` : Array containing all spending taxes (Array containing _Fiscalizer::Tax_ objects)
81
+ * `tax_other` : Array containing all other taxes (Array containing _Fiscalizer::Tax_ objects)
82
+ * `value_tax_liberation` : Ammount that will be submitted for tax liberation (Float)
83
+ * `value_tax_margin` : Ammount that will be subjected to the special tax margin process (Float)
84
+ * `value_non_taxable` : Ammount that isn't subject to any taxing (Float)
85
+ * `fees` : Array containing all fees (Array containing _Fiscalizer::Fee_ objects)
86
+ * `summed_total` : Summed total price of the invoice (Float)
87
+ * `payment_method` : Specifies the payment method, "G" for cash, "K" for card, "C" for check, "T" for transaction, "O" for other (String)
88
+ * `operator_pin` : The PIN number of the person issuing the invoice (String)
89
+ * `security_code` : Security code of the invoice (String)
90
+ * `subsequent_delivery` : Subsequent delivery mark (Boolean)
91
+ * `paragon_label` : Paragon label for invoices that have to be fiscalized after the office space or payment machine has been removed from the fiscalization system (String)
92
+ * `specific_purpose` : This is an additional label in case of further expansion of the fiscalization system (String)
93
+ * `unique_identifier` : Unique identifier of the invoice (String)
94
+ * `reconnect_attempts` : Specifies how many times to try establishing a connection, defaults to 3 (Integer)
95
+
96
+ __Note:__ `summed_total` will return the sum of all taxed values from `tax_vat`, `tax_spending`, `tax_other`
97
+
98
+ #### Office spaces
99
+
100
+ To fiscalize an office space call `fiscalizer.fiscalize_office` and pass it an `Fiscalizer::Office` object.
101
+
102
+ Arguments that can be passed to `fiscalizer.fiscalize_office`:
103
+
104
+ * `uuid` : Universally Unique Identifier (String)
105
+ * `time_sent` : Time the office space fiscalization request was sent (Time)
106
+ * `pin` : The fiscal entitie's PIN number (String)
107
+ * `office_label` : Office space identifier string (String)
108
+ * `adress_street_name` : Name of the street the where the office space is located (String)
109
+ * `adress_house_num` : House number of the office space (String)
110
+ * `adress_house_num_addendum` : Additional house number of the office space, eg.: "a" or "3/4" (String)
111
+ * `adress_post_num` : Post office number of the office space (String)
112
+ * `adress_settlement` : Settlement name of the office space's location (String)
113
+ * `adress_township` : Township name of the office space's location (String)
114
+ * `adress_other` : Field to specify non standart office spaces, eg.: "web store" (String)
115
+ * `office_time` : Specifies the working hours of the office space, anything is valid (String)
116
+ * `take_effect_date` : Date from which the change takes effect (Time)
117
+ * `closure_mark` : Mark that indicates the cloasure of the office space, send "Z" to close (String)
118
+ * `specific_purpose` : Software manufacturer's PIN number (String)
119
+ * `reconnect_attempts` : Specifies how many times to try establishing a connection, defaults to 3 (Integer)
120
+
121
+ #### Echo requests
122
+
123
+ Even though echo requests are not particularly usefull for fiscalization they are described in the API and
124
+ therefore they are also implemented.
125
+
126
+ To make an echo request call `fiscalizer.echo` and eather pass it na `Fiscalizer::Echo` object or `text: "Your echo text"`
127
+ as an argument.
128
+
129
+ #### Responses
130
+
131
+ Response objects are perhaps the most important objects in this Gem.
132
+ They contain pre-parsed information that was returned from the fiscalization servers.
133
+
134
+ Methods:
135
+ * `type` : Type of the response, 0-Error, 1-Echo, 2-Office, 3-Invoice (Integer)
136
+ * `errors` : Hash containg all errors returned from the server, the key is the error code, and the value is the error explanation (Hash)
137
+ * `object` : Holds the object that generated the response (Echo, Invoice, Office)
138
+ * `uuid` : UUID returned by the server (String)
139
+ * `processed_at` : Time the request was processed (Time)
140
+ * `response` : Text returned in an Echo message (String)
141
+ * `unique_identifier` : Unique invoice identifier (String)
142
+ * `tns` : TNS used to parse the XML responses (String)
143
+ * `html_response` : Raw HTML response (HTTP::Response)
144
+ * `generated_xml` : XML generated for the reqest to which this response belongs (String)
145
+ * `has_error` : Returns true if there are any arrors (Boolean), alia method `errors?`
146
+ * `error_codes` : Returns all error codes in an array (Array containing String)
147
+ * `error_messages` : Returns all error messages in an array (Array containing String)
148
+ * `type_str` : Returnes the response type as a string (String)
149
+ * `echo_succeeded` : Returns true if echo message sent and returned are the same (Boolean)
150
+
151
+ # Notes
152
+
153
+ The public and private keys, and signing certificate are automatically extracted from a P12 certificate.
154
+ But the same is not true for a PFX certificate! PFX certificates don't contain a signing certificate and
155
+ therefore one has to be passed as an argument (`certificate_path`) additionaly to the PFX certificate (`certificate_p12_path`)
156
+
157
+ Direct usage of the `Fiscalizer::Communication` class is not advised!
158
+
159
+ # Translations
160
+
161
+ * __uuid__ : UUID
162
+ * __time_sent__ : Datum i vrijeme slanja
163
+ * __pin__ : OIB
164
+ * __office_label__ : Oznaka poslovnog prostora
165
+ * __adress_street_name__ : Ime ulice
166
+ * __adress_house_num__ : Kućni broj
167
+ * __adress_house_num_addendum__ : Dodatak kućnom broju
168
+ * __adress_post_num__ : Broj pošte
169
+ * __adress_settlement__ : Nasenje
170
+ * __adress_township__ : Općina
171
+ * __adress_other__ : Ostali tipovo poslovnog porstora
172
+ * __office_time__ : Radno vrijeme
173
+ * __take_effect_date__ : Datum početka primjene
174
+ * __closure_mark__ : Oznaka zatvaranja
175
+ * __specific_purpose__ : Specifična namjena
176
+ * __in_vat_system__ : U sustavu PDVa
177
+ * __time_issued__ : Datum i vrijeme izdavanja
178
+ * __consistance_mark__ : Oznaka slijednosti
179
+ * __issued_number__ : Brojčana oznaka računa
180
+ * __issued_office__ : Oznaka poslovnog prostora
181
+ * __issued_machine__ : Oznaka naplatnog uređaja
182
+ * __tax_vat__ : PDV
183
+ * __tax_spending__ : PNP
184
+ * __tax_other__ : Ostali porezi
185
+ * __value_tax_liberation__ : Iznos oslobođenja
186
+ * __value_tax_margin__ : Iznos koji se odnosi na poseban postupak oporezivanja marže
187
+ * __value_non_taxable__ : Iznos koji ne podlježe oporezivanju
188
+ * __fees__ : Naknade
189
+ * __summed_total__ : Ukupan iznos
190
+ * __payment_method__ : Način plaćanja
191
+ * __operator_pin__ : OIB operatera
192
+ * __security_code__ : Zaštitni kod izdavatelja (ZKI)
193
+ * __subsequent_delivery__ : Oznaka nadoknadne dostave
194
+ * __paragon_label__ : Oznaka paragon računa
195
+ * __specific_purpose__ : Specifična namjena
196
+ * __unique_identifier__ : Jedinstveni identifikator računa (JIR)
197
+ * __base__ : Osnovica
198
+ * __rate__ : Porezna stopa
199
+
200
+ # Credits
201
+
202
+ Phrasing is maintained and sponsored by
203
+ [Infinum](http://www.infinum.co).
204
+
205
+ ![Infinum](http://www.infinum.co/system/logo.png)
206
+
207
+ # License
208
+
209
+ Phrasing is Copyright © 2014 Infinum. It is free software, and may be redistributed under the terms specified in the LICENSE file.
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new do |t|
5
+ t.libs << 'test'
6
+ end
7
+
8
+ desc "Run tests"
9
+ task :default => :test
@@ -0,0 +1,780 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <schema xmlns="http://www.w3.org/2001/XMLSchema"
3
+ targetNamespace="http://www.apis-it.hr/fin/2012/types/f73"
4
+ xmlns:tns="http://www.apis-it.hr/fin/2012/types/f73"
5
+ xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
6
+ elementFormDefault="qualified" version="1.2">
7
+
8
+ <import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="xmldsig-core-schema.xsd" />
9
+
10
+ <element name="RacunZahtjev">
11
+ <annotation>
12
+ <documentation>
13
+ Poruka prema web servisu za zaprimanje racuna.
14
+ </documentation>
15
+ </annotation>
16
+ <complexType>
17
+ <sequence>
18
+ <element name="Zaglavlje" type="tns:ZaglavljeType" minOccurs="1" maxOccurs="1" />
19
+ <element name="Racun" type="tns:RacunType" minOccurs="1" maxOccurs="1" />
20
+ <element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
21
+ </sequence>
22
+ <attribute name="Id" type="string" >
23
+ <annotation>
24
+ <documentation>
25
+ Atribut za potrebe digitalnog potpisa, u njega se stavlja referentni na koji se referencira digitalni potpis.
26
+ </documentation>
27
+ </annotation>
28
+ </attribute>
29
+ </complexType>
30
+ </element>
31
+
32
+ <element name="RacunOdgovor">
33
+ <annotation>
34
+ <documentation>
35
+ Odgovor servisa za zaprimanje racuna.
36
+ </documentation>
37
+ </annotation>
38
+ <complexType>
39
+ <sequence>
40
+ <element name="Zaglavlje" type="tns:ZaglavljeOdgovorType" minOccurs="1" maxOccurs="1" />
41
+ <element name="Jir" type="tns:UUIDType" minOccurs="0" maxOccurs="1" >
42
+ <annotation>
43
+ <documentation>
44
+ Jedinstveni identifikator racuna.
45
+ </documentation>
46
+ </annotation>
47
+ </element>
48
+ <element name="Greske" type="tns:GreskeType" minOccurs="0" maxOccurs="1" />
49
+ <element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
50
+ </sequence>
51
+ <attribute name="Id" type="string" >
52
+ <annotation>
53
+ <documentation>
54
+ Atribut za potrebe digitalnog potpisa, u njega se stavlja referentni na koji se referencira digitalni potpis.
55
+ </documentation>
56
+ </annotation>
57
+ </attribute>
58
+ </complexType>
59
+ </element>
60
+
61
+ <element name="PoslovniProstorZahtjev">
62
+ <annotation>
63
+ <documentation>
64
+ Poruka prema web servisu za zaprimanje podataka o poslovnom prostoru.
65
+ </documentation>
66
+ </annotation>
67
+ <complexType>
68
+ <sequence>
69
+ <element name="Zaglavlje" type="tns:ZaglavljeType" minOccurs="1" maxOccurs="1" />
70
+ <element name="PoslovniProstor" type="tns:PoslovniProstorType" minOccurs="1" maxOccurs="1"/>
71
+ <element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
72
+ </sequence>
73
+ <attribute name="Id" type="string" >
74
+ <annotation>
75
+ <documentation>
76
+ Atribut za potrebe digitalnog potpisa, u njega se stavlja referentni na koji se referencira digitalni potpis.
77
+ </documentation>
78
+ </annotation>
79
+ </attribute>
80
+ </complexType>
81
+ </element>
82
+
83
+ <element name="PoslovniProstorOdgovor">
84
+ <annotation>
85
+ <documentation>
86
+ Odgovor servisa za zaprimanje podataka o poslovnom prostoru.
87
+ </documentation>
88
+ </annotation>
89
+ <complexType>
90
+ <sequence>
91
+ <element name="Zaglavlje" type="tns:ZaglavljeOdgovorType" minOccurs="1" maxOccurs="1" />
92
+ <element name="Greske" type="tns:GreskeType" minOccurs="0" maxOccurs="1" />
93
+ <element ref="ds:Signature" minOccurs="0" maxOccurs="1"/>
94
+ </sequence>
95
+ <attribute name="Id" type="string" >
96
+ <annotation>
97
+ <documentation>
98
+ Atribut za potrebe digitalnog potpisa, u njega se stavlja referentni na koji se referencira digitalni potpis.
99
+ </documentation>
100
+ </annotation>
101
+ </attribute>
102
+ </complexType>
103
+ </element>
104
+
105
+ <element name="EchoRequest" type="string" nillable="false">
106
+ <annotation>
107
+ <documentation>Poruka echo metodi.</documentation>
108
+ </annotation>
109
+ </element>
110
+ <element name="EchoResponse" type="string" nillable="false">
111
+ <annotation>
112
+ <documentation>Odgovor echo metode u obliku: "Request:
113
+ 'echoRequest'. Response: 'yyyy-MM-dd'T'HH:mm:ss.SSSZ'.
114
+ </documentation>
115
+ </annotation>
116
+ </element>
117
+
118
+ <complexType name="ZaglavljeType">
119
+ <sequence>
120
+ <element name="IdPoruke" type="tns:UUIDType" minOccurs="1"
121
+ maxOccurs="1">
122
+ <annotation>
123
+ <documentation>
124
+ Odabrati:
125
+ Version 1 (MAC address) - ne koristiti
126
+ Version 2 (DCE Security) - bazirano vremenskoj komponenti i
127
+ domeni
128
+ Version 3 (MD5 hash) - osnovni podaci generirano u
129
+ ovisnosti
130
+ o URLu, domeni i sl.
131
+ Version 4 (random) - ne govori
132
+ mnogo
133
+ Version 5 (SHA-1 hash) - preferirano umjesto V3
134
+ </documentation>
135
+ </annotation>
136
+ </element>
137
+ <element name="DatumVrijeme" type="tns:DatumVrijemeType"
138
+ minOccurs="1" maxOccurs="1">
139
+ <annotation>
140
+ <documentation>
141
+ Datum i vrijeme slanja poruke.
142
+ </documentation>
143
+ </annotation>
144
+ </element>
145
+ </sequence>
146
+ </complexType>
147
+
148
+ <complexType name="ZaglavljeOdgovorType">
149
+ <sequence>
150
+ <element name="IdPoruke" minOccurs="1" maxOccurs="1">
151
+ <annotation>
152
+ <documentation>
153
+ Odabrati:
154
+ Version 1 (MAC address) - ne koristiti
155
+ Version 2 (DCE Security) - bazirano vremenskoj komponenti i
156
+ domeni
157
+ Version 3 (MD5 hash) - osnovni podaci generirano u
158
+ ovisnosti
159
+ o URLu, domeni i sl.
160
+ Version 4 (random) - ne govori
161
+ mnogo
162
+ Version 5 (SHA-1 hash) - preferirano umjesto V3
163
+ </documentation>
164
+ </annotation>
165
+ <simpleType>
166
+ <restriction base="string">
167
+ <minLength value="0"/>
168
+ <maxLength value="36"/>
169
+ </restriction>
170
+ </simpleType>
171
+ </element>
172
+ <element name="DatumVrijeme" type="tns:DatumVrijemeType"
173
+ minOccurs="1" maxOccurs="1">
174
+ <annotation>
175
+ <documentation>
176
+ Datum i vrijeme obrade poruke.
177
+ </documentation>
178
+ </annotation>
179
+ </element>
180
+ </sequence>
181
+ </complexType>
182
+
183
+ <complexType name="RacunType">
184
+ <sequence>
185
+ <element name="Oib" type="tns:OibType" minOccurs="1" maxOccurs="1">
186
+ <annotation>
187
+ <documentation>
188
+ Osobni identifikacijski broj obveznika fiskalizacije.
189
+ </documentation>
190
+ </annotation>
191
+ </element>
192
+ <element name="USustPdv" type="boolean" minOccurs="1" maxOccurs="1" >
193
+ <annotation>
194
+ <documentation>
195
+ U sustavu PDV. Oznaka je li obveznik fiskalizacije u sustavu PDV ili nije.
196
+ </documentation>
197
+ </annotation>
198
+ </element>
199
+ <element name="DatVrijeme" type="tns:DatumVrijemeType" minOccurs="1" maxOccurs="1" >
200
+ <annotation>
201
+ <documentation>
202
+ Datum i vrijeme izdavanja racuna koji se ispisuju na racunu.
203
+ </documentation>
204
+ </annotation>
205
+ </element>
206
+ <element name="OznSlijed" type="tns:OznakaSlijednostiType" minOccurs="1" maxOccurs="1">
207
+ <annotation>
208
+ <documentation>
209
+ Oznaka slijednosti izdavanja racuna. Slijednost izdavanja racuna moze biti na razini poslovnog prostora ili naplatnog uredjaja.
210
+ </documentation>
211
+ </annotation>
212
+ </element>
213
+ <element name="BrRac" type="tns:BrojRacunaType" minOccurs="1" maxOccurs="1">
214
+ <annotation>
215
+ <documentation>
216
+ Broj racuna.
217
+ </documentation>
218
+ </annotation>
219
+ </element>
220
+ <element name="Pdv" type="tns:PdvType" minOccurs="0" maxOccurs="1" >
221
+ <annotation>
222
+ <documentation>
223
+ Porez na dodanu vrijednost.
224
+ </documentation>
225
+ </annotation>
226
+ </element>
227
+ <element name="Pnp" type="tns:PorezNaPotrosnjuType" minOccurs="0" maxOccurs="1" >
228
+ <annotation>
229
+ <documentation>
230
+ Porez na potrosnju.
231
+ </documentation>
232
+ </annotation>
233
+ </element>
234
+ <element name="OstaliPor" type="tns:OstaliPoreziType" minOccurs="0" maxOccurs="1" >
235
+ <annotation>
236
+ <documentation>
237
+ Ostali porezi.
238
+ Navode se ostali porezi koji se mogu pojaviti na racunu osim PDV-a i poreza na potrosnju.
239
+ Npr. porez na luksuz.
240
+ </documentation>
241
+ </annotation>
242
+ </element>
243
+ <element name="IznosOslobPdv" type="tns:IznosType" minOccurs="0" maxOccurs="1" >
244
+ <annotation>
245
+ <documentation>
246
+ Iznos oslobodjenja na racunu.
247
+ Ako se isporucuju dobra ili obavljaju usluge koje su oslobodjene od placanja PDV-a,
248
+ potrebno je poslati ukupan iznos oslobodjenja na racunu.
249
+ </documentation>
250
+ </annotation>
251
+ </element>
252
+ <element name="IznosMarza" type="tns:IznosType" minOccurs="0" maxOccurs="1" >
253
+ <annotation>
254
+ <documentation>
255
+ Iznos na koji se odnosi posebni postupka oporezivanja marze na racunu.
256
+ Marza za rabljena dobra, umjetnicka djela, kolekcionarske ili antikne predmete (clanak 22.a Zakona o PDV-u).
257
+ </documentation>
258
+ </annotation>
259
+ </element>
260
+ <element name="IznosNePodlOpor" type="tns:IznosType" minOccurs="0" maxOccurs="1" >
261
+ <annotation>
262
+ <documentation>
263
+ Iznos koji ne podlijeze oporezivanju na racunu.
264
+ </documentation>
265
+ </annotation>
266
+ </element>
267
+ <element name="Naknade" type="tns:NaknadeType" minOccurs="0" maxOccurs="1" >
268
+ <annotation>
269
+ <documentation>
270
+ Naknade koje se mogu pojaviti na racunu tipa povratna naknada za ambalazu i sl.
271
+ </documentation>
272
+ </annotation>
273
+ </element>
274
+ <element name="IznosUkupno" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
275
+ <annotation>
276
+ <documentation>
277
+ Ukupan iznos koji se iskazuje na racunu.
278
+ </documentation>
279
+ </annotation>
280
+ </element>
281
+ <element name="NacinPlac" type="tns:NacinPlacanjaType" minOccurs="1" maxOccurs="1" >
282
+ <annotation>
283
+ <documentation>
284
+ Moguce vrijednosti su G - gotovina, K - kartice, C - cek, T - transakcijski racun, O – ostalo.
285
+ U slucaju vise nacina placanja po jednom racunu, isto je potrebno prijaviti pod O - ostalo.
286
+ Za sve nacine placanja koji nisu propisani koristiti ce se oznaka O – ostalo.
287
+ </documentation>
288
+ </annotation>
289
+ </element>
290
+ <element name="OibOper" type="tns:OibType" minOccurs="1" maxOccurs="1" >
291
+ <annotation>
292
+ <documentation>
293
+ Osobni identifikacijski broj operatera na naplatnom uredjaju koji izdaje racun.
294
+ </documentation>
295
+ </annotation>
296
+ </element>
297
+ <element name="ZastKod" minOccurs="1" maxOccurs="1">
298
+ <annotation>
299
+ <documentation>
300
+ Zastitni kod izdavatelja.
301
+ Zastitni kod izdavatelja obveznika fiskalizacije je alfanumericki zapis kojim se potvrdjuje veza izmedju obveznika fiskalizacije
302
+ i izdanog racuna. Zastitni kod generira obveznik fiskalizacije.
303
+ </documentation>
304
+ </annotation>
305
+ <simpleType>
306
+ <restriction base="string">
307
+ <pattern value="[a-f0-9]{32}"/>
308
+ <length value="32" />
309
+ </restriction>
310
+ </simpleType>
311
+ </element>
312
+ <element name="NakDost" type="boolean" minOccurs="1" maxOccurs="1" >
313
+ <annotation>
314
+ <documentation>
315
+ Oznaka naknadne dostave racuna.
316
+ Obvezno se dostavlja u slucaju naknadne dostave racuna kad je isti prethodno izdan kupcu
317
+ bez JIR-a (prekid Internet veze ili potpuni prestanak rada naplatnog uredjaja).
318
+ </documentation>
319
+ </annotation>
320
+ </element>
321
+ <element name="ParagonBrRac" minOccurs="0" maxOccurs="1">
322
+ <annotation>
323
+ <documentation>
324
+ Oznaka paragon racuna.
325
+ Obavezno se dostavlja u slucaju potpunog prestanka rada naplatnog uredjaja kada obveznik fiskalizacije
326
+ mora prepisati izdane paragon racune i prijaviti ih putem poruke Poreznoj upravi.
327
+ </documentation>
328
+ </annotation>
329
+ <simpleType>
330
+ <restriction base="string">
331
+ <minLength value="1" />
332
+ <maxLength value="100" />
333
+ </restriction>
334
+ </simpleType>
335
+ </element>
336
+ <element name="SpecNamj" minOccurs="0" maxOccurs="1">
337
+ <annotation>
338
+ <documentation>
339
+ Specificna namjena.
340
+ Predvidjeno za slucaj da se naknadno pojavi potreba za dostavom podataka koji nisu prepoznati tokom analize.
341
+ </documentation>
342
+ </annotation>
343
+ <simpleType>
344
+ <restriction base="string">
345
+ <minLength value="1" />
346
+ <maxLength value="1000" />
347
+ </restriction>
348
+ </simpleType>
349
+ </element>
350
+ </sequence>
351
+ </complexType>
352
+
353
+ <complexType name="PoslovniProstorType">
354
+ <sequence>
355
+ <element name="Oib" type="tns:OibType" minOccurs="1" maxOccurs="1" >
356
+ <annotation>
357
+ <documentation>
358
+ Osobni identifikacijski broj obveznika fiskalizacije.
359
+ </documentation>
360
+ </annotation>
361
+ </element>
362
+ <element name="OznPoslProstora" type="tns:OznPoslProstoraType" minOccurs="1" maxOccurs="1" >
363
+ <annotation>
364
+ <documentation>
365
+ Oznaka poslovnog prostora.
366
+ </documentation>
367
+ </annotation>
368
+ </element>
369
+ <element name="AdresniPodatak" type="tns:AdresniPodatakType" minOccurs="1" maxOccurs="1" >
370
+ <annotation>
371
+ <documentation>
372
+ Adresa ili opis poslovnog prostora ( npr. internet trgovina ) kada poslovni prostor nema adresu.
373
+ </documentation>
374
+ </annotation>
375
+ </element>
376
+ <element name="RadnoVrijeme" minOccurs="1" maxOccurs="1">
377
+ <annotation>
378
+ <documentation>
379
+ Radno vrijeme poslovnog prostora, slobodan unos.
380
+ </documentation>
381
+ </annotation>
382
+ <simpleType>
383
+ <restriction base="string">
384
+ <minLength value="1" />
385
+ <maxLength value="1000" />
386
+ </restriction>
387
+ </simpleType>
388
+ </element>
389
+ <element name="DatumPocetkaPrimjene" type="tns:DatumType" minOccurs="1" maxOccurs="1">
390
+ <annotation>
391
+ <documentation>
392
+ Datum otkad vrijedi promjena.
393
+ </documentation>
394
+ </annotation>
395
+ </element>
396
+ <element name="OznakaZatvaranja" type="tns:OznakaZatvaranjaType" minOccurs="0" maxOccurs="1" >
397
+ <annotation>
398
+ <documentation>
399
+ Samo u slucaju da se zatvara poslovni prostor. Nakon zatvaranja poslovnog prostora ne smiju se vise prijavljivati racuni
400
+ s oznakom tog poslovnog prostora.
401
+ </documentation>
402
+ </annotation>
403
+ </element>
404
+ <element name="SpecNamj" minOccurs="0" maxOccurs="1">
405
+ <annotation>
406
+ <documentation>
407
+ Potrebno je dostaviti jedan od podataka u nastavku:
408
+ - OIB pravne ili fizicke osobe koja je proizvela programsko rjesenje ili
409
+ - OIB pravne ili fizicke osobe koja odrzava programsko rjesenje ili
410
+ - OIB pravne ili fizicke osobe prodavatelja u slucaju da se koristi rjesenje od stranog proizvodaca – bez lokalnog partnera
411
+ </documentation>
412
+ </annotation>
413
+ <simpleType>
414
+ <restriction base="string">
415
+ <minLength value="1" />
416
+ <maxLength value="1000" />
417
+ </restriction>
418
+ </simpleType>
419
+ </element>
420
+ </sequence>
421
+ </complexType>
422
+
423
+ <simpleType name="OznakaSlijednostiType">
424
+ <annotation>
425
+ <documentation>
426
+ Oznaka koja govori kako je dodijeljen broj racuna: N - na nivou naplatnog uredjaja , P - na nivou poslovnog prostora
427
+ </documentation>
428
+ </annotation>
429
+ <restriction base="string">
430
+ <enumeration value="N"/>
431
+ <enumeration value="P"/>
432
+ </restriction>
433
+ </simpleType>
434
+
435
+ <simpleType name="OznakaZatvaranjaType">
436
+ <restriction base="string">
437
+ <enumeration value="Z"/>
438
+ </restriction>
439
+ </simpleType>
440
+
441
+ <complexType name="AdresniPodatakType">
442
+ <choice>
443
+ <element name="Adresa" type="tns:AdresaType">
444
+ <annotation>
445
+ <documentation>
446
+ Adresa poslovnog prostora.
447
+ </documentation>
448
+ </annotation>
449
+ </element>
450
+ <element name="OstaliTipoviPP" type="tns:String100Type">
451
+ <annotation>
452
+ <documentation>
453
+ Ostali tipovi poslovnog prostora.
454
+ Predvidjen je slobodan unos za specificne slucajeve kada ne postoji adresa poslovnog prostora (internet trgovina, pokretna trgovina i sl.).
455
+ </documentation>
456
+ </annotation>
457
+ </element>
458
+ </choice>
459
+ </complexType>
460
+
461
+ <complexType name="GreskeType">
462
+ <sequence>
463
+ <element name="Greska" type="tns:GreskaType" minOccurs="1"
464
+ maxOccurs="unbounded" />
465
+ </sequence>
466
+ </complexType>
467
+
468
+ <complexType name="AdresaType">
469
+ <sequence>
470
+ <element name="Ulica" minOccurs="0" maxOccurs="1" type="tns:String100Type"/>
471
+ <element name="KucniBroj" minOccurs="0" maxOccurs="1" type="tns:String4BrojType"/>
472
+ <element name="KucniBrojDodatak" minOccurs="0" maxOccurs="1" type="tns:String4Type"/>
473
+ <element name="BrojPoste" minOccurs="0" maxOccurs="1" type="tns:String12BrojType"/>
474
+ <element name="Naselje" minOccurs="0" maxOccurs="1" type="tns:String35Type"/>
475
+ <element name="Opcina" minOccurs="0" maxOccurs="1" type="tns:String35Type"/>
476
+ </sequence>
477
+ </complexType>
478
+
479
+ <complexType name="GreskaType">
480
+ <sequence>
481
+ <element name="SifraGreske" type="tns:SifraGreskeType"
482
+ minOccurs="1" maxOccurs="1" />
483
+ <element name="PorukaGreske" type="tns:PorukaGreskeType"
484
+ minOccurs="1" maxOccurs="1" />
485
+ </sequence>
486
+ </complexType>
487
+
488
+ <simpleType name="SifraGreskeType">
489
+ <annotation>
490
+ <documentation>Sifra greske je u formatu sXXX gdje je XXX
491
+ troznamenkasti prirodni broj.</documentation>
492
+ </annotation>
493
+ <restriction base="string">
494
+ <pattern value="s[0-9]{3}" />
495
+ </restriction>
496
+ </simpleType>
497
+ <simpleType name="PorukaGreskeType">
498
+ <annotation>
499
+ <documentation>Poruka greske je tekstualni opis greske ogranicen
500
+ na 500 znakova.</documentation>
501
+ </annotation>
502
+ <restriction base="string">
503
+ <maxLength value="500" />
504
+ </restriction>
505
+ </simpleType>
506
+
507
+ <simpleType name="DatumType">
508
+ <restriction base="string">
509
+ <length value="10" />
510
+ <pattern value="[0-9]{2}.[0-9]{2}.[1-2][0-9]{3}" />
511
+ </restriction>
512
+ </simpleType>
513
+
514
+ <simpleType name="NacinPlacanjaType">
515
+ <annotation>
516
+ <documentation>
517
+ Nacini placanja: G - gotovina, K - kartice, C -
518
+ cek, T - transakcijski racun, O - ostalo
519
+ </documentation>
520
+ </annotation>
521
+ <restriction base="string">
522
+ <enumeration value="G" />
523
+ <enumeration value="K" />
524
+ <enumeration value="C" />
525
+ <enumeration value="T" />
526
+ <enumeration value="O" />
527
+ </restriction>
528
+ </simpleType>
529
+
530
+ <complexType name="NaknadeType">
531
+ <sequence>
532
+ <element name="Naknada" type="tns:NaknadaType" minOccurs="1"
533
+ maxOccurs="unbounded" />
534
+ </sequence>
535
+ </complexType>
536
+
537
+ <complexType name="NaknadaType">
538
+ <sequence>
539
+ <element name="NazivN" minOccurs="1" maxOccurs="1">
540
+ <annotation>
541
+ <documentation>
542
+ Naziv naknade.
543
+ </documentation>
544
+ </annotation>
545
+ <simpleType>
546
+ <restriction base="string">
547
+ <minLength value="1" />
548
+ <maxLength value="100" />
549
+ </restriction>
550
+ </simpleType>
551
+ </element>
552
+ <element name="IznosN" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
553
+ <annotation>
554
+ <documentation>
555
+ Iznos naknade.
556
+ </documentation>
557
+ </annotation>
558
+ </element>
559
+ </sequence>
560
+ </complexType>
561
+
562
+ <complexType name="OstaliPoreziType">
563
+ <sequence>
564
+ <element name="Porez" type="tns:PorezOstaloType"
565
+ minOccurs="1" maxOccurs="unbounded" />
566
+ </sequence>
567
+ </complexType>
568
+
569
+ <complexType name="PorezNaPotrosnjuType">
570
+ <sequence>
571
+ <element name="Porez" type="tns:PorezType" minOccurs="1"
572
+ maxOccurs="unbounded" />
573
+ </sequence>
574
+ </complexType>
575
+
576
+ <complexType name="PdvType">
577
+ <sequence>
578
+ <element name="Porez" type="tns:PorezType" minOccurs="1"
579
+ maxOccurs="unbounded" />
580
+ </sequence>
581
+ </complexType>
582
+
583
+ <complexType name="PorezOstaloType">
584
+ <sequence>
585
+ <element name="Naziv" minOccurs="1" maxOccurs="1">
586
+ <annotation>
587
+ <documentation>
588
+ Naziv poreza za koji se salju podaci.
589
+ </documentation>
590
+ </annotation>
591
+ <simpleType>
592
+ <restriction base="string">
593
+ <minLength value="1" />
594
+ <maxLength value="100" />
595
+ </restriction>
596
+ </simpleType>
597
+ </element>
598
+ <element name="Stopa" type="tns:StopaType" minOccurs="1" maxOccurs="1">
599
+ <annotation>
600
+ <documentation>
601
+ Iznos porezne stope.
602
+ </documentation>
603
+ </annotation>
604
+ </element>
605
+ <element name="Osnovica" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
606
+ <annotation>
607
+ <documentation>
608
+ Iznos osnovice.
609
+ </documentation>
610
+ </annotation>
611
+ </element>
612
+ <element name="Iznos" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
613
+ <annotation>
614
+ <documentation>
615
+ Iznos poreza.
616
+ </documentation>
617
+ </annotation>
618
+ </element>
619
+ </sequence>
620
+ </complexType>
621
+
622
+ <complexType name="PorezType">
623
+ <sequence>
624
+ <element name="Stopa" type="tns:StopaType" minOccurs="1" maxOccurs="1">
625
+ <annotation>
626
+ <documentation>
627
+ Iznos porezne stope.
628
+ </documentation>
629
+ </annotation>
630
+ </element>
631
+ <element name="Osnovica" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
632
+ <annotation>
633
+ <documentation>
634
+ Iznos osnovice.
635
+ </documentation>
636
+ </annotation>
637
+ </element>
638
+ <element name="Iznos" type="tns:IznosType" minOccurs="1" maxOccurs="1" >
639
+ <annotation>
640
+ <documentation>
641
+ Iznos poreza.
642
+ </documentation>
643
+ </annotation>
644
+ </element>
645
+ </sequence>
646
+ </complexType>
647
+
648
+ <complexType name="BrojRacunaType">
649
+ <sequence>
650
+ <element name="BrOznRac" minOccurs="1" maxOccurs="1">
651
+ <annotation>
652
+ <documentation>
653
+ Brojcana oznaka racuna.
654
+ </documentation>
655
+ </annotation>
656
+ <simpleType>
657
+ <restriction base="string">
658
+ <minLength value="1" />
659
+ <maxLength value="20" />
660
+ <pattern value="\d*" />
661
+ </restriction>
662
+ </simpleType>
663
+ </element>
664
+ <element name="OznPosPr" type="tns:OznPoslProstoraType" minOccurs="1" maxOccurs="1" >
665
+ <annotation>
666
+ <documentation>
667
+ Oznaka poslovnog prostora.
668
+ </documentation>
669
+ </annotation>
670
+ </element>
671
+ <element name="OznNapUr" type="tns:OznNaplUredjajaType" minOccurs="1" maxOccurs="1" >
672
+ <annotation>
673
+ <documentation>
674
+ Oznaka naplatnog uredjaja.
675
+ </documentation>
676
+ </annotation>
677
+ </element>
678
+ </sequence>
679
+ </complexType>
680
+
681
+ <simpleType name="OznPoslProstoraType">
682
+ <restriction base="string">
683
+ <minLength value="1" />
684
+ <maxLength value="20" />
685
+ <pattern value="[0-9a-zA-Z]{1,20}" />
686
+ </restriction>
687
+ </simpleType>
688
+
689
+ <simpleType name="OznNaplUredjajaType">
690
+ <restriction base="string">
691
+ <minLength value="1" />
692
+ <maxLength value="20" />
693
+ <pattern value="\d*" />
694
+ </restriction>
695
+ </simpleType>
696
+
697
+ <simpleType name="IznosType">
698
+ <annotation>
699
+ <documentation>Iznos. Decimalna vrijednost.</documentation>
700
+ </annotation>
701
+ <restriction base="string">
702
+ <pattern value="([+-]?)[0-9]{1,15}\.[0-9]{2}"/>
703
+ <whiteSpace value="replace"/>
704
+ </restriction>
705
+ </simpleType>
706
+
707
+ <simpleType name="StopaType">
708
+ <annotation>
709
+ <documentation>Iznos porezne stope.</documentation>
710
+ </annotation>
711
+ <restriction base="string">
712
+ <pattern value="([+-]?)[0-9]{1,3}\.[0-9]{2}"/>
713
+ <whiteSpace value="replace"/>
714
+ </restriction>
715
+ </simpleType>
716
+
717
+ <simpleType name="OibType">
718
+ <annotation>
719
+ <documentation>Definira element koji u sebi sadrzava oib.
720
+ </documentation>
721
+ </annotation>
722
+ <restriction base="string">
723
+ <length value="11" />
724
+ <pattern value="\d*" />
725
+ </restriction>
726
+ </simpleType>
727
+
728
+ <simpleType name="DatumVrijemeType">
729
+ <restriction base="string">
730
+ <length value="19" />
731
+ <pattern
732
+ value="[0-9]{2}.[0-9]{2}.[1-2][0-9]{3}T[0-9]{2}:[0-9]{2}:[0-9]{2}" />
733
+ </restriction>
734
+ </simpleType>
735
+
736
+ <simpleType name="UUIDType">
737
+ <restriction base="string">
738
+ <pattern
739
+ value="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}" />
740
+ </restriction>
741
+ </simpleType>
742
+
743
+ <simpleType name="String4Type">
744
+ <restriction base="string">
745
+ <minLength value="1"></minLength>
746
+ <maxLength value="4"></maxLength>
747
+ </restriction>
748
+ </simpleType>
749
+
750
+ <simpleType name="String35Type">
751
+ <restriction base="string">
752
+ <minLength value="1"></minLength>
753
+ <maxLength value="35"></maxLength>
754
+ </restriction>
755
+ </simpleType>
756
+
757
+ <simpleType name="String100Type">
758
+ <restriction base="string">
759
+ <minLength value="1"></minLength>
760
+ <maxLength value="100"></maxLength>
761
+ </restriction>
762
+ </simpleType>
763
+
764
+ <simpleType name="String4BrojType">
765
+ <restriction base="string">
766
+ <minLength value="1"></minLength>
767
+ <maxLength value="4"></maxLength>
768
+ <pattern value="\d*"></pattern>
769
+ </restriction>
770
+ </simpleType>
771
+
772
+ <simpleType name="String12BrojType">
773
+ <restriction base="string">
774
+ <minLength value="1"></minLength>
775
+ <maxLength value="12"></maxLength>
776
+ <pattern value="\d*"></pattern>
777
+ </restriction>
778
+ </simpleType>
779
+
780
+ </schema>