authorizenet 1.9.6 → 1.9.7

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