braintree 4.36.0 → 4.38.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 +4 -4
- data/lib/braintree/credit_card_verification.rb +1 -0
- data/lib/braintree/transaction.rb +1 -0
- data/lib/braintree/transaction_gateway.rb +2 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/credit_card_verification_spec.rb +36 -0
- data/spec/integration/braintree/transaction_spec.rb +119 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +7 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +2 -0
- data/spec/unit/braintree/transaction_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9847c722f0454ca6210b66fd3c083214b2f81947e2b8e2aa3ffd31e7892ae5c1
|
|
4
|
+
data.tar.gz: 0faf0a4519808b21007000b57e353fbf6fd89c02a64551f6fa5560fa00f9fbde
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 91921d4cd7aabff1e758003dc4de8e715c5dd3ba704d5682b9adb74340012eb94eb7c328e40a6620985b1ad129006d62d2c15160f49b483f9b34d3ea8e441d6b
|
|
7
|
+
data.tar.gz: 384b5dcaf3a750f916b1cfb49bc60b625d8cc8c2fc729f3999fe81e6b5c0fcdba32de94cdceb7fde1a1184a12fb3eeaf95eac2dfbfb46c58b38935d578e82b78
|
|
@@ -40,6 +40,7 @@ module Braintree
|
|
|
40
40
|
attr_reader :gateway_rejection_reason
|
|
41
41
|
attr_reader :graphql_id
|
|
42
42
|
attr_reader :id
|
|
43
|
+
attr_reader :mastercard_transaction_link_id
|
|
43
44
|
attr_reader :merchant_account_id
|
|
44
45
|
attr_reader :network_response_code
|
|
45
46
|
attr_reader :network_response_text
|
|
@@ -122,6 +122,7 @@ module Braintree
|
|
|
122
122
|
attr_reader :installment_count
|
|
123
123
|
attr_reader :installments
|
|
124
124
|
attr_reader :local_payment_details
|
|
125
|
+
attr_reader :mastercard_transaction_link_id
|
|
125
126
|
attr_reader :merchant_account_id
|
|
126
127
|
attr_reader :merchant_advice_code
|
|
127
128
|
attr_reader :merchant_advice_code_text
|
data/lib/braintree/version.rb
CHANGED
|
@@ -48,6 +48,42 @@ describe Braintree::CreditCardVerification, "search" do
|
|
|
48
48
|
expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
it "returns mastercard transaction link id in response" do
|
|
52
|
+
verification_params = {
|
|
53
|
+
:credit_card => {
|
|
54
|
+
:expiration_date => "05/2032",
|
|
55
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
result = Braintree::CreditCardVerification.create(verification_params)
|
|
60
|
+
|
|
61
|
+
expect(result).to be_success
|
|
62
|
+
expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
|
|
63
|
+
expect(result.credit_card_verification.processor_response_code).to eq("1000")
|
|
64
|
+
expect(result.credit_card_verification.processor_response_text).to eq("Approved")
|
|
65
|
+
expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
|
|
66
|
+
expect(result.credit_card_verification.mastercard_transaction_link_id).to match(/\A[a-zA-Z0-9]{22}\z/)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "doesnot return mastercard transaction link id in response for a non mastercard" do
|
|
70
|
+
verification_params = {
|
|
71
|
+
:credit_card => {
|
|
72
|
+
:expiration_date => "05/2032",
|
|
73
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
result = Braintree::CreditCardVerification.create(verification_params)
|
|
78
|
+
|
|
79
|
+
expect(result).to be_success
|
|
80
|
+
expect(result.credit_card_verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
|
|
81
|
+
expect(result.credit_card_verification.processor_response_code).to eq("1000")
|
|
82
|
+
expect(result.credit_card_verification.processor_response_text).to eq("Approved")
|
|
83
|
+
expect(result.credit_card_verification.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
|
|
84
|
+
expect(result.credit_card_verification.mastercard_transaction_link_id).to be_nil
|
|
85
|
+
end
|
|
86
|
+
|
|
51
87
|
it "creates a new verification for Visa ANI" do
|
|
52
88
|
verification_params = {
|
|
53
89
|
:credit_card => {
|
|
@@ -336,7 +336,7 @@ describe Braintree::Transaction do
|
|
|
336
336
|
|
|
337
337
|
describe "sca_exemption" do
|
|
338
338
|
context "with a valid request" do
|
|
339
|
-
|
|
339
|
+
xit "succeeds" do
|
|
340
340
|
requested_exemption = "low_value"
|
|
341
341
|
result = Braintree::Transaction.create(
|
|
342
342
|
:type => "sale",
|
|
@@ -6206,6 +6206,90 @@ describe Braintree::Transaction do
|
|
|
6206
6206
|
end.to raise_error(ArgumentError)
|
|
6207
6207
|
end
|
|
6208
6208
|
|
|
6209
|
+
it "succeeds when a vaulted shipping_address_id is passed" do
|
|
6210
|
+
customer = Braintree::Customer.create!(
|
|
6211
|
+
:credit_card => {
|
|
6212
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
6213
|
+
:expiration_date => "06/2009"
|
|
6214
|
+
},
|
|
6215
|
+
)
|
|
6216
|
+
address = Braintree::Address.create!(
|
|
6217
|
+
:customer_id => customer.id,
|
|
6218
|
+
:street_address => "1 Main St",
|
|
6219
|
+
:locality => "Chicago",
|
|
6220
|
+
:region => "IL",
|
|
6221
|
+
:postal_code => "60601",
|
|
6222
|
+
)
|
|
6223
|
+
transaction = Braintree::Transaction.create(
|
|
6224
|
+
:type => "sale",
|
|
6225
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
6226
|
+
:customer_id => customer.id,
|
|
6227
|
+
:payment_method_token => customer.credit_cards.first.token,
|
|
6228
|
+
:options => {
|
|
6229
|
+
:submit_for_settlement => false
|
|
6230
|
+
},
|
|
6231
|
+
).transaction
|
|
6232
|
+
|
|
6233
|
+
result = Braintree::Transaction.submit_for_settlement(transaction.id, nil, {
|
|
6234
|
+
:shipping_address_id => address.id,
|
|
6235
|
+
})
|
|
6236
|
+
|
|
6237
|
+
expect(result.success?).to be_truthy
|
|
6238
|
+
expect(result.transaction.shipping_details.street_address).to eq("1 Main St")
|
|
6239
|
+
expect(result.transaction.shipping_details.postal_code).to eq("60601")
|
|
6240
|
+
end
|
|
6241
|
+
|
|
6242
|
+
it "raises an ArgumentError if an invalid shipping sub-key is passed" do
|
|
6243
|
+
transaction = Braintree::Transaction.sale!(
|
|
6244
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
6245
|
+
:credit_card => {
|
|
6246
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
6247
|
+
:expiration_date => "06/2009"
|
|
6248
|
+
},
|
|
6249
|
+
)
|
|
6250
|
+
|
|
6251
|
+
expect do
|
|
6252
|
+
Braintree::Transaction.submit_for_settlement(transaction.id, nil, {
|
|
6253
|
+
:shipping => {:invalid_field => "bad"}
|
|
6254
|
+
})
|
|
6255
|
+
end.to raise_error(ArgumentError)
|
|
6256
|
+
end
|
|
6257
|
+
|
|
6258
|
+
it "succeeds when shipping address data is passed" do
|
|
6259
|
+
transaction = Braintree::Transaction.sale!(
|
|
6260
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
6261
|
+
:credit_card => {
|
|
6262
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
6263
|
+
:expiration_date => "06/2009"
|
|
6264
|
+
},
|
|
6265
|
+
:options => {
|
|
6266
|
+
:submit_for_settlement => false
|
|
6267
|
+
},
|
|
6268
|
+
)
|
|
6269
|
+
|
|
6270
|
+
result = Braintree::Transaction.submit_for_settlement(transaction.id, nil, {
|
|
6271
|
+
:discount_amount => "12.33",
|
|
6272
|
+
:shipping_amount => "5.00",
|
|
6273
|
+
:ships_from_postal_code => "90210",
|
|
6274
|
+
:shipping => {
|
|
6275
|
+
:first_name => "Andrew",
|
|
6276
|
+
:last_name => "Mason",
|
|
6277
|
+
:company => "Braintree",
|
|
6278
|
+
:street_address => "456 W Main St",
|
|
6279
|
+
:extended_address => "Apt 2F",
|
|
6280
|
+
:locality => "Bartlett",
|
|
6281
|
+
:region => "IL",
|
|
6282
|
+
:postal_code => "60103",
|
|
6283
|
+
:country_name => "United States of America",
|
|
6284
|
+
},
|
|
6285
|
+
})
|
|
6286
|
+
|
|
6287
|
+
expect(result.success?).to be_truthy
|
|
6288
|
+
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
|
6289
|
+
expect(result.transaction.shipping_details.first_name).to eq("Andrew")
|
|
6290
|
+
expect(result.transaction.shipping_details.postal_code).to eq("60103")
|
|
6291
|
+
end
|
|
6292
|
+
|
|
6209
6293
|
it "returns an error result if settlement is too large" do
|
|
6210
6294
|
transaction = Braintree::Transaction.sale!(
|
|
6211
6295
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
@@ -7960,6 +8044,40 @@ describe Braintree::Transaction do
|
|
|
7960
8044
|
end
|
|
7961
8045
|
end
|
|
7962
8046
|
|
|
8047
|
+
describe "mastercard_transaction_link_id" do
|
|
8048
|
+
it "is available in response for mastercard" do
|
|
8049
|
+
result = Braintree::Transaction.create(
|
|
8050
|
+
:type => "sale",
|
|
8051
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
8052
|
+
:accept_partial_authorization => true,
|
|
8053
|
+
:credit_card => {
|
|
8054
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
8055
|
+
:expiration_date => "05/2029"
|
|
8056
|
+
},
|
|
8057
|
+
)
|
|
8058
|
+
|
|
8059
|
+
expect(result.success?).to eq(true)
|
|
8060
|
+
expect(result.transaction.processor_response_code).to eq("1000")
|
|
8061
|
+
expect(result.transaction.mastercard_transaction_link_id).to match(/\A[a-zA-Z0-9]{22}\z/)
|
|
8062
|
+
end
|
|
8063
|
+
|
|
8064
|
+
it "is not available in response for non mastercard" do
|
|
8065
|
+
result = Braintree::Transaction.create(
|
|
8066
|
+
:type => "sale",
|
|
8067
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
8068
|
+
:accept_partial_authorization => true,
|
|
8069
|
+
:credit_card => {
|
|
8070
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
8071
|
+
:expiration_date => "05/2029"
|
|
8072
|
+
},
|
|
8073
|
+
)
|
|
8074
|
+
|
|
8075
|
+
expect(result.success?).to eq(true)
|
|
8076
|
+
expect(result.transaction.processor_response_code).to eq("1000")
|
|
8077
|
+
expect(result.transaction.mastercard_transaction_link_id).to be_nil
|
|
8078
|
+
end
|
|
8079
|
+
end
|
|
8080
|
+
|
|
7963
8081
|
context "Surcharge Amount" do
|
|
7964
8082
|
it "accepts surcharge_amount field" do
|
|
7965
8083
|
result = Braintree::Transaction.create(
|
|
@@ -60,6 +60,13 @@ describe Braintree::CreditCardVerification do
|
|
|
60
60
|
expect(verification.network_transaction_id).to eq "123456789012345"
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
it "sets mastercard_transaction_link_id" do
|
|
64
|
+
verification = Braintree::CreditCardVerification._new(
|
|
65
|
+
:mastercard_transaction_link_id => "ZairABg6CIFekPMsnK0cJ2",
|
|
66
|
+
)
|
|
67
|
+
expect(verification.mastercard_transaction_link_id).to eq "ZairABg6CIFekPMsnK0cJ2"
|
|
68
|
+
end
|
|
69
|
+
|
|
63
70
|
describe "self.create" do
|
|
64
71
|
it "rejects invalid parameters" do
|
|
65
72
|
expect do
|
|
@@ -185,6 +185,8 @@ describe Braintree::TransactionGateway do
|
|
|
185
185
|
:tax_amount,
|
|
186
186
|
:tax_exempt,
|
|
187
187
|
:discount_amount,
|
|
188
|
+
{:shipping => Braintree::AddressGateway._shared_signature},
|
|
189
|
+
:shipping_address_id,
|
|
188
190
|
:shipping_amount,
|
|
189
191
|
:shipping_tax_amount,
|
|
190
192
|
:ships_from_postal_code,
|
|
@@ -43,6 +43,12 @@ describe Braintree::Transaction do
|
|
|
43
43
|
Braintree::Transaction.submit_for_settlement("invalid-transaction-id")
|
|
44
44
|
end.to raise_error(ArgumentError, "transaction_id is invalid")
|
|
45
45
|
end
|
|
46
|
+
|
|
47
|
+
it "raises an ArgumentError if options hash includes an invalid key" do
|
|
48
|
+
expect do
|
|
49
|
+
Braintree::Transaction.submit_for_settlement("validtxnid1", nil, :invalid_key => "foo")
|
|
50
|
+
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
|
51
|
+
end
|
|
46
52
|
end
|
|
47
53
|
|
|
48
54
|
describe "self.adjust_authorization" do
|
|
@@ -577,6 +583,16 @@ describe Braintree::Transaction do
|
|
|
577
583
|
end
|
|
578
584
|
end
|
|
579
585
|
|
|
586
|
+
describe "mastercard transaction link id" do
|
|
587
|
+
it "is correctly set" do
|
|
588
|
+
transaction = Braintree::Transaction._new(
|
|
589
|
+
:gateway,
|
|
590
|
+
:mastercard_transaction_link_id => "ZairABg6CIFekPMsnK0cJ2",
|
|
591
|
+
)
|
|
592
|
+
expect(transaction.mastercard_transaction_link_id).to eq("ZairABg6CIFekPMsnK0cJ2")
|
|
593
|
+
end
|
|
594
|
+
end
|
|
595
|
+
|
|
580
596
|
describe "request includes surcharge amount" do
|
|
581
597
|
it "if the surcharge_amount is present" do
|
|
582
598
|
transaction = Braintree::Transaction._new(:gateway, :surcharge_amount => "1.00")
|
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.
|
|
4
|
+
version: 4.38.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-05-
|
|
11
|
+
date: 2026-05-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|