authorizenet 1.8.2 → 1.8.3

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.
@@ -0,0 +1,34 @@
1
+ module AuthorizeNet::API
2
+ class Transaction < ApiTransaction
3
+
4
+ def initialize(api_login_id, api_transaction_key, options = {})
5
+ super
6
+ end
7
+
8
+ # This request enables you to create a transaction, and optional customer profile.
9
+ # NOTE: Tokenized transactions (e.g. Apple Pay), or PayPal should not be used to
10
+ # create payment profiles.
11
+ #
12
+ # See spec/api_spec.rb for usage examples
13
+ def create_transaction(request)
14
+ make_request(request,CreateTransactionResponse,Type::API_CREATE_TRANSACTION)
15
+ end
16
+
17
+ # This request enables you to create a customer profile, payment profile,
18
+ # and shipping profile from an existing successful transaction.
19
+ # NOTE: Tokenized transactions (e.g. Apple Pay), or PayPal should not be used to
20
+ # create payment profiles.
21
+ #
22
+ # See spec/api_spec.rb for usage examples
23
+ def create_customer_profile_from_transaction(request)
24
+ make_request(request,CreateProfileResponse,Type::API_CREATE_CUSTOMER_PROFILE_FROM_TRANSACTION)
25
+ end
26
+
27
+ # This request enables you to delete a customer profile.
28
+ #
29
+ # See spec/api_spec.rb for usage examples
30
+ def delete_customer_profile(request)
31
+ make_request(request,DeleteCustomerProfileResponse,Type::API_DELETE_CUSTOMER_PROFILE)
32
+ end
33
+ end
34
+ end
@@ -24,6 +24,7 @@ module AuthorizeNet::CIM
24
24
  @address = @root.at_css('address')
25
25
  @payment_profile = @root.at_css('paymentProfile')
26
26
  @profile = @root.at_css('profile')
27
+ @token = node_content_unless_nil(@root.at_css('token'))
27
28
  rescue
28
29
  @raw_response = $!
29
30
  end
@@ -62,6 +63,11 @@ module AuthorizeNet::CIM
62
63
  def payment_profile_ids
63
64
  @customer_payment_profile_id_list
64
65
  end
66
+
67
+ # Returns hosted profile access token when requested. Returns nil otherwise.
68
+ def token
69
+ @token
70
+ end
65
71
 
66
72
  # Returns a validation response as an AuthorizeNet::AIM::Response object if a validation response was returned
67
73
  # by the gateway. Returns nil otherwise.
@@ -39,7 +39,13 @@ module AuthorizeNet::CIM
39
39
  @@create_profile_option_defaults = {
40
40
  :validation_mode => :none
41
41
  }
42
-
42
+
43
+ # The default options for get_hosted_profile_token.
44
+ @@get_hosted_profile_token_option_defaults = {
45
+ :border_visible => true,
46
+ :validation_mode => :none,
47
+ }
48
+
43
49
  # The default options for create_payment_profile.
