authorizenet 1.8.7 → 1.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/lib/app/helpers/authorize_net_helper.rb +23 -23
  3. data/lib/authorize_net.rb +107 -103
  4. data/lib/authorize_net/addresses/address.rb +28 -28
  5. data/lib/authorize_net/addresses/shipping_address.rb +25 -25
  6. data/lib/authorize_net/aim/response.rb +130 -130
  7. data/lib/authorize_net/aim/transaction.rb +190 -190
  8. data/lib/authorize_net/api/api_transaction.rb +103 -102
  9. data/lib/authorize_net/api/schema.rb +4283 -4283
  10. data/lib/authorize_net/api/transaction.rb +240 -240
  11. data/lib/authorize_net/arb/fields.rb +24 -24
  12. data/lib/authorize_net/arb/paging.rb +33 -33
  13. data/lib/authorize_net/arb/response.rb +33 -33
  14. data/lib/authorize_net/arb/sorting.rb +43 -43
  15. data/lib/authorize_net/arb/subscription.rb +71 -71
  16. data/lib/authorize_net/arb/subscription_detail.rb +14 -14
  17. data/lib/authorize_net/arb/subscription_list_response.rb +43 -43
  18. data/lib/authorize_net/arb/transaction.rb +177 -177
  19. data/lib/authorize_net/authorize_net.rb +153 -153
  20. data/lib/authorize_net/cim/customer_profile.rb +18 -18
  21. data/lib/authorize_net/cim/payment_profile.rb +36 -36
  22. data/lib/authorize_net/cim/response.rb +115 -115
  23. data/lib/authorize_net/cim/transaction.rb +727 -727
  24. data/lib/authorize_net/customer.rb +26 -26
  25. data/lib/authorize_net/email_receipt.rb +23 -23
  26. data/lib/authorize_net/fields.rb +779 -779
  27. data/lib/authorize_net/key_value_response.rb +116 -116
  28. data/lib/authorize_net/key_value_transaction.rb +290 -290
  29. data/lib/authorize_net/line_item.rb +24 -24
  30. data/lib/authorize_net/order.rb +41 -41
  31. data/lib/authorize_net/payment_methods/credit_card.rb +62 -62
  32. data/lib/authorize_net/payment_methods/echeck.rb +71 -71
  33. data/lib/authorize_net/reporting/batch.rb +18 -18
  34. data/lib/authorize_net/reporting/batch_statistics.rb +18 -18
  35. data/lib/authorize_net/reporting/fds_filter.rb +10 -10
  36. data/lib/authorize_net/reporting/response.rb +162 -162
  37. data/lib/authorize_net/reporting/returned_item.rb +46 -46
  38. data/lib/authorize_net/reporting/transaction.rb +133 -133
  39. data/lib/authorize_net/reporting/transaction_details.rb +24 -24
  40. data/lib/authorize_net/response.rb +26 -26
  41. data/lib/authorize_net/sim/hosted_payment_form.rb +37 -37
  42. data/lib/authorize_net/sim/hosted_receipt_page.rb +36 -36
  43. data/lib/authorize_net/sim/response.rb +141 -141
  44. data/lib/authorize_net/sim/transaction.rb +137 -137
  45. data/lib/authorize_net/transaction.rb +65 -65
  46. data/lib/authorize_net/xml_response.rb +171 -171
  47. data/lib/authorize_net/xml_transaction.rb +280 -280
  48. data/lib/authorizenet.rb +4 -4
  49. data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +53 -53
  50. data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +48 -48
  51. data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +8 -8
  52. data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +8 -8
  53. data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +30 -30
  54. data/lib/generators/authorize_net/direct_post/templates/initializer.rb +4 -4
  55. data/lib/generators/authorize_net/direct_post/templates/layout.erb +17 -17
  56. data/lib/generators/authorize_net/direct_post/templates/payment.erb +9 -9
  57. data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +9 -9
  58. data/lib/generators/authorize_net/sim/sim_generator.rb +47 -47
  59. data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +51 -51
  60. data/lib/generators/authorize_net/sim/templates/config.yml.erb +8 -8
  61. data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +8 -8
  62. data/lib/generators/authorize_net/sim/templates/controller.rb.erb +20 -20
  63. data/lib/generators/authorize_net/sim/templates/initializer.rb +4 -4
  64. data/lib/generators/authorize_net/sim/templates/layout.erb +17 -17
  65. data/lib/generators/authorize_net/sim/templates/payment.erb +5 -5
  66. data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +5 -5
  67. data/lib/generators/generator_extensions.rb +74 -74
  68. metadata +4 -3
@@ -1,24 +1,24 @@
1
- module AuthorizeNet::ARB
2
- module Fields
3
- EntityDescription = Struct.new(:node_structure, :entity_class, :arg_mapping)
4
-
5
- SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION = EntityDescription.new(
6
- [
7
- {:id => :id},
8
- {:name => :name},
9
- {:status => :status},
10
- {:createTimeStampUTC => :create_time_stamp_utc},
11
- {:firstName => :first_name},
12
- {:lastName => :last_name},
13
- {:totalOccurrences => :total_occurrences},
14
- {:pastOccurrences => :past_occurrences},
15
- {:paymentMethod => :payment_method},
16
- {:accountNumber => :account_number},
17
- {:invoice => :invoice},
18
- {:amount => :amount},
19
- {:currencyId => :currency_id}
20
- ],
21
- AuthorizeNet::ARB::SubscriptionDetail
22
- )
23
- end
24
- end
1
+ module AuthorizeNet::ARB
2
+ module Fields
3
+ EntityDescription = Struct.new(:node_structure, :entity_class, :arg_mapping)
4
+
5
+ SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION = EntityDescription.new(
6
+ [
7
+ {:id => :id},
8
+ {:name => :name},
9
+ {:status => :status},
10
+ {:createTimeStampUTC => :create_time_stamp_utc},
11
+ {:firstName => :first_name},
12
+ {:lastName => :last_name},
13
+ {:totalOccurrences => :total_occurrences},
14
+ {:pastOccurrences => :past_occurrences},
15
+ {:paymentMethod => :payment_method},
16
+ {:accountNumber => :account_number},
17
+ {:invoice => :invoice},
18
+ {:amount => :amount},
19
+ {:currencyId => :currency_id}
20
+ ],
21
+ AuthorizeNet::ARB::SubscriptionDetail
22
+ )
23
+ end
24
+ end
@@ -1,33 +1,33 @@
1
- module AuthorizeNet::ARB
2
-
3
- class Paging
4
-
5
- # Models Paging
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :offset,:limit
9
-
10
- # Initializes Paging object.
11
- #
12
- # Typical usage:
13
- # paging = AuthorizeNet::ARB::Paging.new(1,1000)
14
- #
15
- # Valid values for offset: 1 to 100000
16
- # Valid values for limit: 1 to 1000
17
- #
18
- def initialize(offset,limit)
19
- @offset = offset
20
- @limit = limit
21
- end
22
-
23
- def to_hash
24
- hash = {
25
- :offset => @offset,
26
- :limit => @limit
27
- }
28
- hash.delete_if {|k, v| v.nil?}
29
- end
30
-
31
- end
32
-
33
- end
1
+ module AuthorizeNet::ARB
2
+
3
+ class Paging
4
+
5
+ # Models Paging
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :offset,:limit
9
+
10
+ # Initializes Paging object.
11
+ #
12
+ # Typical usage:
13
+ # paging = AuthorizeNet::ARB::Paging.new(1,1000)
14
+ #
15
+ # Valid values for offset: 1 to 100000
16
+ # Valid values for limit: 1 to 1000
17
+ #
18
+ def initialize(offset,limit)
19
+ @offset = offset
20
+ @limit = limit
21
+ end
22
+
23
+ def to_hash
24
+ hash = {
25
+ :offset => @offset,
26
+ :limit => @limit
27
+ }
28
+ hash.delete_if {|k, v| v.nil?}
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -1,34 +1,34 @@
1
- module AuthorizeNet::ARB
2
-
3
- # The ARB response class.
4
- class Response < AuthorizeNet::XmlResponse
5
-
6
- # Constructs a new response object from a +raw_response. You don't typically
7
- # construct this object yourself, as AuthorizeNet::ARB::Transaction will
8
- # build one for you when it makes the request to the gateway.
9
- def initialize(raw_response, transaction)
10
- super
11
- unless connection_failure?
12
- begin
13
- @subscription_id = node_content_unless_nil(@root.at_css('subscriptionId'))
14
- @subscription_status = node_content_unless_nil(@root.at_css('Status'))
15
- rescue
16
- @raw_response = $!
17
- end
18
- end
19
- end
20
-
21
- # Returns the subscriptionId from the response if there is one. Otherwise returns nil.
22
- def subscription_id
23
- @subscription_id
24
- end
25
-
26
- # Returns the status of the Subscription from the response if there is one. Otherwise returns nil. This value
27
- # is only returned in response to a get_status transaction.
28
- def subscription_status
29
- @subscription_status
30
- end
31
-
32
- end
33
-
1
+ module AuthorizeNet::ARB
2
+
3
+ # The ARB response class.
4
+ class Response < AuthorizeNet::XmlResponse
5
+
6
+ # Constructs a new response object from a +raw_response. You don't typically
7
+ # construct this object yourself, as AuthorizeNet::ARB::Transaction will
8
+ # build one for you when it makes the request to the gateway.
9
+ def initialize(raw_response, transaction)
10
+ super
11
+ unless connection_failure?
12
+ begin
13
+ @subscription_id = node_content_unless_nil(@root.at_css('subscriptionId'))
14
+ @subscription_status = node_content_unless_nil(@root.at_css('Status'))
15
+ rescue
16
+ @raw_response = $!
17
+ end
18
+ end
19
+ end
20
+
21
+ # Returns the subscriptionId from the response if there is one. Otherwise returns nil.
22
+ def subscription_id
23
+ @subscription_id
24
+ end
25
+
26
+ # Returns the status of the Subscription from the response if there is one. Otherwise returns nil. This value
27
+ # is only returned in response to a get_status transaction.
28
+ def subscription_status
29
+ @subscription_status
30
+ end
31
+
32
+ end
33
+
34
34
  end
@@ -1,43 +1,43 @@
1
- module AuthorizeNet::ARB
2
-
3
- class Sorting
4
-
5
- # Models Sorting
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :order_by, :order_descending
9
-
10
- # Initializes Sorting object.
11
- #
12
- # Typical usage:
13
- # sorting = AuthorizeNet::ARB::Sorting.new('name',true)
14
- #
15
- # Valid values for order_by values of the AuthorizeNet::ARB::Sorting:
16
- # id
17
- # name
18
- # status
19
- # createTimeStampUTC
20
- # lastName
21
- # firstName
22
- # accountNumber
23
- # amount
24
- # pastOccurrences
25
- #
26
- # Valid values for order_descending: true, false, 1, 0
27
- #
28
- def initialize(order_by, order_descending)
29
- @order_by = order_by
30
- @order_descending = order_descending
31
- end
32
-
33
- def to_hash
34
- hash = {
35
- :order_by => @order_by,
36
- :order_descending => @order_descending
37
- }
38
- hash.delete_if {|k, v| v.nil?}
39
- end
40
-
41
- end
42
-
43
- end
1
+ module AuthorizeNet::ARB
2
+
3
+ class Sorting
4
+
5
+ # Models Sorting
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :order_by, :order_descending
9
+
10
+ # Initializes Sorting object.
11
+ #
12
+ # Typical usage:
13
+ # sorting = AuthorizeNet::ARB::Sorting.new('name',true)
14
+ #
15
+ # Valid values for order_by values of the AuthorizeNet::ARB::Sorting:
16
+ # id
17
+ # name
18
+ # status
19
+ # createTimeStampUTC
20
+ # lastName
21
+ # firstName
22
+ # accountNumber
23
+ # amount
24
+ # pastOccurrences
25
+ #
26
+ # Valid values for order_descending: true, false, 1, 0
27
+ #
28
+ def initialize(order_by, order_descending)
29
+ @order_by = order_by
30
+ @order_descending = order_descending
31
+ end
32
+
33
+ def to_hash
34
+ hash = {
35
+ :order_by => @order_by,
36
+ :order_descending => @order_descending
37
+ }
38
+ hash.delete_if {|k, v| v.nil?}
39
+ end
40
+
41
+ end
42
+
43
+ end
@@ -1,72 +1,72 @@
1
- module AuthorizeNet::ARB
2
-
3
- # Models an ARB subscription.
4
- class Subscription
5
-
6
- # Use this constant for the value of total_occurrences to get a subscription with no end.
7
- UNLIMITED_OCCURRENCES = 9999
8
-
9
- # Constants for the various interval units supported by the ARB API.
10
- module IntervalUnits
11
- MONTH = 'months'
12
- DAY = 'days'
13
- end
14
-
15
- # Constants for the various statuses a subscription can have. These are returned by the get_status call.
16
- module Status
17
- ACTIVE = 'active'
18
- EXPIRED = 'expired'
19
- SUSPENDED = 'suspended'
20
- CANCELED = 'canceled'
21
- TERMINATED = 'terminated'
22
- end
23
-
24
- include AuthorizeNet::Model
25
-
26
- attr_accessor :name, :length, :unit, :start_date, :total_occurrences, :trial_occurrences, :amount, :trial_amount, :invoice_number, :description, :subscription_id, :credit_card, :billing_address, :shipping_address, :customer
27
-
28
- # Override the total_occurrences setter to provide support for :unlimited shortcut.
29
- def total_occurrences=(new_total_occurrences) #:nodoc:
30
- if new_total_occurrences == :unlimited
31
- @total_occurrences = UNLIMITED_OCCURRENCES
32
- else
33
- @total_occurrences = new_total_occurrences
34
- end
35
- end
36
-
37
- # Override the unit setter to provide support for :day, :days, :month, :months shortcut. Do not document this method in rdoc.
38
- def unit=(new_unit) #:nodoc:
39
- case new_unit
40
- when :day, :days
41
- @unit = IntervalUnits::DAY
42
- when :month, :months
43
- @unit = IntervalUnits::MONTH
44
- else
45
- @unit = new_unit
46
- end
47
- end
48
-
49
- def to_hash
50
- hash = {
51
- :subscription_name => @name,
52
- :subscription_length => @length,
53
- :subscription_unit => @unit,
54
- :subscription_start_date => @start_date,
55
- :subscription_total_occurrences => @total_occurrences,
56
- :subscription_trial_occurrences => @trial_occurrences,
57
- :subscription_amount => @amount,
58
- :subscription_trial_amount => @trial_amount,
59
- :invoice_num => @invoice_number,
60
- :description => @description,
61
- :subscription_id => @subscription_id
62
- }
63
- hash.merge!(@credit_card.to_hash) unless @credit_card.nil?
64
- hash.merge!(@billing_address.to_hash) unless @billing_address.nil?
65
- hash.merge!(@shipping_address.to_hash) unless @shipping_address.nil?
66
- hash.merge!(@customer.to_hash) unless @customer.nil?
67
- hash.delete_if {|k, v| v.nil?}
68
- end
69
-
70
- end
71
-
1
+ module AuthorizeNet::ARB
2
+
3
+ # Models an ARB subscription.
4
+ class Subscription
5
+
6
+ # Use this constant for the value of total_occurrences to get a subscription with no end.
7
+ UNLIMITED_OCCURRENCES = 9999
8
+
9
+ # Constants for the various interval units supported by the ARB API.
10
+ module IntervalUnits
11
+ MONTH = 'months'
12
+ DAY = 'days'
13
+ end
14
+
15
+ # Constants for the various statuses a subscription can have. These are returned by the get_status call.
16
+ module Status
17
+ ACTIVE = 'active'
18
+ EXPIRED = 'expired'
19
+ SUSPENDED = 'suspended'
20
+ CANCELED = 'canceled'
21
+ TERMINATED = 'terminated'
22
+ end
23
+
24
+ include AuthorizeNet::Model
25
+
26
+ attr_accessor :name, :length, :unit, :start_date, :total_occurrences, :trial_occurrences, :amount, :trial_amount, :invoice_number, :description, :subscription_id, :credit_card, :billing_address, :shipping_address, :customer
27
+
28
+ # Override the total_occurrences setter to provide support for :unlimited shortcut.
29
+ def total_occurrences=(new_total_occurrences) #:nodoc:
30
+ if new_total_occurrences == :unlimited
31
+ @total_occurrences = UNLIMITED_OCCURRENCES
32
+ else
33
+ @total_occurrences = new_total_occurrences
34
+ end
35
+ end
36
+
37
+ # Override the unit setter to provide support for :day, :days, :month, :months shortcut. Do not document this method in rdoc.
38
+ def unit=(new_unit) #:nodoc:
39
+ case new_unit
40
+ when :day, :days
41
+ @unit = IntervalUnits::DAY
42
+ when :month, :months
43
+ @unit = IntervalUnits::MONTH
44
+ else
45
+ @unit = new_unit
46
+ end
47
+ end
48
+
49
+ def to_hash
50
+ hash = {
51
+ :subscription_name => @name,
52
+ :subscription_length => @length,
53
+ :subscription_unit => @unit,
54
+ :subscription_start_date => @start_date,
55
+ :subscription_total_occurrences => @total_occurrences,
56
+ :subscription_trial_occurrences => @trial_occurrences,
57
+ :subscription_amount => @amount,
58
+ :subscription_trial_amount => @trial_amount,
59
+ :invoice_num => @invoice_number,
60
+ :description => @description,
61
+ :subscription_id => @subscription_id
62
+ }
63
+ hash.merge!(@credit_card.to_hash) unless @credit_card.nil?
64
+ hash.merge!(@billing_address.to_hash) unless @billing_address.nil?
65
+ hash.merge!(@shipping_address.to_hash) unless @shipping_address.nil?
66
+ hash.merge!(@customer.to_hash) unless @customer.nil?
67
+ hash.delete_if {|k, v| v.nil?}
68
+ end
69
+
70
+ end
71
+
72
72
  end
@@ -1,14 +1,14 @@
1
- module AuthorizeNet::ARB
2
-
3
- # Models Subscription Detail.
4
- class SubscriptionDetail
5
-
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :id, :name, :status, :create_time_stamp_utc, :first_name,
9
- :last_name, :total_occurrences, :past_occurrences,
10
- :payment_method, :account_number, :invoice, :amount, :currency_id
11
-
12
- end
13
-
14
- end
1
+ module AuthorizeNet::ARB
2
+
3
+ # Models Subscription Detail.
4
+ class SubscriptionDetail
5
+
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :id, :name, :status, :create_time_stamp_utc, :first_name,
9
+ :last_name, :total_occurrences, :past_occurrences,
10
+ :payment_method, :account_number, :invoice, :amount, :currency_id
11
+
12
+ end
13
+
14
+ end
@@ -1,43 +1,43 @@
1
- module AuthorizeNet::ARB
2
-
3
- class SubscriptionListResponse < AuthorizeNet::XmlResponse
4
- # Constructs a new response object from a +raw_response. You don't typically
5
- # construct this object yourself, as AuthorizeNet::ARB::Transaction will
6
- # build one for you when it makes the request to the gateway.
7
- def initialize(raw_response, transaction)
8
- super
9
- unless connection_failure?
10
- begin
11
- @subscription_details = @root.at_css('subscriptionDetails')
12
- @subscription_detail = @root.at_css('subscriptionDetail')
13
- @total_num_in_resultset = node_content_unless_nil(@root.at_css('totalNumInResultSet'))
14
-
15
- rescue
16
- @raw_response = $!
17
- end
18
- end
19
- end
20
-
21
- # Returns total number of subscriptions matching the search criteria
22
- def total_num_in_resultset
23
- @total_num_in_resultset
24
- end
25
-
26
- # Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned.
27
- def subscription_details
28
- unless @subscription_details.nil?
29
- subscription_details = []
30
- @subscription_details.element_children.each do |child|
31
- unless child.nil?
32
- subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION)
33
-
34
- subscription_details <<= subscription_detail
35
- end
36
- end
37
- return subscription_details unless subscription_details.length == 0
38
- end
39
- end
40
-
41
- end
42
-
43
- end
1
+ module AuthorizeNet::ARB
2
+
3
+ class SubscriptionListResponse < AuthorizeNet::XmlResponse
4
+ # Constructs a new response object from a +raw_response. You don't typically
5
+ # construct this object yourself, as AuthorizeNet::ARB::Transaction will
6
+ # build one for you when it makes the request to the gateway.
7
+ def initialize(raw_response, transaction)
8
+ super
9
+ unless connection_failure?
10
+ begin
11
+ @subscription_details = @root.at_css('subscriptionDetails')
12
+ @subscription_detail = @root.at_css('subscriptionDetail')
13
+ @total_num_in_resultset = node_content_unless_nil(@root.at_css('totalNumInResultSet'))
14
+
15
+ rescue
16
+ @raw_response = $!
17
+ end
18
+ end
19
+ end
20
+
21
+ # Returns total number of subscriptions matching the search criteria
22
+ def total_num_in_resultset
23
+ @total_num_in_resultset
24
+ end
25
+
26
+ # Returns an Array of SubscriptionDetail objects built from the entities returned in the response. Returns nil if no subscriptions were returned.
27
+ def subscription_details
28
+ unless @subscription_details.nil?
29
+ subscription_details = []
30
+ @subscription_details.element_children.each do |child|
31
+ unless child.nil?
32
+ subscription_detail = build_entity(child, Fields::SUBSCRIPTION_DETAIL_ENTITY_DESCRIPTION)
33
+
34
+ subscription_details <<= subscription_detail
35
+ end
36
+ end
37
+ return subscription_details unless subscription_details.length == 0
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ end