orangedata 0.0.8 → 0.0.10

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
2
  SHA256:
3
- metadata.gz: 5a3f00247b5383fe2991dc28a4df82a5fa53b04c9606a9fa0d8002f3e95d53b3
4
- data.tar.gz: f674045c5658c4b2e72b5e691bd0730e580af2584780ea7b942d4183d223720f
3
+ metadata.gz: c9fa958e5956706463a6a2298893886987840b413bcea4cb4f3dc685df565ae9
4
+ data.tar.gz: '087c9d1118e082e5c0f190d28d7fb585e1c72b5c2cc4e1961af5ec9034316225'
5
5
  SHA512:
6
- metadata.gz: 8d77cf5381bb8c440b7031c50e59c702b59c63e74614c9a45a07e301c7c65d89e24df17ed603b531be25485180fe1690cf9ff63ebb48f52309bb16b9807548cf
7
- data.tar.gz: 9b1ebfa297779c6fa80e1fd59b4ad654ff2fd9a73b3e5dfc32121989d15010bb9e4a85963c16f616a0681ac3a9ad99420248a31f32dafc927364b4ada6293679
6
+ metadata.gz: 6039886a4592a56facf40e4a34b1d97b073c2b0f0e6c8325109ec2e8cbc3167ad507fe6aebd09c78bc4b624f07871cad74a7a2f3d305188ad4ce016bf525743a
7
+ data.tar.gz: 398d24f56636d6f54833c10251e9be3243877cd74a6dc4beea7573aceed0e0ddb9c5984c6b1bb0057d39fb5b1e229be513fc4b757a21944e079120d10abe5e49
data/.rubocop.yml CHANGED
@@ -1,4 +1,6 @@
1
1
  AllCops:
2
+ NewCops: enable
3
+ SuggestExtensions: false
2
4
  # DefaultFormatter: fuubar
3
5
  # TargetRubyVersion: 2.1
4
6
  TargetRubyVersion: 2.3
@@ -6,8 +8,7 @@ AllCops:
6
8
  - 'spec/fixtures/**/*'
7
9
  - 'tmp/**/*'
8
10
 
9
- Gemspec/RequiredRubyVersion:
10
- Enabled: false
11
+ Gemspec/RequiredRubyVersion: { Enabled: false }
11
12
 
12
13
  Metrics/LineLength:
13
14
  Max: 130
@@ -26,8 +27,7 @@ Metrics/MethodLength:
26
27
  Max: 20
27
28
  Enabled: false
28
29
 
29
- Metrics/ClassLength:
30
- Enabled: false
30
+ Metrics/ClassLength: { Enabled: false }
31
31
 
32
32
  Metrics/AbcSize:
33
33
  # Max: 50
@@ -46,10 +46,9 @@ Style/StringLiterals:
46
46
  Enabled: false
47
47
  # EnforcedStyle: double_quotes
48
48
 
49
- Style/RedundantReturn:
50
- Enabled: false
49
+ Style/RedundantReturn: { Enabled: false }
51
50
 
52
- Layout/AlignArguments:
51
+ Layout/ArgumentAlignment:
53
52
  EnforcedStyle: with_fixed_indentation
54
53
 
55
54
  Layout/SpaceBeforeBlockBraces:
@@ -58,11 +57,8 @@ Layout/SpaceBeforeBlockBraces:
58
57
  Layout/SpaceAroundEqualsInParameterDefault:
59
58
  EnforcedStyle: no_space
60
59
 
61
- Layout/SpaceAfterColon:
62
- Enabled: false
63
-
64
- Layout/SpaceAroundOperators:
65
- Enabled: false
60
+ Layout/SpaceAfterColon: { Enabled: false }
61
+ Layout/SpaceAroundOperators: { Enabled: false }
66
62
 
67
63
  Layout/EndAlignment:
68
64
  EnforcedStyleAlignWith: variable
@@ -85,14 +81,11 @@ Layout/DotPosition:
85
81
  # so that code can be copied to console
86
82
  EnforcedStyle: trailing
87
83
 
88
- Layout/IndentFirstHashElement:
84
+ Layout/FirstHashElementIndentation:
89
85
  EnforcedStyle: consistent
90
86
 
91
- Layout/EmptyLines:
92
- Enabled: false
93
-
94
- Style/AsciiComments:
95
- Enabled: false
87
+ Layout/EmptyLines: { Enabled: false }
88
+ Style/AsciiComments: { Enabled: false }
96
89
 
97
90
  Style/Documentation:
98
91
  # TODO
@@ -104,10 +97,9 @@ Style/BlockDelimiters:
104
97
  - 'spec/**/*'
105
98
 
106
99
  # trailing commas make simpler diffs
107
- Style/TrailingCommaInHashLiteral:
108
- Enabled: false
109
- Style/TrailingCommaInArrayLiteral:
110
- Enabled: false
100
+ Style/TrailingCommaInHashLiteral: { Enabled: false }
101
+ Style/TrailingCommaInArrayLiteral: { Enabled: false }
102
+ Style/KeywordParametersOrder: { Enabled: false }
111
103
 
112
- Naming/AccessorMethodName:
113
- Enabled: false
104
+ Naming/AccessorMethodName: { Enabled: false }
105
+ Naming/VariableNumber: { Enabled: false }
data/CHANGELOG.md CHANGED
@@ -1,14 +1,25 @@
1
- # 0.0.8
1
+ # Changelog
2
2
 
3
- - Fixed: return `nil` when document is not ready yet
3
+ ## 0.0.10
4
+ - Changed cashless print title per law change
4
5
 
5
- # 0.0.7
6
+ ## 0.0.9
7
+
8
+ - Added: Payment method names in schema
9
+ - Added: credentials#certificate_subject
10
+ - Added: `Receipt#as_json` and `.from_hash`
11
+
12
+ ## 0.0.8
13
+
14
+ - Fixed: return `nil` when document is not ready yet
15
+
16
+ ## 0.0.7
6
17
 
7
18
  - data schema update to 2.23.0 (15.06.2019)
8
19
  - Added: load credentials from zip file via rubyzip (no dependency, only accept already opened object)
9
20
  - Added: Credentials#from_hash now accepts `key_pass` argument
10
21
 
11
- # 0.0.6
22
+ ## 0.0.6
12
23
 
13
24
  - data schema changes:
14
25
  - title attribute used for field names instead of description
data/Gemfile.lock CHANGED
@@ -1,67 +1,95 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- orangedata (0.0.8)
4
+ orangedata (0.0.10)
5
5
  faraday (>= 0.15)
6
6
  faraday_middleware
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.6.0)
12
- public_suffix (>= 2.0.2, < 4.0)
13
- ast (2.4.0)
14
- crack (0.4.3)
15
- safe_yaml (~> 1.0.0)
16
- diff-lcs (1.3)
17
- docile (1.3.2)
18
- faraday (0.15.4)
19
- multipart-post (>= 1.2, < 3)
20
- faraday_middleware (0.13.1)
21
- faraday (>= 0.7.4, < 1.0)
22
- hashdiff (0.4.0)
23
- jaro_winkler (1.5.3)
24
- json (2.2.0)
25
- json-schema (2.8.1)
26
- addressable (>= 2.4)
27
- multipart-post (2.1.1)
28
- parallel (1.17.0)
29
- parser (2.6.3.0)
30
- ast (~> 2.4.0)
31
- public_suffix (3.1.0)
32
- rainbow (3.0.0)
33
- rake (10.5.0)
34
- rspec (3.8.0)
35
- rspec-core (~> 3.8.0)
36
- rspec-expectations (~> 3.8.0)
37
- rspec-mocks (~> 3.8.0)
38
- rspec-core (3.8.1)
39
- rspec-support (~> 3.8.0)
40
- rspec-expectations (3.8.4)
11
+ addressable (2.8.1)
12
+ public_suffix (>= 2.0.2, < 6.0)
13
+ ast (2.4.2)
14
+ crack (0.4.5)
15
+ rexml
16
+ diff-lcs (1.5.0)
17
+ docile (1.4.0)
18
+ faraday (1.10.2)
19
+ faraday-em_http (~> 1.0)
20
+ faraday-em_synchrony (~> 1.0)
21
+ faraday-excon (~> 1.1)
22
+ faraday-httpclient (~> 1.0)
23
+ faraday-multipart (~> 1.0)
24
+ faraday-net_http (~> 1.0)
25
+ faraday-net_http_persistent (~> 1.0)
26
+ faraday-patron (~> 1.0)
27
+ faraday-rack (~> 1.0)
28
+ faraday-retry (~> 1.0)
29
+ ruby2_keywords (>= 0.0.4)
30
+ faraday-em_http (1.0.0)
31
+ faraday-em_synchrony (1.0.0)
32
+ faraday-excon (1.1.0)
33
+ faraday-httpclient (1.0.1)
34
+ faraday-multipart (1.0.4)
35
+ multipart-post (~> 2)
36
+ faraday-net_http (1.0.1)
37
+ faraday-net_http_persistent (1.2.0)
38
+ faraday-patron (1.0.0)
39
+ faraday-rack (1.0.0)
40
+ faraday-retry (1.0.3)
41
+ faraday_middleware (1.2.0)
42
+ faraday (~> 1.0)
43
+ hashdiff (1.0.1)
44
+ json (2.6.2)
45
+ json-schema (3.0.0)
46
+ addressable (>= 2.8)
47
+ multipart-post (2.2.3)
48
+ parallel (1.22.1)
49
+ parser (3.1.2.1)
50
+ ast (~> 2.4.1)
51
+ public_suffix (5.0.0)
52
+ rainbow (3.1.1)
53
+ rake (13.0.6)
54
+ regexp_parser (2.6.0)
55
+ rexml (3.2.5)
56
+ rspec (3.11.0)
57
+ rspec-core (~> 3.11.0)
58
+ rspec-expectations (~> 3.11.0)
59
+ rspec-mocks (~> 3.11.0)
60
+ rspec-core (3.11.0)
61
+ rspec-support (~> 3.11.0)
62
+ rspec-expectations (3.11.1)
41
63
  diff-lcs (>= 1.2.0, < 2.0)
42
- rspec-support (~> 3.8.0)
43
- rspec-mocks (3.8.1)
64
+ rspec-support (~> 3.11.0)
65
+ rspec-mocks (3.11.1)
44
66
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.8.0)
46
- rspec-support (3.8.2)
47
- rubocop (0.71.0)
48
- jaro_winkler (~> 1.5.1)
67
+ rspec-support (~> 3.11.0)
68
+ rspec-support (3.11.1)
69
+ rubocop (1.36.0)
70
+ json (~> 2.3)
49
71
  parallel (~> 1.10)
50
- parser (>= 2.6)
72
+ parser (>= 3.1.2.1)
51
73
  rainbow (>= 2.2.2, < 4.0)
74
+ regexp_parser (>= 1.8, < 3.0)
75
+ rexml (>= 3.2.5, < 4.0)
76
+ rubocop-ast (>= 1.20.1, < 2.0)
52
77
  ruby-progressbar (~> 1.7)
53
- unicode-display_width (>= 1.4.0, < 1.7)
54
- ruby-progressbar (1.10.1)
55
- rubyzip (1.2.3)
56
- safe_yaml (1.0.5)
57
- simplecov (0.16.1)
78
+ unicode-display_width (>= 1.4.0, < 3.0)
79
+ rubocop-ast (1.21.0)
80
+ parser (>= 3.1.1.0)
81
+ ruby-progressbar (1.11.0)
82
+ ruby2_keywords (0.0.5)
83
+ rubyzip (2.3.2)
84
+ simplecov (0.21.2)
58
85
  docile (~> 1.1)
59
- json (>= 1.8, < 3)
60
- simplecov-html (~> 0.10.0)
61
- simplecov-html (0.10.2)
62
- unicode-display_width (1.6.0)
63
- webmock (3.6.0)
64
- addressable (>= 2.3.6)
86
+ simplecov-html (~> 0.11)
87
+ simplecov_json_formatter (~> 0.1)
88
+ simplecov-html (0.12.3)
89
+ simplecov_json_formatter (0.1.4)
90
+ unicode-display_width (2.3.0)
91
+ webmock (3.18.1)
92
+ addressable (>= 2.8.0)
65
93
  crack (>= 0.3.2)
66
94
  hashdiff (>= 0.4.0, < 2.0.0)
67
95
 
@@ -69,10 +97,10 @@ PLATFORMS
69
97
  ruby
70
98
 
71
99
  DEPENDENCIES
72
- bundler (~> 1.16)
73
- json-schema (~> 2.8)
100
+ bundler
101
+ json-schema (>= 2.8)
74
102
  orangedata!
75
- rake (~> 10.0)
103
+ rake (>= 10.0)
76
104
  rspec
77
105
  rubocop
78
106
  rubyzip
data/Rakefile CHANGED
@@ -21,17 +21,18 @@ namespace :swagger do
21
21
  `curl https://apip.orangedata.ru:2443/swagger/v2/swagger.json > #{swagger_file_name}`
22
22
  end
23
23
 
24
+ desc "compare upstream swagger spec"
24
25
  task diff: [:environment, swagger_file_name] do
25
26
  swagger = JSON.parse(File.read(swagger_file_name))
26
27
 
27
28
  new_definitions = swagger['definitions']
28
29
  old_definitions = OrangeData::PAYLOAD_SCHEMA['definitions']
29
30
 
30
- if new_definitions.keys != old_definitions.keys
31
+ if new_definitions.keys == old_definitions.keys
32
+ puts "No top-level definitions changed"
33
+ else
31
34
  puts "New schema definitions: #{new_definitions.keys - old_definitions.keys}"
32
35
  puts "Removed schema definitions: #{old_definitions.keys - new_definitions.keys}"
33
- else
34
- puts "No top-level definitions changed"
35
36
  end
36
37
 
37
38
  new_definitions.each_pair do |key, new_schema|
@@ -39,13 +40,13 @@ namespace :swagger do
39
40
  next unless old_schema
40
41
 
41
42
  if old_schema['properties'].keys != new_schema['properties'].keys
42
- if old_schema['properties'].keys.sort != new_schema['properties'].keys.sort
43
- puts "\t#{key} added: #{new_schema['properties'].keys - old_schema['properties'].keys}"
44
- puts "\t#{key} removed: #{old_schema['properties'].keys - new_schema['properties'].keys}"
45
- else
43
+ if old_schema['properties'].keys.sort == new_schema['properties'].keys.sort
46
44
  puts "\t#{key} property order changed:"
47
45
  puts "\t\told:#{old_schema['properties'].keys}"
48
46
  puts "\t\tnew:#{new_schema['properties'].keys}"
47
+ else
48
+ puts "\t#{key} added: #{new_schema['properties'].keys - old_schema['properties'].keys}"
49
+ puts "\t#{key} removed: #{old_schema['properties'].keys - new_schema['properties'].keys}"
49
50
  end
50
51
  # else
51
52
  # TODO: deep compare
@@ -18,11 +18,11 @@ module OrangeData
18
18
  h = { 'Modulus' => :n, 'Exponent' => :e }
19
19
  h.merge!('P' => :p, 'Q' => :q, 'DP' => :dmp1, 'DQ' => :dmq1, 'InverseQ' => :iqmp, 'D' => :d) if private?
20
20
 
21
- "<RSAKeyValue>#{h.map{|(k, v)| "<#{k}>#{h_params[v.to_s]}</#{k}>" }.join('')}</RSAKeyValue>"
21
+ "<RSAKeyValue>#{h.map{|(k, v)| "<#{k}>#{h_params[v.to_s]}</#{k}>" }.join}</RSAKeyValue>"
22
22
  end
23
23
 
24
24
  def to_hash
25
- params.map{|k, v| v != 0 && [k, Base64.strict_encode64(v.to_s(2))] || nil }.compact.to_h
25
+ params.map{|k, v| (v != 0 && [k, Base64.strict_encode64(v.to_s(2))]) || nil }.compact.to_h
26
26
  end
27
27
  end
28
28
 
@@ -78,7 +78,7 @@ module OrangeData
78
78
  end
79
79
  else
80
80
  # ruby 2.3 and may be older
81
- key.params.keys.each do |param|
81
+ key.params.each_key do |param|
82
82
  if (v = hash[param] || hash[param.to_sym])
83
83
  key.send(:"#{param}=", OpenSSL::BN.new(Base64.decode64(v), 2))
84
84
  end
@@ -197,13 +197,19 @@ module OrangeData
197
197
  key_name: signature_key_name.inspect,
198
198
  }
199
199
 
200
- if certificate && (subject_name = certificate.subject.to_a.select{|ent| ent.first == 'O' }.first)
201
- info_fields[:certificate] = %("#{(subject_name[1] || 'unknown').gsub('"', '\"')}")
200
+ if certificate && (subject_name = certificate_subject)
201
+ info_fields[:certificate] = %("#{(subject_name || 'unknown').gsub('"', '\"')}")
202
202
  end
203
203
 
204
204
  "#<#{self.class.name}:#{object_id} #{info_fields.map{|(k, v)| "#{k}=#{v}" }.join(' ')}>"
205
205
  end
206
206
 
207
+ def certificate_subject
208
+ return unless (subj = certificate.subject.to_a.select{|ent| ent.first == 'O' }.first)
209
+
210
+ subj[1].force_encoding('UTF-8')
211
+ end
212
+
207
213
  DEFAULT_KEY_LENGTH = 2048
208
214
 
209
215
  # deprecated
@@ -219,14 +225,14 @@ module OrangeData
219
225
 
220
226
  def self.read_certs_from_pack(path, signature_key_name:nil, cert_key_pass:nil, title:nil, signature_key:nil)
221
227
  path = File.expand_path(path)
222
- client_cert = Dir.glob(path + '/*.{crt}').select{|f| File.file?(f.sub(/.crt\z/, '.key')) }
228
+ client_cert = Dir.glob("#{path}/*.{crt}").select{|f| File.file?(f.sub(/.crt\z/, '.key')) }
223
229
  raise 'Expect to find exactly one <num>.crt with corresponding <num>.key file' unless client_cert.size == 1
224
230
 
225
231
  client_cert = client_cert.first
226
232
 
227
233
  unless signature_key
228
234
  # private_key_test.xml || rsa_\d+_private_key.xml
229
- xmls = Dir.glob(path + '/*.{xml}').select{|f| f =~ /private/ }
235
+ xmls = Dir.glob("#{path}/*.{xml}").grep(/private/)
230
236
  signature_key = if xmls.size == 1
231
237
  File.read(xmls.first)
232
238
  else
@@ -254,7 +260,7 @@ module OrangeData
254
260
 
255
261
  unless signature_key
256
262
  # private_key_test.xml || rsa_\d+_private_key.xml
257
- xmls = rubyzip_object.glob('/*.{xml}').select{|f| f =~ /private/ }
263
+ xmls = rubyzip_object.glob('/*.{xml}').grep(/private/)
258
264
  signature_key = if xmls.size == 1
259
265
  xmls.first.get_input_stream.read
260
266
  else
@@ -37,8 +37,8 @@ module OrangeData
37
37
  property_name = info["x-name"] || property.underscore
38
38
 
39
39
  if plain_types.include?(info["type"]) ||
40
- info["type"].is_a?(Array) && plain_types.include?(info["type"].first) &&
41
- info["type"].last == "null" && info["type"].size == 2
40
+ (info["type"].is_a?(Array) && plain_types.include?(info["type"].first) &&
41
+ info["type"].last == "null" && info["type"].size == 2)
42
42
  if info["x-enum"]
43
43
  inverse_map = info["x-enum"].map{|k, v| [v['val'], k.to_sym] }.to_h
44
44
 
@@ -134,8 +134,12 @@ module OrangeData
134
134
  @payload
135
135
  end
136
136
 
137
+ def as_json
138
+ to_hash
139
+ end
140
+
137
141
  def to_json(*args)
138
- to_hash.to_json(*args)
142
+ as_json.to_json(*args)
139
143
  end
140
144
  end
141
145
 
@@ -18,21 +18,36 @@ module OrangeData
18
18
  @inn = inn
19
19
  @group = group
20
20
  @key_name = key_name || inn
21
- @content = content if content
21
+ @content ||= content if content
22
22
  @callback_url = callback_url
23
23
  yield @content if block_given?
24
24
  end
25
25
 
26
- def to_json(*args)
26
+ def self.from_hash(hash)
27
+ new(
28
+ id: hash[:id] || hash['id'],
29
+ inn: hash[:inn] || hash['inn'],
30
+ group: hash[:group] || hash['group'],
31
+ key_name: hash[:key] || hash['key'],
32
+ content: hash[:content] || hash['content'],
33
+ callback_url: hash[:callbackUrl] || hash['callbackUrl']
34
+ )
35
+ end
36
+
37
+ def as_json
27
38
  {
28
39
  id: id,
29
40
  inn: inn,
30
41
  group: group || 'Main',
31
- content: content,
42
+ content: content.is_a?(Hash) ? content : content.as_json,
32
43
  key: key_name
33
44
  }.tap{|h|
34
45
  h[:callbackUrl] = @callback_url if @callback_url
35
- }.to_json(*args)
46
+ }
47
+ end
48
+
49
+ def to_json(*args)
50
+ as_json.to_json(*args)
36
51
  end
37
52
  end
38
53
 
@@ -41,6 +56,7 @@ module OrangeData
41
56
  @content = ReceiptContent.new(content || {})
42
57
  super
43
58
  end
59
+
44
60
  PAYLOAD_SCHEMA["definitions"]["CheckContent"]["properties"]["type"]["x-enum"].each_pair do |slug, _info|
45
61
  define_singleton_method(slug) do |**args, &block|
