authorizenet 1.8.7 → 1.8.8

Sign up to get free protection for your applications and to get access to all the features.
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,25 +1,25 @@
1
- module AuthorizeNet
2
-
3
- # Models an line item.
4
- class LineItem
5
-
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :id, :name, :description, :quantity, :price, :taxable
9
-
10
- def to_hash
11
- hash = {
12
- :line_item_id => @id,
13
- :line_item_name => @name,
14
- :line_item_description => @description,
15
- :line_item_quantity => @quantity,
16
- :line_item_unit_price => @price,
17
- :line_item_taxable => @taxable
18
- }
19
- hash.delete_if {|k, v| v.nil?}
20
- hash
21
- end
22
-
23
- end
24
-
1
+ module AuthorizeNet
2
+
3
+ # Models an line item.
4
+ class LineItem
5
+
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :id, :name, :description, :quantity, :price, :taxable
9
+
10
+ def to_hash
11
+ hash = {
12
+ :line_item_id => @id,
13
+ :line_item_name => @name,
14
+ :line_item_description => @description,
15
+ :line_item_quantity => @quantity,
16
+ :line_item_unit_price => @price,
17
+ :line_item_taxable => @taxable
18
+ }
19
+ hash.delete_if {|k, v| v.nil?}
20
+ hash
21
+ end
22
+
23
+ end
24
+
25
25
  end
@@ -1,42 +1,42 @@
1
- module AuthorizeNet
2
-
3
- # Models an order.
4
- class Order
5
-
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :invoice_num, :description, :tax, :tax_name, :tax_description, :freight, :freight_name, :freight_description, :duty, :duty_name, :duty_description, :tax_exempt, :po_num, :line_items
9
-
10
- def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
11
- if id.kind_of?(AuthorizeNet::LineItem)
12
- line_item = id
13
- else
14
- line_item = AuthorizeNet::LineItem.new({:id => id, :name => name, :description => description, :quantity => quantity, :price => price, :taxable => taxable})
15
- end
16
- @line_items = @line_items.to_a << line_item
17
- end
18
-
19
- def to_hash
20
- hash = {
21
- :invoice_num => @invoice_num,
22
- :description => @description,
23
- :tax => @tax,
24
- :tax_name => @tax_name,
25
- :tax_description => @tax_description,
26
- :freight => @freight,
27
- :freight_name => @freight_name,
28
- :freight_description => @freight_description,
29
- :duty => @duty,
30
- :duty_name => @duty_name,
31
- :duty_description => @duty_description,
32
- :tax_exempt => @tax_exempt,
33
- :po_num => @po_num,
34
- :line_items => handle_multivalue_hashing(@line_items)
35
- }
36
- hash.delete_if {|k, v| v.nil?}
37
- hash
38
- end
39
-
40
- end
41
-
1
+ module AuthorizeNet
2
+
3
+ # Models an order.
4
+ class Order
5
+
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :invoice_num, :description, :tax, :tax_name, :tax_description, :freight, :freight_name, :freight_description, :duty, :duty_name, :duty_description, :tax_exempt, :po_num, :line_items
9
+
10
+ def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
11
+ if id.kind_of?(AuthorizeNet::LineItem)
12
+ line_item = id
13
+ else
14
+ line_item = AuthorizeNet::LineItem.new({:id => id, :name => name, :description => description, :quantity => quantity, :price => price, :taxable => taxable})
15
+ end
16
+ @line_items = @line_items.to_a << line_item
17
+ end
18
+
19
+ def to_hash
20
+ hash = {
21
+ :invoice_num => @invoice_num,
22
+ :description => @description,
23
+ :tax => @tax,
24
+ :tax_name => @tax_name,
25
+ :tax_description => @tax_description,
26
+ :freight => @freight,
27
+ :freight_name => @freight_name,
28
+ :freight_description => @freight_description,
29
+ :duty => @duty,
30
+ :duty_name => @duty_name,
31
+ :duty_description => @duty_description,
32
+ :tax_exempt => @tax_exempt,
33
+ :po_num => @po_num,
34
+ :line_items => handle_multivalue_hashing(@line_items)
35
+ }
36
+ hash.delete_if {|k, v| v.nil?}
37
+ hash
38
+ end
39
+
40
+ end
41
+
42
42
  end
@@ -1,62 +1,62 @@
1
- module AuthorizeNet
2
-
3
- # Defines constants for each payment method type.
4
- module PaymentMethodType
5
- CREDIT_CARD = 'CC'
6
- end
7
-
8
- # Models a credit card.
9
- class CreditCard
10
- PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::CREDIT_CARD
11
-
12
- # The option defaults for the constructor.
13
- @@option_defaults = {
14
- :card_code => nil,
15
- :card_type => nil
16
- }
17
-
18
- attr_accessor :card_number, :expiration, :card_code, :card_type, :track_1, :track_2
19
-
20
- # Constructs a new credit card object. Takes a credit card number
21
- # and an expiration date. The CCV code can be passed as an option. So can
22
- # the data tracks (1 & 2). When passing in data tracks, please pass the
23
- # whole track. Sentinels and the LRC will be removed by the SDK. Track data
24
- # must be passed along as ASCII. The raw bit stream from the card is not acceptable.
25
- #
26
- # Field separators on
27
- #
28
- # +card_number+:: The credit card number as a string.
29
- # +expiration+:: The credit card expiration date as a string with format MMYY.
30
- # +options+:: A hash of options.
31
- #
32
- # Options
33
- # +card_code+:: Sets the CCV code for the credit card.
34
- # +card_type+:: Sets the type of card (Visa, MasterCard, Dinners Club, etc.)
35
- # +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).
36
- # +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).
37
- #
38
- #
39
- def initialize(card_number, expiration, options = {})
40
- @card_number = card_number
41
- @expiration = expiration
42
- options = @@option_defaults.merge(options)
43
- @card_code = options[:card_code]
44
- @card_type = options[:card_type]
45
- @track_1 = options[:track_1]
46
- @track_2 = options[:track_2]
47
- end
48
-
49
- def to_hash
50
- Hash.new.tap do |ch|
51
- ch[:method] = PAYMENT_METHOD_CODE
52
- ch[:card_num] = @card_number
53
- ch[:exp_date] = @expiration
54
- ch[:card_code] = @card_code if @card_code
55
- ch[:track1] = @track_1.match(/(%|^)(.*?)(\?|$)/)[2] if @track_1
56
- ch[:track2] = @track_2.match(/(;|^)(.*?)(\?|$)/)[2] if @track_2
57
- #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
58
- #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
59
- end
60
- end
61
- end
62
- end
1
+ module AuthorizeNet
2
+
3
+ # Defines constants for each payment method type.
4
+ module PaymentMethodType
5
+ CREDIT_CARD = 'CC'
6
+ end
7
+
8
+ # Models a credit card.
9
+ class CreditCard
10
+ PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::CREDIT_CARD
11
+
12
+ # The option defaults for the constructor.
13
+ @@option_defaults = {
14
+ :card_code => nil,
15
+ :card_type => nil
16
+ }
17
+
18
+ attr_accessor :card_number, :expiration, :card_code, :card_type, :track_1, :track_2
19
+
20
+ # Constructs a new credit card object. Takes a credit card number
21
+ # and an expiration date. The CCV code can be passed as an option. So can
22
+ # the data tracks (1 & 2). When passing in data tracks, please pass the
23
+ # whole track. Sentinels and the LRC will be removed by the SDK. Track data
24
+ # must be passed along as ASCII. The raw bit stream from the card is not acceptable.
25
+ #
26
+ # Field separators on
27
+ #
28
+ # +card_number+:: The credit card number as a string.
29
+ # +expiration+:: The credit card expiration date as a string with format MMYY.
30
+ # +options+:: A hash of options.
31
+ #
32
+ # Options
33
+ # +card_code+:: Sets the CCV code for the credit card.
34
+ # +card_type+:: Sets the type of card (Visa, MasterCard, Dinners Club, etc.)
35
+ # +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).
36
+ # +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).
37
+ #
38
+ #
39
+ def initialize(card_number, expiration, options = {})
40
+ @card_number = card_number
41
+ @expiration = expiration
42
+ options = @@option_defaults.merge(options)
43
+ @card_code = options[:card_code]
44
+ @card_type = options[:card_type]
45
+ @track_1 = options[:track_1]
46
+ @track_2 = options[:track_2]
47
+ end
48
+
49
+ def to_hash
50
+ Hash.new.tap do |ch|
51
+ ch[:method] = PAYMENT_METHOD_CODE
52
+ ch[:card_num] = @card_number
53
+ ch[:exp_date] = @expiration
54
+ ch[:card_code] = @card_code if @card_code
55
+ ch[:track1] = @track_1.match(/(%|^)(.*?)(\?|$)/)[2] if @track_1
56
+ ch[:track2] = @track_2.match(/(;|^)(.*?)(\?|$)/)[2] if @track_2
57
+ #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
58
+ #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
59
+ end
60
+ end
61
+ end
62
+ end
@@ -1,72 +1,72 @@
1
- module AuthorizeNet
2
-
3
- # Defines constants for each payment method type.
4
- module PaymentMethodType
5
- ECHECK = 'ECHECK'
6
- end
7
-
8
- # Models an eCheck.
9
- class ECheck
10
- PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::ECHECK
11
-
12
- # Defines constants for each bank account type.
13
- module AccountType
14
- CHECKING = 'CHECKING'
15
- SAVINGS = 'SAVINGS'
16
- BUSINESS_CHECKING = 'BUSINESSCHECKING'
17
- end
18
-
19
- # Defines constants for each check type.
20
- module CheckType
21
- ACCOUNTS_RECEIVABLE_CONVERSION = 'ARC'
22
- BACK_OFFICE_CONVERSION = 'BOC'
23
- CASH_CONCENTRATION_DISBURSEMENT = 'CCD'
24
- PREARRANGED_PAYMENT_DEPOSIT = 'PPD'
25
- TELEPHONE_INITIATED = 'TEL'
26
- INTERNET_INITIATED = 'WEB'
27
- end
28
-
29
- # The option defaults for the constructor.
30
- @@option_defaults = {
31
- :echeck_type => CheckType::INTERNET_INITIATED,
32
- :check_number => nil,
33
- :account_type => AccountType::CHECKING
34
- }
35
-
36
- attr_accessor :routing_number, :account_number, :bank_name, :account_holder_name, :echeck_type, :check_number, :account_type
37
-
38
- # Constructs a new eCheck object.
39
- #
40
- # +routing_number+:: The bank routing number as a string.
41
- # +account_number+:: The bank account number as a string.
42
- # +bank_name+:: The legal name of the bank. This should match the name associated with the +routing_number+.
43
- # +account_holder_name+:: The full name on the bank account represented by +account_number+.
44
- # +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.
45
- #
46
- def initialize(routing_number, account_number, bank_name, account_holder_name, options = {})
47
- @routing_number = routing_number
48
- @account_number = account_number
49
- @bank_name = bank_name
50
- @account_holder_name = account_holder_name
51
- options = @@option_defaults.merge(options)
52
- @echeck_type = options[:echeck_type]
53
- @check_number = options[:check_number]
54
- @account_type = options[:account_type]
55
- end
56
-
57
- def to_hash
58
- hash = {
59
- :method => PAYMENT_METHOD_CODE,
60
- :bank_aba_code => @routing_number,
61
- :bank_acct_num => @account_number,
62
- :bank_acct_type => @account_type,
63
- :bank_name => @bank_name,
64
- :bank_acct_name => @account_holder_name,
65
- :echeck_type => @echeck_type
66
- }
67
- hash[:bank_check_number] = @check_number unless @check_number.nil?
68
- hash
69
- end
70
- end
71
-
1
+ module AuthorizeNet
2
+
3
+ # Defines constants for each payment method type.
4
+ module PaymentMethodType
5
+ ECHECK = 'ECHECK'
6
+ end
7
+
8
+ # Models an eCheck.
9
+ class ECheck
10
+ PAYMENT_METHOD_CODE = AuthorizeNet::PaymentMethodType::ECHECK
11
+
12
+ # Defines constants for each bank account type.
13
+ module AccountType
14
+ CHECKING = 'CHECKING'
15
+ SAVINGS = 'SAVINGS'
16
+ BUSINESS_CHECKING = 'BUSINESSCHECKING'
17
+ end
18
+
19
+ # Defines constants for each check type.
20
+ module CheckType
21
+ ACCOUNTS_RECEIVABLE_CONVERSION = 'ARC'
22
+ BACK_OFFICE_CONVERSION = 'BOC'
23
+ CASH_CONCENTRATION_DISBURSEMENT = 'CCD'
24
+ PREARRANGED_PAYMENT_DEPOSIT = 'PPD'
25
+ TELEPHONE_INITIATED = 'TEL'
26
+ INTERNET_INITIATED = 'WEB'
27
+ end
28
+
29
+ # The option defaults for the constructor.
30
+ @@option_defaults = {
31
+ :echeck_type => CheckType::INTERNET_INITIATED,
32
+ :check_number => nil,
33
+ :account_type => AccountType::CHECKING
34
+ }
35
+
36
+ attr_accessor :routing_number, :account_number, :bank_name, :account_holder_name, :echeck_type, :check_number, :account_type
37
+
38
+ # Constructs a new eCheck object.
39
+ #
40
+ # +routing_number+:: The bank routing number as a string.
41
+ # +account_number+:: The bank account number as a string.
42
+ # +bank_name+:: The legal name of the bank. This should match the name associated with the +routing_number+.
43
+ # +account_holder_name+:: The full name on the bank account represented by +account_number+.
44
+ # +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.
45
+ #
46
+ def initialize(routing_number, account_number, bank_name, account_holder_name, options = {})
47
+ @routing_number = routing_number
48
+ @account_number = account_number
49
+ @bank_name = bank_name
50
+ @account_holder_name = account_holder_name
51
+ options = @@option_defaults.merge(options)
52
+ @echeck_type = options[:echeck_type]
53
+ @check_number = options[:check_number]
54
+ @account_type = options[:account_type]
55
+ end
56
+
57
+ def to_hash
58
+ hash = {
59
+ :method => PAYMENT_METHOD_CODE,
60
+ :bank_aba_code => @routing_number,
61
+ :bank_acct_num => @account_number,
62
+ :bank_acct_type => @account_type,
63
+ :bank_name => @bank_name,
64
+ :bank_acct_name => @account_holder_name,
65
+ :echeck_type => @echeck_type
66
+ }
67
+ hash[:bank_check_number] = @check_number unless @check_number.nil?
68
+ hash
69
+ end
70
+ end
71
+
72
72
  end
@@ -1,19 +1,19 @@
1
- module AuthorizeNet::Reporting
2
-
3
- # Models a batch of credit cards.
4
- class Batch
5
-
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :id, :settled_at, :state, :statistics, :payment_method
9
-
10
- def settled_at=(time)
11
- if time.kind_of?(DateTime)
12
- @settled_at = time
13
- else
14
- @settled_at = DateTime.parse(time.to_s)
15
- end
16
- end
17
- end
18
-
1
+ module AuthorizeNet::Reporting
2
+
3
+ # Models a batch of credit cards.
4
+ class Batch
5
+
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :id, :settled_at, :state, :statistics, :payment_method
9
+
10
+ def settled_at=(time)
11
+ if time.kind_of?(DateTime)
12
+ @settled_at = time
13
+ else
14
+ @settled_at = DateTime.parse(time.to_s)
15
+ end
16
+ end
17
+ end
18
+
19
19
  end
@@ -1,19 +1,19 @@
1
- module AuthorizeNet::Reporting
2
-
3
- # Models a batch of credit cards.
4
- class BatchStatistics
5
-
6
- include AuthorizeNet::Model
7
-
8
- attr_accessor :account_type, :charge_count, :charge_amount, :refund_count,
9
- :refund_amount, :void_count, :decline_count, :error_count,
10
- :returned_item_amount, :returned_item_count, :chargeback_count,
11
- :chargeback_amount, :correction_notice_count, :charge_chageback_count,
12
- :charge_chargeback_amount, :refund_chargeback_amount,
13
- :refund_chargeback_count, :charge_returned_items_amount,
14
- :charge_returned_items_count, :refund_returned_items_amount,
15
- :refund_returned_items_count
16
-
17
- end
18
-
1
+ module AuthorizeNet::Reporting
2
+
3
+ # Models a batch of credit cards.
4
+ class BatchStatistics
5
+
6
+ include AuthorizeNet::Model
7
+
8
+ attr_accessor :account_type, :charge_count, :charge_amount, :refund_count,
9
+ :refund_amount, :void_count, :decline_count, :error_count,
10
+ :returned_item_amount, :returned_item_count, :chargeback_count,
11
+ :chargeback_amount, :correction_notice_count, :charge_chageback_count,
12
+ :charge_chargeback_amount, :refund_chargeback_amount,
13
+ :refund_chargeback_count, :charge_returned_items_amount,
14
+ :charge_returned_items_count, :refund_returned_items_amount,
15
+ :refund_returned_items_count
16
+
17
+ end
18
+
19
19
  end