braintree 4.37.0 → 4.39.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/error_codes.rb +3 -0
- data/lib/braintree/transaction/local_payment_details.rb +2 -0
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +4 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/transaction_spec.rb +84 -0
- data/spec/integration/braintree/transaction_transfer_type_spec.rb +71 -1
- data/spec/unit/braintree/transaction_gateway_spec.rb +4 -0
- data/spec/unit/braintree/transaction_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a8a4986148f9b2ded5832261519f85d75e2932d7d7d15bc7d49207d2422431e
|
|
4
|
+
data.tar.gz: 3431f5d87f5f15ffd7c2d29fe28674d7c49645f0447342360d0f41444def6c16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d523c2199f88f2eea71960c92659b7e8aabb02aa78c35ab51f0b513b575d408b6df9b881c5d895ed8a30b300c3ab4c43fa48ce3d88a331dcd9c96c9c6aac8ca8
|
|
7
|
+
data.tar.gz: d6dc3e11eec83fcbd5c045ff92b04e83ff80686ecc19eedf17a50b19b68d0511f2ec1514fa0f13081ba889509ae161f8f1121380a6e51baa1daf66fa6115f509
|
|
@@ -355,6 +355,7 @@ module Braintree
|
|
|
355
355
|
BillingPhoneNumberIsInvalid = "915206"
|
|
356
356
|
CannotBeVoided = "91504"
|
|
357
357
|
CannotCloneCredit = "91543"
|
|
358
|
+
CannotCloneThirdPartyCofNetworkTokenTransaction = "915274"
|
|
358
359
|
CannotCloneTransactionWithPayPalAccount = "91573"
|
|
359
360
|
CannotCloneTransactionWithVaultCreditCard = "91540"
|
|
360
361
|
CannotCloneUnsuccessfulTransaction = "91542"
|
|
@@ -483,10 +484,12 @@ module Braintree
|
|
|
483
484
|
TransactionTransferDetailsAreMandatory = "97510"
|
|
484
485
|
TransactionTransferDetailsAreNotApplicable = "97511"
|
|
485
486
|
TransactionTransferReceiverAccountReferenceNumberIsNotValid = "97509"
|
|
487
|
+
TransactionTransferReceiverAccountReferenceNumberTypeIsInvalid = "97514"
|
|
486
488
|
TransactionTransferReceiverFirstNameIsNotValid = "97507"
|
|
487
489
|
TransactionTransferReceiverLastNameIsNotValid = "97508"
|
|
488
490
|
TransactionTransferReceiverTaxIdIsNotValid = "97506"
|
|
489
491
|
TransactionTransferSenderAccountReferenceNumberIsNotValid = "97505"
|
|
492
|
+
TransactionTransferSenderAccountReferenceNumberTypeIsInvalid = "97513"
|
|
490
493
|
TransactionTransferSenderFirstNameIsNotValid = "97503"
|
|
491
494
|
TransactionTransferSenderLastNameIsNotValid = "97504"
|
|
492
495
|
TransactionTransferSenderTaxIdIsNotValid = "97502"
|
|
@@ -6,6 +6,8 @@ module Braintree
|
|
|
6
6
|
attr_reader :blik_aliases
|
|
7
7
|
attr_reader :capture_id
|
|
8
8
|
attr_reader :custom_field
|
|
9
|
+
# NEXT_MAJOR_VERSION Remove this attribute
|
|
10
|
+
# DEPRECATED debug_id is deprecated and will be removed in a future version
|
|
9
11
|
attr_reader :debug_id
|
|
10
12
|
attr_reader :description
|
|
11
13
|
attr_reader :funding_source
|
|
@@ -7,6 +7,8 @@ module Braintree
|
|
|
7
7
|
attr_reader :billing_agreement_id
|
|
8
8
|
attr_reader :capture_id
|
|
9
9
|
attr_reader :custom_field
|
|
10
|
+
# NEXT_MAJOR_VERSION Remove this attribute
|
|
11
|
+
# DEPRECATED debug_id is deprecated and will be removed in a future version
|
|
10
12
|
attr_reader :debug_id
|
|
11
13
|
attr_reader :description
|
|
12
14
|
attr_reader :image_url
|
|
@@ -5,6 +5,8 @@ module Braintree
|
|
|
5
5
|
|
|
6
6
|
attr_reader :bank_reference_token
|
|
7
7
|
attr_reader :capture_id
|
|
8
|
+
# NEXT_MAJOR_VERSION Remove this attribute
|
|
9
|
+
# DEPRECATED debug_id is deprecated and will be removed in a future version
|
|
8
10
|
attr_reader :debug_id
|
|
9
11
|
attr_reader :global_id
|
|
10
12
|
attr_reader :last_4
|
|
@@ -291,6 +291,7 @@ module Braintree
|
|
|
291
291
|
{
|
|
292
292
|
:sender => [
|
|
293
293
|
:account_reference_number,
|
|
294
|
+
:account_reference_number_type,
|
|
294
295
|
:date_of_birth,
|
|
295
296
|
:first_name,
|
|
296
297
|
:last_name,
|
|
@@ -302,6 +303,7 @@ module Braintree
|
|
|
302
303
|
{
|
|
303
304
|
:receiver => [
|
|
304
305
|
:account_reference_number,
|
|
306
|
+
:account_reference_number_type,
|
|
305
307
|
:first_name,
|
|
306
308
|
:last_name,
|
|
307
309
|
:middle_name,
|
|
@@ -344,6 +346,8 @@ module Braintree
|
|
|
344
346
|
:tax_amount,
|
|
345
347
|
:tax_exempt,
|
|
346
348
|
:discount_amount,
|
|
349
|
+
{:shipping => AddressGateway._shared_signature},
|
|
350
|
+
:shipping_address_id,
|
|
347
351
|
:shipping_amount,
|
|
348
352
|
:shipping_tax_amount,
|
|
349
353
|
:ships_from_postal_code,
|
data/lib/braintree/version.rb
CHANGED
|
@@ -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,
|
|
@@ -16,6 +16,8 @@ describe Braintree::Transaction do
|
|
|
16
16
|
:transfer => {
|
|
17
17
|
:type => "wallet_transfer",
|
|
18
18
|
:receiver => {
|
|
19
|
+
:account_reference_number => "test123",
|
|
20
|
+
:account_reference_number_type => "SOCIAL_NETWORK_PROFILE_ID",
|
|
19
21
|
:first_name => "John",
|
|
20
22
|
:last_name => "Smith",
|
|
21
23
|
:middle_name => "D",
|
|
@@ -27,7 +29,8 @@ describe Braintree::Transaction do
|
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
:sender => {
|
|
30
|
-
:account_reference_number => "
|
|
32
|
+
:account_reference_number => "test@example.com",
|
|
33
|
+
:account_reference_number_type => "EMAIL_ADDRESS",
|
|
31
34
|
:date_of_birth => Date.new(2002, 1, 2),
|
|
32
35
|
:first_name => "Lisa",
|
|
33
36
|
:last_name => "Ray",
|
|
@@ -48,6 +51,73 @@ describe Braintree::Transaction do
|
|
|
48
51
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
|
49
52
|
end
|
|
50
53
|
|
|
54
|
+
it "should fail on transaction with invalid sender account reference number type" do
|
|
55
|
+
transaction_params = {
|
|
56
|
+
:type => "sale",
|
|
57
|
+
:amount => "100.00",
|
|
58
|
+
:merchant_account_id => "aft_first_data_wallet_transfer",
|
|
59
|
+
:credit_card => {
|
|
60
|
+
:number => "4111111111111111",
|
|
61
|
+
:expiration_date => "06/2026",
|
|
62
|
+
:cvv => "123"
|
|
63
|
+
},
|
|
64
|
+
:transfer => {
|
|
65
|
+
:type => "wallet_transfer",
|
|
66
|
+
:sender => {
|
|
67
|
+
:account_reference_number => "test@example.com",
|
|
68
|
+
:account_reference_number_type => "INVALID_ACCOUNT_REFERENCE_NUMBER_TYPE",
|
|
69
|
+
:date_of_birth => Date.new(2002, 1, 2),
|
|
70
|
+
:first_name => "Lisa",
|
|
71
|
+
:last_name => "Ray",
|
|
72
|
+
:middle_name => "D",
|
|
73
|
+
:address => {
|
|
74
|
+
:country_code_alpha2 => "US",
|
|
75
|
+
:locality => "LA",
|
|
76
|
+
:region => "CA",
|
|
77
|
+
:street_address => "12th Main"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
result = Braintree::Transaction.sale(transaction_params)
|
|
84
|
+
expect(result.success?).to eq(false)
|
|
85
|
+
expect(result.errors.for(:account_funding_transaction).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionTransferSenderAccountReferenceNumberTypeIsInvalid)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should fail on transaction with invalid receiver account reference number type" do
|
|
89
|
+
transaction_params = {
|
|
90
|
+
:type => "sale",
|
|
91
|
+
:amount => "100.00",
|
|
92
|
+
:merchant_account_id => "aft_first_data_wallet_transfer",
|
|
93
|
+
:credit_card => {
|
|
94
|
+
:number => "4111111111111111",
|
|
95
|
+
:expiration_date => "06/2026",
|
|
96
|
+
:cvv => "123"
|
|
97
|
+
},
|
|
98
|
+
:transfer => {
|
|
99
|
+
:type => "wallet_transfer",
|
|
100
|
+
:receiver => {
|
|
101
|
+
:account_reference_number => "test@example.com",
|
|
102
|
+
:account_reference_number_type => "INVALID_ACCOUNT_REFERENCE_NUMBER_TYPE",
|
|
103
|
+
:first_name => "Lisa",
|
|
104
|
+
:last_name => "Ray",
|
|
105
|
+
:middle_name => "D",
|
|
106
|
+
:address => {
|
|
107
|
+
:country_code_alpha2 => "US",
|
|
108
|
+
:locality => "LA",
|
|
109
|
+
:region => "CA",
|
|
110
|
+
:street_address => "12th Main"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
result = Braintree::Transaction.sale(transaction_params)
|
|
117
|
+
expect(result.success?).to eq(false)
|
|
118
|
+
expect(result.errors.for(:account_funding_transaction).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionTransferReceiverAccountReferenceNumberTypeIsInvalid)
|
|
119
|
+
end
|
|
120
|
+
|
|
51
121
|
it "should fail on transaction with non brazil merchant" do
|
|
52
122
|
transaction_params = {
|
|
53
123
|
:type => "sale",
|
|
@@ -135,6 +135,7 @@ describe Braintree::TransactionGateway do
|
|
|
135
135
|
:type,
|
|
136
136
|
{:sender => [
|
|
137
137
|
:account_reference_number,
|
|
138
|
+
:account_reference_number_type,
|
|
138
139
|
:date_of_birth,
|
|
139
140
|
:first_name,
|
|
140
141
|
:last_name,
|
|
@@ -144,6 +145,7 @@ describe Braintree::TransactionGateway do
|
|
|
144
145
|
]},
|
|
145
146
|
{:receiver => [
|
|
146
147
|
:account_reference_number,
|
|
148
|
+
:account_reference_number_type,
|
|
147
149
|
:first_name,
|
|
148
150
|
:last_name,
|
|
149
151
|
:middle_name,
|
|
@@ -185,6 +187,8 @@ describe Braintree::TransactionGateway do
|
|
|
185
187
|
:tax_amount,
|
|
186
188
|
:tax_exempt,
|
|
187
189
|
:discount_amount,
|
|
190
|
+
{:shipping => Braintree::AddressGateway._shared_signature},
|
|
191
|
+
:shipping_address_id,
|
|
188
192
|
:shipping_amount,
|
|
189
193
|
:shipping_tax_amount,
|
|
190
194
|
: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
|
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.39.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-
|
|
11
|
+
date: 2026-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -437,7 +437,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
437
437
|
- !ruby/object:Gem::Version
|
|
438
438
|
version: '0'
|
|
439
439
|
requirements: []
|
|
440
|
-
rubygems_version: 3.
|
|
440
|
+
rubygems_version: 3.3.15
|
|
441
441
|
signing_key:
|
|
442
442
|
specification_version: 4
|
|
443
443
|
summary: Braintree Ruby Server SDK
|