atol 0.7 → 0.7.1
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_todo.yml +2 -11
- data/Gemfile +0 -2
- data/Gemfile.lock +18 -13
- data/atol-rb.gemspec +11 -10
- data/lib/atol/errors.rb +1 -1
- data/lib/atol/request/get_document_state.rb +1 -0
- data/lib/atol/request/post_document/item/body.rb +2 -2
- data/lib/atol/request/post_document/sell/body.rb +12 -9
- data/lib/atol/transaction/get_document_state.rb +1 -0
- data/lib/atol/transaction/post_document.rb +1 -0
- data/lib/atol/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 75da4c224db9bbd13b7688b43902da591c3ebad3aea5a9fdd0e74b9331de1222
|
|
4
|
+
data.tar.gz: 22d9c1141823538a4fe595dbbefe0d82f33dd3e91635379abd48697729a7160c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ea585b8d278bb75b6f4ae5f2ff358846337ea9ae4994dd4c3359d1edaf83997d29fe702a925d94bf11465543c332a40a346336e62432e083d12ff954859e866f
|
|
7
|
+
data.tar.gz: ed192a02125f15b2d9e4abe6003d89bad567e8a9e997ccd5b42627c527e34bbeff506cc19b84ce9a16c7b0a5399940ff1626b0be6e535d640d7e2de4ade7423e
|
data/.rubocop_todo.yml
CHANGED
|
@@ -37,7 +37,7 @@ Layout/ExtraSpacing:
|
|
|
37
37
|
# Cop supports --auto-correct.
|
|
38
38
|
# Configuration parameters: IndentationWidth.
|
|
39
39
|
# SupportedStyles: special_inside_parentheses, consistent, align_braces
|
|
40
|
-
Layout/
|
|
40
|
+
Layout/FirstHashElementIndentation:
|
|
41
41
|
EnforcedStyle: consistent
|
|
42
42
|
|
|
43
43
|
# Offense count: 1
|
|
@@ -66,7 +66,7 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
|
66
66
|
# Cop supports --auto-correct.
|
|
67
67
|
# Configuration parameters: EnforcedStyle.
|
|
68
68
|
# SupportedStyles: final_newline, final_blank_line
|
|
69
|
-
Layout/
|
|
69
|
+
Layout/TrailingEmptyLines:
|
|
70
70
|
Exclude:
|
|
71
71
|
- 'lib/atol.rb'
|
|
72
72
|
- 'lib/atol/request.rb'
|
|
@@ -140,15 +140,6 @@ Style/BlockDelimiters:
|
|
|
140
140
|
Exclude:
|
|
141
141
|
- 'spec/atol/request/post_document/sell/body_spec.rb'
|
|
142
142
|
|
|
143
|
-
# Offense count: 13
|
|
144
|
-
# Cop supports --auto-correct.
|
|
145
|
-
# Configuration parameters: EnforcedStyle.
|
|
146
|
-
# SupportedStyles: braces, no_braces, context_dependent
|
|
147
|
-
Style/BracesAroundHashParameters:
|
|
148
|
-
Exclude:
|
|
149
|
-
- 'spec/atol/transaction/get_token_spec.rb'
|
|
150
|
-
- 'spec/atol/transaction/post_document_spec.rb'
|
|
151
|
-
|
|
152
143
|
# Offense count: 1
|
|
153
144
|
# Cop supports --auto-correct.
|
|
154
145
|
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
atol (0.7)
|
|
4
|
+
atol (0.7.1)
|
|
5
5
|
anyway_config (~> 1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
@@ -10,7 +10,7 @@ GEM
|
|
|
10
10
|
addressable (2.5.2)
|
|
11
11
|
public_suffix (>= 2.0.2, < 4.0)
|
|
12
12
|
anyway_config (1.1.3)
|
|
13
|
-
ast (2.
|
|
13
|
+
ast (2.4.1)
|
|
14
14
|
coveralls (0.8.21)
|
|
15
15
|
json (>= 1.8, < 3)
|
|
16
16
|
simplecov (~> 0.14.1)
|
|
@@ -23,13 +23,14 @@ GEM
|
|
|
23
23
|
docile (1.1.5)
|
|
24
24
|
hashdiff (0.3.7)
|
|
25
25
|
json (2.1.0)
|
|
26
|
-
parallel (1.
|
|
27
|
-
parser (2.
|
|
28
|
-
ast (~> 2.
|
|
29
|
-
powerpack (0.1.1)
|
|
26
|
+
parallel (1.19.2)
|
|
27
|
+
parser (2.7.1.4)
|
|
28
|
+
ast (~> 2.4.1)
|
|
30
29
|
public_suffix (3.0.1)
|
|
31
30
|
rainbow (3.0.0)
|
|
32
31
|
rake (13.0.1)
|
|
32
|
+
regexp_parser (1.7.1)
|
|
33
|
+
rexml (3.2.4)
|
|
33
34
|
rspec (3.7.0)
|
|
34
35
|
rspec-core (~> 3.7.0)
|
|
35
36
|
rspec-expectations (~> 3.7.0)
|
|
@@ -43,14 +44,18 @@ GEM
|
|
|
43
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
44
45
|
rspec-support (~> 3.7.0)
|
|
45
46
|
rspec-support (3.7.0)
|
|
46
|
-
rubocop (0.
|
|
47
|
+
rubocop (0.90.0)
|
|
47
48
|
parallel (~> 1.10)
|
|
48
|
-
parser (>= 2.
|
|
49
|
-
powerpack (~> 0.1)
|
|
49
|
+
parser (>= 2.7.1.1)
|
|
50
50
|
rainbow (>= 2.2.2, < 4.0)
|
|
51
|
+
regexp_parser (>= 1.7)
|
|
52
|
+
rexml
|
|
53
|
+
rubocop-ast (>= 0.3.0, < 1.0)
|
|
51
54
|
ruby-progressbar (~> 1.7)
|
|
52
|
-
unicode-display_width (
|
|
53
|
-
|
|
55
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
56
|
+
rubocop-ast (0.4.0)
|
|
57
|
+
parser (>= 2.7.1.4)
|
|
58
|
+
ruby-progressbar (1.10.1)
|
|
54
59
|
safe_yaml (1.0.4)
|
|
55
60
|
simplecov (0.14.1)
|
|
56
61
|
docile (~> 1.1.0)
|
|
@@ -61,7 +66,7 @@ GEM
|
|
|
61
66
|
tins (~> 1.0)
|
|
62
67
|
thor (0.19.4)
|
|
63
68
|
tins (1.16.3)
|
|
64
|
-
unicode-display_width (1.
|
|
69
|
+
unicode-display_width (1.7.0)
|
|
65
70
|
webmock (3.2.1)
|
|
66
71
|
addressable (>= 2.3.6)
|
|
67
72
|
crack (>= 0.3.2)
|
|
@@ -76,7 +81,7 @@ DEPENDENCIES
|
|
|
76
81
|
coveralls
|
|
77
82
|
rake (~> 13.0)
|
|
78
83
|
rspec (~> 3.0)
|
|
79
|
-
rubocop
|
|
84
|
+
rubocop (~> 0.90)
|
|
80
85
|
webmock (~> 3.0)
|
|
81
86
|
|
|
82
87
|
BUNDLED WITH
|
data/atol-rb.gemspec
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
lib = File.expand_path('
|
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
|
4
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
require 'atol/version'
|
|
6
6
|
|
|
7
7
|
Gem::Specification.new do |spec|
|
|
8
|
-
spec.name
|
|
9
|
-
spec.version
|
|
10
|
-
spec.authors
|
|
11
|
-
spec.email
|
|
8
|
+
spec.name = 'atol'
|
|
9
|
+
spec.version = Atol::Version::LIB
|
|
10
|
+
spec.authors = ['GeorgeGorbanev']
|
|
11
|
+
spec.email = ['GeorgeGorbanev@gmail.com']
|
|
12
12
|
|
|
13
|
-
spec.summary
|
|
14
|
-
spec.homepage
|
|
15
|
-
spec.license
|
|
13
|
+
spec.summary = 'ATOL KaaS client for Ruby'
|
|
14
|
+
spec.homepage = 'https://github.com/sputnik8/atol-rb'
|
|
15
|
+
spec.license = 'MIT'
|
|
16
|
+
spec.required_ruby_version = '>= 2.5.0'
|
|
16
17
|
|
|
17
|
-
spec.files
|
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
19
|
f.match(%r{^(test|spec|features)/})
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -27,6 +28,6 @@ Gem::Specification.new do |spec|
|
|
|
27
28
|
spec.add_development_dependency 'bundler', '~> 1.15'
|
|
28
29
|
spec.add_development_dependency 'rake', '~> 13.0'
|
|
29
30
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
30
|
-
spec.add_development_dependency 'rubocop', '~> 0.
|
|
31
|
+
spec.add_development_dependency 'rubocop', '~> 0.90'
|
|
31
32
|
spec.add_development_dependency 'webmock', '~> 3.0'
|
|
32
33
|
end
|
data/lib/atol/errors.rb
CHANGED
|
@@ -24,7 +24,7 @@ module Atol
|
|
|
24
24
|
attr_accessor :config, :name, :price, :quantity, :payment_method, :payment_object
|
|
25
25
|
|
|
26
26
|
def initialize(config: nil, name:, price:, quantity: 1, payment_method:, payment_object:)
|
|
27
|
-
raise Atol::ZeroItemQuantityError if quantity.
|
|
27
|
+
raise Atol::ZeroItemQuantityError if quantity.to_f.zero?
|
|
28
28
|
raise BadPaymentMethodError unless PAYMENT_METHODS.include?(payment_method.to_s)
|
|
29
29
|
raise BadPaymentObjectError unless PAYMENT_OBJECTS.include?(payment_object.to_s)
|
|
30
30
|
|
|
@@ -40,7 +40,7 @@ module Atol
|
|
|
40
40
|
body.clone
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
-
def to_json
|
|
43
|
+
def to_json(*_args)
|
|
44
44
|
body.to_json
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -22,24 +22,23 @@ module Atol
|
|
|
22
22
|
body.clone
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
def to_json
|
|
25
|
+
def to_json(*_args)
|
|
26
26
|
body.to_json
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
private
|
|
30
30
|
|
|
31
31
|
def body
|
|
32
|
-
|
|
32
|
+
body_template.tap do |result|
|
|
33
|
+
receipt = result[:receipt]
|
|
34
|
+
client = receipt[:client]
|
|
33
35
|
result[:external_id] = @external_id
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
client[:email] = @email unless @email.empty?
|
|
37
|
+
client[:phone] = @phone unless @phone.empty?
|
|
36
38
|
result[:service][:callback_url] = @config.callback_url if @config.callback_url
|
|
37
39
|
|
|
38
|
-
total =
|
|
39
|
-
|
|
40
|
-
result[:receipt][:total] = total
|
|
41
|
-
result[:receipt][:payments][0][:sum] = total
|
|
42
|
-
result[:receipt][:items] = @items
|
|
40
|
+
receipt[:total] = receipt[:payments][0][:sum] = total
|
|
41
|
+
receipt[:items] = @items
|
|
43
42
|
end
|
|
44
43
|
end
|
|
45
44
|
|
|
@@ -65,6 +64,10 @@ module Atol
|
|
|
65
64
|
timestamp: Time.now.strftime(Atol::TIMESTAMP_FORMAT)
|
|
66
65
|
}
|
|
67
66
|
end
|
|
67
|
+
|
|
68
|
+
def total
|
|
69
|
+
@total ||= @items.inject(0) { |sum, item| sum += item[:sum] }
|
|
70
|
+
end
|
|
68
71
|
end
|
|
69
72
|
end
|
|
70
73
|
end
|
|
@@ -9,6 +9,7 @@ module Atol
|
|
|
9
9
|
def initialize(operation:, token:, body:, config: nil, req_logger: nil, res_logger: nil)
|
|
10
10
|
@config = config || Atol.config
|
|
11
11
|
raise(Atol::ConfigExpectedError) unless @config.is_a?(Atol::Config)
|
|
12
|
+
|
|
12
13
|
@params = {
|
|
13
14
|
operation: operation,
|
|
14
15
|
token: token,
|
data/lib/atol/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: atol
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 0.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- GeorgeGorbanev
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-09-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: anyway_config
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0.
|
|
75
|
+
version: '0.90'
|
|
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
|
-
version: '0.
|
|
82
|
+
version: '0.90'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: webmock
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -138,15 +138,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
138
138
|
requirements:
|
|
139
139
|
- - ">="
|
|
140
140
|
- !ruby/object:Gem::Version
|
|
141
|
-
version:
|
|
141
|
+
version: 2.5.0
|
|
142
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
143
143
|
requirements:
|
|
144
144
|
- - ">="
|
|
145
145
|
- !ruby/object:Gem::Version
|
|
146
146
|
version: '0'
|
|
147
147
|
requirements: []
|
|
148
|
-
|
|
149
|
-
rubygems_version: 2.7.3
|
|
148
|
+
rubygems_version: 3.0.3
|
|
150
149
|
signing_key:
|
|
151
150
|
specification_version: 4
|
|
152
151
|
summary: ATOL KaaS client for Ruby
|