Skip to content

Instantly share code, notes, and snippets.

@theCrab
Created March 27, 2013 21:23
Show Gist options
  • Select an option

  • Save theCrab/5258134 to your computer and use it in GitHub Desktop.

Select an option

Save theCrab/5258134 to your computer and use it in GitHub Desktop.
verifone spree payment gateway. VX680 Terminal
require "rubygems"
require "net/telnet"
params = "
T, ##= 1 String [required] Message Type. 'T' to be passed, to define a transaction record
, ##= 2 Account Number. This field is no longer used. Use Field 24
01, ##= 3 Integer [required] Transaction Type. ‘01’ – Purchase, ‘02’ – Refund, ‘04’ – Cash advance
0000, ##= 4 Integer [required] Modifier.
, ##= 5 Reserved, Leave Blank
, ##= 6 Reserved, Leave Blank
, ##= 7 Reserved, Leave Blank
, ##= 8 Reserved, Leave Blank
, ##= 9 Reserved, Leave Blank
, ##= 10 Reserved, Leave Blank
1.23, ##= 11 Decimal [required] Total value of the transaction including tax
, ##= 12 Decimal [conditional] Total Cash Back Value for purchase with Cash back
, ##= 13 Reserved, Leave Blank
, ##= 14 Reserved, Leave Blank
, ##= 15 Reserved, Leave Blank
, ##= 16 Reserved, Leave Blank
, ##= 17 Reserved, Leave Blank
, ##= 18 Reserved, Leave Blank
, ##= 19 Reserved, Leave Blank
, ##= 20 Reserved, Leave Blank
, ##= 21 Reserved, Leave Blank
, ##= 22 Reserved, Leave Blank
, ##= 23 String [optional] Reference (we pass in Order Number Rxxxxxxxxxx)
, ##= 24 Decimal [optional] Account ID, Defines merchant parameter set to be used
, ##= 25 Decimal [conditional] Gratuity/Tip
, ##= 26 Decimal [conditional] Non Discounted Items value
, ##= 27 Integer [conditional]Register for Account On File. Populated if: Not Set = 0, Do Not Register = 1, Register = 2, Register Only = 3
, ##= 28 Decimal [conditional] Token ID. ID assigned to the stored Account On File details
"
params.to_s
begin
printo = Net::Telnet::new(
"Host" => "192.168.0.20",
"Port" => 25000,
"Prompt" => /0x06/,
"Timeout" => 10
)
# printo.cmd( )
# printo.login( "user"=>'admin', "password"=>1234)
printo.cmd(params.strip + "\r\n")
# TODO: On successful connenction and data, the terminal confirms with an ASCII "\0x06".
# Port 25000 disconnects.
# Terminal opens and sends Response on port 25001
# Process Response
printo.close
rescue Exception => e
@ero = "Class: #{e.class} => Message: #{e.message}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment