da_funk 3.16.2 → 3.20.0
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 +5 -5
- data/Gemfile.lock +4 -4
- data/RELEASE_NOTES.md +29 -0
- data/lib/da_funk/helper.rb +36 -22
- data/lib/da_funk/helper/status_bar.rb +4 -4
- data/lib/da_funk/params_dat.rb +25 -19
- data/lib/da_funk/payment_channel.rb +36 -20
- data/lib/da_funk/version.rb +1 -1
- data/lib/device/setting.rb +3 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a61984983d2f7c168e0a4e84d60ac44d3060f7be
|
4
|
+
data.tar.gz: 490ef400806c5e7329d28426ca95fa4284c3ea02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0f22c650827eec86b2fb87251771d519c1132d6a8b488b76ad940fb2e66491810e7235033cfe1ac0f4191058520b39022546ba789fa1dedd279f0cebb52f7d3
|
7
|
+
data.tar.gz: 11da367af36fc688bce9ccc0f7979fc17491b5102d4cd056df675b0e69699e7ff79a817f7f25926aa8ab3e25d58ef7da7b3f63066aedde0de7780e09f0884579
|
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.20.0)
|
5
5
|
archive-zip (~> 0.5)
|
6
6
|
bundler
|
7
7
|
cloudwalk_handshake
|
@@ -15,17 +15,17 @@ GEM
|
|
15
15
|
archive-zip (0.12.0)
|
16
16
|
io-like (~> 0.3.0)
|
17
17
|
ast (2.4.0)
|
18
|
-
cloudwalk (1.
|
18
|
+
cloudwalk (1.15.0)
|
19
19
|
bundler
|
20
20
|
rake
|
21
|
-
cloudwalk_handshake (1.
|
21
|
+
cloudwalk_handshake (1.13.1)
|
22
22
|
funky-simplehttp (~> 0.6)
|
23
23
|
funky-emv (1.2.2)
|
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
|
-
io-like (0.3.
|
28
|
+
io-like (0.3.1)
|
29
29
|
jaro_winkler (1.5.4)
|
30
30
|
parallel (1.19.1)
|
31
31
|
parser (2.7.0.2)
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 3.20.0 - 2020-05-28
|
4
|
+
|
5
|
+
- Rename PaymentChannel::client to ::current;
|
6
|
+
- Fix status bar change link to cache old value.
|
7
|
+
|
8
|
+
### 3.18.1 - 2020-05-20
|
9
|
+
|
10
|
+
- Fix issue on DaFunk::Helper#menu_image_touchscreen_or_keyboard it was not checking for special keys
|
11
|
+
|
12
|
+
### 3.18.0 - 2020-04-03
|
13
|
+
|
14
|
+
- Added enable_txt_ui parameter on the following methods
|
15
|
+
- DaFunk::ParamsDat#download;
|
16
|
+
- DaFunk::ParamsDat#update_apps;
|
17
|
+
- DaFunk::ParamsDat#update_app;
|
18
|
+
- DaFunk::ParamsDat#update_file;
|
19
|
+
- DaFunk::Helper#attach_options;
|
20
|
+
- DaFunk::Helper#check_download_error;
|
21
|
+
|
22
|
+
### 3.17.0 - 2020-02-10
|
23
|
+
|
24
|
+
- Added support to infinitepay endpoints config on config.dat file;
|
25
|
+
- Update cloudwalk (1.15.0);
|
26
|
+
- Update cloudwalk_handshake (1.13.0);
|
27
|
+
|
28
|
+
### 3.16.3 - 2020-01-31
|
29
|
+
|
30
|
+
- Changed setting emv_input_amount_idle to emv_contactless_amount.
|
31
|
+
|
3
32
|
### 3.16.2 - 2020-01-29
|
4
33
|
|
5
34
|
- Moved responsability of beep sound for touch event to DaFunk::Helper#parse_touchscreen_event;
|
data/lib/da_funk/helper.rb
CHANGED
@@ -14,11 +14,11 @@ module DaFunk
|
|
14
14
|
string
|
15
15
|
end
|
16
16
|
|
17
|
-
def attach_options
|
18
|
-
if DaFunk::PaymentChannel.
|
19
|
-
{:print_last => true}
|
17
|
+
def attach_options(enable_txt_ui = true)
|
18
|
+
if DaFunk::PaymentChannel.current == Context::CommunicationChannel
|
19
|
+
{:print_last => true, :enable_txt_ui => enable_txt_ui}
|
20
20
|
else
|
21
|
-
{:print_last => false}
|
21
|
+
{:print_last => false, :enable_txt_ui => enable_txt_ui}
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -35,55 +35,63 @@ module DaFunk
|
|
35
35
|
|
36
36
|
def attach(options = attach_options)
|
37
37
|
if Device::Network.configured?
|
38
|
-
print_attach(:attach_connecting, options)
|
38
|
+
print_attach(:attach_connecting, options) if options[:enable_txt_ui]
|
39
39
|
unless Device::Network.connected?
|
40
40
|
if Device::Network.attach(options) == Device::Network::SUCCESS
|
41
41
|
Device::Setting.network_configured = 1
|
42
|
-
print_attach(:attach_connected, options)
|
42
|
+
print_attach(:attach_connected, options) if options[:enable_txt_ui]
|
43
43
|
else
|
44
44
|
Device::Setting.network_configured = 0 if DaFunk::ParamsDat.file["connection_management"] == "0"
|
45
|
-
|
46
|
-
|
45
|
+
if options[:enable_txt_ui]
|
46
|
+
print_attach(:attach_fail, options.merge(:args => [Device::Network.code.to_s]))
|
47
|
+
getc(10000)
|
48
|
+
end
|
47
49
|
return false
|
48
50
|
end
|
49
51
|
else
|
50
|
-
print_attach(:attach_already_connected, options)
|
52
|
+
print_attach(:attach_already_connected, options) if options[:enable_txt_ui]
|
51
53
|
end
|
52
54
|
true
|
53
55
|
else
|
54
|
-
|
55
|
-
|
56
|
+
if options[:enable_txt_ui]
|
57
|
+
print_attach(:attach_device_not_configured, options)
|
58
|
+
getc(2000)
|
59
|
+
end
|
56
60
|
false
|
57
61
|
end
|
58
62
|
end
|
59
63
|
|
60
|
-
def check_download_error(ret)
|
64
|
+
def check_download_error(ret, enable_txt_ui = true)
|
61
65
|
value = true
|
66
|
+
ui = {}
|
67
|
+
|
62
68
|
case ret
|
63
69
|
when DaFunk::Transaction::Download::SERIAL_NUMBER_NOT_FOUND
|
64
|
-
|
70
|
+
ui[:i18n] = :download_serial_number_not_found
|
65
71
|
value = false
|
66
72
|
when DaFunk::Transaction::Download::FILE_NOT_FOUND
|
67
|
-
|
73
|
+
ui[:i18n] = :download_file_not_found
|
68
74
|
value = false
|
69
75
|
when DaFunk::Transaction::Download::FILE_NOT_CHANGE
|
70
|
-
|
76
|
+
ui[:i18n] = :download_file_is_the_same
|
71
77
|
when DaFunk::Transaction::Download::SUCCESS
|
72
|
-
|
78
|
+
ui[:i18n] = :download_success
|
73
79
|
when DaFunk::Transaction::Download::COMMUNICATION_ERROR
|
74
|
-
|
80
|
+
ui[:i18n] = :download_communication_failure
|
75
81
|
value = false
|
76
82
|
when DaFunk::Transaction::Download::MAPREDUCE_RESPONSE_ERROR
|
77
|
-
|
83
|
+
ui[:i18n] = :download_encoding_error
|
78
84
|
value = false
|
79
85
|
when DaFunk::Transaction::Download::IO_ERROR
|
80
|
-
|
86
|
+
ui[:i18n] = :download_io_error
|
81
87
|
value = false
|
82
88
|
else
|
83
|
-
|
89
|
+
ui[:i18n] = :download_communication_failure
|
84
90
|
value = false
|
85
91
|
end
|
86
92
|
|
93
|
+
I18n.pt(ui[:i18n], :args => [ret]) if enable_txt_ui
|
94
|
+
|
87
95
|
value
|
88
96
|
end
|
89
97
|
|
@@ -176,15 +184,21 @@ module DaFunk
|
|
176
184
|
return nil if menu_itens.empty?
|
177
185
|
|
178
186
|
Device::Display.print_bitmap(path)
|
179
|
-
|
180
187
|
timeout = options[:timeout] || Device::IO.timeout
|
181
|
-
|
188
|
+
|
189
|
+
if options.include?(:special_keys)
|
190
|
+
options[:special_keys] += options[:special_keys]
|
191
|
+
else
|
192
|
+
options[:special_keys] = [Device::IO::CANCEL]
|
193
|
+
end
|
182
194
|
|
183
195
|
event, key = wait_touchscreen_or_keyboard_event(menu_itens, timeout, options)
|
184
196
|
|
185
197
|
if event == :keyboard
|
186
198
|
if key == Device::IO::CANCEL
|
187
199
|
options[:default]
|
200
|
+
elsif options[:special_keys].include?(key)
|
201
|
+
key
|
188
202
|
else
|
189
203
|
index = key.to_i-1 == -1 ? 0 : key.to_i-1
|
190
204
|
menu_itens.keys[index]
|
@@ -58,14 +58,14 @@ module DaFunk
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def self.change_link
|
61
|
-
|
62
|
-
|
61
|
+
info = (!! DaFunk::PaymentChannel.alive?)
|
62
|
+
if self.link.nil? || self.link != info
|
63
|
+
self.link = info
|
64
|
+
if info
|
63
65
|
PAX::Display.print_status_bar(SLOT_LINK, "./shared/link.png")
|
64
66
|
else
|
65
67
|
PAX::Display.print_status_bar(SLOT_LINK, "./shared/unlink.png")
|
66
68
|
end
|
67
|
-
else
|
68
|
-
PAX::Display.print_status_bar(SLOT_LINK, "./shared/unlink.png")
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/da_funk/params_dat.rb
CHANGED
@@ -104,15 +104,17 @@ module DaFunk
|
|
104
104
|
nil
|
105
105
|
end
|
106
106
|
|
107
|
-
def self.download
|
108
|
-
if attach
|
107
|
+
def self.download(enable_txt_ui = true)
|
108
|
+
if attach(attach_options(enable_txt_ui))
|
109
109
|
parse
|
110
110
|
ret = try(3) do |attempt|
|
111
|
-
|
112
|
-
|
111
|
+
if enable_txt_ui
|
112
|
+
Device::Display.clear
|
113
|
+
I18n.pt(:downloading_content, :args => ["PARAMS", 1, 1])
|
114
|
+
end
|
113
115
|
getc(100)
|
114
116
|
ret = DaFunk::Transaction::Download.request_param_file(FILE_NAME)
|
115
|
-
unless check_download_error(ret)
|
117
|
+
unless check_download_error(ret, enable_txt_ui)
|
116
118
|
getc(2000)
|
117
119
|
false
|
118
120
|
else
|
@@ -124,21 +126,21 @@ module DaFunk
|
|
124
126
|
end
|
125
127
|
end
|
126
128
|
|
127
|
-
def self.update_apps(force_params = false, force_crc = false, force = false)
|
128
|
-
self.download if force_params || ! self.valid
|
129
|
+
def self.update_apps(force_params = false, force_crc = false, force = false, enable_txt_ui = true)
|
130
|
+
self.download(enable_txt_ui) if force_params || ! self.valid
|
129
131
|
main_updated = nil
|
130
132
|
if self.valid
|
131
133
|
apps_to_update = self.outdated_apps(force_crc, force)
|
132
134
|
size_apps = apps_to_update.size
|
133
135
|
apps_to_update.each_with_index do |app, index|
|
134
|
-
ret = self.update_app(app, index+1, size_apps, force_crc || force)
|
136
|
+
ret = self.update_app(app, index+1, size_apps, force_crc || force, enable_txt_ui)
|
135
137
|
main_updated ||= (ret && app.main_application?)
|
136
138
|
end
|
137
139
|
|
138
140
|
files_to_update = self.outdated_files(force_crc, force)
|
139
141
|
size_files = files_to_update.size
|
140
142
|
files_to_update.each_with_index do |file_, index|
|
141
|
-
self.update_file(file_, index+1, size_files, force_crc || force)
|
143
|
+
self.update_file(file_, index+1, size_files, force_crc || force, enable_txt_ui)
|
142
144
|
end
|
143
145
|
end
|
144
146
|
ensure
|
@@ -179,26 +181,30 @@ module DaFunk
|
|
179
181
|
File.file?(path) && ! keep
|
180
182
|
end
|
181
183
|
|
182
|
-
def self.update_app(application, index = 1, all = 1, force = false)
|
183
|
-
if attach && application
|
184
|
+
def self.update_app(application, index = 1, all = 1, force = false, enable_txt_ui = true)
|
185
|
+
if attach(attach_options(enable_txt_ui)) && application
|
184
186
|
try(3) do |attempt|
|
185
|
-
|
186
|
-
|
187
|
+
if enable_txt_ui
|
188
|
+
Device::Display.clear
|
189
|
+
I18n.pt(:downloading_content, :args => [I18n.t(:apps), index, all])
|
190
|
+
end
|
187
191
|
getc(100)
|
188
|
-
ret = check_download_error(application.download(force))
|
192
|
+
ret = check_download_error(application.download(force), enable_txt_ui)
|
189
193
|
getc(1000)
|
190
194
|
ret
|
191
195
|
end
|
192
196
|
end
|
193
197
|
end
|
194
198
|
|
195
|
-
def self.update_file(file_parameter, index = 1, all = 1, force = false)
|
196
|
-
if attach && file_parameter
|
199
|
+
def self.update_file(file_parameter, index = 1, all = 1, force = false, enable_txt_ui = true)
|
200
|
+
if attach(attach_options(enable_txt_ui)) && file_parameter
|
197
201
|
try(3) do |attempt|
|
198
|
-
|
199
|
-
|
202
|
+
if enable_txt_ui
|
203
|
+
Device::Display.clear
|
204
|
+
I18n.pt(:downloading_content, :args => [I18n.t(:files), index, all])
|
205
|
+
end
|
200
206
|
getc(100)
|
201
|
-
ret = check_download_error(file_parameter.download(force))
|
207
|
+
ret = check_download_error(file_parameter.download(force), enable_txt_ui)
|
202
208
|
file_parameter.unzip if ret
|
203
209
|
getc(1000)
|
204
210
|
ret
|
@@ -3,11 +3,29 @@ module DaFunk
|
|
3
3
|
DEFAULT_HEARBEAT = "180"
|
4
4
|
|
5
5
|
class << self
|
6
|
-
attr_accessor :
|
6
|
+
attr_accessor :current, :app
|
7
7
|
end
|
8
8
|
|
9
9
|
attr_accessor :handshake_response, :handshake_request, :client, :host, :port
|
10
10
|
|
11
|
+
# Backward compatibility
|
12
|
+
def self.client
|
13
|
+
self.current
|
14
|
+
end
|
15
|
+
|
16
|
+
# Backward compatibility
|
17
|
+
def self.client=(obj)
|
18
|
+
self.current = obj
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.current
|
22
|
+
@current
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.current=(obj)
|
26
|
+
@current = obj
|
27
|
+
end
|
28
|
+
|
11
29
|
def self.ready?
|
12
30
|
Device::Network.connected? && self.configured?
|
13
31
|
end
|
@@ -22,8 +40,8 @@ module DaFunk
|
|
22
40
|
if @app != application
|
23
41
|
@app = application
|
24
42
|
# if Context::CommunicationChannel send application name thought threads
|
25
|
-
if
|
26
|
-
|
43
|
+
if self.current == Context::CommunicationChannel
|
44
|
+
self.current.app = application
|
27
45
|
else
|
28
46
|
Device::System.klass = application
|
29
47
|
end
|
@@ -48,11 +66,11 @@ module DaFunk
|
|
48
66
|
self.print_info(I18n.t(:attach_attaching), display_message)
|
49
67
|
create
|
50
68
|
self.print_info(I18n.t(:attach_authenticate), display_message)
|
51
|
-
|
69
|
+
self.current.handshake
|
52
70
|
else
|
53
71
|
client_clear!
|
54
72
|
end
|
55
|
-
|
73
|
+
self.current
|
56
74
|
end
|
57
75
|
|
58
76
|
def self.payment_channel_limit?
|
@@ -84,18 +102,16 @@ module DaFunk
|
|
84
102
|
if self.dead?
|
85
103
|
unless self.channel_limit_exceed?
|
86
104
|
PaymentChannel.connect(display_message)
|
87
|
-
if
|
105
|
+
if self.current
|
88
106
|
self.print_info(I18n.t(:attach_waiting), display_message)
|
89
|
-
if message =
|
107
|
+
if message = self.current.check || self.current.handshake?
|
90
108
|
self.print_info(I18n.t(:attach_connected), display_message)
|
91
109
|
message
|
92
110
|
end
|
93
111
|
end
|
94
112
|
end
|
95
113
|
else
|
96
|
-
|
97
|
-
@client.check
|
98
|
-
end
|
114
|
+
self.current&.check
|
99
115
|
end
|
100
116
|
end
|
101
117
|
|
@@ -104,11 +120,11 @@ module DaFunk
|
|
104
120
|
end
|
105
121
|
|
106
122
|
def self.alive?
|
107
|
-
Device::Network.connected? &&
|
123
|
+
Device::Network.connected? && self.current&.connected?
|
108
124
|
end
|
109
125
|
|
110
126
|
def self.close!
|
111
|
-
|
127
|
+
self.current&.close
|
112
128
|
ensure
|
113
129
|
client_clear!
|
114
130
|
end
|
@@ -133,16 +149,16 @@ module DaFunk
|
|
133
149
|
end
|
134
150
|
|
135
151
|
def self.create
|
136
|
-
if
|
152
|
+
if self.current != Context::CommunicationChannel
|
137
153
|
payment_channel_increment_attempts
|
138
|
-
|
154
|
+
self.current = PaymentChannel.new
|
139
155
|
else
|
140
|
-
|
156
|
+
self.current.connect
|
141
157
|
end
|
142
158
|
end
|
143
159
|
|
144
160
|
def self.client_clear!
|
145
|
-
|
161
|
+
self.current = nil unless self.current == Context::CommunicationChannel
|
146
162
|
end
|
147
163
|
|
148
164
|
def initialize(client = nil)
|
@@ -180,13 +196,13 @@ module DaFunk
|
|
180
196
|
end
|
181
197
|
|
182
198
|
def close
|
183
|
-
@client
|
199
|
+
@client&.close
|
184
200
|
@client = nil
|
185
|
-
PaymentChannel.
|
201
|
+
PaymentChannel.current = nil
|
186
202
|
end
|
187
203
|
|
188
204
|
def connected?
|
189
|
-
self.client
|
205
|
+
self.client&.connected?
|
190
206
|
end
|
191
207
|
|
192
208
|
def handshake?
|
@@ -215,7 +231,7 @@ module DaFunk
|
|
215
231
|
if Context.development?
|
216
232
|
ContextLog.exception(exception, exception.backtrace, "PaymentChannel error")
|
217
233
|
end
|
218
|
-
PaymentChannel.
|
234
|
+
PaymentChannel.current = nil
|
219
235
|
@client = nil
|
220
236
|
end
|
221
237
|
|
data/lib/da_funk/version.rb
CHANGED
data/lib/device/setting.rb
CHANGED
@@ -62,10 +62,12 @@ class Device
|
|
62
62
|
"payment_channel_date" => "",
|
63
63
|
"infinitepay_authorizer" => "0",
|
64
64
|
"infinitepay_api" => "0",
|
65
|
+
"infinitepay_cw_endpoint" => "0",
|
66
|
+
"infinitepay_google_endpoint" => "1",
|
65
67
|
"transaction_http_enabled" => "1",
|
66
68
|
"transaction_http_host" => HTTP_HOST_PRODUCTION,
|
67
69
|
"transaction_http_port" => HTTP_PORT,
|
68
|
-
"
|
70
|
+
"emv_contactless_amount" => "0",
|
69
71
|
"network_init" => ""
|
70
72
|
}
|
71
73
|
|
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.20.0
|
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-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -253,7 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
- !ruby/object:Gem::Version
|
254
254
|
version: '0'
|
255
255
|
requirements: []
|
256
|
-
|
256
|
+
rubyforge_project:
|
257
|
+
rubygems_version: 2.6.14
|
257
258
|
signing_key:
|
258
259
|
specification_version: 4
|
259
260
|
summary: MRuby Embedded System Framework
|