da_funk 2.6.0 → 2.7.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 +4 -4
- data/Gemfile.lock +2 -2
- data/RELEASE_NOTES.md +8 -0
- data/lib/da_funk/engine.rb +1 -0
- data/lib/da_funk/payment_channel.rb +50 -12
- data/lib/da_funk/version.rb +1 -1
- data/lib/device/setting.rb +19 -2
- data/lib/file_db.rb +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a9b18a63ef6156f2c772c44cf926521b453cd1e
|
4
|
+
data.tar.gz: 55670ae7ca118b9d79b93ccfa8a1d6979b508bfa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '091b2c8dde539fd1cb97fd003e5f1e1cf95e63df0c11b90d514379b035e2d23140c49b5aac03a293af865daf30fce329bf57b3325e6448722d4ff2f0555fe246'
|
7
|
+
data.tar.gz: fa45b38e6cd37cfd121d021863237f16b52baa24c7c8d9735a4459c0931be63cd9da9ef7b3f0a401da367a373360d82039ef45a71e93fed6d4bc5e13e5c19af0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
da_funk (2.
|
4
|
+
da_funk (2.7.0)
|
5
5
|
archive-zip (~> 0.5)
|
6
6
|
bundler
|
7
7
|
cloudwalk_handshake
|
@@ -28,7 +28,7 @@ GEM
|
|
28
28
|
parallel (1.13.0)
|
29
29
|
parser (2.6.0.0)
|
30
30
|
ast (~> 2.4.0)
|
31
|
-
posxml_parser (2.
|
31
|
+
posxml_parser (2.14.0)
|
32
32
|
funky-emv (~> 0.3)
|
33
33
|
powerpack (0.1.2)
|
34
34
|
rainbow (3.0.0)
|
data/RELEASE_NOTES.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# DaFunk
|
2
2
|
|
3
|
+
### 2.7.0 - 2019-02-16
|
4
|
+
|
5
|
+
- Execute ThreadScheduler::keep_alive every engine check
|
6
|
+
- Refresh every file on every FileDb set method if key is boot, this is a temporary fix to avoid edit problem between threads;
|
7
|
+
- Add Device::Setting attributes, payment_channel_attempts - To count channels in a day; payment_channel_date - Connection day;
|
8
|
+
- Implement Device::Setting::payment_channel_set_attempts, it’s a simple helper to set both payment_channel_date and payment_channel_attempts;
|
9
|
+
- Implement channel connection limit configuration.
|
10
|
+
|
3
11
|
### 2.6.0 - 2019-02-14
|
4
12
|
|
5
13
|
- Support to Device::Runtime::reload on Engine stop.
|
data/lib/da_funk/engine.rb
CHANGED
@@ -52,19 +52,41 @@ module DaFunk
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
+
def self.payment_channel_limit?
|
56
|
+
DaFunk::ParamsDat.exists? && DaFunk::ParamsDat.file["payment_channel_check_limit"] != "0"
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.payment_channel_limit
|
60
|
+
if DaFunk::ParamsDat.exists?
|
61
|
+
DaFunk::ParamsDat.file["payment_channel_limit"].to_i
|
62
|
+
else
|
63
|
+
0
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.channel_limit_exceed?
|
68
|
+
if payment_channel_limit?
|
69
|
+
payment_channel_limit <= Device::Setting.payment_channel_attempts.to_i
|
70
|
+
else
|
71
|
+
false
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
55
75
|
def self.check(display_message = true)
|
56
|
-
if self.dead?
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
76
|
+
if self.dead?
|
77
|
+
unless self.channel_limit_exceed?
|
78
|
+
PaymentChannel.connect(display_message)
|
79
|
+
if @client
|
80
|
+
self.print_info(I18n.t(:attach_waiting), display_message)
|
81
|
+
if message = @client.check || @client.handshake?
|
82
|
+
self.print_info(I18n.t(:attach_connected), display_message)
|
83
|
+
message
|
84
|
+
else
|
85
|
+
self.error
|
86
|
+
end
|
63
87
|
else
|
64
88
|
self.error
|
65
89
|
end
|
66
|
-
else
|
67
|
-
self.error
|
68
90
|
end
|
69
91
|
else
|
70
92
|
if @client
|
@@ -91,11 +113,27 @@ module DaFunk
|
|
91
113
|
print_last(message) if display
|
92
114
|
end
|
93
115
|
|
94
|
-
def self.
|
95
|
-
|
96
|
-
|
116
|
+
def self.payment_channel_increment_attempts
|
117
|
+
number = Device::Setting.payment_channel_attempts.to_i
|
118
|
+
date = Device::Setting.payment_channel_date
|
119
|
+
if date.to_s.empty?
|
120
|
+
Device::Setting.payment_channel_set_attempts(Time.now)
|
97
121
|
else
|
122
|
+
year, mon, day = date.split("-")
|
123
|
+
if day.to_i == Time.now.day
|
124
|
+
Device::Setting.payment_channel_set_attempts(nil, number + 1)
|
125
|
+
else
|
126
|
+
Device::Setting.payment_channel_set_attempts(Time.now)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def self.create
|
132
|
+
if @client != Context::CommunicationChannel
|
133
|
+
payment_channel_increment_attempts
|
98
134
|
@client = PaymentChannel.new
|
135
|
+
else
|
136
|
+
@client.connect
|
99
137
|
end
|
100
138
|
end
|
101
139
|
|
data/lib/da_funk/version.rb
CHANGED
data/lib/device/setting.rb
CHANGED
@@ -18,7 +18,7 @@ class Device
|
|
18
18
|
"sim_pin" => "", #GPRS
|
19
19
|
"sim_slot" => "0", #GPRS
|
20
20
|
"sim_dual" => "0", #GPRS
|
21
|
-
"wifi_password"
|
21
|
+
"wifi_password" => "", #WIFI
|
22
22
|
"authentication" => "", #WIFI
|
23
23
|
"essid" => "", #WIFI
|
24
24
|
"bssid" => "", #WIFI
|
@@ -54,7 +54,9 @@ class Device
|
|
54
54
|
"heartbeat" => "", #SYS
|
55
55
|
"boot" => "1", #SYS
|
56
56
|
"company_name" => "", #SYS
|
57
|
-
"metadata_timestamp" => ""
|
57
|
+
"metadata_timestamp" => "",
|
58
|
+
"payment_channel_attempts" => "0",
|
59
|
+
"payment_channel_date" => ""
|
58
60
|
}
|
59
61
|
|
60
62
|
class << self
|
@@ -120,6 +122,21 @@ class Device
|
|
120
122
|
end
|
121
123
|
end
|
122
124
|
|
125
|
+
# helper
|
126
|
+
def self.payment_channel_set_attempts(time = nil, attempts = nil)
|
127
|
+
if time
|
128
|
+
str = "%d-%02d-%02d"
|
129
|
+
update_attributes({
|
130
|
+
"payment_channel_date" => (str % [time.year, time.mon, time.day]),
|
131
|
+
"payment_channel_attempts" => (attempts || 1)
|
132
|
+
})
|
133
|
+
else
|
134
|
+
update_attributes({
|
135
|
+
"payment_channel_attempts" => (attempts || 1)
|
136
|
+
})
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
123
140
|
# Custom Attributes
|
124
141
|
def self.tcp_recv_timeout
|
125
142
|
DaFunk::ParamsDat.file["tcp_recv_timeout"] || method_missing(:tcp_recv_timeout)
|
data/lib/file_db.rb
CHANGED
@@ -41,6 +41,9 @@ class FileDb
|
|
41
41
|
|
42
42
|
def []=(key, value)
|
43
43
|
value = value.to_s
|
44
|
+
# reload if boot is key to avoid initial change problem between threads
|
45
|
+
# TODO: Refactoring config.dat handling between threads
|
46
|
+
open if key == "boot"
|
44
47
|
old = @hash[key.to_s]
|
45
48
|
ret = @hash[key.to_s] = value
|
46
49
|
save if old != value
|
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: 2.
|
4
|
+
version: 2.7.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: 2019-02-
|
11
|
+
date: 2019-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|