authorizenet 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/lib/app/helpers/authorize_net_helper.rb +2 -3
  2. data/lib/authorize_net.rb +5 -5
  3. data/lib/authorize_net/addresses/address.rb +15 -19
  4. data/lib/authorize_net/addresses/shipping_address.rb +12 -16
  5. data/lib/authorize_net/aim/response.rb +27 -38
  6. data/lib/authorize_net/aim/transaction.rb +46 -65
  7. data/lib/authorize_net/api/api_transaction.rb +85 -90
  8. data/lib/authorize_net/api/constants.yml +1 -1
  9. data/lib/authorize_net/api/schema.rb +968 -936
  10. data/lib/authorize_net/api/transaction.rb +100 -102
  11. data/lib/authorize_net/arb/fields.rb +21 -21
  12. data/lib/authorize_net/arb/paging.rb +7 -11
  13. data/lib/authorize_net/arb/response.rb +7 -15
  14. data/lib/authorize_net/arb/sorting.rb +6 -10
  15. data/lib/authorize_net/arb/subscription.rb +27 -31
  16. data/lib/authorize_net/arb/subscription_detail.rb +1 -5
  17. data/lib/authorize_net/arb/subscription_list_response.rb +13 -20
  18. data/lib/authorize_net/arb/transaction.rb +50 -56
  19. data/lib/authorize_net/authorize_net.rb +20 -27
  20. data/lib/authorize_net/cim/customer_profile.rb +4 -8
  21. data/lib/authorize_net/cim/payment_profile.rb +10 -12
  22. data/lib/authorize_net/cim/response.rb +19 -24
  23. data/lib/authorize_net/cim/transaction.rb +168 -174
  24. data/lib/authorize_net/customer.rb +11 -14
  25. data/lib/authorize_net/email_receipt.rb +8 -12
  26. data/lib/authorize_net/fields.rb +483 -502
  27. data/lib/authorize_net/key_value_response.rb +54 -62
  28. data/lib/authorize_net/key_value_transaction.rb +87 -97
  29. data/lib/authorize_net/line_item.rb +10 -14
  30. data/lib/authorize_net/order.rb +21 -25
  31. data/lib/authorize_net/payment_methods/credit_card.rb +6 -7
  32. data/lib/authorize_net/payment_methods/echeck.rb +29 -31
  33. data/lib/authorize_net/reporting/batch.rb +4 -7
  34. data/lib/authorize_net/reporting/batch_statistics.rb +2 -6
  35. data/lib/authorize_net/reporting/fds_filter.rb +2 -5
  36. data/lib/authorize_net/reporting/response.rb +54 -60
  37. data/lib/authorize_net/reporting/returned_item.rb +11 -12
  38. data/lib/authorize_net/reporting/transaction.rb +27 -29
  39. data/lib/authorize_net/reporting/transaction_details.rb +3 -6
  40. data/lib/authorize_net/response.rb +6 -10
  41. data/lib/authorize_net/sim/hosted_payment_form.rb +16 -20
  42. data/lib/authorize_net/sim/hosted_receipt_page.rb +18 -23
  43. data/lib/authorize_net/sim/response.rb +24 -33
  44. data/lib/authorize_net/sim/transaction.rb +33 -43
  45. data/lib/authorize_net/transaction.rb +15 -21
  46. data/lib/authorize_net/xml_response.rb +36 -54
  47. data/lib/authorize_net/xml_transaction.rb +115 -134
  48. data/lib/generators/authorize_net/direct_post/direct_post_generator.rb +5 -6
  49. data/lib/generators/authorize_net/sim/sim_generator.rb +6 -7
  50. data/lib/generators/generator_extensions.rb +23 -25
  51. metadata +127 -81
  52. checksums.yaml +0 -7
@@ -1,19 +1,15 @@
1
1
  module AuthorizeNet::CIM
2
-
3
2
  # Models a customer profile.
4
3
  class CustomerProfile < AuthorizeNet::Customer
5
-
6
4
  include AuthorizeNet::Model
7
-
5
+
8
6
  attr_accessor :customer_profile_id, :payment_profiles
9
-
7
+
10
8
  def to_hash
11
9
  hash = super
12
- hash.delete_if {|k, v| v.nil?}
10
+ hash.delete_if { |_k, v| v.nil? }
13
11
  hash[:payment_profiles] = handle_multivalue_hashing(@payment_profiles)
14
12
  hash
15
13
  end
16
-
17
14
  end
18
-
19
- end
15
+ end
@@ -1,16 +1,15 @@
1
1
  module AuthorizeNet::CIM
2
2
  # Models a payment profile.
3
3
  class PaymentProfile
4
-
5
4
  module CustomerType
6
- INDIVIDUAL = 'individual'
7
- BUSINESS = 'business'
5
+ INDIVIDUAL = 'individual'.freeze
6
+ BUSINESS = 'business'.freeze
8
7
  end
9
-
8
+
10
9
  include AuthorizeNet::Model
11
-
10
+
12
11
  attr_accessor :cust_type, :billing_address, :payment_method, :customer_payment_profile_id
13
-
12
+
14
13
  def cust_type=(type) #:nodoc:
15
14
  case type
16
15
  when :business
@@ -21,17 +20,16 @@ module AuthorizeNet::CIM
21
20
  @cust_type = type
22
21
  end
23
22
  end
24
-
23
+
25
24
  def to_hash
26
25
  hash = {
27
- :cust_type => @cust_type,
28
- :customer_payment_profile_id => @customer_payment_profile_id
26
+ cust_type: @cust_type,
27
+ customer_payment_profile_id: @customer_payment_profile_id
29
28
  }
30
- hash.delete_if {|k, v| v.nil?}
29
+ hash.delete_if { |_k, v| v.nil? }
31
30
  hash.merge!(@billing_address.to_hash) unless @billing_address.nil?
32
31
  hash.merge!(@payment_method.to_hash) unless @payment_method.nil?
33
32
  hash
34
33
  end
35
-
36
34
  end
37
- end
35
+ end
@@ -1,10 +1,8 @@
1
1
  module AuthorizeNet::CIM
2
-
3
2
  # The CIM response class.
4
3
  class Response < AuthorizeNet::XmlResponse
5
-
6
4
  include AuthorizeNet::CIM::Fields
7
-
5
+
8
6
  # Constructs a new response object from raw_response in the context of transaction.
9
7
  # You don‘t typically construct this object yourself, as AuthorizeNet::CIM::Transaction
10
8
  # will build one for you when it makes the request to the gateway.
@@ -25,57 +23,55 @@ module AuthorizeNet::CIM
25
23
  @payment_profile = @root.at_css('paymentProfile')
26
24
  @profile = @root.at_css('profile')
27
25
  @token = node_content_unless_nil(@root.at_css('token'))
28
- rescue
29
- @raw_response = $!
26
+ rescue StandardError
27
+ @raw_response = $ERROR_INFO
30
28
  end
31
29
  end
32
30
  end
33
-
31
+
34
32
  # Returns a CustomerProfile ID if one was returned by the gateway. Returns nil otherwise.
35
33
  # Note that this method will return nil if we got back a list of IDs (see profile_ids).
36
34
  def profile_id
37
35
  @customer_profile_id
38
36
  end
39
-
37
+
40
38
  # Returns a list of CustomerProfile IDs if any were returned by the gateway. Returns nil otherwise.
41
39
  def profile_ids
42
40
  @customer_profile_id_list
43
41
  end
44
-
42
+
45
43
  # Returns an Address ID if one was returned by the gateway. Returns nil otherwise.
46
44
  # Note that this method will return nil if we got back a list of IDs (see address_ids).
47
45
  def address_id
48
46
  @customer_address_id
49
47
  end
50
-
48
+
51
49
  # Returns a list of Address IDs if any were returned by the gateway. Returns nil otherwise.
52
50
  def address_ids
53
51
  @customer_shipping_address_id_list
54
52
  end
55
-
53
+
56
54
  # Returns a PaymentProfile ID if one was returned by the gateway. Returns nil otherwise.
57
55
  # Note that this method will return nil if we got back a list of IDs (see payment_profile_ids).
58
56
  def payment_profile_id
59
57
  @customer_payment_profile_id
60
58
  end
61
-
59
+
62
60
  # Returns a list of PaymentProfile IDs if any were returned by the gateway. Returns nil otherwise.
63
61
  def payment_profile_ids
64
62
  @customer_payment_profile_id_list
65
63
  end
66
64
 
67
65
  # Returns hosted profile access token when requested. Returns nil otherwise.
68
- def token
69
- @token
70
- end
71
-
66
+ attr_reader :token
67
+
72
68
  # Returns a validation response as an AuthorizeNet::AIM::Response object if a validation response was returned
73
69
  # by the gateway. Returns nil otherwise.
74
70
  # Note that this method will return nil if we got back a list of IDs (see validation_responses).
75
71
  def validation_response
76
72
  AuthorizeNet::AIM::Response.new(@validation_direct_response.dup, @transaction) unless @validation_direct_response.nil?
77
73
  end
78
-
74
+
79
75
  # Returns a list of validation response as an AuthorizeNet::AIM::Response objects if a list of validation response was returned
80
76
  # by the gateway. Returns nil otherwise.
81
77
  def validation_responses
@@ -84,33 +80,32 @@ module AuthorizeNet::CIM
84
80
  @validation_direct_response_list.element_children.each do |child|
85
81
  responses <<= AuthorizeNet::AIM::Response.new(child.dup, @transaction) unless child.nil?
86
82
  end
87
- return responses unless responses.length == 0
83
+ return responses unless responses.empty?
88
84
  end
89
85
  end
90
-
86
+
91
87
  # Returns the direct response as an AuthorizeNet::AIM::Response object if a direct response was returned
92
88
  # by the gateway. Returns nil otherwise.
93
89
  def direct_response
94
90
  AuthorizeNet::AIM::Response.new(@direct_response.dup, @transaction) unless @direct_response.nil?
95
91
  end
96
-
92
+
97
93
  # Returns a CustomerProfile built from the entity returned by the gateway. Returns nil otherwise.
98
94
  def profile
99
95
  build_entity(@profile, Fields::PROFILE_ENTITY_DESCRIPTION) unless @profile.nil?
100
96
  end
101
-
97
+
102
98
  # Returns a PaymentProfile built from the entity returned by the gateway. Returns nil otherwise.
103
99
  def payment_profile
104
100
  build_entity(@payment_profile, Fields::PAYMENT_PROFILE_ENTITY_DESCRIPTION) unless @payment_profile.nil?
105
101
  end
106
-
102
+
107
103
  # Returns an Address built from the entity returned by the gateway. Returns nil otherwise.
108
104
  def address
109
105
  build_entity(@address, Fields::ADDRESS_ENTITY_DESCRIPTION) unless @address.nil?
110
106
  end
111
-
107
+
112
108
  #:enddoc:
113
109
  protected
114
-
115
110
  end
116
- end
111
+ end
@@ -1,79 +1,78 @@
1
1
  module AuthorizeNet::CIM
2
-
3
2
  # The CIM transaction class.
4
3
  class Transaction < AuthorizeNet::XmlTransaction
5
-
6
4
  include AuthorizeNet::CIM::Fields
7
-
5
+
8
6
  # The class to wrap our response in.
9
7
  @response_class = AuthorizeNet::CIM::Response
10
-
8
+
11
9
  # The default options for the constructor.
12
10
  @@option_defaults = {
13
- :gateway => :production,
14
- :verify_ssl => true,
15
- :reference_id => nil
11
+ gateway: :production,
12
+ verify_ssl: true,
13
+ reference_id: nil
16
14
  }
17
-
15
+
18
16
  # Constructs a CIM transaction. You can use the new CIM transaction object
19
17
  # to issue a request to the payment gateway and parse the response into a new
20
18
  # AuthorizeNet::CIM::Response object.
21
- #
19
+ #
22
20
  # +api_login_id+:: Your API login ID, as a string.
23
21
  # +api_transaction_key+:: Your API transaction key, as a string.
24
22
  # +options+:: A hash of options. See below for values.
25
- #
23
+ #
26
24
  # Options
27
- # +gateway+:: The gateway to submit the transaction to. Can be a URL string, an AuthorizeNet::CIM::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).
25
+ # +gateway+:: The gateway to submit the transaction to. Can be a URL string, an AuthorizeNet::CIM::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).
28
26
  # +verify_ssl+:: A boolean indicating if the SSL certificate of the +gateway+ should be verified. Defaults to true.
29
27
  # +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.
30
28
  #
31
29
  def initialize(api_login_id, api_transaction_key, options = {})
30
+ ActiveSupport::Deprecation.warn "use AuthorizeNet::API::Transaction"
32
31
  super
33
32
  @delim_char = ','
34
33
  @encap_char = nil
35
34
  @custom_fields = {}
36
35
  end
37
-
36
+
38
37
  # The default options for create_profile.
39
38
  @@create_profile_option_defaults = {
40
- :validation_mode => :none
39
+ validation_mode: :none
41
40
  }
42
41
 
43
42
  # The default options for get_hosted_profile_token.
44
43
  @@get_hosted_profile_token_option_defaults = {
45
- :border_visible => true,
46
- :validation_mode => :none,
44
+ border_visible: true,
45
+ validation_mode: :none
47
46
  }
48
47
 
49
48
  # The default options for create_payment_profile.
50
49
  @@create_payment_profile_option_defaults = {
51
- :validation_mode => :none
50
+ validation_mode: :none
52
51
  }
53
-
52
+
54
53
  # The default options for update_payment_profile.
55
54
  @@update_payment_profile_option_defaults = {
56
- :validation_mode => :none
55
+ validation_mode: :none
57
56
  }
58
-
57
+
59
58
  # The default options for create_transaction and the various type specific create transaction methods.
60
59
  @@create_transaction_option_defaults = {
61
- :address_id => nil,
62
- :split_tender_id => nil,
63
- :aim_options => nil,
64
- :custom_fields => nil
60
+ address_id: nil,
61
+ split_tender_id: nil,
62
+ aim_options: nil,
63
+ custom_fields: nil
65
64
  }
66
-
65
+
67
66
  # The default options for validate_payment_profile.
68
67
  @@validate_payment_profile_option_defaults = {
69
- :address_id => nil,
70
- :card_code => nil,
71
- :validation_mode => :testMode
68
+ address_id: nil,
69
+ card_code: nil,
70
+ validation_mode: :testMode
72
71
  }
73
-
72
+
74
73
  # A list of keys that should be stored if passed as aim_options.
75
- @@aim_response_options = [:delim_char, :encap_char]
76
-
74
+ @@aim_response_options = %i[delim_char encap_char]
75
+
77
76
  # Sets up and submits a createCustomerProfileRequest transaction. If this transaction has already been
78
77
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
79
78
  # response object will have a profile_id if the request was successful. If any PaymentProfiles or Addresses
@@ -81,36 +80,36 @@ module AuthorizeNet::CIM
81
80
  #
82
81
  # +profile+:: An AuthorizeNet::CIM::CustomerProfile object describing the profile to create.
83
82
  # +options+:: An optional hash of options.
84
- #
83
+ #
85
84
  # Options:
86
85
  # +validation_mode+:: Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do (assuming a PaymentProfile is included with the CustomerProfile)
87
- #
86
+ #
88
87
  # Typical usage:
89
- #
88
+ #
90
89
  # profile = AuthorizeNet::CIM::CustomerProfile.new(
91
90
  # :email => 'test@example.com',
92
91
  # :id => 'userassignedid'
93
92
  # )
94
93
  # response = transaction.create_profile(profile)
95
94
  # puts response.profile_id if response.success?
96
- #
95
+ #
97
96
  def create_profile(profile, options = {})
98
97
  options = @@create_profile_option_defaults.merge(options)
99
98
  @type = Type::CIM_CREATE_PROFILE
100
99
  @fields.merge!(profile.to_hash)
101
- set_fields(:validation_mode => options[:validation_mode])
100
+ set_fields(validation_mode: options[:validation_mode])
102
101
  make_request
103
102
  end
104
-
103
+
105
104
  # Sets up and submits a getCustomerProfileRequest transaction. If this transaction has already been
106
105
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
107
106
  # response object will have the CustomerProfile object requested available via its profile method if
108
107
  # the request was successful.
109
- #
108
+ #
110
109
  #
111
110
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile you want to retrieve, or a CustomerProfile object with the ID populated.
112
111
  # Typical usage:
113
- #
112
+ #
114
113
  # response = transaction.get_profile('123456')
115
114
  # profile = response.profile if response.success?
116
115
  #
@@ -119,16 +118,16 @@ module AuthorizeNet::CIM
119
118
  handle_profile_id(profile_id)
120
119
  make_request
121
120
  end
122
-
121
+
123
122
  # Sets up and submits a updateCustomerProfileRequest transaction. If this transaction has already been
124
123
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. Note that
125
124
  # any PaymentProfiles will NOT be updated using this method. This is a limitation of the CIM API. See
126
125
  # update_payment_profile if you need to update a PaymentProfile.
127
- #
126
+ #
128
127
  #
129
128
  # +profile+:: An AuthorizeNet::CIM::CustomerProfile object describing the profile to update. It must contain the customer_profile_id of the record to update.
130
129
  # Typical usage:
131
- #
130
+ #
132
131
  # profile.fax = '5555551234'
133
132
  # response = transaction.update_profile(profile)
134
133
  # puts response.success?
@@ -138,14 +137,14 @@ module AuthorizeNet::CIM
138
137
  @fields.merge!(profile.to_hash)
139
138
  make_request
140
139
  end
141
-
140
+
142
141
  # Sets up and submits a deleteCustomerProfileRequest transaction. If this transaction has already been
143
142
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
144
- #
143
+ #
145
144
  #
146
145
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile you want to delete, or a CustomerProfile object with the ID populated.
147
146
  # Typical usage:
148
- #
147
+ #
149
148
  # response = transaction.delete_profile('123456')
150
149
  # puts response.success?
151
150
  #
@@ -178,7 +177,7 @@ module AuthorizeNet::CIM
178
177
  handle_hosted_profile_settings(options)
179
178
  make_request
180
179
  end
181
-
180
+
182
181
  # Sets up and submits a createCustomerPaymentProfileRequest transaction. If this transaction has already been
183
182
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
184
183
  # response object will have a payment_profile_id if the request was successful.
@@ -186,12 +185,12 @@ module AuthorizeNet::CIM
186
185
  # +profile+:: An AuthorizeNet::CIM::PaymentProfile object describing the profile to create.
187
186
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who will own the PaymentProfile, or a CustomerProfile object with the ID populated.
188
187
  # +options+:: An optional hash of options.
189
- #
188
+ #
190
189
  # Options:
191
190
  # +validation_mode+:: Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do (assuming a PaymentProfile is included with the CustomerProfile)
192
- #
191
+ #
193
192
  # Typical usage:
194
- #
193
+ #
195
194
  # credit_card = AuthorizeNet::CreditCard.new('4111111111111111', '0120')
196
195
  # payment_profile = AuthorizeNet::CIM::PaymentProfile.new(:payment_method => credit_card)
197
196
  # response = transaction.create_payment_profile(payment_profile, '123456')
@@ -201,21 +200,21 @@ module AuthorizeNet::CIM
201
200
  options = @@create_payment_profile_option_defaults.merge(options)
202
201
  @type = Type::CIM_CREATE_PAYMENT
203
202
  @fields.merge!(payment_profile.to_hash)
204
- set_fields(:validation_mode => options[:validation_mode])
203
+ set_fields(validation_mode: options[:validation_mode])
205
204
  handle_profile_id(profile_id)
206
205
  make_request
207
206
  end
208
-
207
+
209
208
  # Sets up and submits a getCustomerPaymentProfileRequest transaction. If this transaction has already been
210
209
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
211
210
  # response object will have the PaymentProfile object requested available via its payment_profile method if
212
211
  # the request was successful.
213
- #
212
+ #
214
213
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to retrieve, or a PaymentProfile object with the ID populated.
215
214
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.
216
- #
215
+ #
217
216
  # Typical usage:
218
- #
217
+ #
219
218
  # response = transaction.get_payment_profile('654321', '123456')
220
219
  # payment_profile = response.payment_profile if response.success?
221
220
  #
@@ -225,20 +224,20 @@ module AuthorizeNet::CIM
225
224
  handle_profile_id(profile_id)
226
225
  make_request
227
226
  end
228
-
227
+
229
228
  # Sets up and submits a updateCustomerPaymentProfileRequest transaction. If this transaction has already been
230
229
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
231
- #
230
+ #
232
231
  #
233
232
  # +payment_profile+:: An AuthorizeNet::CIM::PaymentProfile object describing the profile to update.
234
233
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.
235
- #
234
+ #
236
235
  # Typical usage:
237
- #
236
+ #
238
237
  # payment_profile.cust_type = :business
239
238
  # response = transaction.update_payment_profile(payment_profile, '123456')
240
239
  # puts response.success?
241
- #
240
+ #
242
241
  # Options:
243
242
  # +validation_mode+:: Set to :testMode, :liveMode or :none (the default) to indicate what sort of PaymentProfile validation to do.
244
243
  #
@@ -246,20 +245,20 @@ module AuthorizeNet::CIM
246
245
  options = @@create_payment_profile_option_defaults.merge(options)
247
246
  @type = Type::CIM_UPDATE_PAYMENT
248
247
  @fields.merge!(payment_profile.to_hash)
249
- set_fields(:validation_mode => options[:validation_mode])
248
+ set_fields(validation_mode: options[:validation_mode])
250
249
  handle_profile_id(profile_id)
251
250
  make_request
252
251
  end
253
-
252
+
254
253
  # Sets up and submits a deleteCustomerPaymentProfileRequest transaction. If this transaction has already been
255
254
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
256
- #
255
+ #
257
256
  #
258
257
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to retrieve, or a PaymentProfile object with the ID populated.
259
258
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.
260
- #
259
+ #
261
260
  # Typical usage:
262
- #
261
+ #
263
262
  # response = transaction.delete_profile('123456')
264
263
  # puts response.success?
265
264
  #
@@ -269,45 +268,45 @@ module AuthorizeNet::CIM
269
268
  handle_profile_id(profile_id)
270
269
  make_request
271
270
  end
272
-
271
+
273
272
  # Sets up and submits a validateCustomerPaymentProfileRequest transaction. If this transaction has already been
274
273
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The results
275
274
  # of the validation can be obtained via the direct_response method of the response object.
276
- #
275
+ #
277
276
  #
278
277
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to validate, or a PaymentProfile object with the ID populated.
279
278
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this PaymentProfile, or a CustomerProfile object with the ID populated.
280
- #
279
+ #
281
280
  # Typical usage:
282
- #
281
+ #
283
282
  # response = transaction.validate_payment_profile('654321', '123456')
284
283
  # puts response.direct_response.success? if response.success?
285
- #
284
+ #
286
285
  # Options:
287
286
  # +validation_mode+:: Set to :testMode (the default) or :liveMode to indicate what sort of PaymentProfile validation to do.
288
287
  # +address_id+:: Set a shipping Address to be part of the validation transaction.
289
288
  # +card_code+:: Set a CCV code if one is needed for validation. Defaults to nil.
290
- #
289
+ #
291
290
  def validate_payment_profile(payment_profile_id, profile_id, options = {})
292
291
  @type = Type::CIM_VALIDATE_PAYMENT
293
292
  options = @@validate_payment_profile_option_defaults.merge(options)
294
293
  handle_payment_profile_id(payment_profile_id)
295
294
  handle_profile_id(profile_id)
296
295
  handle_address_id(options[:address_id]) unless options[:address_id].nil?
297
- set_fields(:validation_mode => options[:validation_mode])
298
- set_fields(:card_code => options[:card_code]) unless options[:card_code].nil?
296
+ set_fields(validation_mode: options[:validation_mode])
297
+ set_fields(card_code: options[:card_code]) unless options[:card_code].nil?
299
298
  make_request
300
299
  end
301
-
300
+
302
301
  # Sets up and submits a createCustomerShippingAddressRequest transaction. If this transaction has already been
303
302
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
304
303
  # response object will have a address_id if the request was successful.
305
304
  #
306
305
  # +address+:: An AuthorizeNet::Address object describing the profile to create.
307
306
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who will own this Address, or a CustomerProfile object with the ID populated.
308
- #
307
+ #
309
308
  # Typical usage:
310
- #
309
+ #
311
310
  # address = AuthorizeNet::Address.new(:first_name => 'Jane', :last_name => 'Doe', :address => '123 Fake St', :city => 'Raccoon Junction', :state => 'WY', :zip => '99999')
312
311
  # response = transaction.create_address(address, '123456')
313
312
  # puts response.address_id if response.success?
@@ -318,18 +317,18 @@ module AuthorizeNet::CIM
318
317
  handle_profile_id(profile_id)
319
318
  make_request
320
319
  end
321
-
320
+
322
321
  # Sets up and submits a getCustomerShippingAddressRequest transaction. If this transaction has already been
323
322
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
324
323
  # response object will have the Address object requested available via its address method if
325
324
  # the request was successful.
326
- #
325
+ #
327
326
  #
328
327
  # +address_id+:: Takes either a String containing the ID of the Address you want to retrieve, or an Address object with the ID populated.
329
328
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.
330
- #
329
+ #
331
330
  # Typical usage:
332
- #
331
+ #
333
332
  # response = transaction.get_address('654321', '123456')
334
333
  # address = response.address if response.success?
335
334
  #
@@ -339,16 +338,16 @@ module AuthorizeNet::CIM
339
338
  handle_profile_id(profile_id)
340
339
  make_request
341
340
  end
342
-
341
+
343
342
  # Sets up and submits a updateCustomerShippingAddressRequest transaction. If this transaction has already been
344
343
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
345
- #
344
+ #
346
345
  #
347
346
  # +address+:: An Address object describing the address to update.
348
347
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.
349
- #
348
+ #
350
349
  # Typical usage:
351
- #
350
+ #
352
351
  # address.city = 'Somewhere Else'
353
352
  # response = transaction.update_address(address, '123456')
354
353
  # puts response.success?
@@ -359,16 +358,16 @@ module AuthorizeNet::CIM
359
358
  handle_profile_id(profile_id)
360
359
  make_request
361
360
  end
362
-
361
+
363
362
  # Sets up and submits a deleteCustomerShippingAddressRequest transaction. If this transaction has already been
364
363
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object.
365
- #
364
+ #
366
365
  #
367
366
  # +address_id+:: Takes either a String containing the ID of the Address you want to delete, or an Address object with the ID populated.
368
367
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns this Address, or a CustomerProfile object with the ID populated.
369
- #
368
+ #
370
369
  # Typical usage:
371
- #
370
+ #
372
371
  # response = transaction.delete_address('654321', '123456')
373
372
  # puts response.success?
374
373
  #
@@ -378,57 +377,56 @@ module AuthorizeNet::CIM
378
377
  handle_profile_id(profile_id)
379
378
  make_request
380
379
  end
381
-
380
+
382
381
  # Sets up and submits a createCustomerProfileTransactionRequest transaction. If this transaction has already been
383
382
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. It is recommend
384
383
  # to use the connivence methods for each type of payment transaction rather than this method.
385
- #
384
+ #
386
385
  # +type+:: The type of payment transaction to run. Can be :auth_capture, :auth_only, :prior_auth_capture, :void, or :refund.
387
386
  # +amount+:: The amount of the transaction. This is required for every transaction type except :void.
388
387
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.
389
388
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.
390
389
  # +order+:: An Order object describing the order that this payment transaction is for. Pass nil for no order.
391
390
  # +options+:: An optional hash of options.
392
- #
391
+ #
393
392
  # Options:
394
393
  # +address_id+:: Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.
395
394
  # +split_tender_id+:: A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.
396
395
  # +aim_options+:: A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.
397
396
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
398
- #
397
+ #
399
398
  # Typical usage:
400
- #
399
+ #
401
400
  # response = transaction.create_transaction(:auth_capture, 10.00, '123456', '654321', nil)
402
401
  # if response.success?
403
402
  # puts response.direct_response if direct_response.success?
404
- #
405
- #
403
+ #
404
+ #
406
405
  def create_transaction(type, amount, profile_id, payment_profile_id, order, options = {})
407
406
  @type = Type::CIM_CREATE_TRANSACTION
408
407
  options = @@create_transaction_option_defaults.merge(options)
409
408
  handle_profile_id(profile_id)
410
409
  handle_payment_profile_id(payment_profile_id)
411
410
  handle_address_id(options[:address_id]) unless options[:address_id].nil?
412
- set_fields(:split_tender_id => options[:split_tender_id])
411
+ set_fields(split_tender_id: options[:split_tender_id])
413
412
  @transaction_type = type
414
413
  @fields.merge!(order.to_hash) unless order.nil?
415
- set_fields(:amount => amount)
414
+ set_fields(amount: amount)
416
415
  handle_aim_options(options[:aim_options])
417
416
  handle_custom_fields(options[:custom_fields])
418
417
  make_request
419
418
  end
420
-
421
-
419
+
422
420
  # Sets up and submits an AUTHORIZE_AND_CAPTURE transaction using stored payment information. If this
423
421
  # transaction has already been run, this method will return nil. Otherwise it will return an
424
422
  # AuthorizeNet::CIM::Response object.
425
- #
423
+ #
426
424
  # +amount+:: The amount of the transaction.
427
425
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.
428
426
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.
429
427
  # +order+:: An Order object describing the order that this payment transaction is for. Pass nil for no order.
430
428
  # +options+:: An optional hash of options.
431
- #
429
+ #
432
430
  # Options:
433
431
  # +address_id+:: Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.
434
432
  # +split_tender_id+:: A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.
@@ -436,7 +434,7 @@ module AuthorizeNet::CIM
436
434
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
437
435
  #
438
436
  # Typical usage:
439
- #
437
+ #
440
438
  # response = transaction.create_transaction_auth_capture(10.00, '123456', '654321', nil)
441
439
  # if response.success?
442
440
  # puts response.direct_response if direct_response.success?
@@ -444,17 +442,17 @@ module AuthorizeNet::CIM
444
442
  def create_transaction_auth_capture(amount, profile_id, payment_profile_id, order = nil, options = {})
445
443
  create_transaction(:auth_capture, amount, profile_id, payment_profile_id, order, options)
446
444
  end
447
-
445
+
448
446
  # Sets up and submits an AUTH_ONLY transaction using stored payment information. If this
449
447
  # transaction has already been run, this method will return nil. Otherwise it will return an
450
448
  # AuthorizeNet::CIM::Response object.
451
- #
449
+ #
452
450
  # +amount+:: The amount of the transaction.
453
451
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be charged, or a CustomerProfile object with the ID populated.
454
452
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to charge, or a PaymentProfile object with the ID populated.
455
453
  # +order+:: An Order object describing the order that this payment transaction is for. Pass nil for no order.
456
454
  # +options+:: An optional hash of options.
457
- #
455
+ #
458
456
  # Options:
459
457
  # +address_id+:: Takes either a String containing the ID of an Address, or an Address object with the ID populated. Used as the shipping address for the payment transaction. Defaults to nil.
460
458
  # +split_tender_id+:: A split tender transaction ID as a string. If the transaction is to be part of a split tender batch, this must be included. Defaults to nil.
@@ -462,7 +460,7 @@ module AuthorizeNet::CIM
462
460
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
463
461
  #
464
462
  # Typical usage:
465
- #
463
+ #
466
464
  # response = transaction.create_transaction_auth_only(10.00, '123456', '654321', nil)
467
465
  # if response.success?
468
466
  # puts response.direct_response if direct_response.success?
@@ -470,22 +468,22 @@ module AuthorizeNet::CIM
470
468
  def create_transaction_auth_only(amount, profile_id, payment_profile_id, order = nil, options = {})
471
469
  create_transaction(:auth_only, amount, profile_id, payment_profile_id, order, options)
472
470
  end
473
-
471
+
474
472
  # Sets up and submits a PRIOR_AUTHORIZATION_AND_CAPTURE transaction using stored payment information. If this
475
473
  # transaction has already been run, this method will return nil. Otherwise it will return an
476
474
  # AuthorizeNet::CIM::Response object.
477
- #
475
+ #
478
476
  # +transaction_id+:: A string containing a transaction ID that was generated via an AUTH_ONLY transaction.
479
477
  # +amount+:: The amount to capture. Must be <= the amount authorized via the AUTH_ONLY transaction.
480
478
  # +order+:: An Order object describing the order that this payment transaction is for. Pass nil for no order.
481
479
  # +options+:: An optional hash of options.
482
- #
480
+ #
483
481
  # Options:
484
482
  # +aim_options+:: A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.
485
483
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
486
484
  #
487
485
  # Typical usage:
488
- #
486
+ #
489
487
  # response = transaction.create_transaction_prior_auth_capture('111222', 10.00)
490
488
  # if response.success?
491
489
  # puts response.direct_response if direct_response.success?
@@ -494,20 +492,20 @@ module AuthorizeNet::CIM
494
492
  handle_transaction_id(transaction_id)
495
493
  create_transaction(:prior_auth_capture, amount, nil, nil, order, options)
496
494
  end
497
-
495
+
498
496
  # Sets up and submits a VOID transaction using stored payment information. If this
499
497
  # transaction has already been run, this method will return nil. Otherwise it will return an
500
498
  # AuthorizeNet::CIM::Response object.
501
- #
499
+ #
502
500
  # +transaction_id+:: A string containing a transaction ID to void.
503
501
  # +options+:: An optional hash of options.
504
- #
502
+ #
505
503
  # Options:
506
504
  # +aim_options+:: A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.
507
505
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
508
506
  #
509
507
  # Typical usage:
510
- #
508
+ #
511
509
  # response = transaction.create_transaction_void('111222')
512
510
  # if response.success?
513
511
  # puts response.direct_response if direct_response.success?
@@ -516,24 +514,24 @@ module AuthorizeNet::CIM
516
514
  handle_transaction_id(transaction_id)
517
515
  create_transaction(:void, nil, nil, nil, nil, options)
518
516
  end
519
-
517
+
520
518
  # Sets up and submits a REFUND transaction using stored payment information. If this
521
519
  # transaction has already been run, this method will return nil. Otherwise it will return an
522
520
  # AuthorizeNet::CIM::Response object.
523
- #
521
+ #
524
522
  # +transaction_id+:: A string containing a transaction ID to refund. Pass nil for an unlinked refund.
525
523
  # +amount+:: The amount to refund.
526
524
  # +profile_id+:: Takes either a String containing the ID of the CustomerProfile who owns the PaymentProfile to be credited, or a CustomerProfile object with the ID populated. Pass nil for an unlinked refund.
527
525
  # +payment_profile_id+:: Takes either a String containing the ID of the PaymentProfile you want to credit, or a PaymentProfile object with the ID populated. Pass nil for an unlinked refund.
528
526
  # +order+:: An Order object describing the order that is being refunded. Pass nil for no order.
529
527
  # +options+:: An optional hash of options.
530
- #
528
+ #
531
529
  # Options:
532
530
  # +aim_options+:: A hash of AIM options to be included with the payment transaction. Since the payment transactions in CIM are just encapsulated AIM transactions, any field used by AIM can be set here. Defaults to nil.
533
531
  # +custom_fields+:: A hash of custom fields to pass along with the payment transaction. These fields will be stored with the AIM transaction generated by the CIM transaction. Defaults to nil.
534
532
  #
535
533
  # Typical usage:
536
- #
534
+ #
537
535
  # response = transaction.create_transaction_refund('111222', 10.00, '123456', '654321')
538
536
  # if response.success?
539
537
  # puts response.direct_response if direct_response.success?
@@ -542,125 +540,123 @@ module AuthorizeNet::CIM
542
540
  handle_transaction_id(transaction_id)
543
541
  create_transaction(:refund, amount, profile_id, payment_profile_id, order, options)
544
542
  end
545
-
543
+
546
544
  # Sets up and submits a updateSplitTenderGroupRequest transaction. Use this to end or void a split
547
- # tender batch. If this transaction has already been run, this method will return nil. Otherwise
545
+ # tender batch. If this transaction has already been run, this method will return nil. Otherwise
548
546
  # it will return an AuthorizeNet::CIM::Response object.
549
- #
547
+ #
550
548
  # +split_tender_id+:: The split tender batch ID you want to change the status of.
551
549
  # +status+:: The new status to set for the batch. Options are :voided or :completed.
552
- #
550
+ #
553
551
  # Typical usage:
554
- #
552
+ #
555
553
  # response = transaction.update_split_tender('1111111', :voided)
556
554
  # puts response if response.success?
557
555
  #
558
556
  def update_split_tender(split_tender_id, status)
559
557
  @type = Type::CIM_UPDATE_SPLIT
560
- set_fields(:split_tender_id => split_tender_id, :split_tender_status => status.to_s)
558
+ set_fields(split_tender_id: split_tender_id, split_tender_status: status.to_s)
561
559
  make_request
562
560
  end
563
-
561
+
564
562
  # Sets up and submits a getCustomerProfileIdsRequest transaction. If this transaction has already been
565
563
  # run, this method will return nil. Otherwise it will return an AuthorizeNet::CIM::Response object. The
566
564
  # response object will have a list of all CustomerProfile IDs available via its profile_ids method on success.
567
- #
565
+ #
568
566
  # Typical usage:
569
- #
567
+ #
570
568
  # response = transaction.get_profile_ids()
571
569
  # puts response.profile_ids if response.success?
572
- #
573
- def get_profile_ids()
570
+ #
571
+ def get_profile_ids
574
572
  @type = Type::CIM_GET_PROFILE_IDS
575
573
  make_request
576
574
  end
577
-
575
+
578
576
  # :stopdoc:
579
577
  # Duck-type as an AIM transaction so we can build AIM responses easily
580
-
578
+
581
579
  # No encapsulation_character.
582
580
  def encapsulation_character
583
581
  @encap_char
584
582
  end
585
-
583
+
586
584
  # Comma delimited.
587
585
  def delimiter
588
586
  @delim_char
589
587
  end
590
-
588
+
591
589
  # Custom fields accessor.
592
- def custom_fields
593
- @custom_fields
594
- end
595
-
590
+ attr_reader :custom_fields
591
+
596
592
  # Always version 3.1.
597
593
  def version
598
594
  3.1
599
595
  end
600
-
596
+
601
597
  # Always nil.
602
598
  def cp_version
603
599
  nil
604
600
  end
605
601
  # :startdoc:
606
-
602
+
607
603
  #:enddoc:
608
604
  protected
609
-
605
+
610
606
  # Handles profile id type massaging.
611
607
  def handle_profile_id(id)
612
608
  case id
613
609
  when CustomerProfile
614
- set_fields(:customer_profile_id => id.customer_profile_id.to_s)
610
+ set_fields(customer_profile_id: id.customer_profile_id.to_s)
615
611
  when nil
616
612
  nil
617
613
  else
618
- set_fields(:customer_profile_id => id.to_s)
614
+ set_fields(customer_profile_id: id.to_s)
619
615
  end
620
616
  end
621
-
617
+
622
618
  # Handles payment profile id type massaging.
623
619
  def handle_payment_profile_id(id)
624
620
  case id
625
621
  when PaymentProfile
626
- set_fields(:customer_payment_profile_id => id.customer_payment_profile_id.to_s)
622
+ set_fields(customer_payment_profile_id: id.customer_payment_profile_id.to_s)
627
623
  when nil
628
624
  nil
629
625
  else
630
- set_fields(:customer_payment_profile_id => id.to_s)
626
+ set_fields(customer_payment_profile_id: id.to_s)
631
627
  end
632
628
  end
633
-
629
+
634
630
  # Handles address id type massaging.
635
631
  def handle_address_id(id)
636
632
  case id
637
633
  when AuthorizeNet::Address
638
- set_fields(:customer_address_id => id.customer_address_id.to_s)
634
+ set_fields(customer_address_id: id.customer_address_id.to_s)
639
635
  when nil
640
636
  nil
641
637
  else
642
- set_fields(:customer_address_id => id.to_s)
638
+ set_fields(customer_address_id: id.to_s)
643
639
  end
644
640
  end
645
-
641
+
646
642
  # Handles tranasction id type massaging.
647
643
  def handle_transaction_id(id)
648
644
  case id
649
645
  when AuthorizeNet::AIM::Response
650
- set_fields(:trans_id => id.transaction_id.to_s)
646
+ set_fields(trans_id: id.transaction_id.to_s)
651
647
  else
652
- set_fields(:trans_id => id.to_s)
648
+ set_fields(trans_id: id.to_s)
653
649
  end
654
650
  end
655
-
651
+
656
652
  # Handles packing up aim options.
657
653
  def handle_aim_options(options)
658
654
  encoded_options = []
659
655
  case options
660
656
  when Hash
661
- options.each_pair do |k,v|
657
+ options.each_pair do |k, v|
662
658
  if @@aim_response_options.include?(k)
663
- self.instance_variable_set(('@' + k.to_s).to_sym, v)
659
+ instance_variable_set(('@' + k.to_s).to_sym, v)
664
660
  end
665
661
  end
666
662
  when nil
@@ -668,27 +664,26 @@ module AuthorizeNet::CIM
668
664
  else
669
665
  return handle_aim_options(options.to_hash)
670
666
  end
671
-
667
+
672
668
  @fields[:extra_options] ||= {}
673
669
  @fields[:extra_options].merge!(options)
674
670
  end
675
671
 
676
672
  def handle_hosted_profile_settings(options)
677
673
  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,
674
+ return_url: :hostedProfileReturnUrl,
675
+ return_url_text: :hostedProfileReturnUrlText,
676
+ heading_color: :hostedProfileHeadingBgColor,
677
+ border_visible: :hostedProfilePageBorderVisible,
678
+ iframe_communicator_url: :hostedProfileIFrameCommunicatorUrl,
679
+ validation_mode: :hostedProfileValidationMode
684
680
  }
685
681
  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
682
+ hosted_settings: options.select do |k, _|
683
+ options_mapping.keys.include? k
684
+ end.map do |k, v|
685
+ { setting_name: options_mapping[k], setting_value: v }
686
+ end
692
687
  )
693
688
  end
694
689
 
@@ -704,24 +699,23 @@ module AuthorizeNet::CIM
704
699
  return handle_custom_fields(options.to_hash)
705
700
  end
706
701
  end
707
-
702
+
708
703
  # Callback for creating the right node structure for a given transaction type. `node` is ignored for now.
709
- def select_transaction_type_fields(node)
704
+ def select_transaction_type_fields(_node)
710
705
  case @transaction_type
711
706
  when :auth_only
712
- return TRANSACTION_AUTH_FIELDS
707
+ TRANSACTION_AUTH_FIELDS
713
708
  when :auth_capture
714
- return TRANSACTION_AUTH_CAPTURE_FIELDS
709
+ TRANSACTION_AUTH_CAPTURE_FIELDS
715
710
  when :void
716
- return TRANSACTION_VOID_FIELDS
711
+ TRANSACTION_VOID_FIELDS
717
712
  when :refund
718
- return TRANSACTION_REFUND_FIELDS
713
+ TRANSACTION_REFUND_FIELDS
719
714
  when :capture_only
720
- return TRASNACTION_CAPTURE_FIELDS
715
+ TRASNACTION_CAPTURE_FIELDS
721
716
  when :prior_auth_capture
722
- return TRANSACTION_PRIOR_AUTH_CAPTURE_FIELDS
717
+ TRANSACTION_PRIOR_AUTH_CAPTURE_FIELDS
723
718
  end
724
719
  end
725
-
726
720
  end
727
721
  end