authorizenet 1.9.5 → 1.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  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/api_transaction.rb +119 -119
  9. data/lib/authorize_net/api/constants.yml +1 -1
  10. data/lib/authorize_net/api/schema.rb +5165 -5153
  11. data/lib/authorize_net/api/transaction.rb +261 -261
  12. data/lib/authorize_net/arb/fields.rb +24 -24
  13. data/lib/authorize_net/arb/paging.rb +29 -29
  14. data/lib/authorize_net/arb/response.rb +26 -26
  15. data/lib/authorize_net/arb/sorting.rb +39 -39
  16. data/lib/authorize_net/arb/subscription.rb +68 -68
  17. data/lib/authorize_net/arb/subscription_detail.rb +10 -10
  18. data/lib/authorize_net/arb/subscription_list_response.rb +36 -36
  19. data/lib/authorize_net/arb/transaction.rb +171 -171
  20. data/lib/authorize_net/authorize_net.rb +154 -154
  21. data/lib/authorize_net/cim/customer_profile.rb +15 -15
  22. data/lib/authorize_net/cim/payment_profile.rb +35 -35
  23. data/lib/authorize_net/cim/response.rb +111 -111
  24. data/lib/authorize_net/cim/transaction.rb +721 -721
  25. data/lib/authorize_net/customer.rb +24 -24
  26. data/lib/authorize_net/email_receipt.rb +20 -20
  27. data/lib/authorize_net/fields.rb +760 -760
  28. data/lib/authorize_net/key_value_response.rb +109 -109
  29. data/lib/authorize_net/key_value_transaction.rb +281 -281
  30. data/lib/authorize_net/line_item.rb +21 -21
  31. data/lib/authorize_net/order.rb +38 -38
  32. data/lib/authorize_net/payment_methods/credit_card.rb +61 -61
  33. data/lib/authorize_net/payment_methods/echeck.rb +70 -70
  34. data/lib/authorize_net/reporting/batch.rb +16 -16
  35. data/lib/authorize_net/reporting/batch_statistics.rb +15 -15
  36. data/lib/authorize_net/reporting/fds_filter.rb +8 -8
  37. data/lib/authorize_net/reporting/response.rb +157 -157
  38. data/lib/authorize_net/reporting/returned_item.rb +45 -45
  39. data/lib/authorize_net/reporting/transaction.rb +131 -131
  40. data/lib/authorize_net/reporting/transaction_details.rb +22 -22
  41. data/lib/authorize_net/response.rb +25 -25
  42. data/lib/authorize_net/sim/hosted_payment_form.rb +34 -34
  43. data/lib/authorize_net/sim/hosted_receipt_page.rb +32 -32
  44. data/lib/authorize_net/sim/response.rb +133 -133
  45. data/lib/authorize_net/sim/transaction.rb +128 -128
  46. data/lib/authorize_net/transaction.rb +66 -66
  47. data/lib/authorize_net/xml_response.rb +154 -154
  48. data/lib/authorize_net/xml_transaction.rb +279 -279
  49. data/lib/authorizenet.rb +4 -4
  50. data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +52 -52
  51. data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +48 -48
  52. data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +8 -8
  53. data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +8 -8
  54. data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +30 -30
  55. data/lib/generators/authorize_net/direct_post/templates/initializer.rb +4 -4
  56. data/lib/generators/authorize_net/direct_post/templates/layout.erb +17 -17
  57. data/lib/generators/authorize_net/direct_post/templates/payment.erb +9 -9
  58. data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +9 -9
  59. data/lib/generators/authorize_net/sim/sim_generator.rb +46 -46
  60. data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +51 -51
  61. data/lib/generators/authorize_net/sim/templates/config.yml.erb +8 -8
  62. data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +8 -8
  63. data/lib/generators/authorize_net/sim/templates/controller.rb.erb +20 -20
  64. data/lib/generators/authorize_net/sim/templates/initializer.rb +4 -4
  65. data/lib/generators/authorize_net/sim/templates/layout.erb +17 -17
  66. data/lib/generators/authorize_net/sim/templates/payment.erb +5 -5
  67. data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +5 -5
  68. data/lib/generators/generator_extensions.rb +73 -73
  69. metadata +84 -102
@@ -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