activemerchant 1.109.0 → 1.110.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c4b380a0488ea2f5e78175b1dfa65fee57051b7015f0b890da0bbc38d720b19
4
- data.tar.gz: 0067c05edeb3396266fdeb63366e56fe4b2c96e9ded24957405798a36d2f4f73
3
+ metadata.gz: 947d711ce2e079aee4a485b32b4ba5349973461854026135c36192ed4b510ce2
4
+ data.tar.gz: bf6ac95e994f6f7aaa22543bdc6cd0ef36e373b3e7b06b249d931a91a11b9d31
5
5
  SHA512:
6
- metadata.gz: 789d158841099fcb4fab1873328480657352a44febdcc938bb86897cedd1db568fc5139082272ba4415dde7a8f07dc9f75f93eaea95dab6cc7bc26a01698b091
7
- data.tar.gz: 4d64a064ffa8d589780a785da3e1eabb2d3633db5c2ce6bbf0cf0998944f7c1bc25e4a09b557f9922bc1fe8b68f2ab2d3ef4a56dd441b9a50646911fdd5075d4
6
+ metadata.gz: 9d6745f7228a6b068db47d588b3e1d4770d6399aa45fa2ffe74671259d4945bc82fc6cfd7a943fd7b19fd2c8c9ed4e0fb1df76f1fdbf56fee1f01ca316e2ac07
7
+ data.tar.gz: 214fe490b01b7b3389137a30641e4fc49df892bb769bedecdf82ac477481670b89026287aa68a8aaad87b283dbf2a1ccc0b55533ccb03b744845352baff46a0f
data/CHANGELOG CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  == HEAD
4
4
 
5
+ == Version 1.110.0
6
+ * FirstData e4 v27+: Strip linebreaks from address [curiousepic] #3693
7
+ * Adyen: Change shopper_email to email and shopper_ip to ip [rikterbeek] #3675
8
+ * FirstData e4 v27+ Fix strip_line_breaks method [carrigan] #3695
9
+ * Cybersource: Set authorization on the response even when in fraud review [pi3r] #3701
10
+ * Cybersource: Add fields to override stored creds [leila-alderman] #3689
11
+ * Cybersource: Conditionally find stored credentials [therufs] #3696 #3697
12
+ * Cybersource: Update logic to send cavv as xid for 3DS2 [douglas] #3699
13
+ * Credorax: Default 3ds_browsercolordepth to 32 when passed as 30 [britth] #3700
14
+
5
15
  == Version 1.109.0
6
16
  * Remove reference to `Billing::Integrations` [pi3r] #3692
7
17
  * DLocal: Handle nil address1 [molbrown] #3661
@@ -26,7 +36,6 @@
26
36
  * RuboCop: Fix Style/TrailingUnderscoreVariable [leila-alderman] #3663
27
37
  * RuboCop: Fix Style/WordArray [leila-alderman] #3664
28
38
  * RuboCop: Fix Style/SymbolArray [leila-alderman] #3665
29
-
30
39
  * Mercado-Pago: Notification url GSF [cdmackeyfree] #3678
31
40
  * Credorax: Update logic for setting 3ds_homephonecountry [britth] #3691
32
41
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Active Merchant
2
- [![Build Status](https://travis-ci.org/activemerchant/active_merchant.png?branch=master)](https://travis-ci.org/activemerchant/active_merchant)
3
- [![Code Climate](https://codeclimate.com/github/activemerchant/active_merchant.png)](https://codeclimate.com/github/activemerchant/active_merchant)
2
+ [![Build Status](https://travis-ci.org/activemerchant/active_merchant.svg?branch=master)](https://travis-ci.org/activemerchant/active_merchant)
3
+ [![Code Climate](https://codeclimate.com/github/activemerchant/active_merchant.svg)](https://codeclimate.com/github/activemerchant/active_merchant)
4
4
 
5
5
  Active Merchant is an extraction from the ecommerce system [Shopify](http://www.shopify.com).
6
6
  Shopify's requirements for a simple and unified API to access dozens of different payment
@@ -196,9 +196,6 @@ module ActiveMerchant #:nodoc:
196
196
 
197
197
  def add_extra_data(post, payment, options)
198
198
  post[:telephoneNumber] = options[:billing_address][:phone] if options.dig(:billing_address, :phone)
199
- post[:shopperEmail] = options[:shopper_email] if options[:shopper_email]
200
- post[:shopperIP] = options[:shopper_ip] if options[:shopper_ip]
201
- post[:shopperStatement] = options[:shopper_statement] if options[:shopper_statement]
202
199
  post[:fraudOffset] = options[:fraud_offset] if options[:fraud_offset]
203
200
  post[:selectedBrand] = options[:selected_brand] if options[:selected_brand]
204
201
  post[:selectedBrand] ||= NETWORK_TOKENIZATION_CARD_SOURCE[payment.source.to_s] if payment.is_a?(NetworkTokenizationCreditCard)
@@ -212,13 +209,22 @@ module ActiveMerchant #:nodoc:
212
209
  post[:additionalData][:authorisationType] = options[:authorisation_type] if options[:authorisation_type]
213
210
  post[:additionalData][:adjustAuthorisationData] = options[:adjust_authorisation_data] if options[:adjust_authorisation_data]
214
211
  post[:additionalData][:industryUsage] = options[:industry_usage] if options[:industry_usage]
215
- post[:additionalData][:updateShopperStatement] = options[:update_shopper_statement] if options[:update_shopper_statement]
216
212
  post[:additionalData][:RequestedTestAcquirerResponseCode] = options[:requested_test_acquirer_response_code] if options[:requested_test_acquirer_response_code] && test?
217
213
  post[:deviceFingerprint] = options[:device_fingerprint] if options[:device_fingerprint]
214
+ add_shopper_data(post, options)
218
215
  add_risk_data(post, options)
219
216
  add_shopper_reference(post, options)
220
217
  end
221
218
 
219
+ def add_shopper_data(post, options)
220
+ post[:shopperEmail] = options[:email] if options[:email]
221
+ post[:shopperEmail] = options[:shopper_email] if options[:shopper_email]
222
+ post[:shopperIP] = options[:ip] if options[:ip]
223
+ post[:shopperIP] = options[:shopper_ip] if options[:shopper_ip]
224
+ post[:shopperStatement] = options[:shopper_statement] if options[:shopper_statement]
225
+ post[:additionalData][:updateShopperStatement] = options[:update_shopper_statement] if options[:update_shopper_statement]
226
+ end
227
+
222
228
  def add_risk_data(post, options)
223
229
  if (risk_data = options[:risk_data])
224
230
  risk_data = Hash[risk_data.map { |k, v| ["riskdata.#{k}", v] }]
@@ -333,7 +333,7 @@ module ActiveMerchant #:nodoc:
333
333
  post[:'3ds_browsertz'] = browser_info[:timezone]
334
334
  post[:'3ds_browserscreenwidth'] = browser_info[:width]
335
335
  post[:'3ds_browserscreenheight'] = browser_info[:height]
336
- post[:'3ds_browsercolordepth'] = browser_info[:depth]
336
+ post[:'3ds_browsercolordepth'] = browser_info[:depth].to_s == '30' ? '32' : browser_info[:depth]
337
337
  post[:d6] = browser_info[:language]
338
338
  post[:'3ds_browserjavaenabled'] = browser_info[:java]
339
339
  post[:'3ds_browseracceptheader'] = browser_info[:accept_header]
@@ -611,16 +611,22 @@ module ActiveMerchant #:nodoc:
611
611
 
612
612
  def add_normalized_threeds_2_data(xml, payment_method, options)
613
613
  threeds_2_options = options[:three_d_secure]
614
+ cc_brand = card_brand(payment_method).to_sym
615
+ xid = threeds_2_options[:xid]
614
616
 
615
- xml.tag!('cavv', threeds_2_options[:cavv]) if threeds_2_options[:cavv] && card_brand(payment_method).to_sym != :master
617
+ xml.tag!('cavv', threeds_2_options[:cavv]) if threeds_2_options[:cavv] && cc_brand != :master
616
618
  xml.tag!('cavvAlgorithm', threeds_2_options[:cavv_algorithm]) if threeds_2_options[:cavv_algorithm]
617
619
  xml.tag!('paSpecificationVersion', threeds_2_options[:version]) if threeds_2_options[:version]
618
620
  xml.tag!('directoryServerTransactionID', threeds_2_options[:ds_transaction_id]) if threeds_2_options[:ds_transaction_id]
619
- xml.tag!('commerceIndicator', options[:commerce_indicator] || ECI_BRAND_MAPPING[card_brand(payment_method).to_sym])
621
+ xml.tag!('commerceIndicator', options[:commerce_indicator] || ECI_BRAND_MAPPING[cc_brand])
620
622
  xml.tag!('eciRaw', threeds_2_options[:eci]) if threeds_2_options[:eci]
621
623
 
622
- xid = threeds_2_options[:xid] || threeds_2_options[:cavv]
623
- xml.tag!('xid', xid) if xid
624
+ if xid.present?
625
+ xml.tag!('xid', xid)
626
+ elsif threeds_2_options[:version]&.start_with?('2') && cc_brand != :master
627
+ cavv = threeds_2_options[:cavv]
628
+ xml.tag!('xid', cavv) if cavv.present?
629
+ end
624
630
 
625
631
  xml.tag!('veresEnrolled', threeds_2_options[:enrolled]) if threeds_2_options[:enrolled]
626
632
  xml.tag!('paresStatus', threeds_2_options[:authentication_response_status]) if threeds_2_options[:authentication_response_status]
@@ -831,12 +837,22 @@ module ActiveMerchant #:nodoc:
831
837
  end
832
838
 
833
839
  def add_stored_credential_options(xml, options={})
834
- return unless options[:stored_credential]
840
+ return unless options[:stored_credential] || options[:stored_credential_overrides]
841
+
842
+ stored_credential_subsequent_auth = 'true' if options.dig(:stored_credential, :initiator) == 'merchant'
843
+ stored_credential_subsequent_auth_first = 'true' if options.dig(:stored_credential, :initial_transaction)
844
+ stored_credential_transaction_id = options.dig(:stored_credential, :network_transaction_id) if options.dig(:stored_credential, :initiator) == 'merchant'
845
+ stored_credential_subsequent_auth_stored_cred = 'true' if options.dig(:stored_credential, :initiator) == 'cardholder' && !options.dig(:stored_credential, :initial_transaction) || options.dig(:stored_credential, :initiator) == 'merchant' && options.dig(:stored_credential, :reason_type) == 'unscheduled'
835
846
 
836
- xml.tag! 'subsequentAuth', 'true' if options[:stored_credential][:initiator] == 'merchant'
837
- xml.tag! 'subsequentAuthFirst', 'true' if options[:stored_credential][:initial_transaction]
838
- xml.tag! 'subsequentAuthTransactionID', options[:stored_credential][:network_transaction_id] if options[:stored_credential][:initiator] == 'merchant'
839
- xml.tag! 'subsequentAuthStoredCredential', 'true' if options[:stored_credential][:initiator] == 'cardholder' && !options[:stored_credential][:initial_transaction] || options[:stored_credential][:initiator] == 'merchant' && options[:stored_credential][:reason_type] == 'unscheduled'
847
+ override_subsequent_auth = options.dig(:stored_credential_overrides, :subsequent_auth)
848
+ override_subsequent_auth_first = options.dig(:stored_credential_overrides, :subsequent_auth_first)
849
+ override_subsequent_auth_transaction_id = options.dig(:stored_credential_overrides, :subsequent_auth_transaction_id)
850
+ override_subsequent_auth_stored_cred = options.dig(:stored_credential_overrides, :subsequent_auth_stored_credential)
851
+
852
+ xml.subsequentAuth override_subsequent_auth.nil? ? stored_credential_subsequent_auth : override_subsequent_auth
853
+ xml.subsequentAuthFirst override_subsequent_auth_first.nil? ? stored_credential_subsequent_auth_first : override_subsequent_auth_first
854
+ xml.subsequentAuthTransactionID override_subsequent_auth_transaction_id.nil? ? stored_credential_transaction_id : override_subsequent_auth_transaction_id
855
+ xml.subsequentAuthStoredCredential override_subsequent_auth_stored_cred.nil? ? stored_credential_subsequent_auth_stored_cred : override_subsequent_auth_stored_cred
840
856
  end
841
857
 
842
858
  def add_partner_solution_id(xml)
@@ -887,8 +903,7 @@ module ActiveMerchant #:nodoc:
887
903
 
888
904
  success = success?(response)
889
905
  message = message_from(response)
890
-
891
- authorization = success ? authorization_from(response, action, amount, options) : nil
906
+ authorization = success || in_fraud_review?(response) ? authorization_from(response, action, amount, options) : nil
892
907
 
893
908
  Response.new(success, message, response,
894
909
  test: test?,
@@ -287,6 +287,8 @@ module ActiveMerchant #:nodoc:
287
287
 
288
288
  def add_address(xml, options)
289
289
  if (address = options[:billing_address] || options[:address])
290
+ address = strip_line_breaks(address)
291
+
290
292
  xml.tag! 'Address' do
291
293
  xml.tag! 'Address1', address[:address1]
292
294
  xml.tag! 'Address2', address[:address2] if address[:address2]
@@ -299,6 +301,12 @@ module ActiveMerchant #:nodoc:
299
301
  end
300
302
  end
301
303
 
304
+ def strip_line_breaks(address)
305
+ return unless address.is_a?(Hash)
306
+
307
+ Hash[address.map { |k, s| [k, s&.tr("\r\n", ' ')&.strip] }]
308
+ end
309
+
302
310
  def add_invoice(xml, options)
303
311
  xml.tag! 'Reference_No', options[:order_id]
304
312
  xml.tag! 'Reference_3', options[:description] if options[:description]
@@ -28,6 +28,10 @@ module ActiveMerchant #:nodoc:
28
28
  end
29
29
 
30
30
  def purchase(money, payment, options={})
31
+ # Do a Verification with AVS prior to purchase
32
+ verification_response = verify(payment, options)
33
+ return verification_response if verification_response.message != 'OK'
34
+
31
35
  post = {}
32
36
  add_invoice(post, money, options)
33
37
  add_settle_with_auth(post)
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.109.0'
2
+ VERSION = '1.110.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activemerchant
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.109.0
4
+ version: 1.110.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-30 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport