braintree 4.41.0 → 4.42.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: 874cd322dda721874dc4418b2f6ca24116b9395f7affc02d43fe056f43424b3a
4
- data.tar.gz: 8c73ed2ec27ecf6b916474bc12dc14bde985c48107a53bdcea17a65a216cc3d5
3
+ metadata.gz: 8ec866027a8aca5a627799053012f7e992155e64b4c318e1f8da68bf0a395a84
4
+ data.tar.gz: d4900837bac1f44acc8f0a9b976d75d6b1a60bde93df1a7cbdabf19bf623de2b
5
5
  SHA512:
6
- metadata.gz: f8f4fa7af94d5b317dc5efa9aea66d1fbcf84f689e9cb19435f6899b8af8c39fb25063a8d0ff40e4025f42014e4c18555e9d4b2e779132b0fc73afc3f6204baa
7
- data.tar.gz: 815d5927abfa22e7acbdf7fa4353d9408b0b0add7f66a5e1cbf43b2b2aaa03a5ac4f925eb25b69bcf1060ff04c01e9cdc9c908e560a4e6e7df9db14339ed886a
6
+ metadata.gz: e6c03eb513ad06b6fcaabc57167e2398c5a1d36c82f6863f30dcb57e6f1a40a43142f2b8c4591eb594eb36e4fc0d6c4cf2b9a3b756c77450501d5d6c2baa6652
7
+ data.tar.gz: e4f00316d23efaf9bee33c0af67d05e7a013e7c4a32224f810a4c39a72135e0fd977c57077e816c4fddad6e8e6e95245e6f0eb2888c00f96dec25f8ecbe0e0e1
@@ -120,7 +120,7 @@ module Braintree
120
120
  :billing_address_id, :cardholder_name, :cvv, :expiration_date, :expiration_month,
121
121
  :expiration_year, :number, :token, :venmo_sdk_payment_method_code, # Deprecated
122
122
  :device_data, :payment_method_nonce,
123
- {:external_vault => [:network_transaction_id]},
123
+ {:external_vault => [:network_transaction_id, :mastercard_transaction_link_id]},
124
124
  {:options => options},
125
125
  {:billing_address => billing_address_params}
126
126
  ]
@@ -61,6 +61,7 @@ module Braintree
61
61
  ]},
62
62
  {:external_vault => [
63
63
  :previous_network_transaction_id,
64
+ :previous_mastercard_transaction_link_id,
64
65
  :status,
65
66
  ]},
66
67
  :intended_transaction_source,
@@ -120,6 +120,10 @@ module Braintree
120
120
  VerificationAccountTypeNotSupported = "91758"
121
121
  VerificationNotSupportedOnThisMerchantAccount = "91730"
122
122
 
123
+ module ExternalVault
124
+ MastercardTransactionLinkIdIsInvalid = "91767"
125
+ end
126
+
123
127
  module Options
124
128
  UpdateExistingTokenIsInvalid = "91723"
125
129
  UpdateExistingTokenNotAllowed = "91729"
@@ -367,6 +371,7 @@ module Braintree
367
371
  CannotRefundUnlessSettled = "91506"
368
372
  CannotRefundWithPendingMerchantAccount = "91559"
369
373
  CannotRefundWithSuspendedMerchantAccount = "91538"
374
+ CannotReverseAtThisTime = "915282"
370
375
  CannotSimulateTransactionSettlement = "91575"
371
376
  CannotSubmitForSettlement = "91507"
372
377
  CannotUpdateTransactionDetailsNotSubmittedForSettlement = "915129"
@@ -613,8 +618,10 @@ module Braintree
613
618
  end
614
619
 
615
620
  module ExternalVault
621
+ PreviousMastercardTransactionLinkIdIsInvalid = "915279"
616
622
  PreviousNetworkTransactionIdIsInvalid = "915179"
617
623
  StatusIsInvalid = "915175"
624
+ StatusWithPreviousMastercardTransactionLinkIdIsInvalid = "915278"
618
625
  StatusWithPreviousNetworkTransactionIdIsInvalid = "915177"
619
626
  end
620
627
  end
@@ -745,6 +752,11 @@ module Braintree
745
752
  end
746
753
 
747
754
  module Verification
755
+ module ExternalVault
756
+ PreviousMastercardTransactionLinkIdIsInvalid = "942206"
757
+ StatusWithPreviousMastercardTransactionLinkIdIsInvalid = "942205"
758
+ end
759
+
748
760
  module Options
749
761
  AccountTypeIsInvalid = "942184"
750
762
  AccountTypeNotSupported = "942185"
@@ -247,6 +247,14 @@ module Braintree
247
247
  Configuration.gateway.transaction.refund!(*args)
248
248
  end
249
249
 
250
+ def self.reverse(*args)
251
+ Configuration.gateway.transaction.reverse(*args)
252
+ end
253
+
254
+ def self.reverse!(*args)
255
+ Configuration.gateway.transaction.reverse!(*args)
256
+ end
257
+
250
258
  def self.sale(*args)
251
259
  Configuration.gateway.transaction.sale(*args)
252
260
  end
@@ -100,6 +100,22 @@ module Braintree
100
100
  _do_create "/transactions", :transaction => attributes
101
101
  end
102
102
 
103
+ def reverse(transaction_id, options = {})
104
+ raise ArgumentError, "transaction_id contains invalid characters" if Util.invalid_path_segment?(transaction_id)
105
+
106
+ Util.verify_keys(TransactionGateway._reverse_signature, options)
107
+ transaction_params = options.empty? ? nil : options
108
+ response = @config.http.post(
109
+ "#{@config.base_merchant_path}/transactions/#{transaction_id}/reverse",
110
+ transaction_params ? {:transaction => transaction_params} : nil,
111
+ )
112
+ _handle_transaction_response(response)
113
+ end
114
+
115
+ def reverse!(*args)
116
+ return_object_or_raise(:transaction) { reverse(*args) }
117
+ end
118
+
103
119
  def sale(attributes)
104
120
  create(attributes.merge(:type => "sale"))
105
121
  end
@@ -226,6 +242,7 @@ module Braintree
226
242
  {:external_vault => [
227
243
  :status,
228
244
  :previous_network_transaction_id,
245
+ :previous_mastercard_transaction_link_id,
229
246
  ]},
230
247
  {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
231
248
  {:industry => [
@@ -394,6 +411,12 @@ module Braintree
394
411
  ]
395
412
  end
396
413
 
414
+ def self._reverse_signature
415
+ [
416
+ :api_request_key,
417
+ ]
418
+ end
419
+
397
420
  def _do_create(path, params=nil)
398
421
  if !params.nil?
399
422
  params = Util.replace_key(params, :google_pay_card, :android_pay_card)
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 41
4
+ Minor = 42
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -56,7 +56,9 @@ describe Braintree::ApplePayGateway do
56
56
  it "returns stubbed registered domains" do
57
57
  result = @gateway.apple_pay.registered_domains
58
58
  expect(result).to be_success
59
- expect(result.apple_pay_options.domains).to eq(["www.example.com"])
59
+ domains = result.apple_pay_options.domains
60
+ expect(domains).not_to be_empty
61
+ expect(domains).to all(be_a(String).and(satisfy { |domain| !domain.empty? }))
60
62
  end
61
63
  end
62
64
  end
@@ -529,6 +529,37 @@ describe Braintree::CreditCard do
529
529
  expect(result.success?).to eq(true)
530
530
  end
531
531
 
532
+ it "can set the mastercard transaction link identifier when creating a credit card" do
533
+ customer = Braintree::Customer.create!
534
+
535
+ result = Braintree::CreditCard.create(
536
+ :customer_id => customer.id,
537
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
538
+ :expiration_date => "05/2009",
539
+ :external_vault => {
540
+ :mastercard_transaction_link_id => "1234567890123456789012",
541
+ },
542
+ )
543
+
544
+ expect(result.success?).to eq(true)
545
+ end
546
+
547
+ it "rejects a mastercard transaction link identifier that is not 22 characters" do
548
+ customer = Braintree::Customer.create!
549
+
550
+ result = Braintree::CreditCard.create(
551
+ :customer_id => customer.id,
552
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
553
+ :expiration_date => "05/2009",
554
+ :external_vault => {
555
+ :mastercard_transaction_link_id => "1234567890123456789012123",
556
+ },
557
+ )
558
+
559
+ expect(result.success?).to eq(false)
560
+ expect(result.errors.for(:credit_card).for(:external_vault).on(:mastercard_transaction_link_id)[0].code).to eq(Braintree::ErrorCodes::CreditCard::ExternalVault::MastercardTransactionLinkIdIsInvalid)
561
+ end
562
+
532
563
  context "card type indicators" do
533
564
  it "sets the prepaid field if the card is prepaid" do
534
565
  customer = Braintree::Customer.create!
@@ -147,6 +147,60 @@ describe Braintree::CreditCardVerification, "search" do
147
147
  expect(result.credit_card_verification.network_transaction_id).not_to be_nil
148
148
  end
149
149
 
150
+ it "creates a new verification with previous_mastercard_transaction_link_id" do
151
+ verification_params = {
152
+ :credit_card => {
153
+ :expiration_date => "05/2029",
154
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
155
+ },
156
+ :external_vault => {
157
+ :status => "vaulted",
158
+ :previous_mastercard_transaction_link_id => "1234567890123456789012",
159
+ }
160
+ }
161
+
162
+ result = Braintree::CreditCardVerification.create(verification_params)
163
+
164
+ expect(result).to be_success
165
+ expect(result.credit_card_verification.id).to match(/^\w{6,}$/)
166
+ end
167
+
168
+ it "rejects non-vaulted status with previous_mastercard_transaction_link_id" do
169
+ verification_params = {
170
+ :credit_card => {
171
+ :expiration_date => "05/2029",
172
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
173
+ },
174
+ :external_vault => {
175
+ :status => "will_vault",
176
+ :previous_mastercard_transaction_link_id => "1234567890123456789012",
177
+ }
178
+ }
179
+
180
+ result = Braintree::CreditCardVerification.create(verification_params)
181
+
182
+ expect(result.success?).to eq(false)
183
+ expect(result.errors.for(:verification).for(:external_vault).on(:status)[0].code).to eq(Braintree::ErrorCodes::Verification::ExternalVault::StatusWithPreviousMastercardTransactionLinkIdIsInvalid)
184
+ end
185
+
186
+ it "rejects previous_mastercard_transaction_link_id that is not 22 characters" do
187
+ verification_params = {
188
+ :credit_card => {
189
+ :expiration_date => "05/2029",
190
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
191
+ },
192
+ :external_vault => {
193
+ :status => "vaulted",
194
+ :previous_mastercard_transaction_link_id => "1234567890123456789012123",
195
+ }
196
+ }
197
+
198
+ result = Braintree::CreditCardVerification.create(verification_params)
199
+
200
+ expect(result.success?).to eq(false)
201
+ expect(result.errors.for(:verification).for(:external_vault).on(:previous_mastercard_transaction_link_id)[0].code).to eq(Braintree::ErrorCodes::Verification::ExternalVault::PreviousMastercardTransactionLinkIdIsInvalid)
202
+ end
203
+
150
204
  it "creates a new verification from risk data param" do
151
205
  verification_params = {
152
206
  :credit_card => {
@@ -102,6 +102,21 @@ describe Braintree::Customer do
102
102
  expect(result).to be_success
103
103
  end
104
104
 
105
+ it "supports creation with a mastercard_transaction_link_id external_vault param" do
106
+ result = Braintree::Customer.create(
107
+ :credit_card => {
108
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
109
+ :expiration_date => "05/2010",
110
+ :cvv => "100",
111
+ :external_vault => {
112
+ :mastercard_transaction_link_id => "1234567890123456789012",
113
+ },
114
+ },
115
+ )
116
+
117
+ expect(result).to be_success
118
+ end
119
+
105
120
  it "supports creation including risk data with customer_browser and customer_ip" do
106
121
  result = Braintree::Customer.create(
107
122
  :credit_card => {
@@ -277,6 +277,36 @@ describe Braintree::Transaction, "idempotency" do
277
277
  end
278
278
  end
279
279
 
280
+ describe "reverse" do
281
+ it "returns original reverse on duplicate request with same api_request_key" do
282
+ api_request_key = "reverse-idempotency-key-#{rand(1000000)}"
283
+
284
+ sale_request = {
285
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
286
+ :credit_card => {
287
+ :number => "4111111111111111",
288
+ :expiration_date => "05/2035"
289
+ }
290
+ }
291
+
292
+ sale_result = Braintree::Transaction.sale(sale_request)
293
+ expect(sale_result).to be_success
294
+ transaction_id = sale_result.transaction.id
295
+
296
+ reverse_options = {
297
+ :api_request_key => api_request_key
298
+ }
299
+
300
+ reverse_result1 = Braintree::Transaction.reverse(transaction_id, reverse_options)
301
+ expect(reverse_result1).to be_success
302
+
303
+ reverse_result2 = Braintree::Transaction.reverse(transaction_id, reverse_options)
304
+ expect(reverse_result2).to be_success
305
+ expect(reverse_result1.transaction.id).to eq(reverse_result2.transaction.id)
306
+ expect(reverse_result2.transaction.status).to eq(Braintree::Transaction::Status::Voided)
307
+ end
308
+ end
309
+
280
310
  describe "refund" do
281
311
  it "returns original refund on duplicate request with same api_request_key" do
282
312
  api_request_key = "refund-idempotency-key-#{rand(1000000)}"
@@ -5013,6 +5013,23 @@ describe Braintree::Transaction do
5013
5013
  expect(result.transaction.network_transaction_id).not_to be_nil
5014
5014
  end
5015
5015
 
5016
+ it "accepts previous_mastercard_transaction_link_id" do
5017
+ result = Braintree::Transaction.create(
5018
+ :type => "sale",
5019
+ :credit_card => {
5020
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
5021
+ :expiration_date => "05/2009"
5022
+ },
5023
+ :external_vault => {
5024
+ :status => Braintree::Transaction::ExternalVault::Status::Vaulted,
5025
+ :previous_mastercard_transaction_link_id => "1234567890123456789012",
5026
+ },
5027
+ :amount => "10.00",
5028
+ )
5029
+ expect(result.success?).to eq(true)
5030
+ expect(result.transaction.network_transaction_id).not_to be_nil
5031
+ end
5032
+
5016
5033
  it "rejects non-vaulted status with previous_network_transaction_id" do
5017
5034
  result = Braintree::Transaction.create(
5018
5035
  :type => "sale",
@@ -5029,6 +5046,40 @@ describe Braintree::Transaction do
5029
5046
  expect(result.success?).to eq(false)
5030
5047
  expect(result.errors.for(:transaction).for(:external_vault).on(:status)[0].code).to eq(Braintree::ErrorCodes::Transaction::ExternalVault::StatusWithPreviousNetworkTransactionIdIsInvalid)
5031
5048
  end
5049
+
5050
+ it "rejects non-vaulted status with previous_mastercard_transaction_link_id" do
5051
+ result = Braintree::Transaction.create(
5052
+ :type => "sale",
5053
+ :credit_card => {
5054
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
5055
+ :expiration_date => "05/2009"
5056
+ },
5057
+ :external_vault => {
5058
+ :status => Braintree::Transaction::ExternalVault::Status::WillVault,
5059
+ :previous_mastercard_transaction_link_id => "1234567890123456789012",
5060
+ },
5061
+ :amount => "10.00",
5062
+ )
5063
+ expect(result.success?).to eq(false)
5064
+ expect(result.errors.for(:transaction).for(:external_vault).on(:status)[0].code).to eq(Braintree::ErrorCodes::Transaction::ExternalVault::StatusWithPreviousMastercardTransactionLinkIdIsInvalid)
5065
+ end
5066
+
5067
+ it "rejects previous_mastercard_transaction_link_id that is not 22 characters" do
5068
+ result = Braintree::Transaction.create(
5069
+ :type => "sale",
5070
+ :credit_card => {
5071
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
5072
+ :expiration_date => "05/2009"
5073
+ },
5074
+ :external_vault => {
5075
+ :status => Braintree::Transaction::ExternalVault::Status::Vaulted,
5076
+ :previous_mastercard_transaction_link_id => "1234567890123456789012123",
5077
+ },
5078
+ :amount => "10.00",
5079
+ )
5080
+ expect(result.success?).to eq(false)
5081
+ expect(result.errors.for(:transaction).for(:external_vault).on(:previous_mastercard_transaction_link_id)[0].code).to eq(Braintree::ErrorCodes::Transaction::ExternalVault::PreviousMastercardTransactionLinkIdIsInvalid)
5082
+ end
5032
5083
  end
5033
5084
 
5034
5085
  context "Non-(Visa/Mastercard/Discover/AmEx) card types" do
@@ -7339,6 +7390,85 @@ describe Braintree::Transaction do
7339
7390
  end
7340
7391
  end
7341
7392
 
7393
+ describe "self.reverse" do
7394
+ it "voids a voidable transaction" do
7395
+ transaction = Braintree::Transaction.sale!(
7396
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
7397
+ :credit_card => {
7398
+ :number => Braintree::Test::CreditCardNumbers::Visa,
7399
+ :expiration_date => "05/2009"
7400
+ },
7401
+ )
7402
+
7403
+ result = Braintree::Transaction.reverse(transaction.id)
7404
+
7405
+ expect(result.success?).to eq(true)
7406
+ expect(result.transaction.id).to eq(transaction.id)
7407
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::Voided)
7408
+ expect(result.transaction.refunded_transaction_id).to be_nil
7409
+ end
7410
+
7411
+ it "returns an error when reversing twice without an api request key" do
7412
+ transaction = Braintree::Transaction.sale!(
7413
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
7414
+ :credit_card => {
7415
+ :number => Braintree::Test::CreditCardNumbers::Visa,
7416
+ :expiration_date => "05/2009"
7417
+ },
7418
+ )
7419
+
7420
+ expect(Braintree::Transaction.reverse(transaction.id)).to be_success
7421
+ result = Braintree::Transaction.reverse(transaction.id)
7422
+
7423
+ expect(result.success?).to eq(false)
7424
+ expect(result.errors.for(:transaction).on(:base).first.code).to eq(
7425
+ Braintree::ErrorCodes::Transaction::CannotRefundUnlessSettled,
7426
+ )
7427
+ end
7428
+
7429
+ it "voids an explicitly created voidable refund" do
7430
+ transaction = Braintree::Transaction.sale!(
7431
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
7432
+ :credit_card => {
7433
+ :number => Braintree::Test::CreditCardNumbers::Visa,
7434
+ :expiration_date => "05/2009"
7435
+ },
7436
+ :options => {
7437
+ :submit_for_settlement => true
7438
+ },
7439
+ )
7440
+ Braintree::TestTransaction.settle(transaction.id)
7441
+ refund = Braintree::Transaction.refund!(transaction.id)
7442
+
7443
+ result = Braintree::Transaction.reverse(refund.id)
7444
+
7445
+ expect(result.success?).to eq(true)
7446
+ expect(result.transaction.id).to eq(refund.id)
7447
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::Voided)
7448
+ expect(result.transaction.refunded_transaction_id).to eq(transaction.id)
7449
+ end
7450
+
7451
+ it "refunds a settled transaction" do
7452
+ transaction = Braintree::Transaction.sale!(
7453
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
7454
+ :credit_card => {
7455
+ :number => Braintree::Test::CreditCardNumbers::Visa,
7456
+ :expiration_date => "05/2009"
7457
+ },
7458
+ :options => {
7459
+ :submit_for_settlement => true
7460
+ },
7461
+ )
7462
+ Braintree::TestTransaction.settle(transaction.id)
7463
+
7464
+ result = Braintree::Transaction.reverse(transaction.id)
7465
+
7466
+ expect(result.success?).to eq(true)
7467
+ expect(result.transaction.type).to eq(Braintree::Transaction::Type::Credit)
7468
+ expect(result.transaction.refunded_transaction_id).to eq(transaction.id)
7469
+ end
7470
+ end
7471
+
7342
7472
  describe "self.void" do
7343
7473
  it "returns a successful result if successful" do
7344
7474
  transaction = Braintree::Transaction.sale!(
@@ -23,7 +23,7 @@ describe Braintree::CreditCard do
23
23
  :venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
24
24
  :device_data,
25
25
  :payment_method_nonce,
26
- {:external_vault=>[:network_transaction_id]},
26
+ {:external_vault=>[:network_transaction_id, :mastercard_transaction_link_id]},
27
27
  {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
28
28
  :account_information_inquiry, :fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
29
29
  {:billing_address => [
@@ -72,7 +72,7 @@ describe Braintree::CreditCard do
72
72
  :venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
73
73
  :device_data,
74
74
  :payment_method_nonce,
75
- {:external_vault=>[:network_transaction_id]},
75
+ {:external_vault=>[:network_transaction_id, :mastercard_transaction_link_id]},
76
76
  {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
77
77
  :account_information_inquiry, :fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
78
78
  {:billing_address => [
@@ -31,6 +31,7 @@ describe Braintree::CreditCardVerificationGateway do
31
31
  expect(result.inspect).to include("number")
32
32
  expect(result.inspect).to include("external_vault")
33
33
  expect(result.inspect).to include("previous_network_transaction_id")
34
+ expect(result.inspect).to include("previous_mastercard_transaction_link_id")
34
35
  expect(result.inspect).to include("status")
35
36
  expect(result.inspect).to include("intended_transaction_source")
36
37
  expect(result.inspect).to include("options")
@@ -136,7 +136,7 @@ describe Braintree::Customer do
136
136
  :venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
137
137
  :device_data,
138
138
  :payment_method_nonce,
139
- {:external_vault=>[:network_transaction_id]},
139
+ {:external_vault=>[:network_transaction_id, :mastercard_transaction_link_id]},
140
140
  {:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
141
141
  :account_information_inquiry, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
142
142
  {:billing_address => [
@@ -267,7 +267,7 @@ describe Braintree::Customer do
267
267
  :venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
268
268
  :device_data,
269
269
  :payment_method_nonce,
270
- {:external_vault=>[:network_transaction_id]},
270
+ {:external_vault=>[:network_transaction_id, :mastercard_transaction_link_id]},
271
271
  {:options => match_array([
272
272
  :account_information_inquiry,
273
273
  :make_default,
@@ -53,6 +53,7 @@ describe Braintree::TransactionGateway do
53
53
  {:external_vault => [
54
54
  :status,
55
55
  :previous_network_transaction_id,
56
+ :previous_mastercard_transaction_link_id,
56
57
  ]},
57
58
  {:google_pay_card => [:number, :cryptogram, :google_transaction_id, :expiration_month, :expiration_year, :source_card_type, :source_card_last_four, :eci_indicator]},
58
59
  {:industry => [
@@ -210,5 +211,18 @@ describe Braintree::TransactionGateway do
210
211
  :surcharge_amount,
211
212
  ])
212
213
  end
214
+
215
+ it "creates a transaction gateway reverse signature" do
216
+ expect(Braintree::TransactionGateway._reverse_signature).to match([
217
+ :api_request_key,
218
+ ])
219
+ end
220
+
221
+ it "rejects invalid transaction IDs when reversing" do
222
+ transaction = Braintree::TransactionGateway.new(gateway)
223
+
224
+ expect { transaction.reverse("../transactions/victim") }
225
+ .to raise_error(ArgumentError, "transaction_id contains invalid characters")
226
+ end
213
227
  end
214
228
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.41.0
4
+ version: 4.42.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-16 00:00:00.000000000 Z
11
+ date: 2026-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder