activemerchant 1.120.0 → 1.121.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 649ffe0485eeee7fba63fb57ee6f2ccee8ae113d8ad7ec42fb26d7895f5e8c03
4
- data.tar.gz: 24dcf747601a2be45ca1938919e0626428be6ea19a22834666166772c8773035
3
+ metadata.gz: d8bbedca7a5cfd13a87cfcfc7dd7b2eb59a73e6407e5e4df0d0247e9c7e70e0c
4
+ data.tar.gz: 8ca081c01c837adae8a76bdc357c28753cd899cae9b4467b1c390048c4a2794f
5
5
  SHA512:
6
- metadata.gz: 72e799731ef457d0f5c9d9995591c692e268265562465ba91023e87dad7fde4b25db3754920a51e24180d052d59ce7ecc33a7b2f2fc80b1e127984c5550122f9
7
- data.tar.gz: 6dcc6c4f22b351497233ebd2ef9fc6354113921c75a4279909050e73e509570d6d97b698c9aa98199b7996019a53fb4dbb2daaa8ba1f85732d0af748033022ff
6
+ metadata.gz: 2115a9d6a83597cef54510ce37cb4f3fbf7afecfc9c3662462c554b16e221fec07c1b6ffd622d2f103daf6b2eea7b03899b7a705d04118579833e1c548bb82ed
7
+ data.tar.gz: 2c8c426554798d1f91ece60ea4de4013ba79283a0f2171c4e54976d2c561ad9e0f74ade0ca3af144f24596151ba82910f83ab42bf6c943acca32d97f366e8517
data/CHANGELOG CHANGED
@@ -3,6 +3,15 @@
3
3
  == HEAD
4
4
 
5
5
 
6
+ == Version 1.121 (June 8th, 2021)
7
+ * Braintree: Lift restriction on gem version to allow for backwards compatibility [naashton] #3993
8
+ * Payment Express/Windcave: Send amount on verify calls [cdmackeyfree] #3995
9
+ * Orbital: Use billing_address name as fallback [curiousepic] #3966
10
+ * vPOS: handle shop_process_id correctly [therufs] #3996
11
+ * Checkout v2: Support metadata field [saschakala] #3992
12
+ * Adyen: Support networkTxReference field [naashton] #3997
13
+ * Paypal Express: Enable PayPal express reference transaction request to send merchant session id [janees-e] #3994
14
+
6
15
  == Version 1.120.0 (May 28th, 2021)
7
16
  * Braintree: Bump required braintree gem version to 3.0.1
8
17
  * Stripe PI: ensure `setup_future_sage` and `off_session` work when using SetupIntents.
@@ -67,7 +76,7 @@
67
76
  * Payeezy: support general credit [cdmackeyfree] #3977
68
77
  * Ripley and Hipercard: Add BIN ranges [naashton] #3978
69
78
  * Adyen: Default card holder name for credit cards [shasum] #3980
70
- * PaywayDotCom: make `source_id` a required field [dsmcclain] # 3981
79
+ * PaywayDotCom: make `source_id` a required field [dsmcclain] # 3981
71
80
  * Qvalent: remove `pem_password` from required credentials [dsmcclain] #3982
72
81
  * Authorize.net: Fix stored credentials [tatsianaclifton] #3971
73
82
  * CyberSource: Add support for multiple new fields [dsmcclain] #3984
@@ -397,6 +397,7 @@ module ActiveMerchant #:nodoc:
397
397
  def add_reference(post, authorization, options = {})
398
398
  _, psp_reference, = authorization.split('#')
399
399
  post[:originalReference] = single_reference(authorization) || psp_reference
400
+ post[:networkTxReference] = options[:network_transaction_id] if options[:network_transaction_id]
400
401
  end
401
402
 
402
403
  def add_original_reference(post, authorization, options = {})
@@ -511,6 +512,7 @@ module ActiveMerchant #:nodoc:
511
512
  raw_response = e.response.body
512
513
  response = parse(raw_response)
513
514
  end
515
+
514
516
  success = success_from(action, response, options)
515
517
  Response.new(
516
518
  success,
@@ -519,6 +521,7 @@ module ActiveMerchant #:nodoc:
519
521
  authorization: authorization_from(action, parameters, response),
520
522
  test: test?,
521
523
  error_code: success ? nil : error_code_from(response),
524
+ network_transaction_id: network_transaction_id_from(response),
522
525
  avs_result: AVSResult.new(code: avs_code_from(response)),
523
526
  cvv_result: CVVResult.new(cvv_result_from(response))
524
527
  )
