activemerchant 1.85.0 → 1.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +15 -3
  3. data/lib/active_merchant/billing/avs_result.rb +12 -12
  4. data/lib/active_merchant/billing/compatibility.rb +1 -2
  5. data/lib/active_merchant/billing/gateways/adyen.rb +1 -1
  6. data/lib/active_merchant/billing/gateways/authorize_net.rb +12 -0
  7. data/lib/active_merchant/billing/gateways/authorize_net_cim.rb +1 -2
  8. data/lib/active_merchant/billing/gateways/barclaycard_smartpay.rb +45 -22
  9. data/lib/active_merchant/billing/gateways/beanstream.rb +2 -2
  10. data/lib/active_merchant/billing/gateways/beanstream/beanstream_core.rb +4 -6
  11. data/lib/active_merchant/billing/gateways/beanstream_interac.rb +0 -1
  12. data/lib/active_merchant/billing/gateways/blue_pay.rb +1 -1
  13. data/lib/active_merchant/billing/gateways/braintree_blue.rb +6 -4
  14. data/lib/active_merchant/billing/gateways/bridge_pay.rb +3 -3
  15. data/lib/active_merchant/billing/gateways/card_connect.rb +6 -6
  16. data/lib/active_merchant/billing/gateways/card_save.rb +5 -6
  17. data/lib/active_merchant/billing/gateways/cardprocess.rb +4 -4
  18. data/lib/active_merchant/billing/gateways/cashnet.rb +4 -4
  19. data/lib/active_merchant/billing/gateways/cecabank.rb +1 -1
  20. data/lib/active_merchant/billing/gateways/checkout.rb +8 -8
  21. data/lib/active_merchant/billing/gateways/citrus_pay.rb +0 -1
  22. data/lib/active_merchant/billing/gateways/creditcall.rb +3 -3
  23. data/lib/active_merchant/billing/gateways/credorax.rb +1 -1
  24. data/lib/active_merchant/billing/gateways/ct_payment.rb +1 -1
  25. data/lib/active_merchant/billing/gateways/cyber_source.rb +5 -5
  26. data/lib/active_merchant/billing/gateways/efsnet.rb +9 -9
  27. data/lib/active_merchant/billing/gateways/elavon.rb +3 -5
  28. data/lib/active_merchant/billing/gateways/eway_managed.rb +1 -1
  29. data/lib/active_merchant/billing/gateways/exact.rb +0 -1
  30. data/lib/active_merchant/billing/gateways/federated_canada.rb +0 -1
  31. data/lib/active_merchant/billing/gateways/finansbank.rb +0 -1
  32. data/lib/active_merchant/billing/gateways/first_giving.rb +0 -1
  33. data/lib/active_merchant/billing/gateways/first_pay.rb +3 -3
  34. data/lib/active_merchant/billing/gateways/firstdata_e4.rb +7 -7
  35. data/lib/active_merchant/billing/gateways/firstdata_e4_v27.rb +6 -6
  36. data/lib/active_merchant/billing/gateways/garanti.rb +0 -1
  37. data/lib/active_merchant/billing/gateways/global_collect.rb +21 -6
  38. data/lib/active_merchant/billing/gateways/hdfc.rb +0 -1
  39. data/lib/active_merchant/billing/gateways/hps.rb +1 -1
  40. data/lib/active_merchant/billing/gateways/inspire.rb +0 -1
  41. data/lib/active_merchant/billing/gateways/instapay.rb +1 -2
  42. data/lib/active_merchant/billing/gateways/itransact.rb +0 -1
  43. data/lib/active_merchant/billing/gateways/jetpay.rb +1 -1
  44. data/lib/active_merchant/billing/gateways/jetpay_v2.rb +1 -1
  45. data/lib/active_merchant/billing/gateways/linkpoint.rb +3 -3
  46. data/lib/active_merchant/billing/gateways/litle.rb +1 -1
  47. data/lib/active_merchant/billing/gateways/mercado_pago.rb +7 -1
  48. data/lib/active_merchant/billing/gateways/merchant_one.rb +0 -1
  49. data/lib/active_merchant/billing/gateways/mercury.rb +1 -1
  50. data/lib/active_merchant/billing/gateways/migs.rb +5 -5
  51. data/lib/active_merchant/billing/gateways/modern_payments.rb +0 -1
  52. data/lib/active_merchant/billing/gateways/modern_payments_cim.rb +0 -1
  53. data/lib/active_merchant/billing/gateways/money_movers.rb +0 -1
  54. data/lib/active_merchant/billing/gateways/mundipagg.rb +4 -4
  55. data/lib/active_merchant/billing/gateways/nab_transact.rb +8 -8
  56. data/lib/active_merchant/billing/gateways/net_registry.rb +1 -1
  57. data/lib/active_merchant/billing/gateways/netaxept.rb +0 -1
  58. data/lib/active_merchant/billing/gateways/netbanx.rb +4 -3
  59. data/lib/active_merchant/billing/gateways/netpay.rb +0 -1
  60. data/lib/active_merchant/billing/gateways/network_merchants.rb +0 -1
  61. data/lib/active_merchant/billing/gateways/omise.rb +1 -1
  62. data/lib/active_merchant/billing/gateways/opp.rb +0 -1
  63. data/lib/active_merchant/billing/gateways/optimal_payment.rb +20 -20
  64. data/lib/active_merchant/billing/gateways/orbital.rb +1 -1
  65. data/lib/active_merchant/billing/gateways/pac_net_raven.rb +0 -1
  66. data/lib/active_merchant/billing/gateways/pagarme.rb +1 -1
  67. data/lib/active_merchant/billing/gateways/pay_gate_xml.rb +1 -1
  68. data/lib/active_merchant/billing/gateways/pay_junction_v2.rb +1 -1
  69. data/lib/active_merchant/billing/gateways/pay_secure.rb +0 -1
  70. data/lib/active_merchant/billing/gateways/payeezy.rb +1 -1
  71. data/lib/active_merchant/billing/gateways/payex.rb +2 -3
  72. data/lib/active_merchant/billing/gateways/payflow/payflow_express_response.rb +5 -1
  73. data/lib/active_merchant/billing/gateways/payflow/payflow_response.rb +2 -2
  74. data/lib/active_merchant/billing/gateways/payflow_express_uk.rb +0 -1
  75. data/lib/active_merchant/billing/gateways/payflow_uk.rb +0 -1
  76. data/lib/active_merchant/billing/gateways/payment_express.rb +1 -1
  77. data/lib/active_merchant/billing/gateways/paymentez.rb +4 -4
  78. data/lib/active_merchant/billing/gateways/payscout.rb +1 -2
  79. data/lib/active_merchant/billing/gateways/psigate.rb +1 -1
  80. data/lib/active_merchant/billing/gateways/psl_card.rb +6 -6
  81. data/lib/active_merchant/billing/gateways/quickbooks.rb +2 -2
  82. data/lib/active_merchant/billing/gateways/quickpay.rb +0 -1
  83. data/lib/active_merchant/billing/gateways/quickpay/quickpay_common.rb +7 -8
  84. data/lib/active_merchant/billing/gateways/quickpay/quickpay_v4to7.rb +1 -2
  85. data/lib/active_merchant/billing/gateways/s5.rb +1 -1
  86. data/lib/active_merchant/billing/gateways/sage_pay.rb +5 -5
  87. data/lib/active_merchant/billing/gateways/sallie_mae.rb +0 -1
  88. data/lib/active_merchant/billing/gateways/secure_pay.rb +0 -1
  89. data/lib/active_merchant/billing/gateways/secure_pay_au.rb +0 -1
  90. data/lib/active_merchant/billing/gateways/secure_pay_tech.rb +0 -1
  91. data/lib/active_merchant/billing/gateways/securion_pay.rb +5 -5
  92. data/lib/active_merchant/billing/gateways/smart_ps.rb +0 -1
  93. data/lib/active_merchant/billing/gateways/stripe.rb +1 -1
  94. data/lib/active_merchant/billing/gateways/swipe_checkout.rb +4 -8
  95. data/lib/active_merchant/billing/gateways/telr.rb +2 -2
  96. data/lib/active_merchant/billing/gateways/transax.rb +4 -5
  97. data/lib/active_merchant/billing/gateways/transnational.rb +0 -1
  98. data/lib/active_merchant/billing/gateways/trexle.rb +6 -6
  99. data/lib/active_merchant/billing/gateways/trust_commerce.rb +5 -5
  100. data/lib/active_merchant/billing/gateways/usa_epay.rb +1 -1
  101. data/lib/active_merchant/billing/gateways/usa_epay_advanced.rb +1 -1
  102. data/lib/active_merchant/billing/gateways/usa_epay_transaction.rb +3 -2
  103. data/lib/active_merchant/billing/gateways/world_net.rb +3 -3
  104. data/lib/active_merchant/billing/gateways/worldpay_online_payments.rb +15 -15
  105. data/lib/active_merchant/connection.rb +2 -2
  106. data/lib/active_merchant/network_connection_retries.rb +1 -1
  107. data/lib/active_merchant/posts_data.rb +2 -2
  108. data/lib/active_merchant/version.rb +1 -1
  109. data/lib/activemerchant.rb +1 -1
  110. data/lib/support/gateway_support.rb +0 -1
  111. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3fdd27bb50be46ff07917a7dc873c045912fa92
4
- data.tar.gz: 04d786332b1047ddc974bc53a989c656b79d9856
3
+ metadata.gz: 8651e675cc5726ec8424c3023a81307c0d03f66b
4
+ data.tar.gz: cc00a987adb4cbcd89ac106d07e8cd86d7046052
5
5
  SHA512:
6
- metadata.gz: 40f01dbedce7566d83da6aa05a068d3b93f86264905e5a34fc50ea08b90952f9cb9bf1206f045c3e76f369bf6012d4975047b74fac577f551108c37ab27e91b4
7
- data.tar.gz: dae3bf98f0c4d86885ba4f9e0fd84c218ea9b84be55e1ca21a0eedb98596bd6ae3b19b1d695338c5bc8f29b616fe184ac58e486b16ac1ac874552e5538085c40
6
+ metadata.gz: 53533aee5d0cb713eb89cdf53ac2d7e71f5ffa0e0ff46a06a6d69effd36e54f76f7f4e18acda564b7392963c586388e55df8e8fdf8f65bb36d090917b3d32df5
7
+ data.tar.gz: 815a578f9421bb5b5c316c9ee79bf8043dd20cea4fabf8e19885587bf07b9418d2944b218b121b32cbc6ac481a52635ae2c22e6e66a7399b77e1cef90789f117
data/CHANGELOG CHANGED
@@ -1,12 +1,24 @@
1
1
  = ActiveMerchant CHANGELOG
2
2
 
3
3
  == HEAD
4
+ == Version 1.86.0 (October 26, 2018)
5
+ * UsaEpayTransaction: Support UMcheckformat option for echecks [dtykocki] #3002
6
+ * Global Collect: handle internal server errors [molbrown] #3005
7
+ * Barclaycard Smartpay: allow third-party payouts for credits [bpollack] #3009
8
+ * RuboCop: AlignHash [nfarve] #3004
9
+ * Beanstream: Switch `recurringPayment` flag from boolean to integer [dtykocki] #3011
10
+ * Update Swipe HQ endpoint [bdewater] #3013
11
+ * Braintree: Adds device_data [deedeelavinder] #3012
12
+ * Payflow Express: Add phone to returned Response [filipebarcos] #3003
13
+ * Authorize.Net: Pass some level 3 fields [curiousepic] #3022
14
+ * Add state to the netbanx payload [Girardvjonathan] #3024
15
+
4
16
  == Version 1.85.0 (September 28, 2018)
5
- * Authorize.Net: Support custom delimiter for cim [curiousepic] [#3001]
17
+ * Authorize.Net: Support custom delimiter for cim [curiousepic] #3001
6
18
 
7
19
  == Version 1.84.0 (September 27, 2018)
8
20
  * PayU Latam: support partial captures [bpollack] #2974
9
- * Braintree: Reflect correct test mode in Braintree responses [elfassy] [#2980]
21
+ * Braintree: Reflect correct test mode in Braintree responses [elfassy] #2980
10
22
  * FirstPay: Expose error code [curiousepic] #2979
11
23
  * Barclaycard Smartpay: Pass device_fingerprint when specified [dtykocki] #2981
12
24
  * Komoju: remove no-longer-relevant sandbox URL [miyazawadegica] #2987
@@ -32,7 +44,7 @@
32
44
  * Gateway generator: fix a typo that would cause the script to crash [bpollack] #2962
33
45
  * Clearhaus: use $0 for verify transactions [bpollack] #2964
34
46
  * Global Collect: properly handle partial captures [bpollack] #2967
35
- * Braintree: Add support for GooglePay [dtykocki] [#2966]
47
+ * Braintree: Add support for GooglePay [dtykocki] #2966
36
48
  * Adyen: allow overriding card brands [bpollack] #2968
37
49
  * Adyen: allow custom routing [bpollack] #2969
38
50
  * First Pay: Adds scrubbing [deedeelavinder] #2972
@@ -2,7 +2,7 @@
2
2
  # encoding: utf-8
3
3
 
4
4
  module ActiveMerchant
5
- module Billing
5
+ module Billing
6
6
  # Implements the Address Verification System
7
7
  # https://www.wellsfargo.com/downloads/pdf/biz/merchant/visa_avs.pdf
8
8
  # http://en.wikipedia.org/wiki/Address_Verification_System
@@ -38,7 +38,7 @@ module ActiveMerchant
38
38
  'Y' => 'Street address and 5-digit postal code match.',
39
39
  'Z' => 'Street address does not match, but 5-digit postal code matches.'
40
40
  }
41
-
41
+
42
42
  # Map vendor's AVS result code to a postal match code
43
43
  POSTAL_MATCH_CODE = {
44
44
  'Y' => %w( D H F H J L M P Q V W X Y Z ),
@@ -49,7 +49,7 @@ module ActiveMerchant
49
49
  codes.each { |code| map[code] = type }
50
50
  map
51
51
  end
52
-
52
+
53
53
  # Map vendor's AVS result code to a street match code
54
54
  STREET_MATCH_CODE = {
55
55
  'Y' => %w( A B D H J M O Q T V X Y ),
@@ -60,32 +60,32 @@ module ActiveMerchant
60
60
  codes.each { |code| map[code] = type }
61
61
  map
62
62
  end
63
-
63
+
64
64
  attr_reader :code, :message, :street_match, :postal_match
65
-
65
+
66
66
  def self.messages
67
67
  MESSAGES
68
68
  end
69
-
69
+
70
70
  def initialize(attrs)
71
71
  attrs ||= {}
72
-
72
+
73
73
  @code = attrs[:code].upcase unless attrs[:code].blank?
74
74
  @message = self.class.messages[code]
75
-
75
+
76
76
  if attrs[:street_match].blank?
77
77
  @street_match = STREET_MATCH_CODE[code]
78
- else
78
+ else
79
79
  @street_match = attrs[:street_match].upcase
80
80
  end
81
-
81
+
82
82
  if attrs[:postal_match].blank?
83
83
  @postal_match = POSTAL_MATCH_CODE[code]
84
- else
84
+ else
85
85
  @postal_match = attrs[:postal_match].upcase
86
86
  end
87
87
  end
88
-
88
+
89
89
  def to_hash
90
90
  { 'code' => code,
91
91
  'message' => message,
@@ -75,7 +75,7 @@ module ActiveMerchant
75
75
  end
76
76
 
77
77
  def empty?
78
- all?{|k, v| v && v.empty?}
78
+ all?{|k, v| v&.empty?}
79
79
  end
80
80
 
81
81
  def on(field)
@@ -115,4 +115,3 @@ module ActiveMerchant
115
115
  Compatibility::Model.send(:include, Rails::Model)
116
116
  end
117
117
  end
118
-
@@ -135,7 +135,7 @@ module ActiveMerchant #:nodoc:
135
135
  end
136
136
 
137
137
  def add_address(post, options)
138
- return unless post[:card] && post[:card].kind_of?(Hash)
138
+ return unless post[:card]&.kind_of?(Hash)
139
139
  if (address = options[:billing_address] || options[:address]) && address[:country]
140
140
  post[:card][:billingAddress] = {}
141
141
  post[:card][:billingAddress][:street] = address[:address1] || 'N/A'
@@ -257,6 +257,7 @@ module ActiveMerchant
257
257
  add_market_type_device_type(xml, payment, options)
258
258
  add_settings(xml, payment, options)
259
259
  add_user_fields(xml, amount, options)
260
+ add_ship_from_address(xml, options)
260
261
  end
261
262
  end
262
263
 
@@ -610,6 +611,16 @@ module ActiveMerchant
610
611
  end
611
612
  end
612
613
 
614
+ def add_ship_from_address(xml, options, root_node='shipFrom')
615
+ address = options[:ship_from_address]
616
+ return unless address
617
+
618
+ xml.send(root_node) do
619
+ xml.zip(truncate(address[:zip], 20)) unless empty?(address[:zip])
620
+ xml.country(truncate(address[:country], 60)) unless empty?(address[:country])
621
+ end
622
+ end
623
+
613
624
  def add_order_id(xml, options)
614
625
  xml.refId(truncate(options[:order_id], 20))
615
626
  end
@@ -619,6 +630,7 @@ module ActiveMerchant
619
630
  xml.invoiceNumber(truncate(options[:order_id], 20))
620
631
  xml.description(truncate(options[:description], 255))
621
632
  xml.purchaseOrderNumber(options[:po_number]) if options[:po_number] && transaction_type.start_with?('profileTrans')
633
+ xml.summaryCommodityCode(truncate(options[:summary_commodity_code], 4)) if options[:summary_commodity_code] && !transaction_type.start_with?('profileTrans')
622
634
  end
623
635
 
624
636
  # Authorize.net API requires lineItems to be placed directly after order tag
@@ -671,7 +671,6 @@ module ActiveMerchant #:nodoc:
671
671
  tag_unless_blank(xml,'customerShippingAddressId', transaction[:customer_shipping_address_id])
672
672
  xml.tag!('transId', transaction[:trans_id])
673
673
  when :refund
674
- #TODO - add lineItems field
675
674
  xml.tag!('amount', transaction[:amount])
676
675
  tag_unless_blank(xml, 'customerProfileId', transaction[:customer_profile_id])
677
676
  tag_unless_blank(xml, 'customerPaymentProfileId', transaction[:customer_payment_profile_id])
@@ -879,7 +878,7 @@ module ActiveMerchant #:nodoc:
879
878
  end
880
879
 
881
880
  def format_extra_options(options)
882
- options.map{ |k, v| "#{k}=#{v}" }.join('&') unless options.nil?
881
+ options&.map{ |k, v| "#{k}=#{v}" }&.join('&')
883
882
  end
884
883
 
885
884
  def parse_direct_response(params)
@@ -68,7 +68,27 @@ module ActiveMerchant #:nodoc:
68
68
  post[:nationality] = options[:nationality] if options[:nationality]
69
69
  post[:shopperName] = options[:shopper_name] if options[:shopper_name]
70
70
 
71
- commit('refundWithData', post)
71
+ if options[:third_party_payout]
72
+ post[:recurring] = options[:recurring_contract] || {contract: 'PAYOUT'}
73
+ MultiResponse.run do |r|
74
+ r.process {
75
+ commit(
76
+ 'storeDetailAndSubmitThirdParty',
77
+ post,
78
+ @options[:store_payout_account],
79
+ @options[:store_payout_password])
80
+ }
81
+ r.process {
82
+ commit(
83
+ 'confirmThirdParty',
84
+ modification_request(r.authorization, @options),
85
+ @options[:review_payout_account],
86
+ @options[:review_payout_password])
87
+ }
88
+ end
89
+ else
90
+ commit('refundWithData', post)
91
+ end
72
92
  end
73
93
 
74
94
  def void(identification, options = {})
@@ -128,9 +148,10 @@ module ActiveMerchant #:nodoc:
128
148
  '18' => 'I' # Neither postal code nor address were checked
129
149
  }
130
150
 
131
- def commit(action, post)
151
+ def commit(action, post, account = 'ws', password = @options[:password])
132
152
  request = post_data(flatten_hash(post))
133
- raw_response = ssl_post(build_url(action), request, headers)
153
+ request_headers = headers(account, password)
154
+ raw_response = ssl_post(build_url(action), request, request_headers)
134
155
  response = parse(raw_response)
135
156
 
136
157
  Response.new(
@@ -181,10 +202,10 @@ module ActiveMerchant #:nodoc:
181
202
  flat_hash
182
203
  end
183
204
 
184
- def headers
205
+ def headers(account, password)
185
206
  {
186
207
  'Content-Type' => 'application/x-www-form-urlencoded; charset=utf-8',
187
- 'Authorization' => 'Basic ' + Base64.strict_encode64("ws@Company.#{@options[:company]}:#{@options[:password]}").strip
208
+ 'Authorization' => 'Basic ' + Base64.strict_encode64("#{account}@Company.#{@options[:company]}:#{password}").strip
188
209
  }
189
210
  end
190
211
 
@@ -214,10 +235,10 @@ module ActiveMerchant #:nodoc:
214
235
 
215
236
  def success_from(response)
216
237
  return true if response['result'] == 'Success'
217
- return true if response['resultCode'] == 'Authorised'
218
- return true if response['resultCode'] == 'Received'
219
- successful_responses = %w([capture-received] [cancel-received] [refund-received])
220
- successful_responses.include?(response['response'])
238
+
239
+ successful_results = %w(Authorised Received [payout-submit-received])
240
+ successful_responses = %w([capture-received] [cancel-received] [refund-received] [payout-confirm-received])
241
+ successful_results.include?(response['resultCode']) || successful_responses.include?(response['response'])
221
242
  end
222
243
 
223
244
  def build_url(action)
@@ -226,6 +247,8 @@ module ActiveMerchant #:nodoc:
226
247
  "#{test? ? self.test_url : self.live_url}/Recurring/#{API_VERSION}/storeToken"
227
248
  when 'finalize3ds'
228
249
  "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/authorise3d"
250
+ when 'storeDetailAndSubmitThirdParty', 'confirmThirdParty'
251
+ "#{test? ? self.test_url : self.live_url}/Payout/#{API_VERSION}/#{action}"
229
252
  else
230
253
  "#{test? ? self.test_url : self.live_url}/Payment/#{API_VERSION}/#{action}"
231
254
  end
@@ -263,11 +286,11 @@ module ActiveMerchant #:nodoc:
263
286
  hash = {}
264
287
  hash[:houseNumberOrName] = house
265
288
  hash[:street] = street
266
- hash[:city] = address[:city] if address[:city]
267
- hash[:stateOrProvince] = address[:state] if address[:state]
268
- hash[:postalCode] = address[:zip] if address[:zip]
269
- hash[:country] = address[:country] if address[:country]
270
- hash
289
+ hash[:city] = address[:city]
290
+ hash[:stateOrProvince] = address[:state]
291
+ hash[:postalCode] = address[:zip]
292
+ hash[:country] = address[:country]
293
+ hash.keep_if { |_, v| v }
271
294
  end
272
295
 
273
296
  def amount_hash(money, currency)
@@ -301,20 +324,20 @@ module ActiveMerchant #:nodoc:
301
324
 
302
325
  def payment_request(money, options)
303
326
  hash = {}
304
- hash[:merchantAccount] = @options[:merchant]
305
- hash[:reference] = options[:order_id] if options[:order_id]
306
- hash[:shopperEmail] = options[:email] if options[:email]
307
- hash[:shopperIP] = options[:ip] if options[:ip]
308
- hash[:shopperReference] = options[:customer] if options[:customer]
309
- hash[:shopperInteraction] = options[:shopper_interaction] if options[:shopper_interaction]
310
- hash[:deviceFingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
327
+ hash[:merchantAccount] = @options[:merchant]
328
+ hash[:reference] = options[:order_id]
329
+ hash[:shopperEmail] = options[:email]
330
+ hash[:shopperIP] = options[:ip]
331
+ hash[:shopperReference] = options[:customer]
332
+ hash[:shopperInteraction] = options[:shopper_interaction]
333
+ hash[:deviceFingerprint] = options[:device_fingerprint]
311
334
  hash.keep_if { |_, v| v }
312
335
  end
313
336
 
314
337
  def store_request(options)
315
338
  hash = {}
316
339
  hash[:merchantAccount] = @options[:merchant]
317
- hash[:shopperEmail] = options[:email] if options[:email]
340
+ hash[:shopperEmail] = options[:email]
318
341
  hash[:shopperReference] = options[:customer] if options[:customer]
319
342
  hash.keep_if { |_, v| v }
320
343
  end
@@ -167,8 +167,8 @@ module ActiveMerchant #:nodoc:
167
167
  commit(post, true)
168
168
  end
169
169
 
170
- #can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
171
- #Closed profiles will have to removed manually.
170
+ # can't actually delete a secure profile with the supplicated API. This function sets the status of the profile to closed (C).
171
+ # Closed profiles will have to removed manually.
172
172
  def delete(vault_id)
173
173
  update(vault_id, false, {:status => 'C'})
174
174
  end
@@ -266,7 +266,7 @@ module ActiveMerchant #:nodoc:
266
266
  end
267
267
 
268
268
  def add_recurring_payment(post, options)
269
- post[:recurringPayment] = true if options[:recurring].to_s == 'true'
269
+ post[:recurringPayment] = 1 if options[:recurring].to_s == 'true'
270
270
  end
271
271
 
272
272
  def add_invoice(post, options)
@@ -375,11 +375,9 @@ module ActiveMerchant #:nodoc:
375
375
 
376
376
  def parse(body)
377
377
  results = {}
378
- if !body.nil?
379
- body.split(/&/).each do |pair|
380
- key, val = pair.split(/\=/)
381
- results[key.to_sym] = val.nil? ? nil : CGI.unescape(val)
382
- end
378
+ body&.split(/&/)&.each do |pair|
379
+ key, val = pair.split(/\=/)
380
+ results[key.to_sym] = val.nil? ? nil : CGI.unescape(val)
383
381
  end
384
382
 
385
383
  # Clean up the message text if there is any
@@ -55,4 +55,3 @@ module ActiveMerchant #:nodoc:
55
55
  end
56
56
  end
57
57
  end
58
-
@@ -173,7 +173,7 @@ module ActiveMerchant #:nodoc:
173
173
  end
174
174
 
175
175
  def credit(money, payment_object, options = {})
176
- if(payment_object && payment_object.kind_of?(String))
176
+ if payment_object&.kind_of?(String)
177
177
  ActiveMerchant.deprecated 'credit should only be used to credit a payment method'
178
178
  return refund(money, payment_object, options)
179
179
  end
@@ -159,7 +159,7 @@ module ActiveMerchant #:nodoc:
159
159
  :last_name => creditcard.last_name,
160
160
  :email => scrub_email(options[:email]),
161
161
  :phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
162
- options[:billing_address][:phone]),
162
+ options[:billing_address][:phone]),
163
163
  :credit_card => credit_card_params
164
164
  )
165
165
  Response.new(result.success?, message_from_result(result),
@@ -231,8 +231,9 @@ module ActiveMerchant #:nodoc:
231
231
  :last_name => creditcard.last_name,
232
232
  :email => scrub_email(options[:email]),
233
233
  :phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
234
- options[:billing_address][:phone]),
234
+ options[:billing_address][:phone]),
235
235
  :id => options[:customer],
236
+ :device_data => options[:device_data],
236
237
  }.merge credit_card_params
237
238
  result = @braintree_gateway.customer.create(merge_credit_card_options(parameters, options))
238
239
  Response.new(result.success?, message_from_result(result),
@@ -256,6 +257,7 @@ module ActiveMerchant #:nodoc:
256
257
  cvv: credit_card.verification_value,
257
258
  expiration_month: credit_card.month.to_s.rjust(2, '0'),
258
259
  expiration_year: credit_card.year.to_s,
260
+ device_data: options[:device_data],
259
261
  }
260
262
  parameters[:billing_address] = map_address(options[:billing_address]) if options[:billing_address]
261
263
 
@@ -353,7 +355,7 @@ module ActiveMerchant #:nodoc:
353
355
  result.success?,
354
356
  message_from_result(result),
355
357
  response_hash,
356
- authorization: (result.transaction.id if result.transaction),
358
+ authorization: result.transaction&.id,
357
359
  test: test?
358
360
  )
