Skip to content

Commit 708415b

Browse files
committed
Merge pull request AuthorizeNet#13 from sapta89/master
sample code for 'Get Transaction List'
2 parents 4db863a + d11bcd8 commit 708415b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require 'rubygems'
2+
require 'yaml'
3+
require 'authorizenet'
4+
5+
include AuthorizeNet::Reporting
6+
7+
config = YAML.load_file(File.dirname(__FILE__) + "/../credentials.yml")
8+
9+
transaction = Transaction.new(config['api_login_id'], config['api_transaction_key'], :gateway => :sandbox)
10+
11+
#batchId = "4606008"
12+
batchId = "4551107"
13+
14+
response = transaction.get_transaction_list(batchId)
15+
16+
if response.result_code == "Ok"
17+
transactions = response.transactions
18+
if transactions == nil
19+
puts "#{response.message_text}"
20+
else
21+
transactions.each do |transaction|
22+
puts "\nTransaction ID : #{transaction.id} "
23+
puts "Submitted on (Local) : %s " %[transaction.submitted_at.strftime("%m/%d/%Y %I:%M:%S %p")]
24+
puts "Status : #{transaction.status} "
25+
puts "Settle Amount : %.2f " %[transaction.settle_amount]
26+
end
27+
end
28+
else
29+
puts "Error : Failed to get Transaction List\n"
30+
puts "Error Text : #{response.message_text} \n"
31+
puts "Error Code : #{response.message_code} "
32+
end

0 commit comments

Comments
 (0)