da_funk 3.21.1 → 3.24.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/Gemfile.lock +8 -8
- data/RELEASE_NOTES.md +27 -0
- data/Rakefile +2 -1
- data/lib/da_funk/helper.rb +3 -3
- data/lib/da_funk/helper/status_bar.rb +34 -2
- data/lib/da_funk/params_dat.rb +2 -0
- data/lib/da_funk/version.rb +1 -1
- data/lib/device/network.rb +0 -1
- data/lib/device/setting.rb +3 -3
- data/lib/device/signature.rb +30 -0
- data/lib/device/virtual_keyboard.rb +8 -0
- data/test/unit/device/signature_test.rb +24 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d44dfedaab6c25ce6e052478bf489480dd2617e2c9f04537c0a57ac6742b526c
|
4
|
+
data.tar.gz: 04d1789a605fb768e9689064d58b1dd9785379e8bbae3c4d75760a2605b57323
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70221b238e7627133daf23a8e64c1dbf44800c6a7181c45a5bed64bb0f20bb93f3d3fcd3fa8a01d6e5ea9be289d5e629921f52ae9adf6af63629c68afc1db7a6
|
7
|
+
data.tar.gz: bedf894f506861b471d50b8798fed306d55b7fb84f7ab40c802a51e4545182930a0c45315fff21820673930dd1c5d0c2b253dc658b2de7cad3a93ed42cf24761
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
da_funk (3.
|
4
|
+
da_funk (3.24.1)
|
5
5
|
archive-zip (~> 0.5)
|
6
6
|
bundler
|
7
7
|
cloudwalk_handshake
|
@@ -18,30 +18,30 @@ GEM
|
|
18
18
|
cloudwalk (1.15.0)
|
19
19
|
bundler
|
20
20
|
rake
|
21
|
-
cloudwalk_handshake (1.
|
21
|
+
cloudwalk_handshake (1.14.0)
|
22
22
|
funky-simplehttp (~> 0.6)
|
23
|
-
funky-emv (1.
|
23
|
+
funky-emv (1.4.1)
|
24
24
|
funky-tlv (~> 0.2)
|
25
25
|
funky-mock (0.1.0)
|
26
26
|
funky-simplehttp (0.6.0)
|
27
27
|
funky-tlv (0.2.3)
|
28
28
|
io-like (0.3.1)
|
29
|
-
parallel (1.19.
|
30
|
-
parser (2.7.1.
|
31
|
-
ast (~> 2.4.
|
29
|
+
parallel (1.19.2)
|
30
|
+
parser (2.7.1.4)
|
31
|
+
ast (~> 2.4.1)
|
32
32
|
posxml_parser (2.26.0)
|
33
33
|
funky-emv (~> 1)
|
34
34
|
rainbow (3.0.0)
|
35
35
|
rake (13.0.1)
|
36
36
|
regexp_parser (1.7.1)
|
37
37
|
rexml (3.2.4)
|
38
|
-
rubocop (0.
|
38
|
+
rubocop (0.86.0)
|
39
39
|
parallel (~> 1.10)
|
40
40
|
parser (>= 2.7.0.1)
|
41
41
|
rainbow (>= 2.2.2, < 4.0)
|
42
42
|
regexp_parser (>= 1.7)
|
43
43
|
rexml
|
44
|
-
rubocop-ast (>= 0.0.3)
|
44
|
+
rubocop-ast (>= 0.0.3, < 1.0)
|
45
45
|
ruby-progressbar (~> 1.7)
|
46
46
|
unicode-display_width (>= 1.4.0, < 2.0)
|
47
47
|
rubocop-ast (0.0.3)
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 3.24.1 - 2020-07-27
|
4
|
+
|
5
|
+
- Infinitepay authorizer setting 1 as default.
|
6
|
+
|
7
|
+
### 3.24.0 - 2020-07-25
|
8
|
+
|
9
|
+
- Added Device::Signature class;
|
10
|
+
- Added support of converting signature after updating params.dat;
|
11
|
+
- Added support to network state on status bar;
|
12
|
+
- Added support to physical number keys on virtual keyboard.
|
13
|
+
|
14
|
+
### 3.23.0 - 2020-06-22
|
15
|
+
|
16
|
+
- Remove ThreadPubSub publication before attach;
|
17
|
+
- Update funky-emv (1.4.1).
|
18
|
+
|
19
|
+
### 3.22.0 - 2020-06-18
|
20
|
+
|
21
|
+
- Update libs:
|
22
|
+
- cloudwalk_handshake (1.14.0)
|
23
|
+
- funky-emv (1.4.0)
|
24
|
+
|
25
|
+
### 3.21.2 - 2020-06-16
|
26
|
+
|
27
|
+
- Fixed timeout return on DaFunK::Helper#menu, it should return Device::IO::KEY_TIMEOUT not options[:timeout];
|
28
|
+
- Set cloudwalk endpoint as default.
|
29
|
+
|
3
30
|
### 3.21.1 - 2020-06-16
|
4
31
|
|
5
32
|
- Fix error when timeout on DaFunk::menu_image_touchscreen_or_keyboard.
|
data/Rakefile
CHANGED
data/lib/da_funk/helper.rb
CHANGED
@@ -276,7 +276,7 @@ module DaFunk
|
|
276
276
|
# }
|
277
277
|
#
|
278
278
|
# menu("Option menu", selection, options)
|
279
|
-
#
|
279
|
+
# @return nil if user canceled or Device::IO::KEY_TIMEOUT if timeout or option selected
|
280
280
|
def menu(title, selection, options = {})
|
281
281
|
return nil if selection.empty?
|
282
282
|
options[:number] = true if options[:number].nil?
|
@@ -299,7 +299,7 @@ module DaFunk
|
|
299
299
|
if key == Device::IO::ENTER
|
300
300
|
options[:default]
|
301
301
|
elsif key == Device::IO::KEY_TIMEOUT
|
302
|
-
|
302
|
+
Device::IO::KEY_TIMEOUT
|
303
303
|
else
|
304
304
|
selected
|
305
305
|
end
|
@@ -307,7 +307,7 @@ module DaFunk
|
|
307
307
|
|
308
308
|
# TODO Scalone: Refactor.
|
309
309
|
def pagination(title, options, collection, &block)
|
310
|
-
timeout = Device::IO.timeout
|
310
|
+
timeout = options[:timeout].nil? ? options[:timeout] : Device::IO.timeout
|
311
311
|
touchscreen_options = {}
|
312
312
|
start_line, options[:limit], options[:header] = pagination_limit(title, options)
|
313
313
|
|
@@ -7,6 +7,20 @@ module DaFunk
|
|
7
7
|
SLOT_UPDATE = 2
|
8
8
|
SLOT_BATTERY_PERCENTUAL = 6
|
9
9
|
SLOT_BATTERY_LEVEL = 7
|
10
|
+
SLOT_MESSAGE_CONNECTION = {
|
11
|
+
true => {
|
12
|
+
:slot1 => 2,
|
13
|
+
:slot2 => 3,
|
14
|
+
:message1 => './shared/conectado_01.png',
|
15
|
+
:message2 => './shared/conectado_02.png'
|
16
|
+
},
|
17
|
+
false => {
|
18
|
+
:slot1 => 2,
|
19
|
+
:slot2 => 3,
|
20
|
+
:message1 => './shared/buscando_01.png',
|
21
|
+
:message2 => './shared/buscando_02.png'
|
22
|
+
}
|
23
|
+
}
|
10
24
|
|
11
25
|
BATTERY_IMAGES = {
|
12
26
|
0..4 => "./shared/battery0.png",
|
@@ -61,7 +75,7 @@ module DaFunk
|
|
61
75
|
}
|
62
76
|
|
63
77
|
class << self
|
64
|
-
attr_accessor :signal, :battery, :power, :managment
|
78
|
+
attr_accessor :signal, :battery, :power, :managment, :connected
|
65
79
|
end
|
66
80
|
|
67
81
|
def self.check
|
@@ -75,8 +89,26 @@ module DaFunk
|
|
75
89
|
def self.change_update
|
76
90
|
if File.exists?('./shared/system_update')
|
77
91
|
PAX::Display.print_status_bar(SLOT_UPDATE, "./shared/system_update_download.png")
|
92
|
+
PAX::Display.print_status_bar(3, nil)
|
78
93
|
else
|
79
|
-
|
94
|
+
change_message
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.change_message
|
99
|
+
connected = Device::Network.connected?
|
100
|
+
|
101
|
+
if connected != self.connected
|
102
|
+
self.connected = connected
|
103
|
+
|
104
|
+
slot_message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:slot1]
|
105
|
+
slot_message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:slot2]
|
106
|
+
|
107
|
+
message_1 = SLOT_MESSAGE_CONNECTION[self.connected][:message1]
|
108
|
+
message_2 = SLOT_MESSAGE_CONNECTION[self.connected][:message2]
|
109
|
+
|
110
|
+
Device::Display.print_status_bar(slot_message_1, message_1)
|
111
|
+
Device::Display.print_status_bar(slot_message_2, message_2)
|
80
112
|
end
|
81
113
|
end
|
82
114
|
|
data/lib/da_funk/params_dat.rb
CHANGED
data/lib/da_funk/version.rb
CHANGED
data/lib/device/network.rb
CHANGED
@@ -191,7 +191,6 @@ class Device
|
|
191
191
|
|
192
192
|
def self.attach(options = nil)
|
193
193
|
Device::Network.connected?
|
194
|
-
Context::ThreadPubSub.publish('communication_update')
|
195
194
|
if self.code != SUCCESS
|
196
195
|
ThreadScheduler.pausing_communication do
|
197
196
|
self.code = Device::Network.init(*self.config)
|
data/lib/device/setting.rb
CHANGED
@@ -60,10 +60,10 @@ class Device
|
|
60
60
|
"metadata_timestamp" => "",
|
61
61
|
"payment_channel_attempts" => "0",
|
62
62
|
"payment_channel_date" => "",
|
63
|
-
"infinitepay_authorizer" => "
|
63
|
+
"infinitepay_authorizer" => "1",
|
64
64
|
"infinitepay_api" => "0",
|
65
|
-
"infinitepay_cw_endpoint" => "
|
66
|
-
"infinitepay_google_endpoint" => "
|
65
|
+
"infinitepay_cw_endpoint" => "1",
|
66
|
+
"infinitepay_google_endpoint" => "0",
|
67
67
|
"transaction_http_enabled" => "1",
|
68
68
|
"transaction_http_host" => HTTP_HOST_PRODUCTION,
|
69
69
|
"transaction_http_port" => HTTP_PORT,
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Device
|
4
|
+
class Signature
|
5
|
+
FILE = './shared/device.sig'
|
6
|
+
|
7
|
+
CONVERTED = 1
|
8
|
+
FILE_NOT_FOUND = 2
|
9
|
+
IS_THE_SAME = 3
|
10
|
+
|
11
|
+
def self.convert
|
12
|
+
load
|
13
|
+
return FILE_NOT_FOUND unless @file
|
14
|
+
|
15
|
+
if must_convert?
|
16
|
+
@file.update_attributes({ 'signer' => DaFunk::ParamsDat.file['signer'] })
|
17
|
+
return CONVERTED
|
18
|
+
end
|
19
|
+
IS_THE_SAME
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.must_convert?
|
23
|
+
DaFunk::ParamsDat.file['signer'] && DaFunk::ParamsDat.file['signer'] != @file['signer']
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.load
|
27
|
+
@file = FileDb.new FILE
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -114,6 +114,7 @@ class Device
|
|
114
114
|
}
|
115
115
|
|
116
116
|
def self.type_text(params = {})
|
117
|
+
phisical_keys = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', "\017"]
|
117
118
|
change_keyboard
|
118
119
|
Device::Display.print_line("#{self.text}", params[:line], params[:column])
|
119
120
|
time = Time.now + (params[:timeout] || Device::IO.timeout) / 1000
|
@@ -129,6 +130,13 @@ class Device
|
|
129
130
|
break(Device::IO::KEY_TIMEOUT) if Time.now > time
|
130
131
|
|
131
132
|
key = getc(100)
|
133
|
+
if phisical_keys.include?(key)
|
134
|
+
if key == Device::IO::BACK
|
135
|
+
show_text({char: :erase}, params)
|
136
|
+
else
|
137
|
+
show_text({char: key}, params)
|
138
|
+
end
|
139
|
+
end
|
132
140
|
end
|
133
141
|
end
|
134
142
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'funky-mock'
|
2
|
+
|
3
|
+
class SignatureTest < DaFunk::Test.case
|
4
|
+
def test_signature_should_be_updated
|
5
|
+
FileDb.new(Device::Signature::FILE).update_attributes({'signer' => 'whatever'})
|
6
|
+
DaFunk::ParamsDat.file = {'signer' => 'thebestsignature'}
|
7
|
+
|
8
|
+
assert_equal Device::Signature::CONVERTED, Device::Signature.convert
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_signature_file_not_found
|
12
|
+
FunkyMock::Mock.new
|
13
|
+
Device::Signature.stubs(:load).returns(nil)
|
14
|
+
|
15
|
+
assert_equal Device::Signature::FILE_NOT_FOUND, Device::Signature.convert
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_signature_is_the_same
|
19
|
+
FileDb.new(Device::Signature::FILE).update_attributes({'signer' => 'whatever'})
|
20
|
+
DaFunk::ParamsDat.file = {'signer' => 'whatever'}
|
21
|
+
|
22
|
+
assert_equal Device::Signature::IS_THE_SAME, Device::Signature.convert
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: da_funk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.24.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago Scalone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -189,6 +189,7 @@ files:
|
|
189
189
|
- lib/device/printer.rb
|
190
190
|
- lib/device/runtime.rb
|
191
191
|
- lib/device/setting.rb
|
192
|
+
- lib/device/signature.rb
|
192
193
|
- lib/device/support.rb
|
193
194
|
- lib/device/system.rb
|
194
195
|
- lib/device/version.rb
|
@@ -227,6 +228,7 @@ files:
|
|
227
228
|
- test/unit/device/io_test.rb
|
228
229
|
- test/unit/device/notification_callback_test.rb
|
229
230
|
- test/unit/device/notification_event_test.rb
|
231
|
+
- test/unit/device/signature_test.rb
|
230
232
|
- test/unit/ext/float_test.rb
|
231
233
|
- test/unit/ext/string_test.rb
|
232
234
|
- test/unit/file_db_test.rb
|
@@ -275,6 +277,7 @@ test_files:
|
|
275
277
|
- test/unit/device/io_test.rb
|
276
278
|
- test/unit/device/notification_callback_test.rb
|
277
279
|
- test/unit/device/notification_event_test.rb
|
280
|
+
- test/unit/device/signature_test.rb
|
278
281
|
- test/unit/ext/float_test.rb
|
279
282
|
- test/unit/ext/string_test.rb
|
280
283
|
- test/unit/file_db_test.rb
|