46
62
  new(**args, &block).tap{|doc|
@@ -52,7 +68,7 @@ module OrangeData
52
68
 
53
69
  class ReceiptContent < PayloadContent
54
70
  def initialize(payload={})
55
- @payload = payload || {}
71
+ super(payload || {})
56
72
  # TODO: import...
57
73
  # TODO: taxationSystem default in checkclose
58
74
  @check_close = CheckClose.new(@payload['checkClose'])
@@ -102,12 +118,12 @@ module OrangeData
102
118
  def set_agent_info(**options)
103
119
  # agent info may have some validations/transformations, so
104
120
  agent_info = AgentInfo.new.assign_attributes(options)
105
- assign_attributes(agent_info.attributes.reject{|_k, v| v.nil? })
121
+ assign_attributes(agent_info.attributes.compact)
106
122
  end
107
123
 
108
124
  class Position < PayloadContent
109
125
  def initialize(payload={})
110
- @payload = payload
126
+ super(payload || {})
111
127
  @supplier_info = SupplierInfo.new(@payload['supplierInfo']) if @payload['supplierInfo']
112
128
  @agent_info = AgentInfo.new(@payload['agentInfo']) if @payload['agentInfo']
113
129
  end
@@ -144,9 +160,8 @@ module OrangeData
144
160
 
145
161
  class CheckClose < PayloadContent
146
162
  def initialize(payload={})
147
- payload ||= {}
148
- @payload = payload
149
- @payments = (payload['payments'] || []).map{|p| Payment.new(p) }
163
+ super(payload || {})
164
+ @payments = (@payload['payments'] || []).map{|p| Payment.new(p) }
150
165
  end
151
166
 
152
167
  def to_hash
@@ -176,7 +191,7 @@ module OrangeData
176
191
 
177
192
  class ReceiptResult < PayloadContent
178
193
  def initialize(payload)
179
- @payload = payload
194
+ super(payload)
180
195
  @content = ReceiptContent.new(@payload["content"])
181
196
  end
182
197
 
@@ -188,6 +203,7 @@ module OrangeData
188
203
  end
189
204
 
190
205
  attr_reader :content
206
+
191
207
  GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CheckStatusViewModel[CheckContent]"])
192
208
 
193
209
  def qr_code_content
@@ -232,7 +248,7 @@ module OrangeData
232
248
 
233
249
  class CorrectionResult < PayloadContent
234
250
  def initialize(payload)
235
- @payload = payload || {}
251
+ super(payload || {})
236
252
  @content = CorrectionContent.new(@payload["content"] || {})
237
253
  end
238
254
 
@@ -244,6 +260,7 @@ module OrangeData
244
260
  end
245
261
 
246
262
  attr_reader :content
263
+
247
264
  GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CheckStatusViewModel[CheckContent]"])
248
265
  end
249
266
 
@@ -2,7 +2,12 @@
2
2
  info:
3
3
  version: '2.0'
4
4
  title: Nebula API v2
5
- description: OpenApi-like definition for receipt schema with extensions and additions
5
+ description: |-
6
+ OpenApi-like definition for receipt schema with extensions and additions
7
+ Подробнее про поля имеет смысл смотреть в Приказ ФНС России от 21.03.2017 N ММВ-7-20/229@ (ред. от 22.10.2018)
8
+ "Об утверждении дополнительных реквизитов фискальных документов и форматов фискальных документов,
9
+ обязательных к использованию" (Зарегистрировано в Минюсте России 13.04.2017 N 46361)
10
+ (с изм. и доп., вступ. в силу с 01.01.2019)
6
11
 
7
12
  anyOf:
8
13
  - "$ref": "#definitions/CheckDocumentCreate[CheckContent]"
@@ -205,6 +210,18 @@ definitions:
205
210
  title: ИНН покупателя (клиента)
206
211
  x-tag-id: 1228
207
212
  type: string
213
+ cashier:
214
+ title: Кассир
215
+ x-tag-id: 1021
216
+ type: string
217
+ cashierINN:
218
+ title: ИНН кассира
219
+ x-tag-id: 1203
220
+ type: string
221
+ senderEmail:
222
+ title: Адрес электронной почты отправителя чека
223
+ x-tag-id: 1117
224
+ type: string
208
225
 
209
226
 
210
227
  CheckPosition:
@@ -570,22 +587,27 @@ definitions:
570
587
  cash:
571
588
  val: 1
572
589
  title: сумма по чеку наличными
590
+ print: Наличными
573
591
  x-tag-id: 1031
574
592
  card:
575
593
  val: 2
576
594
  title: сумма по чеку электронными
595
+ print: Безналичными
577
596
  x-tag-id: 1081
578
597
  prepaid:
579
598
  val: 14
580
599
  title: сумма по чеку предоплатой(зачетом аванса и (или) предыдущих платежей)
600
+ print: Предварительная оплата(аванс)
581
601
  x-tag-id: 1215
582
602
  credit:
583
603
  val: 15
584
604
  title: сумма по чеку постоплатой(в кредит)
605
+ print: Последующая оплата(кредит)
585
606
  x-tag-id: 1216
586
607
  counterclaim:
587
608
  val: 16
588
609
  title: сумма по чеку(БСО) встречным предоставлением
610
+ print: Иная форма оплаты
589
611
  x-tag-id: 1217
590
612
  amount:
591
613
  format: double
@@ -780,7 +802,14 @@ definitions:
780
802
  patent:
781
803
  val: 5
782
804
  title: Патентная система налогообложения, Патент
783
-
805
+ cashier:
806
+ title: Кассир
807
+ x-tag-id: 1021
808
+ type: string
809
+ cashierINN:
810
+ title: ИНН кассира
811
+ x-tag-id: 1203
812
+ type: string
784
813
 
785
814
  CheckStatusViewModel[CheckContent]:
786
815
  type: object
@@ -24,11 +24,12 @@ module OrangeData
24
24
  def initialize(app, signature_key)
25
25
  @app = app
26
26
  @signature_key = signature_key
27
+ super(app)
27
28
  end
28
29
 
29
30
  def call(env)
30
31
  if env.body
31
- signature = @signature_key.sign(OpenSSL::Digest::SHA256.new, env.body)
32
+ signature = @signature_key.sign(OpenSSL::Digest.new('SHA256'), env.body)
32
33
  env.request_headers['X-Signature'] = Base64.strict_encode64(signature)
33
34
  end
34
35
  @app.call(env)
@@ -105,8 +106,8 @@ module OrangeData
105
106
 
106
107
  @transport.send(
107
108
  get_method,
108
- @data.respond_to?(:inn) && @data.inn || @data[:inn] || @data["inn"],
109
- @data.respond_to?(:id) && @data.id || @data[:id] || @data["id"]
109
+ (@data.respond_to?(:inn) && @data.inn) || @data[:inn] || @data["inn"],
110
+ (@data.respond_to?(:id) && @data.id) || @data[:id] || @data["id"]
110
111
  )
111
112
  end
112
113
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OrangeData
4
4
 
5
- VERSION = "0.0.8"
5
+ VERSION = "0.0.10"
6
6
 
7
7
  end
data/orangedata.gemspec CHANGED
@@ -28,9 +28,9 @@ Gem::Specification.new do |spec|
28
28
  spec.add_dependency "faraday", ">=0.15"
29
29
  spec.add_dependency "faraday_middleware"
30
30
 
31
- spec.add_development_dependency "bundler", "~> 1.16"
32
- spec.add_development_dependency "json-schema", "~> 2.8"
33
- spec.add_development_dependency "rake", "~> 10.0"
31
+ spec.add_development_dependency "bundler"
32
+ spec.add_development_dependency "json-schema", ">= 2.8"
33
+ spec.add_development_dependency "rake", ">= 10.0"
34
34
  spec.add_development_dependency "rspec"
35
35
  spec.add_development_dependency "rubocop"
36
36
  spec.add_development_dependency "rubyzip"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orangedata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vasily Fedoseyev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-20 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,42 +42,42 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.16'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.16'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: json-schema
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.8'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '2.8'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '10.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
83
  - !ruby/object:Gem::Dependency
@@ -184,7 +184,7 @@ homepage: https://github.com/Vasfed/orangedata
184
184
  licenses:
185
185
  - MIT
186
186
  metadata: {}
187
- post_install_message:
187
+ post_install_message:
188
188
  rdoc_options: []
189
189
  require_paths:
190
190
  - lib
@@ -199,8 +199,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
199
  - !ruby/object:Gem::Version
200
200
  version: '0'
201
201
  requirements: []
202
- rubygems_version: 3.0.2
203
- signing_key:
202
+ rubygems_version: 3.1.6
203
+ signing_key:
204
204
  specification_version: 4
205
205
  summary: Ruby client for orangedata.ru service
206
206
  test_files: []