app/models/extface/driver/daisy_fx1200.rb in extface-0.4.3a vs app/models/extface/driver/daisy_fx1200.rb in extface-0.4.3b
- old
+ new
@@ -28,10 +28,18 @@
6 => "\xc5",
7 => "\xc6",
8 => "\xc7"
}
+ PAYMENT_TYPE_MAP = {
+ 1 => "P",
+ 2 => "N",
+ 3 => "C",
+ 4 => "D",
+ 5 => "B"
+ }
+
has_serial_config
include Extface::Driver::Daisy::CommandsFx1200
def handle(buffer) #buffer is filled with multiple pushes, wait for full frame (ACKs)STX..PA2..PA1..ETX
@@ -122,9 +130,15 @@
raise "Not in fiscal session" unless @fiscal_session
end
def add_payment(value = nil, type_num = nil)
raise "Not in fiscal session" unless @fiscal_session
+ fsend(Sales::TOTAL, "".tap() do |data|
+ data << "\t"
+ data << PAYMENT_TYPE_MAP[type_num] unless type_num.blank?
+ data << item.price.to_s
+ end
+ )
end
def total_payment
raise "Not in fiscal session" unless @fiscal_session
fsend(Sales::TOTAL, "\t")
\ No newline at end of file