braintree 4.12.0 → 4.13.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/apple_pay_card.rb +2 -0
- data/lib/braintree/test/nonce.rb +1 -0
- data/lib/braintree/transaction/apple_pay_details.rb +12 -10
- data/lib/braintree/transaction.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +17 -1
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/payment_method_spec.rb +61 -0
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +0 -163
- data/spec/integration/braintree/transaction_spec.rb +385 -172
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +0 -242
- data/spec/unit/braintree/apple_pay_card_spec.rb +9 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +2 -1
- data/spec/unit/braintree/transaction_spec.rb +11 -0
- metadata +3 -3
@@ -10,126 +10,6 @@ describe Braintree::Transaction do
|
|
10
10
|
Braintree::Configuration.private_key = "integration2_private_key"
|
11
11
|
end
|
12
12
|
|
13
|
-
context "plaid-verified" do
|
14
|
-
let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
|
15
|
-
|
16
|
-
context "nonce" do
|
17
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
18
|
-
xit "sale succeeds" do
|
19
|
-
result = Braintree::Transaction.create(
|
20
|
-
:type => "sale",
|
21
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
22
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
23
|
-
:payment_method_nonce => plaid_nonce,
|
24
|
-
:options => {
|
25
|
-
:submit_for_settlement => true,
|
26
|
-
},
|
27
|
-
)
|
28
|
-
result.success?.should == true
|
29
|
-
result.transaction.id.should =~ /^\w{6,}$/
|
30
|
-
result.transaction.type.should == "sale"
|
31
|
-
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
|
32
|
-
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
33
|
-
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
34
|
-
result.transaction.us_bank_account_details.routing_number.should == "011000015"
|
35
|
-
result.transaction.us_bank_account_details.last_4.should == "0000"
|
36
|
-
result.transaction.us_bank_account_details.account_type.should == "checking"
|
37
|
-
result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
38
|
-
result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
39
|
-
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
40
|
-
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
context "token" do
|
45
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
46
|
-
xit "payment_method#create then sale succeeds" do
|
47
|
-
payment_method = Braintree::PaymentMethod.create(
|
48
|
-
:payment_method_nonce => plaid_nonce,
|
49
|
-
:customer_id => Braintree::Customer.create.customer.id,
|
50
|
-
:options => {
|
51
|
-
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
52
|
-
},
|
53
|
-
).payment_method
|
54
|
-
|
55
|
-
payment_method.verifications.count.should == 1
|
56
|
-
payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
57
|
-
payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
|
58
|
-
payment_method.verifications.first.id.should_not be_empty
|
59
|
-
payment_method.verifications.first.verification_determined_at.should be_a Time
|
60
|
-
payment_method.verified.should == true
|
61
|
-
|
62
|
-
result = Braintree::Transaction.create(
|
63
|
-
:type => "sale",
|
64
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
65
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
66
|
-
:payment_method_token => payment_method.token,
|
67
|
-
:options => {
|
68
|
-
:submit_for_settlement => true,
|
69
|
-
},
|
70
|
-
)
|
71
|
-
|
72
|
-
result.success?.should == true
|
73
|
-
|
74
|
-
transaction = result.transaction
|
75
|
-
|
76
|
-
transaction.id.should =~ /^\w{6,}$/
|
77
|
-
transaction.type.should == "sale"
|
78
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
79
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
80
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
81
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
82
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
83
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
84
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
85
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
86
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
87
|
-
end
|
88
|
-
|
89
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
90
|
-
xit "transaction#create store_in_vault then sale succeeds" do
|
91
|
-
result = Braintree::Transaction.create(
|
92
|
-
:type => "sale",
|
93
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
94
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
95
|
-
:payment_method_nonce => plaid_nonce,
|
96
|
-
:options => {
|
97
|
-
:submit_for_settlement => true,
|
98
|
-
:store_in_vault => true,
|
99
|
-
},
|
100
|
-
)
|
101
|
-
|
102
|
-
result.success?.should == true
|
103
|
-
|
104
|
-
result = Braintree::Transaction.create(
|
105
|
-
:type => "sale",
|
106
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
107
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
108
|
-
:payment_method_token => result.transaction.us_bank_account_details.token,
|
109
|
-
:options => {
|
110
|
-
:submit_for_settlement => true,
|
111
|
-
},
|
112
|
-
)
|
113
|
-
|
114
|
-
result.success?.should == true
|
115
|
-
|
116
|
-
transaction = result.transaction
|
117
|
-
|
118
|
-
transaction.id.should =~ /^\w{6,}$/
|
119
|
-
transaction.type.should == "sale"
|
120
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
121
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
122
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
123
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
124
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
125
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
126
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
127
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
128
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
129
|
-
end
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
13
|
context "not plaid-verified" do
|
134
14
|
let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
|
135
15
|
let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
|
@@ -232,128 +112,6 @@ describe Braintree::Transaction do
|
|
232
112
|
Braintree::Configuration.private_key = "integration_private_key"
|
233
113
|
end
|
234
114
|
|
235
|
-
context "plaid-verified" do
|
236
|
-
let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
|
237
|
-
|
238
|
-
context "nonce" do
|
239
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
240
|
-
xit "sale succeeds" do
|
241
|
-
result = Braintree::Transaction.create(
|
242
|
-
:type => "sale",
|
243
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
244
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
245
|
-
:payment_method_nonce => plaid_nonce,
|
246
|
-
:options => {
|
247
|
-
:submit_for_settlement => true,
|
248
|
-
},
|
249
|
-
)
|
250
|
-
result.success?.should == true
|
251
|
-
result.transaction.id.should =~ /^\w{6,}$/
|
252
|
-
result.transaction.type.should == "sale"
|
253
|
-
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
|
254
|
-
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
255
|
-
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
256
|
-
result.transaction.us_bank_account_details.routing_number.should == "011000015"
|
257
|
-
result.transaction.us_bank_account_details.last_4.should == "0000"
|
258
|
-
result.transaction.us_bank_account_details.account_type.should == "checking"
|
259
|
-
result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
260
|
-
result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
261
|
-
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
262
|
-
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
263
|
-
end
|
264
|
-
end
|
265
|
-
|
266
|
-
context "token" do
|
267
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
268
|
-
xit "payment_method#create then sale succeeds" do
|
269
|
-
result = Braintree::PaymentMethod.create(
|
270
|
-
:payment_method_nonce => plaid_nonce,
|
271
|
-
:customer_id => Braintree::Customer.create.customer.id,
|
272
|
-
:options => {
|
273
|
-
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
274
|
-
},
|
275
|
-
)
|
276
|
-
|
277
|
-
payment_method = result.payment_method
|
278
|
-
|
279
|
-
payment_method.verifications.count.should == 1
|
280
|
-
payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
281
|
-
payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
|
282
|
-
payment_method.verifications.first.id.should_not be_empty
|
283
|
-
payment_method.verifications.first.verification_determined_at.should be_a Time
|
284
|
-
payment_method.verified.should == true
|
285
|
-
|
286
|
-
result = Braintree::Transaction.create(
|
287
|
-
:type => "sale",
|
288
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
289
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
290
|
-
:payment_method_token => payment_method.token,
|
291
|
-
:options => {
|
292
|
-
:submit_for_settlement => true,
|
293
|
-
},
|
294
|
-
)
|
295
|
-
|
296
|
-
result.success?.should == true
|
297
|
-
|
298
|
-
transaction = result.transaction
|
299
|
-
|
300
|
-
transaction.id.should =~ /^\w{6,}$/
|
301
|
-
transaction.type.should == "sale"
|
302
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
303
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
304
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
305
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
306
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
307
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
308
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
309
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
310
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
311
|
-
end
|
312
|
-
|
313
|
-
# we are temporarily skipping this test until we have a more stable CI env
|
314
|
-
xit "transaction#create store_in_vault then sale succeeds" do
|
315
|
-
result = Braintree::Transaction.create(
|
316
|
-
:type => "sale",
|
317
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
318
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
319
|
-
:payment_method_nonce => plaid_nonce,
|
320
|
-
:options => {
|
321
|
-
:submit_for_settlement => true,
|
322
|
-
:store_in_vault => true,
|
323
|
-
},
|
324
|
-
)
|
325
|
-
|
326
|
-
result.success?.should == true
|
327
|
-
|
328
|
-
result = Braintree::Transaction.create(
|
329
|
-
:type => "sale",
|
330
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
331
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
332
|
-
:payment_method_token => result.transaction.us_bank_account_details.token,
|
333
|
-
:options => {
|
334
|
-
:submit_for_settlement => true,
|
335
|
-
},
|
336
|
-
)
|
337
|
-
|
338
|
-
result.success?.should == true
|
339
|
-
|
340
|
-
transaction = result.transaction
|
341
|
-
|
342
|
-
transaction.id.should =~ /^\w{6,}$/
|
343
|
-
transaction.type.should == "sale"
|
344
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
345
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
346
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
347
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
348
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
349
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
350
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
351
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
352
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
353
|
-
end
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
115
|
context "not plaid-verified" do
|
358
116
|
let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
|
359
117
|
let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
|
@@ -35,10 +35,12 @@ describe Braintree::ApplePayCard do
|
|
35
35
|
:image_url => nil,
|
36
36
|
:issuing_bank => "Big Bad Bank",
|
37
37
|
:last_4 => "9876",
|
38
|
+
:merchant_token_identifier => "merchant-token-123",
|
38
39
|
:payment_instrument_name => nil,
|
39
40
|
:payroll => "No",
|
40
41
|
:prepaid => "No",
|
41
42
|
:product_id => "MAC",
|
43
|
+
:source_card_last4 => "1234",
|
42
44
|
:source_description => "blah",
|
43
45
|
:subscriptions => [
|
44
46
|
{
|
@@ -81,6 +83,13 @@ describe Braintree::ApplePayCard do
|
|
81
83
|
|
82
84
|
expect(card.subscriptions).to be_empty
|
83
85
|
end
|
86
|
+
|
87
|
+
it "handles mpan attributes" do
|
88
|
+
card = Braintree::ApplePayCard._new(:gateway, attributes)
|
89
|
+
|
90
|
+
expect(card.merchant_token_identifier).to_not be_nil
|
91
|
+
expect(card.source_card_last4).to_not be_nil
|
92
|
+
end
|
84
93
|
end
|
85
94
|
|
86
95
|
describe "default?" do
|
@@ -74,6 +74,7 @@ describe Braintree::TransactionGateway do
|
|
74
74
|
:skip_avs,
|
75
75
|
:skip_cvv,
|
76
76
|
{:paypal => [:custom_field, :payee_id, :payee_email, :description, {:supplementary_data => :_any_key_}]},
|
77
|
+
{:processing_overrides => [:customer_email, :customer_first_name, :customer_last_name, :customer_tax_identifier]},
|
77
78
|
{:three_d_secure => [:required]},
|
78
79
|
{:amex_rewards => [:request_id, :points, :currency_amount, :currency_iso_code]},
|
79
80
|
{:venmo => [:profile_id]},
|
@@ -92,7 +93,7 @@ describe Braintree::TransactionGateway do
|
|
92
93
|
{:data => [
|
93
94
|
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
94
95
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
95
|
-
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone,
|
96
|
+
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
96
97
|
{:legs => [
|
97
98
|
:conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
|
98
99
|
:arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
|
@@ -246,6 +246,17 @@ describe Braintree::Transaction do
|
|
246
246
|
transaction.authorization_adjustments[1].processor_response_text.should == "Processor Network Unavailable - Try Again"
|
247
247
|
end
|
248
248
|
|
249
|
+
it "accepts retry_ids and retried_transaction_id attributes in a transactions" do
|
250
|
+
transaction = Braintree::Transaction._new(
|
251
|
+
:gateway,
|
252
|
+
:retry_ids => ["retry_id_1"],
|
253
|
+
:retried_transaction_id => "original_retried_tranction_id",
|
254
|
+
)
|
255
|
+
transaction.retry_ids.count.should == 1
|
256
|
+
transaction.retry_ids[0].should == "retry_id_1"
|
257
|
+
transaction.retried_transaction_id.should == "original_retried_tranction_id"
|
258
|
+
end
|
259
|
+
|
249
260
|
it "handles receiving custom as an empty string" do
|
250
261
|
transaction = Braintree::Transaction._new(
|
251
262
|
:gateway,
|
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.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|
@@ -364,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
364
364
|
- !ruby/object:Gem::Version
|
365
365
|
version: '0'
|
366
366
|
requirements: []
|
367
|
-
rubygems_version: 3.
|
367
|
+
rubygems_version: 3.2.5
|
368
368
|
signing_key:
|
369
369
|
specification_version: 4
|
370
370
|
summary: Braintree Ruby Server SDK
|