44
50
  @@create_payment_profile_option_defaults = {
45
51
  :validation_mode => :none
@@ -148,6 +154,30 @@ module AuthorizeNet::CIM
148
154
  handle_profile_id(profile_id)
149
155
  make_request
150
156
  end
157
+
158
+ # Sets up and submits a getHostedProfilePageRequest transaction. If this transaction has already been
159
+ # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
160
+ #
161
+ # +profile_id+:: Takes either a String containing the ID of the CustomerProfile you want to delete, or a CustomerProfile object with the ID populated.
162
+ #
163
+ # Options:
164
+ # +return_url+:: Enter the URL for the page that the customer returns to when the hosted session ends. Do not pass this setting for iframes or popups.
165
+ # +return_url_text+:: Enter the text to display on the button that returns the customer to your web site. The value can be any text up to 200 characters.
166
+ # If you do not pass this parameter, the default button text is Continue. Do not pass this setting for iframes or popups.
167
+ # +heading_color+:: Enter a hex color string such as #e0e0e0. The background color of the section headers changes from gray to a custom color.
168
+ # +border_visible+:: Enter true or false. Must be false for iframes or popups, and must be true for redirects.
169
+ # +iframe_communicator_url+:: Enter the URL to a page that can communicate with the merchant’s main page using javascript.
170
+ # This parameter enables you to dynamically change the size of the popup so that there are no scroll bars.
171
+ # This parameter is required only for iframe or lightbox applications.
172
+ # +validation_mode+:: Set to :testMode, :liveMode or :none (the default) to set hostedProfileValidationMode mode
173
+
174
+ def get_hosted_profile_token(profile_id, options = {})
175
+ options = @@get_hosted_profile_token_option_defaults.merge(options)
176
+ @type = Type::CIM_GET_HOSTED_PROFILE
177
+ handle_profile_id(profile_id)
178
+ handle_hosted_profile_settings(options)
179
+ make_request
180
+ end
151
181
 
152
182
  # Sets up and submits a createCustomerPaymentProfileRequest transaction. If this transaction has already been
153
183
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
@@ -642,7 +672,26 @@ module AuthorizeNet::CIM
642
672
  @fields[:extra_options] ||= {}
643
673
  @fields[:extra_options].merge!(options)
644
674
  end
645
-
675
+
676
+ def handle_hosted_profile_settings(options)
677
+ options_mapping = {
678
+ :return_url => :hostedProfileReturnUrl,
679
+ :return_url_text => :hostedProfileReturnUrlText,
680
+ :heading_color => :hostedProfileHeadingBgColor,
681
+ :border_visible => :hostedProfilePageBorderVisible,
682
+ :iframe_communicator_url => :hostedProfileIFrameCommunicatorUrl,
683
+ :validation_mode => :hostedProfileValidationMode,
684
+ }
685
+ set_fields(
686
+ :hosted_settings =>
687
+ options.select do |k,_|
688
+ options_mapping.keys.include? k
689
+ end.map do |k,v|
690
+ { :setting_name => options_mapping[k], :setting_value => v }
691
+ end
692
+ )
693
+ end
694
+
646
695
  # Handles packing up custom fields.
647
696
  def handle_custom_fields(options)
648
697
  encoded_options = []
@@ -111,7 +111,7 @@ module AuthorizeNet
111
111
  ]
112
112
  end
113
113
  end
114
-
114
+
115
115
  module SIM
116
116
  # Contains the various lists of fields needed by the SIM API.
117
117
  module Fields
@@ -283,13 +283,13 @@ module AuthorizeNet
283
283
  module Fields
284
284
 
285
285
  REFID_FIELDS = {:refId => :reference_id}
286
-
286
+
287
287
  VALIDATION_MODE_FIELDS = {:validationMode => :validation_mode}
288
-
288
+
289
289
  CUSTOMER_PROFILE_ID_FIELDS = {:customerProfileId => :customer_profile_id}
290
-
290
+
291
291
  CUSTOMER_PAYMENT_PROFILE_ID_FIELDS = {:customerPaymentProfileId => :customer_payment_profile_id}
292
-
292
+
293
293
  BILL_TO_FIELDS = {:billTo => [
294
294
  {:firstName => :first_name},
295
295
  {:lastName => :last_name},
@@ -487,6 +487,12 @@ module AuthorizeNet
487
487
  CUSTOMER_PROFILE_ID_FIELDS,
488
488
  {:customerAddressId => :customer_address_id}
489
489
  ]
490
+
491
+ GET_HOSTED_PROFILE_FIELDS = [
492
+ REFID_FIELDS,
493
+ CUSTOMER_PROFILE_ID_FIELDS,
494
+ { :hostedProfileSettings => [ { :setting => [ { :settingName => :setting_name }, { :settingValue => :setting_value } ], :_multivalue => :hosted_settings } ] }
495
+ ]
490
496
 
491
497
  UPDATE_PROFILE_FIELDS = [
492
498
  REFID_FIELDS,
@@ -548,6 +554,7 @@ module AuthorizeNet
548
554
  AuthorizeNet::XmlTransaction::Type::CIM_GET_PROFILE => GET_PROFILE_FIELDS,
549
555
  AuthorizeNet::XmlTransaction::Type::CIM_GET_PAYMENT => GET_PAYMENT_FIELDS,
550
556
  AuthorizeNet::XmlTransaction::Type::CIM_GET_ADDRESS => GET_ADDRESS_FIELDS,
557
+ AuthorizeNet::XmlTransaction::Type::CIM_GET_HOSTED_PROFILE => GET_HOSTED_PROFILE_FIELDS,
551
558
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PROFILE => UPDATE_PROFILE_FIELDS,
552
559
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_PAYMENT => UPDATE_PAYMENT_FIELDS,
553
560
  AuthorizeNet::XmlTransaction::Type::CIM_UPDATE_ADDRESS => UPDATE_ADDRESS_FIELDS,
@@ -635,6 +642,9 @@ module AuthorizeNet
635
642
  {:batchId => :batch_id}
636
643
  ]
637
644
 
645
+ GET_UNSETTLED_TRANSACTION_LIST = [
646
+ ]
647
+
638
648
  GET_TRANSACTION_DETAILS = [
639
649
  {:transId => :transaction_id}
640
650
  ]
@@ -760,6 +770,7 @@ module AuthorizeNet
760
770
  FIELDS = {
761
771
  AuthorizeNet::XmlTransaction::Type::REPORT_GET_BATCH_LIST => GET_BATCH_LIST,
762
772
  AuthorizeNet::XmlTransaction::Type::REPORT_GET_TRANSACTION_LIST => GET_TRANSACTION_LIST,
773
+ AuthorizeNet::XmlTransaction::Type::REPORT_GET_UNSETTLED_TRANSACTION_LIST => GET_UNSETTLED_TRANSACTION_LIST,
763
774
  AuthorizeNet::XmlTransaction::Type::REPORT_GET_TRANSACTION_DETAILS => GET_TRANSACTION_DETAILS
764
775
  }
765
776
  end
@@ -69,6 +69,23 @@ module AuthorizeNet::Reporting
69
69
  make_request
70
70
  end
71
71
 
72
+ # Sets up and submits a getUnsettledTransactionListRequest transaction. If this transaction has already been
73
+ # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
74
+ # response object will have an array of TransactionDetail objects available via its transactions method if
75
+ # the request was successful. These TransactionDetail objects will not be fully populated. Use get_transaction_details
76
+ # to get all the details.
77
+ #
78
+ #
79
+ # Typical usage:
80
+ #
81
+ # response = transaction.get_unsettled_transaction_list
82
+ # transactions = response.transactions if response.success?
83
+ #
84
+ def get_unsettled_transaction_list
85
+ @type = Type::REPORT_GET_UNSETTLED_TRANSACTION_LIST
86
+ make_request
87
+ end
88
+
72
89
  # Sets up and submits a getTransactionDetailsRequest transaction. If this transaction has already been
73
90
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::Reporting::Response object. The
74
91
  # response object will have a TransactionDetail object available via its transactions method if
@@ -30,6 +30,7 @@ module AuthorizeNet
30
30
  CIM_GET_PROFILE = "getCustomerProfileRequest"
31
31
  CIM_GET_PAYMENT = "getCustomerPaymentProfileRequest"
32
32
  CIM_GET_ADDRESS = "getCustomerShippingAddressRequest"
33
+ CIM_GET_HOSTED_PROFILE = "getHostedProfilePageRequest"
33
34
  CIM_UPDATE_PROFILE = "updateCustomerProfileRequest"
34
35
  CIM_UPDATE_PAYMENT = "updateCustomerPaymentProfileRequest"
35
36
  CIM_UPDATE_ADDRESS = "updateCustomerShippingAddressRequest"
@@ -37,6 +38,7 @@ module AuthorizeNet
37
38
  CIM_VALIDATE_PAYMENT = "validateCustomerPaymentProfileRequest"
38
39
  REPORT_GET_BATCH_LIST = "getSettledBatchListRequest"
39
40
  REPORT_GET_TRANSACTION_LIST = "getTransactionListRequest"
41
+ REPORT_GET_UNSETTLED_TRANSACTION_LIST = "getUnsettledTransactionListRequest"
40
42
  REPORT_GET_TRANSACTION_DETAILS = "getTransactionDetailsRequest"
41
43
  end
42
44
 
@@ -251,6 +253,7 @@ module AuthorizeNet
251
253
  }
252
254
  end
253
255
  @xml = builder.to_xml
256
+
254
257
  url = URI.parse(@gateway)
255
258
 
256
259
  request = Net::HTTP::Post.new(url.path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authorizenet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.2
4
+ version: 1.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Authorize.Net
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-31 00:00:00.000000000 Z
11
+ date: 2014-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -16,14 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.4.3
19
+ version: 1.6.4
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 1.6.5
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: 1.4.3
29
+ version: 1.6.4
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 1.6.5
33
+ - !ruby/object:Gem::Dependency
34
+ name: roxml
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '='
38
+ - !ruby/object:Gem::Version
39
+ version: 3.3.1
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - '='
45
+ - !ruby/object:Gem::Version
46
+ version: 3.3.1
27
47
  - !ruby/object:Gem::Dependency
28
48
  name: rake
29
49
  requirement: !ruby/object:Gem::Requirement
@@ -67,27 +87,21 @@ extra_rdoc_files: []
67
87
  files:
68
88
  - lib/app/helpers/authorize_net_helper.rb
69
89
  - lib/authorize_net.rb
70
- - lib/authorize_net.rb~
71
90
  - lib/authorize_net/addresses/address.rb
72
91
  - lib/authorize_net/addresses/shipping_address.rb
73
92
  - lib/authorize_net/aim/response.rb
74
- - lib/authorize_net/aim/response.rb~
75
93
  - lib/authorize_net/aim/transaction.rb
94
+ - lib/authorize_net/api/api_transaction.rb
95
+ - lib/authorize_net/api/schema.rb
96
+ - lib/authorize_net/api/transaction.rb
76
97
  - lib/authorize_net/arb/fields.rb
77
- - lib/authorize_net/arb/fields.rb~
78
98
  - lib/authorize_net/arb/paging.rb
79
- - lib/authorize_net/arb/paging.rb~
80
99
  - lib/authorize_net/arb/response.rb
81
- - lib/authorize_net/arb/response.rb~
82
100
  - lib/authorize_net/arb/sorting.rb
83
- - lib/authorize_net/arb/sorting.rb~
84
101
  - lib/authorize_net/arb/subscription.rb
85
102
  - lib/authorize_net/arb/subscription_detail.rb
86
- - lib/authorize_net/arb/subscription_detail.rb~
87
103
  - lib/authorize_net/arb/subscription_list_response.rb
88
- - lib/authorize_net/arb/subscription_list_response.rb~
89
104
  - lib/authorize_net/arb/transaction.rb
90
- - lib/authorize_net/arb/transaction.rb~
91
105
  - lib/authorize_net/authorize_net.rb
92
106
  - lib/authorize_net/cim/customer_profile.rb
93
107
  - lib/authorize_net/cim/payment_profile.rb
@@ -96,7 +110,6 @@ files:
96
110
  - lib/authorize_net/customer.rb
97
111
  - lib/authorize_net/email_receipt.rb
98
112
  - lib/authorize_net/fields.rb
99
- - lib/authorize_net/fields.rb~
100
113
  - lib/authorize_net/key_value_response.rb
101
114
  - lib/authorize_net/key_value_transaction.rb
102
115
  - lib/authorize_net/line_item.rb
@@ -117,9 +130,7 @@ files:
117
130
  - lib/authorize_net/sim/transaction.rb
118
131
  - lib/authorize_net/transaction.rb
119
132
  - lib/authorize_net/xml_response.rb
120
- - lib/authorize_net/xml_response.rb~
121
133
  - lib/authorize_net/xml_transaction.rb
122
- - lib/authorize_net/xml_transaction.rb~
123
134
  - lib/authorizenet.rb
124
135
  - lib/generators/authorize_net/direct_post/direct_post_generator.rb
125
136
  - lib/generators/authorize_net/direct_post/templates/README-AuthorizeNet
@@ -155,7 +166,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
155
166
  requirements:
156
167
  - - ">="
157
168
  - !ruby/object:Gem::Version
158
- version: 1.8.7
169
+ version: 1.9.3
159
170
  required_rubygems_version: !ruby/object:Gem::Requirement
160
171
  requirements:
161
172
  - - ">="
@@ -1,95 +0,0 @@
1
- # The SDK initialization enters here. Loads all needed libraries and files. Inspects
2
- # the current runtime to see if Rails is present. If it is, we inject our helper into
3
- # ActiveSupport.
4
-
5
- require "cgi"
6
- require "net/https"
7
- require "uri"
8
- require "openssl"
9
- require 'bigdecimal'
10
- require 'nokogiri'
11
- require 'date'
12
-
13
- # TODO: Add local data validation where possible
14
-
15
- $:.unshift File.dirname(__FILE__)
16
-
17
- require "authorize_net/authorize_net"
18
- require "authorize_net/payment_methods/credit_card"
19
- require "authorize_net/payment_methods/echeck"
20
- require "authorize_net/addresses/address"
21
- require "authorize_net/addresses/shipping_address"
22
- require "authorize_net/customer"
23
- require "authorize_net/email_receipt"
24
- require "authorize_net/order"
25
- require "authorize_net/line_item"
26
- require "authorize_net/cim/payment_profile"
27
- require "authorize_net/cim/customer_profile"
28
- require "authorize_net/reporting/batch"
29
- require "authorize_net/reporting/batch_statistics"
30
- require "authorize_net/reporting/transaction_details"
31
- require "authorize_net/reporting/fds_filter"
32
- require "authorize_net/reporting/returned_item"
33
- require "authorize_net/response"
34
- require "authorize_net/key_value_response"
35
- require "authorize_net/xml_response"
36
- require "authorize_net/transaction"
37
- require "authorize_net/key_value_transaction"
38
- require "authorize_net/xml_transaction"
39
- require "authorize_net/fields"
40
-
41
- # AIM
42
-
43
- require "authorize_net/aim/transaction"
44
- require "authorize_net/aim/response"
45
-
46
- # SIM
47
-
48
- require "authorize_net/sim/hosted_payment_form"
49
- require "authorize_net/sim/hosted_receipt_page"
50
- require "authorize_net/sim/transaction"
51
- require "authorize_net/sim/response"
52
-
53
- # ARB
54
-
55
- require "authorize_net/arb/subscription_detail"
56
- require "authorize_net/arb/fields"
57
- require "authorize_net/arb/subscription"
58
- require "authorize_net/arb/response"
59
- require "authorize_net/arb/transaction"
60
-
61
- # CIM
62
-
63
- require "authorize_net/cim/response"
64
- require "authorize_net/cim/transaction"
65
-
66
- # Reporting
67
-
68
- require "authorize_net/reporting/response"
69
- require "authorize_net/reporting/transaction"
70
-
71
- # Load our Rails plugin
72
-
73
- if defined?(Rails)
74
- if defined?(Rails::Railtie)
75
- module AuthorizeNet
76
- class Railtie < Rails::Railtie
77
- initializer "authorize_net.load_path_initialize" do |app|
78
- %w{ models controllers helpers }.each do |dir|
79
- path = File.join(File.dirname(__FILE__), 'app', dir)
80
- $LOAD_PATH << path
81
- ActiveSupport::Dependencies.autoload_paths << path
82
- ActiveSupport::Dependencies.autoload_once_paths.delete(path)
83
- end
84
- end
85
- end
86
- end
87
- else
88
- %w{ models controllers helpers }.each do |dir|
89
- path = File.join(File.dirname(__FILE__), 'app', dir)
90
- $LOAD_PATH << path
91
- ActiveSupport::Dependencies.load_paths << path
92
- ActiveSupport::Dependencies.load_once_paths.delete(path)
93
- end
94
- end
95
- end