authorizenet 1.9.7 → 2.0.0

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 (74) hide show
  1. checksums.yaml +5 -5
  2. data/lib/app/helpers/authorize_net_helper.rb +23 -23
  3. data/lib/authorize_net.rb +62 -107
  4. data/lib/authorize_net/api/LogHelper.rb +97 -97
  5. data/lib/authorize_net/api/SensitiveDataFilter.rb +92 -92
  6. data/lib/authorize_net/api/api_transaction.rb +129 -129
  7. data/lib/authorize_net/api/constants.yml +1 -1
  8. data/lib/authorize_net/api/schema.rb +5421 -5421
  9. data/lib/authorize_net/api/transaction.rb +265 -265
  10. data/lib/authorize_net/authorize_net.rb +154 -154
  11. data/lib/authorize_net/response.rb +23 -25
  12. data/lib/authorize_net/transaction.rb +64 -66
  13. data/lib/authorize_net/xml_response.rb +154 -154
  14. data/lib/authorize_net/xml_transaction.rb +279 -279
  15. data/lib/authorizenet.rb +4 -4
  16. metadata +3 -61
  17. data/lib/authorize_net/addresses/address.rb +0 -25
  18. data/lib/authorize_net/addresses/shipping_address.rb +0 -22
  19. data/lib/authorize_net/aim/response.rb +0 -120
  20. data/lib/authorize_net/aim/transaction.rb +0 -171
  21. data/lib/authorize_net/arb/fields.rb +0 -24
  22. data/lib/authorize_net/arb/paging.rb +0 -29
  23. data/lib/authorize_net/arb/response.rb +0 -26
  24. data/lib/authorize_net/arb/sorting.rb +0 -39
  25. data/lib/authorize_net/arb/subscription.rb +0 -68
  26. data/lib/authorize_net/arb/subscription_detail.rb +0 -10
  27. data/lib/authorize_net/arb/subscription_list_response.rb +0 -36
  28. data/lib/authorize_net/arb/transaction.rb +0 -171
  29. data/lib/authorize_net/cim/customer_profile.rb +0 -15
  30. data/lib/authorize_net/cim/payment_profile.rb +0 -35
  31. data/lib/authorize_net/cim/response.rb +0 -111
  32. data/lib/authorize_net/cim/transaction.rb +0 -721
  33. data/lib/authorize_net/customer.rb +0 -24
  34. data/lib/authorize_net/email_receipt.rb +0 -20
  35. data/lib/authorize_net/fields.rb +0 -760
  36. data/lib/authorize_net/key_value_response.rb +0 -109
  37. data/lib/authorize_net/key_value_transaction.rb +0 -281
  38. data/lib/authorize_net/line_item.rb +0 -21
  39. data/lib/authorize_net/order.rb +0 -38
  40. data/lib/authorize_net/payment_methods/credit_card.rb +0 -61
  41. data/lib/authorize_net/payment_methods/echeck.rb +0 -70
  42. data/lib/authorize_net/reporting/batch.rb +0 -16
  43. data/lib/authorize_net/reporting/batch_statistics.rb +0 -15
  44. data/lib/authorize_net/reporting/fds_filter.rb +0 -8
  45. data/lib/authorize_net/reporting/response.rb +0 -157
  46. data/lib/authorize_net/reporting/returned_item.rb +0 -45
  47. data/lib/authorize_net/reporting/transaction.rb +0 -131
  48. data/lib/authorize_net/reporting/transaction_details.rb +0 -22
  49. data/lib/authorize_net/sim/hosted_payment_form.rb +0 -34
  50. data/lib/authorize_net/sim/hosted_receipt_page.rb +0 -32
  51. data/lib/authorize_net/sim/response.rb +0 -133
  52. data/lib/authorize_net/sim/transaction.rb +0 -128
  53. data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +0 -52
  54. data/lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet +0 -49
  55. data/lib/generators/authorize_net/direct_post/templates/config.yml.erb +0 -8
  56. data/lib/generators/authorize_net/direct_post/templates/config.yml.rails3.erb +0 -8
  57. data/lib/generators/authorize_net/direct_post/templates/controller.rb.erb +0 -31
  58. data/lib/generators/authorize_net/direct_post/templates/initializer.rb +0 -4
  59. data/lib/generators/authorize_net/direct_post/templates/layout.erb +0 -18
  60. data/lib/generators/authorize_net/direct_post/templates/payment.erb +0 -10
  61. data/lib/generators/authorize_net/direct_post/templates/payment.rails3.erb +0 -10
  62. data/lib/generators/authorize_net/direct_post/templates/receipt.erb +0 -1
  63. data/lib/generators/authorize_net/direct_post/templates/relay_response.erb +0 -1
  64. data/lib/generators/authorize_net/sim/sim_generator.rb +0 -46
  65. data/lib/generators/authorize_net/sim/templates/README-AuthorizeNet +0 -52
  66. data/lib/generators/authorize_net/sim/templates/config.yml.erb +0 -8
  67. data/lib/generators/authorize_net/sim/templates/config.yml.rails3.erb +0 -8
  68. data/lib/generators/authorize_net/sim/templates/controller.rb.erb +0 -21
  69. data/lib/generators/authorize_net/sim/templates/initializer.rb +0 -4
  70. data/lib/generators/authorize_net/sim/templates/layout.erb +0 -18
  71. data/lib/generators/authorize_net/sim/templates/payment.erb +0 -6
  72. data/lib/generators/authorize_net/sim/templates/payment.rails3.erb +0 -6
  73. data/lib/generators/authorize_net/sim/templates/thank_you.erb +0 -1
  74. data/lib/generators/generator_extensions.rb +0 -73
@@ -1,61 +0,0 @@
1
- module AuthorizeNet
2
- # Defines constants for each payment method type.
3
- module PaymentMethodType
4
- CREDIT_CARD = 'CC'.freeze
5
- end
6
-
7
- # Models a credit card.
8
- class CreditCard
9
- PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::CREDIT_CARD
10
-
11
- # The option defaults for the constructor.
12
- @@option_defaults = {
13
- card_code: nil,
14
- card_type: nil
15
- }
16
-
17
- attr_accessor :card_number, :expiration, :card_code, :card_type, :track_1, :track_2
18
-
19
- # Constructs a new credit card object. Takes a credit card number
20
- # and an expiration date. The CCV code can be passed as an option. So can
21
- # the data tracks (1 & 2). When passing in data tracks, please pass the
22
- # whole track. Sentinels and the LRC will be removed by the SDK. Track data
23
- # must be passed along as ASCII. The raw bit stream from the card is not acceptable.
24
- #
25
- # Field separators on
26
- #
27
- # +card_number+:: The credit card number as a string.
28
- # +expiration+:: The credit card expiration date as a string with format MMYY.
29
- # +options+:: A hash of options.
30
- #
31
- # Options
32
- # +card_code+:: Sets the CCV code for the credit card.
33
- # +card_type+:: Sets the type of card (Visa, MasterCard, Dinners Club, etc.)
34
- # +track_1+:: Sets the track 1 data. Either track 1 or track 2 data needs to be included for card present transactions (otherwise fee structure will change).
35
- # +track_2+:: Sets the track 2 data. Either track 1 or track 2 data needs to be included for card present transactions (otherwise fee structure will change).
36
- #
37
- #
38
- def initialize(card_number, expiration, options = {})
39
- @card_number = card_number
40
- @expiration = expiration
41
- options = @@option_defaults.merge(options)
42
- @card_code = options[:card_code]
43
- @card_type = options[:card_type]
44
- @track_1 = options[:track_1]
45
- @track_2 = options[:track_2]
46
- end
47
-
48
- def to_hash
49
- {}.tap do |ch|
50
- ch[:method] = PAYMENT_METHOD_CODE
51
- ch[:card_num] = @card_number
52
- ch[:exp_date] = @expiration
53
- ch[:card_code] = @card_code if @card_code
54
- ch[:track1] = @track_1.match(/(%|^)(.*?)(\?|$)/)[2] if @track_1
55
- ch[:track2] = @track_2.match(/(;|^)(.*?)(\?|$)/)[2] if @track_2
56
- # ch[:track1] = @track_1.match(/^%(?<fc>.)(?<p>[\d]{1,19}+)\^(?<n>.{2,26})\^(?<e>[\d]{0,4}|\^)(?<sc>[\d]{0,3}|\^)(?<dd>.*)\?\Z/) if @track_1
57
- # ch[:track2] = @track_2.match(/\A;(?<pan>[\d]{1,19}+)=(?<expiration>[\d]{0,4}|=)(?<service_code>[\d]{0,3}|=)(?<discretionary_data>.*)\?\Z/) if @track_2
58
- end
59
- end
60
- end
61
- end
@@ -1,70 +0,0 @@
1
- module AuthorizeNet
2
- # Defines constants for each payment method type.
3
- module PaymentMethodType
4
- ECHECK = 'ECHECK'.freeze
5
- end
6
-
7
- # Models an eCheck.
8
- class ECheck
9
- PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::ECHECK
10
-
11
- # Defines constants for each bank account type.
12
- module AccountType
13
- CHECKING = 'CHECKING'.freeze
14
- SAVINGS = 'SAVINGS'.freeze
15
- BUSINESS_CHECKING = 'BUSINESSCHECKING'.freeze
16
- end
17
-
18
- # Defines constants for each check type.
19
- module CheckType
20
- ACCOUNTS_RECEIVABLE_CONVERSION = 'ARC'.freeze
21
- BACK_OFFICE_CONVERSION = 'BOC'.freeze
22
- CASH_CONCENTRATION_DISBURSEMENT = 'CCD'.freeze
23
- PREARRANGED_PAYMENT_DEPOSIT = 'PPD'.freeze
24
- TELEPHONE_INITIATED = 'TEL'.freeze
25
- INTERNET_INITIATED = 'WEB'.freeze
26
- end
27
-
28
- # The option defaults for the constructor.
29
- @@option_defaults = {
30
- echeck_type: CheckType::INTERNET_INITIATED,
31
- check_number: nil,
32
- account_type: AccountType::CHECKING
33
- }
34
-
35
- attr_accessor :routing_number, :account_number, :bank_name, :account_holder_name, :echeck_type, :check_number, :account_type
36
-
37
- # Constructs a new eCheck object.
38
- #
39
- # +routing_number+:: The bank routing number as a string.
40
- # +account_number+:: The bank account number as a string.
41
- # +bank_name+:: The legal name of the bank. This should match the name associated with the +routing_number+.
42
- # +account_holder_name+:: The full name on the bank account represented by +account_number+.
43
- # +options+:: A hash of options. Accepts +echeck_type+ (the type of check, can usually be ignored), +check_number+ (the number on the check, only needed for some check types), and +account_type+ (the type of bank account the check draws from). All values should be passed as strings.
44
- #
45
- def initialize(routing_number, account_number, bank_name, account_holder_name, options = {})
46
- @routing_number = routing_number
47
- @account_number = account_number
48
- @bank_name = bank_name
49
- @account_holder_name = account_holder_name
50
- options = @@option_defaults.merge(options)
51
- @echeck_type = options[:echeck_type]
52
- @check_number = options[:check_number]
53
- @account_type = options[:account_type]
54
- end
55
-
56
- def to_hash
57
- hash = {
58
- method: PAYMENT_METHOD_CODE,
59
- bank_aba_code: @routing_number,
60
- bank_acct_num: @account_number,
61
- bank_acct_type: @account_type,
62
- bank_name: @bank_name,
63
- bank_acct_name: @account_holder_name,
64
- echeck_type: @echeck_type
65
- }
66
- hash[:bank_check_number] = @check_number unless @check_number.nil?
67
- hash
68
- end
69
- end
70
- end
@@ -1,16 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- # Models a batch of credit cards.
3
- class Batch
4
- include AuthorizeNet::Model
5
-
6
- attr_accessor :id, :settled_at, :state, :statistics, :payment_method
7
-
8
- def settled_at=(time)
9
- if time.is_a?(DateTime)
10
- @settled_at = time
11
- else
12
- @settled_at = DateTime.parse(time.to_s)
13
- end
14
- end
15
- end
16
- end
@@ -1,15 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- # Models a batch of credit cards.
3
- class BatchStatistics
4
- include AuthorizeNet::Model
5
-
6
- attr_accessor :account_type, :charge_count, :charge_amount, :refund_count,
7
- :refund_amount, :void_count, :decline_count, :error_count,
8
- :returned_item_amount, :returned_item_count, :chargeback_count,
9
- :chargeback_amount, :correction_notice_count, :charge_chageback_count,
10
- :charge_chargeback_amount, :refund_chargeback_amount,
11
- :refund_chargeback_count, :charge_returned_items_amount,
12
- :charge_returned_items_count, :refund_returned_items_amount,
13
- :refund_returned_items_count
14
- end
15
- end
@@ -1,8 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- # Models a fraud detection filter.
3
- class FDSFilter
4
- include AuthorizeNet::Model
5
-
6
- attr_accessor :name, :action
7
- end
8
- end
@@ -1,157 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- # The CIM response class.
3
- class Response < AuthorizeNet::XmlResponse
4
- include AuthorizeNet::CIM::Fields
5
-
6
- # Constructs a new response object from raw_response in the context of transaction.
7
- # You don‘t typically construct this object yourself, as AuthorizeNet::Reeporting::Transaction
8
- # will 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
- @batch_list = @root.at_css('batchList')
14
- @transactions = @root.at_css('transactions')
15
- @transaction = @root.at_css('transaction')
16
- rescue StandardError
17
- @raw_response = $ERROR_INFO
18
- end
19
- end
20
- end
21
-
22
- # Returns an Array of Batch objects built from the entities returned in the response. Returns nil if no batchList was returned.
23
- def batch_list
24
- unless @batch_list.nil?
25
- batches = []
26
- @batch_list.element_children.each do |child|
27
- batches <<= build_entity(child, Fields::BATCH_ENTITY_DESCRIPTION) unless child.nil?
28
- end
29
- return batches unless batches.empty?
30
- end
31
- end
32
-
33
- # Returns an Array of TransactionDetail objects built from the entities returned in the response. Returns nil if no transactions were returned.
34
- def transactions
35
- unless @transactions.nil?
36
- transactions = []
37
- @transactions.element_children.each do |child|
38
- next if child.nil?
39
- transaction = build_entity(child, Fields::TRANSACTION_DETAILS_ENTITY_DESCRIPTION)
40
-
41
- # handle some stuff thats too tricky for EntityDecription to handle
42
- first_name = node_content_unless_nil(child.at_css('firstName'))
43
- last_name = node_content_unless_nil(child.at_css('lastName'))
44
- unless first_name.nil? && last_name.nil?
45
- address = AuthorizeNet::Address.new(first_name: first_name, last_name: last_name)
46
- transaction.customer = AuthorizeNet::Customer.new(address: address)
47
- end
48
- invoice_number = node_content_unless_nil(child.at_css('invoiceNumber'))
49
- unless invoice_number.nil?
50
- transaction.order = AuthorizeNet::Order.new(invoice_num: invoice_number)
51
- end
52
- subscription = child.at_css('subscription')
53
- unless subscription.nil?
54
- subscription_id = node_content_unless_nil(child.at_css('subscription').at_css('id'))
55
- transaction.subscription_id = subscription_id unless subscription_id.nil?
56
-
57
- pay_num = node_content_unless_nil(child.at_css('subscription').at_css('payNum'))
58
- transaction.subscription_paynum = pay_num unless pay_num.nil?
59
- end
60
-
61
- transactions <<= transaction
62
- end
63
- return transactions unless transactions.empty?
64
- end
65
- end
66
-
67
- # Builds and returns a TransactionDetail entity built from the response. If no transaction was found, returns nil.
68
- def transaction
69
- unless @transaction.nil?
70
- transaction = build_entity(@transaction, Fields::TRANSACTION_DETAILS_ENTITY_DESCRIPTION)
71
-
72
- ip = node_content_unless_nil(@transaction.at_css('customerIP'))
73
- unless ip.nil?
74
- transaction.customer ||= AuthorizeNet::CIM::CustomerProfile.new
75
- transaction.customer.ip = ip
76
- end
77
-
78
- tax_exempt = node_content_unless_nil(@transaction.at_css('taxExempt'))
79
- unless tax_exempt.nil?
80
- transaction.order ||= AuthorizeNet::Order.new
81
- transaction.order.tax_exempt = value_to_boolean(tax_exempt)
82
- end
83
-
84
- tax = @transaction.at_css('tax')
85
- unless tax.nil?
86
- transaction.order ||= AuthorizeNet::Order.new
87
- tax_amount = node_content_unless_nil(tax.at_css('amount'))
88
- transaction.order.tax = value_to_decimal(tax_amount) unless tax_amount.nil?
89
- transaction.order.tax_name = node_content_unless_nil(tax.at_css('name'))
90
- transaction.order.tax_description = node_content_unless_nil(tax.at_css('description'))
91
- end
92
-
93
- shipping = @transaction.at_css('shipping')
94
- unless shipping.nil?
95
- transaction.order ||= AuthorizeNet::Order.new
96
- shipping_amount = node_content_unless_nil(shipping.at_css('amount'))
97
- transaction.order.freight = value_to_decimal(shipping_amount) unless shipping_amount.nil?
98
- transaction.order.freight_name = node_content_unless_nil(shipping.at_css('name'))
99
- transaction.order.freight_description = node_content_unless_nil(shipping.at_css('description'))
100
- end
101
-
102
- duty = @transaction.at_css('duty')
103
- unless duty.nil?
104
- transaction.order ||= AuthorizeNet::Order.new
105
- duty_amount = node_content_unless_nil(duty.at_css('amount'))
106
- transaction.order.duty = value_to_decimal(duty_amount) unless duty_amount.nil?
107
- transaction.order.duty_name = node_content_unless_nil(duty.at_css('name'))
108
- transaction.order.duty_description = node_content_unless_nil(duty.at_css('description'))
109
- end
110
-
111
- line_items = @transaction.at_css('lineItems')
112
- unless line_items.nil?
113
- transaction.order ||= AuthorizeNet::Order.new
114
- line_items.element_children.each do |child|
115
- line_item = build_entity(child, Fields::LINE_ITEM_ENTITY_DESCRIPTION)
116
- transaction.order.add_line_item(line_item)
117
- end
118
- end
119
-
120
- # Really not sure what to do with customer type here. It should go on a payment
121
- customer_type = node_content_unless_nil(@transaction.at_css('customer type'))
122
- unless customer_type.nil?
123
- transaction.customer ||= AuthorizeNet::CIM::CustomerProfile.new
124
- transaction.customer.payment_profiles = [AuthorizeNet::CIM::PaymentProfile.new(cust_type: customer_type)]
125
- end
126
-
127
- subscription = @transaction.at_css('subscription')
128
- unless subscription.nil?
129
- subscription_id = node_content_unless_nil(@transaction.at_css('subscription').at_css('id'))
130
- transaction.subscription_id = value_to_decimal(subscription_id) unless subscription_id.nil?
131
-
132
- pay_num = node_content_unless_nil(@transaction.at_css('subscription').at_css('payNum'))
133
- transaction.subscription_paynum = value_to_decimal(pay_num) unless pay_num.nil?
134
- end
135
-
136
- solution = @transaction.at_css('solution')
137
- unless solution.nil?
138
- solution_id = node_content_unless_nil(@transaction.at_css('solution').at_css('id'))
139
- transaction.solution_id = solution_id unless solution_id.nil?
140
-
141
- transaction.solution_name = node_content_unless_nil(@transaction.at_css('solution').at_css('name'))
142
- end
143
-
144
- returned_items = @transaction.at_css('returnedItems')
145
- unless returned_items.nil?
146
- transaction.returns ||= AuthorizeNet::Reporting::ReturnedItem.new
147
- returned_items.element_children.each do |child|
148
- returned_item = build_entity(child, Fields::RETURNED_ITEM_ENTITY_DESCRIPTION)
149
- transaction.returns.add_returned_item(returned_item)
150
- end
151
- end
152
-
153
- transaction
154
- end
155
- end
156
- end
157
- end
@@ -1,45 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- class ReturnedItem
3
- include AuthorizeNet::Model
4
-
5
- attr_accessor :id, :date_utc, :date_local, :code, :description, :returned_items
6
-
7
- def date_utc=(time)
8
- if time.is_a?(DateTime)
9
- @date_utc = time
10
- else
11
- @date_utc = DateTime.parse(time.to_s)
12
- end
13
- end
14
-
15
- def date_local=(time)
16
- if time.is_a?(DateTime)
17
- @date_local = time
18
- else
19
- @date_local = DateTime.parse(time.to_s)
20
- end
21
- end
22
-
23
- def add_returned_item(id = nil, date_utc = nil, date_local = nil, code = nil, description = nil)
24
- if id.is_a?(AuthorizeNet::Reporting::ReturnedItem)
25
- returned_item = id
26
- else
27
- returned_item = AuthorizeNet::Reporting::ReturnedItem.new(return_item_id: id, return_item_date_utc: date_utc, return_item_date_local: date_local, return_item_code: code, line_item_description: description)
28
- end
29
- @returned_items = @returned_items.to_a << returned_item
30
- end
31
-
32
- def to_hash
33
- hash = {
34
- id: @id,
35
- date_utc: @date_utc,
36
- date_local: @date_local,
37
- code: @code,
38
- description: @description,
39
- returned_items: handle_multivalue_hashing(@returned_items)
40
- }
41
- hash.delete_if { |_k, v| v.nil? }
42
- hash
43
- end
44
- end
45
- end
@@ -1,131 +0,0 @@
1
- module AuthorizeNet::Reporting
2
- # The Reporting API transaction class.
3
- class Transaction < AuthorizeNet::XmlTransaction
4
- include AuthorizeNet::Reporting::Fields
5
-
6
- # The class to wrap our response in.
7
- @response_class = AuthorizeNet::Reporting::Response
8
-
9
- # Fields to convert to/from Date.
10
- @@datetime_fields = %i[first_settlement_date last_settlement_date]
11
-
12
- # Constructs a Reporting transaction. You can use the new Reporting transaction object
13
- # to issue a request to the payment gateway and parse the response into a new
14
- # AuthorizeNet::Reporting::Response object.
15
- #
16
- # +api_login_id+:: Your API login ID, as a string.
17
- # +api_transaction_key+:: Your API transaction key, as a string.
18
- # +options+:: A hash of options. See below for values.
19
- #
20
- # Options
21
- # +gateway+:: The gateway to submit the transaction to. Can be a URL string, an AuthorizeNet::Reporting::Transaction::Gateway constant, or one of the convenience symbols :sandbox, :test, :production, or :live (:test is an alias for :sandbox, and :live is an alias for :production).
22
- # +verify_ssl+:: A boolean indicating if the SSL certificate of the +gateway+ should be verified. Defaults to true.
23
- # +reference_id+:: A string that can be used to identify a particular transaction with its response. Will be echo'd in the response, only if it was provided in the transaction. Defaults to nil.
24
- #
25
- def initialize(api_login_id, api_transaction_key, options = {})
26
- ActiveSupport::Deprecation.warn "use AuthorizeNet::API::Transaction"
27
- super
28
- end
29
-
30
- # Sets up and submits a getSettledBatchListRequest transaction. If this transaction has already been
31
- # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
32
- # response object will have an array of Batch objects available via its batch_list method if
33
- # the request was successful.
34
- #
35
- #
36
- # +from_date+:: Takes either a DateTime or a String representing a date and time. Only settled batches >= this value will be returned. Defaults to nil (which returns >= 24hrs ago). A to_date must be specified if a from_date is.
37
- # +to_date+:: Takes either a DateTime or a String representing a date and time. Only settled batches <= this value will be returned. Defaults to nil. The maximum date range is 31 days, and a from_date must be supplied if a to_date is.
38
- # +include_stats+:: Takes a Boolean. Determines if BatchStatistics should be returned with the Batch objects. Defaults to false.
39
- #
40
- # Typical usage:
41
- #
42
- # response = transaction.get_settled_batch_list(DateTime.now() - (1 * 3600 * 48), DateTime.now(), true)
43
- # batches = response.batch_list if response.success?
44
- #
45
- def get_settled_batch_list(from_date = nil, to_date = nil, include_stats = false)
46
- @type = Type::REPORT_GET_BATCH_LIST
47
- set_fields(first_settlement_date: from_date, last_settlement_date: to_date, include_statistics: include_stats)
48
- make_request
49
- end
50
-
51
- # Sets up and submits a getTransactionListRequest transaction. If this transaction has already been
52
- # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
53
- # response object will have an array of TransactionDetail objects available via its transactions method if
54
- # the request was successful. These TransactionDetail objects will not be fully populated. Use get_transaction_details
55
- # to get all the details.
56
- #
57
- #
58
- # +batch_id+:: Takes either a Batch object with its id attribute populated, or a String representing the ID of the batch to retrieve the transaction list from.
59
- #
60
- # Typical usage:
61
- #
62
- # response = transaction.get_transaction_list('123456')
63
- # transactions = response.transactions if response.success?
64
- #
65
- def get_transaction_list(batch_id)
66
- @type = Type::REPORT_GET_TRANSACTION_LIST
67
- handle_batch_id(batch_id)
68
- make_request
69
- end
70
-
71
- # Sets up and submits a getUnsettledTransactionListRequest transaction. If this transaction has already been
72
- # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
73
- # response object will have an array of TransactionDetail objects available via its transactions method if
74
- # the request was successful. These TransactionDetail objects will not be fully populated. Use get_transaction_details
75
- # to get all the details.
76
- #
77
- #
78
- # Typical usage:
79
- #
80
- # response = transaction.get_unsettled_transaction_list
81
- # transactions = response.transactions if response.success?
82
- #
83
- def get_unsettled_transaction_list
84
- @type = Type::REPORT_GET_UNSETTLED_TRANSACTION_LIST
85
- make_request
86
- end
87
-
88
- # Sets up and submits a getTransactionDetailsRequest transaction. If this transaction has already been
89
- # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
90
- # response object will have a TransactionDetail object available via its transactions method if
91
- # the request was successful. This TransactionDetail object will have more data than the limited version
92
- # returned by get_transaction_list.
93
- #
94
- #
95
- # +transaction_id+:: Takes either a TransactionDetail object with its id attribute populated, or a String representing the ID of the transaction to retrieve the details from.
96
- #
97
- # Typical usage:
98
- #
99
- # response = transaction.get_transaction_details('123456789')
100
- # transactions = response.transactions if response.success?
101
- #
102
- def get_transaction_details(transaction_id)
103
- @type = Type::REPORT_GET_TRANSACTION_DETAILS
104
- handle_transaction_id(transaction_id)
105
- make_request
106
- end
107
-
108
- #:enddoc:
109
- protected
110
-
111
- # Handles batch id type massaging.
112
- def handle_batch_id(id)
113
- case id
114
- when Batch
115
- set_fields(batch_id: id.id.to_s)
116
- else
117
- set_fields(batch_id: id.to_s)
118
- end
119
- end
120
-
121
- # Handles transaction id type massaging.
122
- def handle_transaction_id(id)
123
- case id
124
- when TransactionDetails
125
- set_fields(transaction_id: id.id.to_s)
126
- else
127
- set_fields(transaction_id: id.to_s)
128
- end
129
- end
130
- end
131
- end