fiscalizer 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 62cfc9cca5cdb3e2fb06172c267172a138e93f6a92dfc34ab171060236d655e3
|
4
|
+
data.tar.gz: 0d48930dabb751c781c967dae029234af397d5fe664a0a67d8b5112d3e6b49d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6aaa5993eb0a5e548882c02a2919d93713fdaf39bf92d9925eea4e88137814490799e124d9662645f0edeffcbc4a581404a5c4e9b7966e95055da8b6b42b62e
|
7
|
+
data.tar.gz: c7e4375d2525c474392cc7ebf36ba415821f13f1dc6714ba4c89c56f4d9d4ad98d191eb15a40193c1fde5c204ccfdf9d7474ca4896eb619e0f4c52866e04482e
|
data/README.md
CHANGED
@@ -123,28 +123,28 @@ If the fiscalization process is successful, response will contain a `unique_iden
|
|
123
123
|
|
124
124
|
Example:
|
125
125
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
126
|
+
```ruby
|
127
|
+
invoice = YourApp::Invoice.find(...)
|
128
|
+
fiscalizer_invoice = Fiscalizer::Invoice.new(...) # convert your invoice to fiscalizer invoice
|
129
|
+
fiscalizer = Fiscalizer.new(
|
130
|
+
app_cert_path: 'path/to/FISCAL_1.p12',
|
131
|
+
password: 'password'
|
132
|
+
)
|
133
|
+
|
134
|
+
begin
|
135
|
+
response = fiscalizer.fiscalize_invoice(fiscalizer_invoice)
|
136
|
+
fail 'Fiscalization error' if response.errors? # or do something with the errors
|
137
|
+
|
138
|
+
invoice.update(jir: response.unique_identifier)
|
139
|
+
ensure
|
140
|
+
invoice.update(
|
141
|
+
fiscalization_response: response.raw_response,
|
142
|
+
fiscalization_request: fiscalizer_invoice.generated_xml,
|
143
|
+
zki: fiscalizer_invoice.security_code,
|
144
|
+
errors: response.errors
|
145
|
+
)
|
146
|
+
end
|
147
|
+
```
|
148
148
|
|
149
149
|
#### Taxes and Fees
|
150
150
|
|
@@ -195,17 +195,17 @@ To fiscalize the office space, you first need to create a `Fiscalizer::Office` o
|
|
195
195
|
|
196
196
|
Example:
|
197
197
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
198
|
+
```ruby
|
199
|
+
fiscalizer_office = Fiscalizer::Office.new(...)
|
200
|
+
fiscalizer = Fiscalizer.new(
|
201
|
+
app_cert_path: 'path/to/FISCAL_1.p12',
|
202
|
+
password: 'password'
|
203
|
+
)
|
204
204
|
|
205
|
-
|
205
|
+
response = fiscalizer.fiscalize_office(fiscalizer_office)
|
206
206
|
|
207
|
-
|
208
|
-
|
207
|
+
# do something with the response
|
208
|
+
```
|
209
209
|
|
210
210
|
# Fiscalization specification
|
211
211
|
|
@@ -217,7 +217,7 @@ The official technical specification for the Fiscalization process can be found
|
|
217
217
|
Fiscalizer is maintained and sponsored by
|
218
218
|
[Infinum](https://infinum.co/).
|
219
219
|
|
220
|
-
|
220
|
+
<img src="https://infinum.co/infinum.png" width="264">
|
221
221
|
|
222
222
|
# License
|
223
223
|
|
@@ -46,6 +46,13 @@ class Fiscalizer
|
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
49
|
+
def add_header(xml)
|
50
|
+
xml['tns'].Zaglavlje do
|
51
|
+
xml['tns'].IdPoruke object.uuid
|
52
|
+
xml['tns'].DatumVrijeme object.time_sent_str
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
49
56
|
def add_signature(xml)
|
50
57
|
Serializers::Signature.new(xml, "##{message_id}", public_key, cert_issuer).call
|
51
58
|
end
|
@@ -19,13 +19,6 @@ class Fiscalizer
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def add_header(xml)
|
23
|
-
xml['tns'].Zaglavlje do
|
24
|
-
xml['tns'].IdPoruke object.uuid
|
25
|
-
xml['tns'].DatumVrijeme object.time_sent_str
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
22
|
def add_body(xml)
|
30
23
|
xml['tns'].Racun do
|
31
24
|
add_general_invoice_info(xml)
|
@@ -19,13 +19,6 @@ class Fiscalizer
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
def add_header(xml)
|
23
|
-
xml['tns'].Zaglavlje do
|
24
|
-
xml['tns'].IdPoruke object.uuid
|
25
|
-
xml['tns'].DatumVrijeme object.time_sent_str
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
22
|
def add_body(xml)
|
30
23
|
xml['tns'].PoslovniProstor do
|
31
24
|
add_general_info(xml)
|
@@ -52,7 +52,13 @@ class Fiscalizer
|
|
52
52
|
# istom fileu kao i public i private key
|
53
53
|
# taj file ima ekstenziju .p12 (npr. FISKAL_1.p12)
|
54
54
|
production_certificates.each do |certificate|
|
55
|
-
|
55
|
+
begin
|
56
|
+
http.cert_store.add_cert(certificate)
|
57
|
+
rescue OpenSSL::X509::StoreError => err
|
58
|
+
# ignore duplicate certs
|
59
|
+
# Novi finini certifikati sadze CA koji vec postoje medu default_paths(line 45)
|
60
|
+
raise unless err.message == 'cert already in hash table'
|
61
|
+
end
|
56
62
|
end
|
57
63
|
|
58
64
|
# u testnom okruzenju, treba dodati 2 trusted CA certifikata
|
data/lib/fiscalizer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fiscalizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stanko Krtalić Rusendić
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -164,11 +164,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.7.3
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: A gem that automatically handles fiscalization
|
171
171
|
test_files:
|
172
172
|
- spec/fiscalizer_spec.rb
|
173
173
|
- spec/spec_helper.rb
|
174
|
-
has_rdoc:
|