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
- SHA1:
3
- metadata.gz: cc259947daa868463b0de723f158b9f4d5b46dc5
4
- data.tar.gz: 1fe536eca7ea1a013f819c26c1ccfffd2aead82d
2
+ SHA256:
3
+ metadata.gz: 62cfc9cca5cdb3e2fb06172c267172a138e93f6a92dfc34ab171060236d655e3
4
+ data.tar.gz: 0d48930dabb751c781c967dae029234af397d5fe664a0a67d8b5112d3e6b49d0
5
5
  SHA512:
6
- metadata.gz: 1249e0e6e1d45c5ce5115e562e0f903336eb16e0ee41a8a27b3c0617808a6b5d342ed774d04218d13ca8cb0089ce974558d31da212fdec910fb1ad7600855afc
7
- data.tar.gz: 37fab01aaec2515768621f022356b6722af529e1aa425166557b26670fc4ae5a5898f261de1f4c9f89e6e4be45d668353e797a2844aa5eabc9e872a3f3573cc4
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
- ```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
- ```
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
- ```ruby
199
- fiscalizer_office = Fiscalizer::Office.new(...)
200
- fiscalizer = Fiscalizer.new(
201
- app_cert_path: 'path/to/FISCAL_1.p12',
202
- password: 'password'
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
- response = fiscalizer.fiscalize_office(fiscalizer_office)
205
+ response = fiscalizer.fiscalize_office(fiscalizer_office)
206
206
 
207
- # do something with the response
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
- ![Infinum](https://camo.githubusercontent.com/ce804b9555629d79335cf51c0bd6aedc615aeb3f/68747470733a2f2f696e66696e756d2e636f2f696e66696e756d2e706e67)
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
- http.cert_store.add_cert(certificate)
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
@@ -1,3 +1,3 @@
1
1
  class Fiscalizer
2
- VERSION = '1.0.0'
2
+ VERSION = '1.1.0'
3
3
  end
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.0.0
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: 2017-01-19 00:00:00.000000000 Z
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.4.5.1
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: