Class: Guide::TransactMessage
- Inherits:
-
Device::Transaction::Iso
- Object
- Device::Transaction::Iso
- Guide::TransactMessage
- Defined in:
- guides/sample_transaction_iso8583.rb
Class Method Summary collapse
Class Method Details
.call ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'guides/sample_transaction_iso8583.rb', line 189 def self.call # Create ISO8583 message and set fields date_time = DateTime.now = self.new .mti = "0800" # MTI [7] = date_time.strftime "%m%d%H%M%S" # Bit 7 [11] = "000023" # Bit 11 [12] = date_time.strftime "%H%M%S" # Bit 12 [13] = date_time.strftime "%m%d" # Bit 13 [41] = "00000002" # Bit 41 [42] = "72010003" # Bit 42 [60] = "09" # Bit 60 [61] = "APPKS" # Bit 61 [70] = "001" # Bit 70 # Print ISO8583 Message puts "Message ISO8583: " + .to_b puts "=" * 100 puts .to_s # Try send ISO8583 Message puts "=" * 100 bufRecv = self.send_send() # bufRecv = "08008238000000C000180400000000000000071103041000002303041007110000000272010003 00209005APPKS001" puts "Buffer Received: " + bufRecv # Parse message msgRecv = self.parse bufRecv puts "=" * 100 p msgRecv end |
.send_message(iso8583message) ⇒ Object
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'guides/sample_transaction_iso8583.rb', line 161 def self. () serial_terminal = "0000115030462365" puts "TCP #{(socket = TCPSocket.new('switch.cloudwalk.io', 31415)).inspect}" handshake = "#{serial_terminal};maxtraprivatelabel.posxml;0002;3.64" socket.write handshake.insert(0, handshake.size.chr) @message = socket.read(3) puts "Company Name #{@message}" if (@message != "err" && @message) msgSend = .to_b socket.write(msgSend) # Receive message length msg = socket.recv(2) # Receive message buf = socket.recv(msg.unpack("s>").first) end socket.close return buf end |