orangedata 0.0.9 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -24
- data/CHANGELOG.md +10 -5
- data/Gemfile.lock +80 -52
- data/Rakefile +7 -7
- data/lib/orange_data/credentials.rb +9 -9
- data/lib/orange_data/generated_attributes.rb +2 -2
- data/lib/orange_data/receipt.rb +10 -9
- data/lib/orange_data/schema_definitions.yml +7 -2
- data/lib/orange_data/transport.rb +4 -3
- data/lib/orange_data/version.rb +1 -1
- data/orangedata.gemspec +3 -3
- metadata +14 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9fa958e5956706463a6a2298893886987840b413bcea4cb4f3dc685df565ae9
|
|
4
|
+
data.tar.gz: '087c9d1118e082e5c0f190d28d7fb585e1c72b5c2cc4e1961af5ec9034316225'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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/
|
|
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
|
-
|
|
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/
|
|
84
|
+
Layout/FirstHashElementIndentation:
|
|
89
85
|
EnforcedStyle: consistent
|
|
90
86
|
|
|
91
|
-
Layout/EmptyLines:
|
|
92
|
-
|
|
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
|
-
|
|
109
|
-
Style/
|
|
110
|
-
Enabled: false
|
|
100
|
+
Style/TrailingCommaInHashLiteral: { Enabled: false }
|
|
101
|
+
Style/TrailingCommaInArrayLiteral: { Enabled: false }
|
|
102
|
+
Style/KeywordParametersOrder: { Enabled: false }
|
|
111
103
|
|
|
112
|
-
Naming/AccessorMethodName:
|
|
113
|
-
|
|
104
|
+
Naming/AccessorMethodName: { Enabled: false }
|
|
105
|
+
Naming/VariableNumber: { Enabled: false }
|
data/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.0.10
|
|
4
|
+
- Changed cashless print title per law change
|
|
5
|
+
|
|
6
|
+
## 0.0.9
|
|
2
7
|
|
|
3
8
|
- Added: Payment method names in schema
|
|
4
9
|
- Added: credentials#certificate_subject
|
|
5
10
|
- Added: `Receipt#as_json` and `.from_hash`
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
## 0.0.8
|
|
8
13
|
|
|
9
|
-
- Fixed: return `nil` when document is not ready yet
|
|
14
|
+
- Fixed: return `nil` when document is not ready yet
|
|
10
15
|
|
|
11
|
-
|
|
16
|
+
## 0.0.7
|
|
12
17
|
|
|
13
18
|
- data schema update to 2.23.0 (15.06.2019)
|
|
14
19
|
- Added: load credentials from zip file via rubyzip (no dependency, only accept already opened object)
|
|
15
20
|
- Added: Credentials#from_hash now accepts `key_pass` argument
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## 0.0.6
|
|
18
23
|
|
|
19
24
|
- data schema changes:
|
|
20
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.
|
|
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.
|
|
12
|
-
public_suffix (>= 2.0.2, <
|
|
13
|
-
ast (2.4.
|
|
14
|
-
crack (0.4.
|
|
15
|
-
|
|
16
|
-
diff-lcs (1.
|
|
17
|
-
docile (1.
|
|
18
|
-
faraday (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
faraday (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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.
|
|
43
|
-
rspec-mocks (3.
|
|
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.
|
|
46
|
-
rspec-support (3.
|
|
47
|
-
rubocop (
|
|
48
|
-
|
|
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.
|
|
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, <
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
simplecov-html (0.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
|
73
|
-
json-schema (
|
|
100
|
+
bundler
|
|
101
|
+
json-schema (>= 2.8)
|
|
74
102
|
orangedata!
|
|
75
|
-
rake (
|
|
103
|
+
rake (>= 10.0)
|
|
76
104
|
rspec
|
|
77
105
|
rubocop
|
|
78
106
|
rubyzip
|
data/Rakefile
CHANGED
|
@@ -28,11 +28,11 @@ namespace :swagger do
|
|
|
28
28
|
new_definitions = swagger['definitions']
|
|
29
29
|
old_definitions = OrangeData::PAYLOAD_SCHEMA['definitions']
|
|
30
30
|
|
|
31
|
-
if new_definitions.keys
|
|
31
|
+
if new_definitions.keys == old_definitions.keys
|
|
32
|
+
puts "No top-level definitions changed"
|
|
33
|
+
else
|
|
32
34
|
puts "New schema definitions: #{new_definitions.keys - old_definitions.keys}"
|
|
33
35
|
puts "Removed schema definitions: #{old_definitions.keys - new_definitions.keys}"
|
|
34
|
-
else
|
|
35
|
-
puts "No top-level definitions changed"
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
new_definitions.each_pair do |key, new_schema|
|
|
@@ -40,13 +40,13 @@ namespace :swagger do
|
|
|
40
40
|
next unless old_schema
|
|
41
41
|
|
|
42
42
|
if old_schema['properties'].keys != new_schema['properties'].keys
|
|
43
|
-
if old_schema['properties'].keys.sort
|
|
44
|
-
puts "\t#{key} added: #{new_schema['properties'].keys - old_schema['properties'].keys}"
|
|
45
|
-
puts "\t#{key} removed: #{old_schema['properties'].keys - new_schema['properties'].keys}"
|
|
46
|
-
else
|
|
43
|
+
if old_schema['properties'].keys.sort == new_schema['properties'].keys.sort
|
|
47
44
|
puts "\t#{key} property order changed:"
|
|
48
45
|
puts "\t\told:#{old_schema['properties'].keys}"
|
|
49
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}"
|
|
50
50
|
end
|
|
51
51
|
# else
|
|
52
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
|
|
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.
|
|
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
|
|
@@ -205,9 +205,9 @@ module OrangeData
|
|
|
205
205
|
end
|
|
206
206
|
|
|
207
207
|
def certificate_subject
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
return unless (subj = certificate.subject.to_a.select{|ent| ent.first == 'O' }.first)
|
|
209
|
+
|
|
210
|
+
subj[1].force_encoding('UTF-8')
|
|
211
211
|
end
|
|
212
212
|
|
|
213
213
|
DEFAULT_KEY_LENGTH = 2048
|
|
@@ -225,14 +225,14 @@ module OrangeData
|
|
|
225
225
|
|
|
226
226
|
def self.read_certs_from_pack(path, signature_key_name:nil, cert_key_pass:nil, title:nil, signature_key:nil)
|
|
227
227
|
path = File.expand_path(path)
|
|
228
|
-
client_cert = Dir.glob(path
|
|
228
|
+
client_cert = Dir.glob("#{path}/*.{crt}").select{|f| File.file?(f.sub(/.crt\z/, '.key')) }
|
|
229
229
|
raise 'Expect to find exactly one <num>.crt with corresponding <num>.key file' unless client_cert.size == 1
|
|
230
230
|
|
|
231
231
|
client_cert = client_cert.first
|
|
232
232
|
|
|
233
233
|
unless signature_key
|
|
234
234
|
# private_key_test.xml || rsa_\d+_private_key.xml
|
|
235
|
-
xmls = Dir.glob(path
|
|
235
|
+
xmls = Dir.glob("#{path}/*.{xml}").grep(/private/)
|
|
236
236
|
signature_key = if xmls.size == 1
|
|
237
237
|
File.read(xmls.first)
|
|
238
238
|
else
|
|
@@ -260,7 +260,7 @@ module OrangeData
|
|
|
260
260
|
|
|
261
261
|
unless signature_key
|
|
262
262
|
# private_key_test.xml || rsa_\d+_private_key.xml
|
|
263
|
-
xmls = rubyzip_object.glob('/*.{xml}').
|
|
263
|
+
xmls = rubyzip_object.glob('/*.{xml}').grep(/private/)
|
|
264
264
|
signature_key = if xmls.size == 1
|
|
265
265
|
xmls.first.get_input_stream.read
|
|
266
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
|
|
data/lib/orange_data/receipt.rb
CHANGED
|
@@ -30,7 +30,7 @@ module OrangeData
|
|
|
30
30
|
group: hash[:group] || hash['group'],
|
|
31
31
|
key_name: hash[:key] || hash['key'],
|
|
32
32
|
content: hash[:content] || hash['content'],
|
|
33
|
-
callback_url: hash[:callbackUrl] || hash['callbackUrl']
|
|
33
|
+
callback_url: hash[:callbackUrl] || hash['callbackUrl']
|
|
34
34
|
)
|
|
35
35
|
end
|
|
36
36
|
|
|
@@ -68,7 +68,7 @@ module OrangeData
|
|
|
68
68
|
|
|
69
69
|
class ReceiptContent < PayloadContent
|
|
70
70
|
def initialize(payload={})
|
|
71
|
-
|
|
71
|
+
super(payload || {})
|
|
72
72
|
# TODO: import...
|
|
73
73
|
# TODO: taxationSystem default in checkclose
|
|
74
74
|
@check_close = CheckClose.new(@payload['checkClose'])
|
|
@@ -118,12 +118,12 @@ module OrangeData
|
|
|
118
118
|
def set_agent_info(**options)
|
|
119
119
|
# agent info may have some validations/transformations, so
|
|
120
120
|
agent_info = AgentInfo.new.assign_attributes(options)
|
|
121
|
-
assign_attributes(agent_info.attributes.
|
|
121
|
+
assign_attributes(agent_info.attributes.compact)
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
class Position < PayloadContent
|
|
125
125
|
def initialize(payload={})
|
|
126
|
-
|
|
126
|
+
super(payload || {})
|
|
127
127
|
@supplier_info = SupplierInfo.new(@payload['supplierInfo']) if @payload['supplierInfo']
|
|
128
128
|
@agent_info = AgentInfo.new(@payload['agentInfo']) if @payload['agentInfo']
|
|
129
129
|
end
|
|
@@ -160,9 +160,8 @@ module OrangeData
|
|
|
160
160
|
|
|
161
161
|
class CheckClose < PayloadContent
|
|
162
162
|
def initialize(payload={})
|
|
163
|
-
payload
|
|
164
|
-
@
|
|
165
|
-
@payments = (payload['payments'] || []).map{|p| Payment.new(p) }
|
|
163
|
+
super(payload || {})
|
|
164
|
+
@payments = (@payload['payments'] || []).map{|p| Payment.new(p) }
|
|
166
165
|
end
|
|
167
166
|
|
|
168
167
|
def to_hash
|
|
@@ -192,7 +191,7 @@ module OrangeData
|
|
|
192
191
|
|
|
193
192
|
class ReceiptResult < PayloadContent
|
|
194
193
|
def initialize(payload)
|
|
195
|
-
|
|
194
|
+
super(payload)
|
|
196
195
|
@content = ReceiptContent.new(@payload["content"])
|
|
197
196
|
end
|
|
198
197
|
|
|
@@ -204,6 +203,7 @@ module OrangeData
|
|
|
204
203
|
end
|
|
205
204
|
|
|
206
205
|
attr_reader :content
|
|
206
|
+
|
|
207
207
|
GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CheckStatusViewModel[CheckContent]"])
|
|
208
208
|
|
|
209
209
|
def qr_code_content
|
|
@@ -248,7 +248,7 @@ module OrangeData
|
|
|
248
248
|
|
|
249
249
|
class CorrectionResult < PayloadContent
|
|
250
250
|
def initialize(payload)
|
|
251
|
-
|
|
251
|
+
super(payload || {})
|
|
252
252
|
@content = CorrectionContent.new(@payload["content"] || {})
|
|
253
253
|
end
|
|
254
254
|
|
|
@@ -260,6 +260,7 @@ module OrangeData
|
|
|
260
260
|
end
|
|
261
261
|
|
|
262
262
|
attr_reader :content
|
|
263
|
+
|
|
263
264
|
GeneratedAttributes.from_schema(self, PAYLOAD_SCHEMA["definitions"]["CheckStatusViewModel[CheckContent]"])
|
|
264
265
|
end
|
|
265
266
|
|
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
info:
|
|
3
3
|
version: '2.0'
|
|
4
4
|
title: Nebula API v2
|
|
5
|
-
description:
|
|
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]"
|
|
@@ -587,7 +592,7 @@ definitions:
|
|
|
587
592
|
card:
|
|
588
593
|
val: 2
|
|
589
594
|
title: сумма по чеку электронными
|
|
590
|
-
print:
|
|
595
|
+
print: Безналичными
|
|
591
596
|
x-tag-id: 1081
|
|
592
597
|
prepaid:
|
|
593
598
|
val: 14
|
|
@@ -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
|
|
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
|
data/lib/orange_data/version.rb
CHANGED
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"
|
|
32
|
-
spec.add_development_dependency "json-schema", "
|
|
33
|
-
spec.add_development_dependency "rake", "
|
|
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.
|
|
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:
|
|
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: '
|
|
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: '
|
|
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.
|
|
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: []
|