authorize_net_reporting 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/README.md +74 -0
- data/Rakefile +2 -0
- data/authorize_net_reporting.gemspec +24 -0
- data/lib/authorize_net_reporting/common.rb +12 -0
- data/lib/authorize_net_reporting/gateway.rb +41 -0
- data/lib/authorize_net_reporting/report.rb +145 -0
- data/lib/authorize_net_reporting/response.rb +100 -0
- data/lib/authorize_net_reporting/version.rb +3 -0
- data/lib/authorize_net_reporting.rb +7 -0
- data/spec/authorize_net_reporting_spec.rb +82 -0
- data/spec/spec_helper.rb +1 -0
- metadata +102 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# WORK IN PROGRESS!!!!
|
2
|
+
# AuhtorizeNetReporting
|
3
|
+
|
4
|
+
AuthorizeNetReporting allows you to retrieve Authorize.net transaction details through the [Transaction Details API](http://developer.authorize.net/api/transaction_details/)
|
5
|
+
|
6
|
+
# Sample Usage
|
7
|
+
**Go to [Authorize.net](http://authorize.net) to obtain your key/login**
|
8
|
+
|
9
|
+
````ruby
|
10
|
+
require 'rubygems'
|
11
|
+
|
12
|
+
require 'authorize_net_reporting'
|
13
|
+
|
14
|
+
report = AuthorizeNetReporting::Report.new({ :mode => ['test'|'live'], :key => 'your_api_key', :login => 'your_api_login' })
|
15
|
+
````
|
16
|
+
|
17
|
+
**All settled batched with a date range**
|
18
|
+
|
19
|
+
|
20
|
+
````ruby
|
21
|
+
#It will default to the last 12 hours if no date range is provided
|
22
|
+
report.settled_batch_list({ :first_settlement_date => "2011/04/20", :last_settlement_date => "2011/05/20", :include_statistics => true })
|
23
|
+
````
|
24
|
+
|
25
|
+
**Statistics for a specific batch**
|
26
|
+
|
27
|
+
````ruby
|
28
|
+
report.batch_statistics(1049686)
|
29
|
+
````
|
30
|
+
|
31
|
+
**Data for all transactions in a specified batch**
|
32
|
+
|
33
|
+
````ruby
|
34
|
+
report.transaction_list(1049686)
|
35
|
+
````
|
36
|
+
|
37
|
+
**Unsettled Transactions**
|
38
|
+
|
39
|
+
````ruby
|
40
|
+
report.unsettled_transaction_list
|
41
|
+
````
|
42
|
+
|
43
|
+
**Detailed information about one specific transaction**
|
44
|
+
|
45
|
+
````ruby
|
46
|
+
report.transaction_details(2157585857)
|
47
|
+
````
|
48
|
+
|
49
|
+
# LICENSE:
|
50
|
+
|
51
|
+
(The MIT License)
|
52
|
+
|
53
|
+
Copyright (c) 2011:
|
54
|
+
|
55
|
+
[Jazmin Schroeder](http://jazminschroeder.com)
|
56
|
+
|
57
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
58
|
+
a copy of this software and associated documentation files (the
|
59
|
+
'Software'), to deal in the Software without restriction, including
|
60
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
61
|
+
distribute, sub license, and/or sell copies of the Software, and to
|
62
|
+
permit persons to whom the Software is furnished to do so, subject to
|
63
|
+
the following conditions:
|
64
|
+
|
65
|
+
The above copyright notice and this permission notice shall be
|
66
|
+
included in all copies or substantial portions of the Software.
|
67
|
+
|
68
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
69
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
70
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
71
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
72
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
73
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
74
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "authorize_net_reporting/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "authorize_net_reporting"
|
7
|
+
s.version = AuthorizeNetReporting::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Jazmin Schroeder"]
|
10
|
+
s.email = ["jazminschroeder@gmail.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{Authorize.net Transaction Details API }
|
13
|
+
s.description = %q{Retrieve transaction details through the Authorize.net Transaction Details API }
|
14
|
+
|
15
|
+
s.rubyforge_project = "authorize_net_reporting"
|
16
|
+
s.add_dependency 'httparty'
|
17
|
+
s.add_dependency 'builder'
|
18
|
+
s.add_development_dependency "rspec"
|
19
|
+
|
20
|
+
s.files = `git ls-files`.split("\n")
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
23
|
+
s.require_paths = ["lib"]
|
24
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Helper methods
|
2
|
+
module Common
|
3
|
+
# Converts string to underscore
|
4
|
+
def underscore(str)
|
5
|
+
str.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
6
|
+
end
|
7
|
+
# Converts string to camelCase format
|
8
|
+
def camelize(str)
|
9
|
+
str.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'builder'
|
2
|
+
require 'httparty'
|
3
|
+
require 'date'
|
4
|
+
module AuthorizeNetReporting
|
5
|
+
# Gateway to connect to Authorize.net web services in order to interact with Reporting API
|
6
|
+
class Gateway
|
7
|
+
include HTTParty
|
8
|
+
headers 'Content-Type' => 'text/xml'
|
9
|
+
format :xml
|
10
|
+
|
11
|
+
# Authorize.net Developer TEST API
|
12
|
+
# Note: Authorize.net requires the use of a developer test payment gateway account, you may have to request one from Authorize.net Developer Center
|
13
|
+
TEST_URL = "https://apitest.authorize.net/xml/v1/request.api"
|
14
|
+
|
15
|
+
# Authorize.net Production API
|
16
|
+
LIVE_URL = "https://api.authorize.net/xml/v1/request.api"
|
17
|
+
|
18
|
+
# Authorize.net XML schema
|
19
|
+
XMLNS = "AnetApi/xml/v1/schema/AnetApiSchema.xsd"
|
20
|
+
|
21
|
+
# Make Http request
|
22
|
+
# param[String] xml api request
|
23
|
+
def send_xml(xml)
|
24
|
+
begin
|
25
|
+
Gateway.post(api_url, :body => xml)
|
26
|
+
rescue
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Using test or live mode?
|
32
|
+
def mode
|
33
|
+
@mode
|
34
|
+
end
|
35
|
+
|
36
|
+
# AuthorizeNet API Url test/live
|
37
|
+
def api_url
|
38
|
+
mode.eql?('test') ? TEST_URL : LIVE_URL
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
# AuthorizeNetReporting::Report
|
2
|
+
module AuthorizeNetReporting
|
3
|
+
# Initialize AuthorizeNetReporting::Report class
|
4
|
+
#
|
5
|
+
# report = AuthorizeNetReporting::Report.new({ :mode => ['test'|'live'], :key => 'your api key', :login => 'your api_login' })
|
6
|
+
class Report < Gateway
|
7
|
+
include Common
|
8
|
+
# Set API login, password and mode(live/test)
|
9
|
+
#
|
10
|
+
# AuthorizeNetReporting::Report.new({ :mode => ['test'|'live'], :key => 'your api key', :login => 'your api_login' })
|
11
|
+
# @param [Hash] { :mode => ['test'|'live'], :key => 'your api key', :login => 'your api_login' }
|
12
|
+
def initialize(options = {})
|
13
|
+
requires!(options, :mode, :key, :login)
|
14
|
+
@mode, @key, @login = options[:mode], options[:key], options[:login]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Authorize.net API function: getSettledBatchListRequest
|
18
|
+
#
|
19
|
+
# This function returns Batch ID, Settlement Time, & Settlement State for all settled batches with a range of dates.
|
20
|
+
# optionally you can include __:include_statistics => true__ to receive batch statistics by payment type and batch totals.
|
21
|
+
#
|
22
|
+
# If no dates are specified, then the default is the last 24 hours.
|
23
|
+
# @param [Hash] options { :first_settlement_date => "2011/04/20", :last_settlement_date => "2011/05/20", :include_statistics => true }
|
24
|
+
def settled_batch_list(options = {})
|
25
|
+
process_request(__method__, options)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Authorize.net API function getBatchStatisticsRequest
|
29
|
+
#
|
30
|
+
# Returns statistics for a single batch, specified by the batch ID.
|
31
|
+
# @param [Integer] batch_id
|
32
|
+
def batch_statistics(batch_id)
|
33
|
+
process_request(__method__, {:batch_id => batch_id})
|
34
|
+
end
|
35
|
+
|
36
|
+
# Authorize.net API function getTransactionListRequest
|
37
|
+
#
|
38
|
+
# Returns data for all transactions in a specified batch.
|
39
|
+
# @param [Integer] batch_id
|
40
|
+
def transaction_list(batch_id)
|
41
|
+
process_request(__method__, {:batch_id => batch_id})
|
42
|
+
end
|
43
|
+
|
44
|
+
# Authorize.net API function getUnsettledTransactionListRequest
|
45
|
+
#
|
46
|
+
# Returns data for unsettled transactions. This API function return data for up to 1000 of the most recent transactions
|
47
|
+
def unsettled_transaction_list
|
48
|
+
process_request(__method__)
|
49
|
+
end
|
50
|
+
|
51
|
+
# Authorize.net API function getTransactionDetailsRequest
|
52
|
+
#
|
53
|
+
# Get detailed information about one specific transaction
|
54
|
+
# @param [Integer] transaction_id, The transaction ID
|
55
|
+
def transaction_details(transaction_id)
|
56
|
+
process_request(__method__, {:transaction_id => transaction_id})
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
# Process request
|
61
|
+
# @param [Symbol] api_function requested, ':settled_batch_list', ':batch_statistics', ':transaction_details', ':transactions_list'
|
62
|
+
# @param [Hash] options, options to be passed to API request, '{:batch_id => 12345}'
|
63
|
+
def process_request(api_function, options = {})
|
64
|
+
xml = build_request(api_function, options)
|
65
|
+
response = send_xml(xml)
|
66
|
+
handle_response(api_function,response)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Validates that required parameters are present
|
70
|
+
# @param [Hash] hash
|
71
|
+
# @param [Symbol] params required :mode, :key
|
72
|
+
def requires!(hash, *params)
|
73
|
+
params.each do |param|
|
74
|
+
raise ArgumentError, "Missing Required Parameter #{param}" unless hash.has_key?(param)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# Build xml request file for specified API function and options requested
|
79
|
+
# @param[String], api_fundtion requested ':settled_batch_list', 'batch_statistics', ':transaction_details', ':transactions_list'
|
80
|
+
# @param [Hash] options, options to be passed to API request, '{:batch_id => 12345}'
|
81
|
+
def build_request(api_function, options = {})
|
82
|
+
api_request = "get#{camelize(api_function.to_s)}Request"
|
83
|
+
xml = Builder::XmlMarkup.new(:indent => 2)
|
84
|
+
xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
|
85
|
+
xml.tag!(api_request, :xmlns => XMLNS) do
|
86
|
+
xml.tag!('merchantAuthentication') do
|
87
|
+
xml.tag!('name', @login)
|
88
|
+
xml.tag!('transactionKey', @key)
|
89
|
+
end
|
90
|
+
send("build_#{underscore(api_request)}", xml, options)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def build_get_settled_batch_list_request(xml, options) #:nodoc:
|
95
|
+
xml.tag!("includeStatistics", true) if options[:include_statistics]
|
96
|
+
if options[:first_settlement_date] and options[:last_settlement_date]
|
97
|
+
xml.tag!("firstSettlementDate", Date.parse(options[:first_settlement_date]).strftime("%Y-%m-%dT00:00:00Z"))
|
98
|
+
xml.tag!("lastSettlementDate", Date.parse(options[:last_settlement_date]).strftime("%Y-%m-%dT00:00:00Z"))
|
99
|
+
end
|
100
|
+
xml.target!
|
101
|
+
end
|
102
|
+
|
103
|
+
def build_get_batch_statistics_request(xml, options) #:nodoc:
|
104
|
+
xml.tag!("batchId", options[:batch_id])
|
105
|
+
xml.target!
|
106
|
+
end
|
107
|
+
|
108
|
+
def build_get_transaction_list_request(xml, options) #:nodoc:
|
109
|
+
xml.tag!("batchId", options[:batch_id])
|
110
|
+
xml.target!
|
111
|
+
end
|
112
|
+
|
113
|
+
def build_get_unsettled_transaction_list_request(xml, options) #:nodoc:
|
114
|
+
xml.target!
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_get_transaction_details_request(xml, options) #:nodoc:
|
118
|
+
xml.tag!('transId', options[:transaction_id])
|
119
|
+
xml.target!
|
120
|
+
end
|
121
|
+
|
122
|
+
# Call to Response.parse to handle response if transaction is successful, otherwise raise StandardError
|
123
|
+
def handle_response(api_function, response)
|
124
|
+
response_message = get_response_message(api_function, response)
|
125
|
+
if response_message =~ /successful/
|
126
|
+
eval("AuthorizeNetReporting::Response.parse_#{api_function}(#{response.parsed_response})")
|
127
|
+
elsif response_message =~ /found/
|
128
|
+
["transaction_details", "batch_statistics"].include?(api_function.to_s) ? nil : []
|
129
|
+
else
|
130
|
+
raise StandardError, response_message
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
# Extract response message from response for specified api_function
|
135
|
+
def get_response_message(api_function, response)
|
136
|
+
api_response = "get#{camelize(api_function.to_s)}Response"
|
137
|
+
if response.parsed_response[api_response]
|
138
|
+
message = response.parsed_response[api_response]["messages"]["message"]["text"]
|
139
|
+
else
|
140
|
+
message = response.parsed_response["ErrorResponse"]["messages"]["message"]["text"] rescue "Unable to execute transaction"
|
141
|
+
end
|
142
|
+
message.downcase
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
module AuthorizeNetReporting
|
2
|
+
# AuthorizeNetReporting::Response parses the response from Authorize.net API and turns results into objects setting attributes for easy integration
|
3
|
+
|
4
|
+
class Response
|
5
|
+
extend Common
|
6
|
+
# Parse response for settled_batch_list
|
7
|
+
def self.parse_settled_batch_list(response)
|
8
|
+
batch_list = response["getSettledBatchListResponse"]["batchList"]["batch"]
|
9
|
+
batches = []
|
10
|
+
batch_list.each do |batch|
|
11
|
+
statistics = extract_batch_statistics(batch)
|
12
|
+
params = to_single_hash(batch)
|
13
|
+
params.merge!("statistics" => statistics) unless statistics.blank?
|
14
|
+
batches << create_class("Batch", params)
|
15
|
+
end
|
16
|
+
batches
|
17
|
+
end
|
18
|
+
|
19
|
+
# Parse response for batch_statistics
|
20
|
+
def self.parse_batch_statistics(response)
|
21
|
+
batch = response["getBatchStatisticsResponse"]["batch"]
|
22
|
+
statistics = extract_batch_statistics(batch)
|
23
|
+
params = to_single_hash(batch)
|
24
|
+
params.merge!("statistics" => statistics) unless statistics.blank?
|
25
|
+
create_class("Batch", params)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Parse response for transaction_list
|
29
|
+
def self.parse_transaction_list(response)
|
30
|
+
transactions = [response["getTransactionListResponse"]["transactions"]["transaction"]].flatten
|
31
|
+
transaction_list = []
|
32
|
+
transactions.each do |transaction|
|
33
|
+
transaction_list << create_class("AuthorizeNetTransaction", to_single_hash(transaction))
|
34
|
+
end
|
35
|
+
transaction_list
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# Parse response unsettled_transaction
|
40
|
+
def self.parse_unsettled_transaction_list(response)
|
41
|
+
unsettled_transactions = [response["getUnsettledTransactionListResponse"]["transactions"]["transaction"]]
|
42
|
+
transactions = []
|
43
|
+
unsettled_transactions.each do |transaction|
|
44
|
+
transactions << create_class("AuthorizeNetTransaction", to_single_hash(transaction))
|
45
|
+
end
|
46
|
+
transactions
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Parse response transaction_details
|
51
|
+
def self.parse_transaction_details(response)
|
52
|
+
params = response["getTransactionDetailsResponse"]["transaction"]
|
53
|
+
create_class("AuthorizeNetTransaction", to_single_hash(params))
|
54
|
+
end
|
55
|
+
|
56
|
+
# Handle batch statistics
|
57
|
+
def self.extract_batch_statistics(batch)
|
58
|
+
statistics = []
|
59
|
+
if batch["statistics"]
|
60
|
+
batch_statistics = [batch["statistics"]["statistic"]].flatten
|
61
|
+
batch_statistics.each do |statistic|
|
62
|
+
statistic = statistic.inject({}) {|h, (key,value)| h[underscore(key)] = value; h}
|
63
|
+
statistics << statistic
|
64
|
+
end
|
65
|
+
end
|
66
|
+
statistics
|
67
|
+
end
|
68
|
+
|
69
|
+
# Convert response nested hash into a single hash
|
70
|
+
# param[Hash] hash
|
71
|
+
def self.to_single_hash(hash)
|
72
|
+
hash.each do |key, value|
|
73
|
+
case value
|
74
|
+
when Hash then to_single_hash(value)
|
75
|
+
when String, Integer then (@temp_hash||={})[underscore(key)] = value
|
76
|
+
end
|
77
|
+
end
|
78
|
+
@temp_hash
|
79
|
+
end
|
80
|
+
|
81
|
+
#Create objects dinamicaly
|
82
|
+
def self.create_class(class_name, params)
|
83
|
+
if AuthorizeNetReporting.const_defined?(class_name)
|
84
|
+
klass = AuthorizeNetReporting.const_get(class_name)
|
85
|
+
else
|
86
|
+
klass = AuthorizeNetReporting.const_set(class_name, Class.new)
|
87
|
+
klass.class_eval do
|
88
|
+
define_method(:initialize) do |params|
|
89
|
+
params.each do |key, value|
|
90
|
+
self.class.__send__(:attr_accessor, key)
|
91
|
+
instance_variable_set("@#{key}", value)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
klass.new(params)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
describe AuthorizeNetReporting::Report do
|
3
|
+
let(:test_mode) do
|
4
|
+
#TEST API LOGIN: 3vk59E5BgM - API KEY:4c8FeAW7ebq5U733
|
5
|
+
{ :mode => "test", :login=>"3vk59E5BgM", :key => "4c8FeAW7ebq5U733" }
|
6
|
+
end
|
7
|
+
|
8
|
+
let(:live_mode) do
|
9
|
+
{ :mode => "live", :key=>"key", :login => "login" }
|
10
|
+
end
|
11
|
+
context "missing requirements" do
|
12
|
+
it "should raise exception" do
|
13
|
+
lambda { AuthorizeNetReporting::Report.new }.should raise_error(ArgumentError)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
describe "API URL in live mode" do
|
17
|
+
subject { AuthorizeNetReporting::Report.new(live_mode) }
|
18
|
+
it "should be live url" do
|
19
|
+
subject.api_url.should eql(AuthorizeNetReporting::Report::LIVE_URL)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
before(:each) do
|
24
|
+
@authorize_net_reporting = AuthorizeNetReporting::Report.new(test_mode)
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "API URL in test mode" do
|
28
|
+
it 'should be test url' do
|
29
|
+
@authorize_net_reporting.api_url.should eql(AuthorizeNetReporting::Report::TEST_URL)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "settled_batch_list" do
|
34
|
+
context "when there are not batches settled" do
|
35
|
+
it "should return an empty array" do
|
36
|
+
@authorize_net_reporting.settled_batch_list.should be_empty
|
37
|
+
end
|
38
|
+
end
|
39
|
+
context "when there are settled batches" do
|
40
|
+
it "should return batches" do
|
41
|
+
batches = @authorize_net_reporting.settled_batch_list({:first_settlement_date => "2011/04/20", :last_settlement_date => "2011/05/20"})
|
42
|
+
batches.size.should eql(4)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
context "when request include statistics" do
|
46
|
+
it "should return statistis as an Array" do
|
47
|
+
batches = @authorize_net_reporting.settled_batch_list({:first_settlement_date => "2011/04/20", :last_settlement_date => "2011/05/20", :include_statistics => true})
|
48
|
+
batches.first.statistics.should be_an_instance_of(Array)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "batch_statistics" do
|
54
|
+
it "should return an array statistics for given batch" do
|
55
|
+
@authorize_net_reporting.batch_statistics(1049686).statistics.should be_an_instance_of(Array)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "transactions_list" do
|
60
|
+
it "should return all transactions in a specified batch" do
|
61
|
+
transactions = @authorize_net_reporting.transaction_list(1049686)
|
62
|
+
transactions.size.should eql(4)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe "unsettled_transaction_list" do
|
67
|
+
it "should return unsettled transactions" do
|
68
|
+
transactions = @authorize_net_reporting.unsettled_transaction_list
|
69
|
+
transactions.should be_an_instance_of(Array)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "transaction_details" do
|
74
|
+
it "should return transaction if transaction_exists" do
|
75
|
+
transaction = @authorize_net_reporting.transaction_details(2157585857)
|
76
|
+
transaction.should be_an_instance_of(AuthorizeNetReporting::AuthorizeNetTransaction)
|
77
|
+
end
|
78
|
+
it "should return nil if transaction doesn't exist" do
|
79
|
+
@authorize_net_reporting.transaction_details(0).should be_nil
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'authorize_net_reporting'
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: authorize_net_reporting
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jazmin Schroeder
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2011-07-04 00:00:00 -05:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: httparty
|
18
|
+
prerelease: false
|
19
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
none: false
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: "0"
|
25
|
+
type: :runtime
|
26
|
+
version_requirements: *id001
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: builder
|
29
|
+
prerelease: false
|
30
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
+
none: false
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: "0"
|
36
|
+
type: :runtime
|
37
|
+
version_requirements: *id002
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: rspec
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
type: :development
|
48
|
+
version_requirements: *id003
|
49
|
+
description: "Retrieve transaction details through the Authorize.net Transaction Details API "
|
50
|
+
email:
|
51
|
+
- jazminschroeder@gmail.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files: []
|
57
|
+
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- .rspec
|
61
|
+
- Gemfile
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- authorize_net_reporting.gemspec
|
65
|
+
- lib/authorize_net_reporting.rb
|
66
|
+
- lib/authorize_net_reporting/common.rb
|
67
|
+
- lib/authorize_net_reporting/gateway.rb
|
68
|
+
- lib/authorize_net_reporting/report.rb
|
69
|
+
- lib/authorize_net_reporting/response.rb
|
70
|
+
- lib/authorize_net_reporting/version.rb
|
71
|
+
- spec/authorize_net_reporting_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
has_rdoc: true
|
74
|
+
homepage: ""
|
75
|
+
licenses: []
|
76
|
+
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: "0"
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: "0"
|
94
|
+
requirements: []
|
95
|
+
|
96
|
+
rubyforge_project: authorize_net_reporting
|
97
|
+
rubygems_version: 1.5.0
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Authorize.net Transaction Details API
|
101
|
+
test_files: []
|
102
|
+
|