extface 0.4.1a → 0.4.1b
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/app/controllers/extface/devices_controller.rb +8 -0
- data/app/models/extface/driver.rb +2 -0
- data/app/models/extface/driver/base/fiscal.rb +3 -0
- data/app/models/extface/driver/eltrade_tm_u220.rb +16 -0
- data/app/models/extface/driver/fidelio/fias.rb +88 -0
- data/app/views/extface/driver/fidelio/fias/_control.html.erb +1 -0
- data/app/views/extface/driver/fidelio/fias/_settings.html.erb +1 -0
- data/config/routes.rb +1 -0
- data/lib/extface/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 178303c328b58ad61130fa1ae3fcba9ab4ddef44
|
4
|
+
data.tar.gz: c2c145a2957be5ebf5e042ae09dc900cf1b62419
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df62a69f4786b4b65fcb41a2a03ad6682f967d5a3bfde371d604b93523d8f19bd199588a8614e5f9477fdcf2aa3baae8f1c536c4fe002f446d8beb757527abf6
|
7
|
+
data.tar.gz: 7e77ecda2b063f8cfeab9fccfae612f6297409d4df79cdb5f1002138b141942d2b99aa9f4cc0c6482554bf8daff7451b6840d7c6931b58bd3905f631b4267e06
|
@@ -83,6 +83,14 @@ module Extface
|
|
83
83
|
end
|
84
84
|
render action: :show
|
85
85
|
end
|
86
|
+
|
87
|
+
def raw
|
88
|
+
set_device
|
89
|
+
if @device.raw?
|
90
|
+
@device.driver.test(params[:test])
|
91
|
+
end
|
92
|
+
render action: :show
|
93
|
+
end
|
86
94
|
|
87
95
|
private
|
88
96
|
# Use callbacks to share common setup or constraints between actions.
|
@@ -52,6 +52,9 @@ module Extface
|
|
52
52
|
|
53
53
|
#fiscal basket session of Extface::Driver::Base::Fiscal::SaleItem instances
|
54
54
|
def sale_and_pay_items_session(sale_items = [], operator = '', password = '') raise_not_implemented end
|
55
|
+
|
56
|
+
#other
|
57
|
+
def payed_recv_account(value = 0.00, payment_type_num = 0) raise_not_implemented end
|
55
58
|
|
56
59
|
class SaleItem
|
57
60
|
include ActiveModel::Validations
|
@@ -160,6 +160,22 @@ module Extface
|
|
160
160
|
raise "Not in fiscal session" unless @fiscal_session
|
161
161
|
add_payment
|
162
162
|
end
|
163
|
+
|
164
|
+
def payed_recv_account(value = 0.00, payment_type_num = 0)
|
165
|
+
raise "Incorrect Amount Value" if value.zero?
|
166
|
+
value_bytes = "\x00\x00\x00\x00" # recalculate
|
167
|
+
unless value.nil?
|
168
|
+
value_units = 0x100000000 + (value * 100).to_i # !FIXME
|
169
|
+
value_bytes = "".b
|
170
|
+
4.times{ |shift| value_bytes.insert 0, ((value_units >> shift*8) & 0xff).chr }
|
171
|
+
end
|
172
|
+
device.session("Payed Out / Received on Account (#{value.to_s})") do |s|
|
173
|
+
s.notify "Payed / Received Start"
|
174
|
+
fsend Other::PAYED_RECV_ACCOUNT, "" << (1 + payment_type_num).chr << value_bytes
|
175
|
+
status = get_printer_status
|
176
|
+
s.notify "Payed / Received End"
|
177
|
+
end
|
178
|
+
end
|
163
179
|
|
164
180
|
#basket
|
165
181
|
def sale_and_pay_items_session(items = [], operator = '', password = '')
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module Extface
|
2
|
+
class Driver::Fidelio::Fias < Extface::Driver
|
3
|
+
NAME = 'Fidelio FIAS Simple Posting (TCP/IP)'.freeze
|
4
|
+
GROUP = Extface::RAW_DRIVER
|
5
|
+
|
6
|
+
DEVELOPMENT = true #driver is not ready for production (not passing all tests or has major bugs)
|
7
|
+
|
8
|
+
# Select driver features
|
9
|
+
RAW = true #responds to #push(data) and #pull
|
10
|
+
PRINT = false #POS, slip printers
|
11
|
+
FISCAL = false #cash registers, fiscal printers
|
12
|
+
REPORT = false #only transmit data that must be parsed by handler, CDR, report devices
|
13
|
+
|
14
|
+
STX = 0x02
|
15
|
+
ETX = 0x03
|
16
|
+
|
17
|
+
def handle(buffer)
|
18
|
+
if i = buffer.index(/\x03/) # find position of frame possible delimiter
|
19
|
+
rpush buffer[0..i] # this will make data available for #pull(timeout) method
|
20
|
+
return i+1 # return number of bytes processed
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def ps(room, price)
|
25
|
+
push build_packet("PS|RN#{room}|PTC|TA#{(price*100).to_i}")
|
26
|
+
if status = pull(3)
|
27
|
+
tags = inspect_frame(status)
|
28
|
+
if tags.include? "ASUR"
|
29
|
+
err_tag = tags.find{ |t| t.starts_with? "CT" }
|
30
|
+
errors.add :base, "FIAS ERROR: #{err_tag[2..-1]}"
|
31
|
+
end
|
32
|
+
else
|
33
|
+
errors.add :base, "No data received from device"
|
34
|
+
end
|
35
|
+
errors.empty?
|
36
|
+
end
|
37
|
+
|
38
|
+
def test(params = {})
|
39
|
+
device.session("Simple Post") do |s|
|
40
|
+
s.push build_packet("PS|RN101|PTC|TA200")
|
41
|
+
if status = pull(3)
|
42
|
+
tags = inspect_frame(status)
|
43
|
+
if tags.include? "ASUR"
|
44
|
+
err_tag = tags.find{ |t| t.starts_with? "CT" }
|
45
|
+
raise "FIAS ERROR: #{err_tag[2..-1]}"
|
46
|
+
end
|
47
|
+
else
|
48
|
+
raise "No data received from device"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def check_status
|
54
|
+
flush
|
55
|
+
push build_packet("LS")
|
56
|
+
if status = pull(3)
|
57
|
+
tags = inspect_frame(status)
|
58
|
+
if tags.include? "ASUR"
|
59
|
+
err_tag = tags.find{ |t| t.starts_with? "CT" }
|
60
|
+
errors.add :base, err_tag[2..-1]
|
61
|
+
end
|
62
|
+
errors.empty?
|
63
|
+
else
|
64
|
+
errors.add :base, "No data received from device"
|
65
|
+
return false
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def build_packet(data = "")
|
70
|
+
"".b.tap() do |packet|
|
71
|
+
packet << STX
|
72
|
+
packet << data
|
73
|
+
packet << "|DA#{Date.today.strftime("%y%m%d")}|TI#{Time.now.strftime("%H%M%S")}|"
|
74
|
+
packet << ETX
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
def inspect_frame(buffer)
|
80
|
+
if match = buffer.match(/\x02(.+)\x03/nm)
|
81
|
+
return match[1].split("|")
|
82
|
+
else
|
83
|
+
errors.add :base, "Invalid data received from device"
|
84
|
+
end
|
85
|
+
return nil
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= button_to 'Test', raw_device_path(@device), remote: true, name: :test, value: true, class: 'btn btn-warning' %>
|
@@ -0,0 +1 @@
|
|
1
|
+
settings
|
data/config/routes.rb
CHANGED
data/lib/extface/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: extface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1b
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Vangelov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- app/models/extface/driver/datecs/fp550.rb
|
119
119
|
- app/models/extface/driver/eltrade/commands_fp4.rb
|
120
120
|
- app/models/extface/driver/eltrade_tm_u220.rb
|
121
|
+
- app/models/extface/driver/fidelio/fias.rb
|
121
122
|
- app/models/extface/driver/generic_pos.rb
|
122
123
|
- app/models/extface/driver/star_scp700.rb
|
123
124
|
- app/models/extface/driver/star_tsp200.rb
|
@@ -136,6 +137,8 @@ files:
|
|
136
137
|
- app/views/extface/driver/datecs/fp550/_settings.html.erb
|
137
138
|
- app/views/extface/driver/eltrade_tm_u220/_control_.html.erb
|
138
139
|
- app/views/extface/driver/eltrade_tm_u220/_settings.html.erb
|
140
|
+
- app/views/extface/driver/fidelio/fias/_control.html.erb
|
141
|
+
- app/views/extface/driver/fidelio/fias/_settings.html.erb
|
139
142
|
- app/views/extface/driver/generic_pos/_settings.html.erb
|
140
143
|
- app/views/extface/driver/star_scp700/_settings.html.erb
|
141
144
|
- app/views/extface/driver/star_tsp200/_settings.html.erb
|