359
361
  end
@@ -556,7 +558,7 @@ module ActiveMerchant #:nodoc:
556
558
  :id => options[:store] == true ? '' : options[:store],
557
559
  :email => scrub_email(options[:email]),
558
560
  :phone => options[:phone] || (options[:billing_address][:phone] if options[:billing_address] &&
559
- options[:billing_address][:phone])
561
+ options[:billing_address][:phone])
560
562
  },
561
563
  :options => {
562
564
  :store_in_vault => options[:store] ? true : false,
@@ -166,8 +166,8 @@ module ActiveMerchant #:nodoc:
166
166
  response = {}
167
167
 
168
168
  doc = Nokogiri::XML(xml)
169
- doc.root.xpath('*').each do |node|
170
- if (node.elements.size == 0)
169
+ doc.root&.xpath('*')&.each do |node|
170
+ if node.elements.size == 0
171
171
  response[node.name.downcase.to_sym] = node.text
172
172
  else
173
173
  node.elements.each do |childnode|
@@ -175,7 +175,7 @@ module ActiveMerchant #:nodoc:
175
175
  response[name.to_sym] = childnode.text
176
176
  end
177
177
  end
178
- end unless doc.root.nil?
178
+ end
179
179
 
180
180
  response
181
181
  end
@@ -150,12 +150,12 @@ module ActiveMerchant #:nodoc:
150
150
  end
151
151
 
152
152
  def scrub(transcript)
153
- transcript
154
- .gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]')
155
- .gsub(%r(("cvv2\\":\\")\d*), '\1[FILTERED]')
156
- .gsub(%r(("merchid\\":\\")\d*), '\1[FILTERED]')
157
- .gsub(%r((&?"account\\":\\")\d*), '\1[FILTERED]')
158
- .gsub(%r((&?"token\\":\\")\d*), '\1[FILTERED]')
153
+ transcript.
154
+ gsub(%r((Authorization: Basic )\w+), '\1[FILTERED]').
155
+ gsub(%r(("cvv2\\":\\")\d*), '\1[FILTERED]').
156
+ gsub(%r(("merchid\\":\\")\d*), '\1[FILTERED]').
157
+ gsub(%r((&?"account\\":\\")\d*), '\1[FILTERED]').
158
+ gsub(%r((&?"token\\":\\")\d*), '\1[FILTERED]')
159
159
  end
160
160
 
161
161
  private