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,21 +1,21 @@
1
- module AuthorizeNet
2
- # Models an line item.
3
- class LineItem
4
- include AuthorizeNet::Model
5
-
6
- attr_accessor :id, :name, :description, :quantity, :price, :taxable
7
-
8
- def to_hash
9
- hash = {
10
- line_item_id: @id,
11
- line_item_name: @name,
12
- line_item_description: @description,
13
- line_item_quantity: @quantity,
14
- line_item_unit_price: @price,
15
- line_item_taxable: @taxable
16
- }
17
- hash.delete_if { |_k, v| v.nil? }
18
- hash
19
- end
20
- end
21
- end
1
+ module AuthorizeNet
2
+ # Models an line item.
3
+ class LineItem
4
+ include AuthorizeNet::Model
5
+
6
+ attr_accessor :id, :name, :description, :quantity, :price, :taxable
7
+
8
+ def to_hash
9
+ hash = {
10
+ line_item_id: @id,
11
+ line_item_name: @name,
12
+ line_item_description: @description,
13
+ line_item_quantity: @quantity,
14
+ line_item_unit_price: @price,
15
+ line_item_taxable: @taxable
16
+ }
17
+ hash.delete_if { |_k, v| v.nil? }
18
+ hash
19
+ end
20
+ end
21
+ end
@@ -1,38 +1,38 @@
1
- module AuthorizeNet
2
- # Models an order.
3
- class Order
4
- include AuthorizeNet::Model
5
-
6
- 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
7
-
8
- def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
9
- if id.is_a?(AuthorizeNet::LineItem)
10
- line_item = id
11
- else
12
- line_item = AuthorizeNet::LineItem.new(id: id, name: name, description: description, quantity: quantity, price: price, taxable: taxable)
13
- end
14
- @line_items = @line_items.to_a << line_item
15
- end
16
-
17
- def to_hash
18
- hash = {
19
- invoice_num: @invoice_num,
20
- description: @description,
21
- tax: @tax,
22
- tax_name: @tax_name,
23
- tax_description: @tax_description,
24
- freight: @freight,
25
- freight_name: @freight_name,
26
- freight_description: @freight_description,
27
- duty: @duty,
28
- duty_name: @duty_name,
29
- duty_description: @duty_description,
30
- tax_exempt: @tax_exempt,
31
- po_num: @po_num,
32
- line_items: handle_multivalue_hashing(@line_items)
33
- }
34
- hash.delete_if { |_k, v| v.nil? }
35
- hash
36
- end
37
- end
38
- end
1
+ module AuthorizeNet
2
+ # Models an order.
3
+ class Order
4
+ include AuthorizeNet::Model
5
+
6
+ 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
7
+
8
+ def add_line_item(id = nil, name = nil, description = nil, quantity = nil, price = nil, taxable = nil)
9
+ if id.is_a?(AuthorizeNet::LineItem)
10
+ line_item = id
11
+ else
12
+ line_item = AuthorizeNet::LineItem.new(id: id, name: name, description: description, quantity: quantity, price: price, taxable: taxable)
13
+ end
14
+ @line_items = @line_items.to_a << line_item
15
+ end
16
+
17
+ def to_hash
18
+ hash = {
19
+ invoice_num: @invoice_num,
20
+ description: @description,
21
+ tax: @tax,
22
+ tax_name: @tax_name,
23
+ tax_description: @tax_description,
24
+ freight: @freight,
25
+ freight_name: @freight_name,
26
+ freight_description: @freight_description,
27
+ duty: @duty,
28
+ duty_name: @duty_name,
29
+ duty_description: @duty_description,
30
+ tax_exempt: @tax_exempt,
31
+ po_num: @po_num,
32
+ line_items: handle_multivalue_hashing(@line_items)
33
+ }
34
+ hash.delete_if { |_k, v| v.nil? }
35
+ hash
36
+ end
37
+ end
38
+ end
@@ -1,61 +1,61 @@
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
+ 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 +1,70 @@
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
+ 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 +1,16 @@
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
+ 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 +1,15 @@
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
+ 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