@@ -621,6 +624,10 @@ module ActiveMerchant #:nodoc:
621
624
  STANDARD_ERROR_CODE_MAPPING[response['errorCode']]
622
625
  end
623
626
 
627
+ def network_transaction_id_from(response)
628
+ response.dig('additionalData', 'networkTxReference')
629
+ end
630
+
624
631
  def add_browser_info(browser_info, post)
625
632
  return unless browser_info
626
633
 
@@ -7,7 +7,7 @@ rescue LoadError
7
7
  raise 'Could not load the braintree gem. Use `gem install braintree` to install it.'
8
8
  end
9
9
 
10
- raise "Need braintree gem >= 3.0.0. Run `gem install braintree --version '~>3.0.0'` to get the correct version." unless Braintree::Version::Major == 3 && Braintree::Version::Minor == 0
10
+ raise 'Need braintree gem >= 2.0.0.' unless Braintree::Version::Major >= 2 && Braintree::Version::Minor >= 0
11
11
 
12
12
  module ActiveMerchant #:nodoc:
13
13
  module Billing #:nodoc:
@@ -801,7 +801,8 @@ module ActiveMerchant #:nodoc:
801
801
  eci_indicator: credit_card_or_vault_id.eci
802
802
  }
803
803
  elsif credit_card_or_vault_id.source == :android_pay || credit_card_or_vault_id.source == :google_pay
804
- parameters[:google_pay_card] = {
804
+ Braintree::Version::Major < 3 ? pay_card = :android_pay_card : pay_card = :google_pay_card
805
+ parameters[pay_card] = {
805
806
  number: credit_card_or_vault_id.number,
806
807
  cryptogram: credit_card_or_vault_id.payment_cryptogram,
807
808
  expiration_month: credit_card_or_vault_id.month.to_s.rjust(2, '0'),
@@ -37,12 +37,15 @@ module ActiveMerchant #:nodoc:
37
37
  post = {}
38
38
  add_invoice(post, amount, options)
39
39
  add_customer_data(post, options)
40
+ add_metadata(post, options)
40
41
 
41
42
  commit(:capture, post, authorization)
42
43
  end
43
44
 
44
45
  def void(authorization, _options = {})
45
46
  post = {}
47
+ add_metadata(post, options)
48
+
46
49
  commit(:void, post, authorization)
47
50
  end
48
51
 
@@ -50,6 +53,7 @@ module ActiveMerchant #:nodoc:
50
53
  post = {}
51
54
  add_invoice(post, amount, options)
52
55
  add_customer_data(post, options)
56
+ add_metadata(post, options)
53
57
 
54
58
  commit(:refund, post, authorization)
55
59
  end
@@ -82,6 +86,7 @@ module ActiveMerchant #:nodoc:
82
86
  add_stored_credential_options(post, options)
83
87
  add_transaction_data(post, options)
84
88
  add_3ds(post, options)
89
+ add_metadata(post, options)
85
90
  end
86
91
 
87
92
  def add_invoice(post, money, options)
@@ -97,6 +102,11 @@ module ActiveMerchant #:nodoc:
97
102
  post[:metadata][:udf5] = application_id || 'ActiveMerchant'
98
103
  end
99
104
 
105
+ def add_metadata(post, options)
106
+ post[:metadata] = {} unless post[:metadata]
107
+ post[:metadata].merge!(options[:metadata]) if options[:metadata]
108
+ end
109
+
100
110
  def add_payment_method(post, payment_method, options)
101
111
  post[:source] = {}
102
112
  if payment_method.is_a?(NetworkTokenizationCreditCard) && payment_method.source == :network_token
@@ -464,7 +464,7 @@ module ActiveMerchant #:nodoc:
464
464
  xml.tag! :AVSphoneNum, (address[:phone] ? address[:phone].scan(/\d/).join.to_s[0..13] : nil)
465
465
  end
466
466
 
467
- xml.tag! :AVSname, (payment_source&.name ? payment_source.name[0..29] : nil)
467
+ xml.tag! :AVSname, billing_name(payment_source, options)
468
468
  xml.tag! :AVScountryCode, (avs_supported ? byte_limit(format_address_field(address[:country]), 2) : '')
469
469
 
470
470
  # Needs to come after AVScountryCode
@@ -472,6 +472,14 @@ module ActiveMerchant #:nodoc:
472
472
  end
473
473
  end
474
474
 
475
+ def billing_name(payment_source, options)
476
+ if payment_source&.name.present?
477
+ payment_source.name[0..29]
478
+ elsif options[:billing_address][:name].present?
479
+ options[:billing_address][:name][0..29]
480
+ end
481
+ end
482
+
475
483
  def add_destination_address(xml, address)
476
484
  if address[:dest_zip]
477
485
  avs_supported = AVS_SUPPORTED_COUNTRIES.include?(address[:dest_country].to_s)
@@ -86,8 +86,8 @@ module ActiveMerchant #:nodoc:
86
86
  refund(money, identification, options)
87
87
  end
88
88
 
89
- def verify(payment_source, options = {})
90
- request = build_purchase_or_authorization_request(nil, payment_source, options)
89
+ def verify(money, payment_source, options = {})
90
+ request = build_purchase_or_authorization_request(money, payment_source, options)
91
91
  commit(:validate, request)
92
92
  end
93
93
 
@@ -250,6 +250,7 @@ module ActiveMerchant #:nodoc:
250
250
  xml.tag! 'n2:PaymentType', options[:payment_type] || 'Any'
251
251
  add_payment_details(xml, money, currency_code, options)
252
252
  xml.tag! 'n2:IPAddress', options[:ip]
253
+ xml.tag! 'n2:MerchantSessionId', options[:merchant_session_id] if options[:merchant_session_id].present?
253
254
  end
254
255
  end
255
256
  end
@@ -34,14 +34,15 @@ module ActiveMerchant #:nodoc:
34
34
  def purchase(money, payment, options = {})
35
35
  commerce = options[:commerce] || @options[:commerce]
36
36
  commerce_branch = options[:commerce_branch] || @options[:commerce_branch]
37
+ shop_process_id = options[:shop_process_id] || @shop_process_id
37
38
 
38
- token = generate_token(@shop_process_id, 'pay_pci', commerce, commerce_branch, amount(money), currency(money))
39
+ token = generate_token(shop_process_id, 'pay_pci', commerce, commerce_branch, amount(money), currency(money))
39
40
 
40
41
  post = {}
41
42
  post[:token] = token
42
43
  post[:commerce] = commerce.to_s
43
44
  post[:commerce_branch] = commerce_branch.to_s
44
- post[:shop_process_id] = @shop_process_id
45
+ post[:shop_process_id] = shop_process_id
45
46
  post[:number_of_payments] = options[:number_of_payments] || 1
46
47
  post[:recursive] = options[:recursive] || false
47
48
 
@@ -52,11 +53,12 @@ module ActiveMerchant #:nodoc:
52
53
  commit(:pay_pci_buy_encrypted, post)
53
54
  end
54
55
 
55
- def void(_authorization, options = {})
56
- token = generate_token(@shop_process_id, 'rollback', '0.00')
56
+ def void(authorization, options = {})
57
+ _, shop_process_id = authorization.to_s.split('#')
58
+ token = generate_token(shop_process_id, 'rollback', '0.00')
57
59
  post = {
58
60
  token: token,
59
- shop_process_id: @shop_process_id
61
+ shop_process_id: shop_process_id
60
62
  }
61
63
  commit(:pci_buy_rollback, post)
62
64
  end
@@ -151,7 +153,10 @@ module ActiveMerchant #:nodoc:
151
153
  end
152
154
 
153
155
  def authorization_from(response)
154
- response.dig('confirmation', 'authorization_number')
156
+ authorization_number = response.dig('confirmation', 'authorization_number')
157
+ shop_process_id = response.dig('confirmation', 'shop_process_id')
158
+
159
+ "#{authorization_number}##{shop_process_id}"
155
160
  end
156
161
 
157
162
  def error_code_from(response)
@@ -1,3 +1,3 @@
1
1
  module ActiveMerchant
2
- VERSION = '1.120.0'
2
+ VERSION = '1.121.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.120.0
4
+ version: 1.121.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: 2021-05-28 00:00:00.000000000 Z
11
+ date: 2021-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport