braintree 4.29.0 → 4.31.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/address_gateway.rb +5 -0
  3. data/lib/braintree/apple_pay_card.rb +1 -0
  4. data/lib/braintree/bank_account_instant_verification_gateway.rb +38 -0
  5. data/lib/braintree/bank_account_instant_verification_jwt.rb +23 -0
  6. data/lib/braintree/bank_account_instant_verification_jwt_request.rb +21 -0
  7. data/lib/braintree/dispute.rb +1 -0
  8. data/lib/braintree/error_codes.rb +2 -0
  9. data/lib/braintree/gateway.rb +4 -0
  10. data/lib/braintree/payment_method_gateway.rb +6 -0
  11. data/lib/braintree/successful_result.rb +1 -0
  12. data/lib/braintree/transaction/apple_pay_details.rb +1 -0
  13. data/lib/braintree/transaction.rb +3 -0
  14. data/lib/braintree/transaction_gateway.rb +29 -0
  15. data/lib/braintree/us_bank_account_verification.rb +3 -1
  16. data/lib/braintree/version.rb +1 -1
  17. data/lib/braintree/webhook_notification.rb +1 -0
  18. data/lib/braintree/webhook_testing_gateway.rb +16 -0
  19. data/lib/braintree.rb +3 -0
  20. data/spec/integration/braintree/bank_account_instant_verification_spec.rb +191 -0
  21. data/spec/integration/braintree/client_api/spec_helper.rb +81 -0
  22. data/spec/integration/braintree/dispute_spec.rb +13 -2
  23. data/spec/integration/braintree/payment_method_spec.rb +3 -0
  24. data/spec/integration/braintree/transaction_search_spec.rb +26 -24
  25. data/spec/integration/braintree/transaction_spec.rb +43 -3
  26. data/spec/integration/braintree/transaction_transfer_type_spec.rb +301 -0
  27. data/spec/spec_helper.rb +7 -0
  28. data/spec/unit/braintree/apple_pay_card_spec.rb +2 -0
  29. data/spec/unit/braintree/bank_account_instant_verification_gateway_spec.rb +98 -0
  30. data/spec/unit/braintree/bank_account_instant_verification_jwt_request_spec.rb +71 -0
  31. data/spec/unit/braintree/dispute_spec.rb +6 -0
  32. data/spec/unit/braintree/transaction_ach_mandate_spec.rb +82 -0
  33. data/spec/unit/braintree/transaction_gateway_spec.rb +25 -0
  34. data/spec/unit/braintree/transaction_spec.rb +18 -0
  35. data/spec/unit/braintree/webhook_notification_spec.rb +17 -0
  36. metadata +11 -4
  37. data/lib/ssl/securetrust_ca.crt +0 -44
@@ -0,0 +1,82 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+
3
+ describe "Transaction ACH Mandate" do
4
+ describe "transaction request handling" do
5
+ let(:gateway) { Braintree::Gateway.new(:environment => :sandbox, :merchant_id => "test", :public_key => "test", :private_key => "test") }
6
+ let(:transaction_gateway) { gateway.transaction }
7
+
8
+ it "processes us_bank_account ACH mandate fields" do
9
+ mandate_time = Time.now
10
+
11
+ # Mock the HTTP response for transaction creation
12
+ allow(gateway.config.http).to receive(:post).and_return({
13
+ :transaction => {
14
+ :id => "test_transaction_id",
15
+ :amount => "100.00",
16
+ :status => "authorized",
17
+ :us_bank_account => {
18
+ :token => "test_token",
19
+ :ach_mandate => {
20
+ :text => "I authorize this ACH debit",
21
+ :accepted_at => mandate_time.iso8601
22
+ }
23
+ }
24
+ }
25
+ })
26
+
27
+ transaction_attributes = {
28
+ :amount => "100.00",
29
+ :payment_method_token => "test_token",
30
+ :us_bank_account => {
31
+ :ach_mandate_text => "I authorize this ACH debit",
32
+ :ach_mandate_accepted_at => mandate_time
33
+ }
34
+ }
35
+
36
+ # This should not raise an error due to signature validation
37
+ expect {
38
+ Braintree::Util.verify_keys(Braintree::TransactionGateway._create_signature, transaction_attributes)
39
+ }.not_to raise_error
40
+ end
41
+
42
+ it "allows ACH mandate text only" do
43
+ transaction_attributes = {
44
+ :amount => "50.00",
45
+ :payment_method_token => "test_token",
46
+ :us_bank_account => {
47
+ :ach_mandate_text => "I authorize this ACH debit"
48
+ }
49
+ }
50
+
51
+ expect {
52
+ Braintree::Util.verify_keys(Braintree::TransactionGateway._create_signature, transaction_attributes)
53
+ }.not_to raise_error
54
+ end
55
+
56
+ it "allows ACH mandate accepted_at only" do
57
+ transaction_attributes = {
58
+ :amount => "50.00",
59
+ :payment_method_token => "test_token",
60
+ :us_bank_account => {
61
+ :ach_mandate_accepted_at => Time.now
62
+ }
63
+ }
64
+
65
+ expect {
66
+ Braintree::Util.verify_keys(Braintree::TransactionGateway._create_signature, transaction_attributes)
67
+ }.not_to raise_error
68
+ end
69
+
70
+ it "allows empty us_bank_account hash" do
71
+ transaction_attributes = {
72
+ :amount => "50.00",
73
+ :payment_method_token => "test_token",
74
+ :us_bank_account => {}
75
+ }
76
+
77
+ expect {
78
+ Braintree::Util.verify_keys(Braintree::TransactionGateway._create_signature, transaction_attributes)
79
+ }.not_to raise_error
80
+ end
81
+ end
82
+ end
@@ -129,6 +129,31 @@ describe Braintree::TransactionGateway do
129
129
  :ds_transaction_id,
130
130
  ]
131
131
  },
132
+ {
133
+ :transfer => [
134
+ :type,
135
+ {:sender => [
136
+ :first_name,
137
+ :last_name,
138
+ :account_reference_number,
139
+ :tax_id,
140
+ :address => Braintree::AddressGateway._address_attributes
141
+ ]},
142
+ {:receiver => [
143
+ :first_name,
144
+ :last_name,
145
+ :account_reference_number,
146
+ :tax_id,
147
+ :address => Braintree::AddressGateway._address_attributes
148
+ ]},
149
+ ]
150
+ },
151
+ {
152
+ :us_bank_account => [
153
+ :ach_mandate_text,
154
+ :ach_mandate_accepted_at,
155
+ ]
156
+ },
132
157
  ])
133
158
  end
134
159
 
@@ -267,6 +267,14 @@ describe Braintree::Transaction do
267
267
  expect(transaction.retried_transaction_id).to eq("original_retried_tranction_id")
268
268
  end
269
269
 
270
+ it "accepts upcoming_retry_date attribute in a transaction" do
271
+ transaction = Braintree::Transaction._new(
272
+ :gateway,
273
+ :upcoming_retry_date => "2024-12-25",
274
+ )
275
+ expect(transaction.upcoming_retry_date).to eq("2024-12-25")
276
+ end
277
+
270
278
  it "handles receiving custom as an empty string" do
271
279
  Braintree::Transaction._new(
272
280
  :gateway,
@@ -309,6 +317,16 @@ describe Braintree::Transaction do
309
317
  expect(transaction.ach_return_code).to eq("R01")
310
318
  end
311
319
 
320
+ it "accepts ach_reject_reason" do
321
+ transaction = Braintree::Transaction._new(
322
+ :gateway,
323
+ :ach_return_code => "RJCT",
324
+ :ach_reject_reason => "some reject reason",
325
+ )
326
+ expect(transaction.ach_return_code).to eq("RJCT")
327
+ expect(transaction.ach_reject_reason).to eq("some reject reason")
328
+ end
329
+
312
330
  it "accepts network_response code and network_response_text" do
313
331
  transaction = Braintree::Transaction._new(
314
332
  :gateway,
@@ -330,6 +330,23 @@ describe Braintree::WebhookNotification do
330
330
  end
331
331
  end
332
332
 
333
+ context "transaction retried" do
334
+ it "builds a sample notification for a transaction retried webhook" do
335
+ sample_notification = Braintree::WebhookTesting.sample_notification(
336
+ Braintree::WebhookNotification::Kind::TransactionRetried,
337
+ "my_id",
338
+ )
339
+
340
+ notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
341
+
342
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::TransactionRetried)
343
+ expect(notification.transaction.id).to eq("my_id")
344
+ expect(notification.transaction.amount).to eq(1_00)
345
+ expect(notification.transaction.status).to eq("submitted_for_settlement")
346
+ expect(notification.transaction.retried_transaction_id).to eq("original_txn_id")
347
+ end
348
+ end
349
+
333
350
  context "transaction review" do
334
351
  it " builds a sample notification for a transaction reviewed webhook" do
335
352
  sample_notification = Braintree::WebhookTesting.sample_notification(
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.29.0
4
+ version: 4.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-26 00:00:00.000000000 Z
11
+ date: 2025-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -61,6 +61,9 @@ files:
61
61
  - lib/braintree/apple_pay_gateway.rb
62
62
  - lib/braintree/apple_pay_options.rb
63
63
  - lib/braintree/authorization_adjustment.rb
64
+ - lib/braintree/bank_account_instant_verification_gateway.rb
65
+ - lib/braintree/bank_account_instant_verification_jwt.rb
66
+ - lib/braintree/bank_account_instant_verification_jwt_request.rb
64
67
  - lib/braintree/base_module.rb
65
68
  - lib/braintree/bin_data.rb
66
69
  - lib/braintree/client_token.rb
@@ -237,7 +240,6 @@ files:
237
240
  - lib/braintree/xml/parser.rb
238
241
  - lib/braintree/xml/rexml.rb
239
242
  - lib/ssl/api_braintreegateway_com.ca.crt
240
- - lib/ssl/securetrust_ca.crt
241
243
  - spec/fixtures/files/bt_logo.png
242
244
  - spec/fixtures/files/gif_extension_bt_logo.gif
243
245
  - spec/fixtures/files/malformed_pdf.pdf
@@ -246,6 +248,7 @@ files:
246
248
  - spec/integration/braintree/address_spec.rb
247
249
  - spec/integration/braintree/advanced_search_spec.rb
248
250
  - spec/integration/braintree/apple_pay_spec.rb
251
+ - spec/integration/braintree/bank_account_instant_verification_spec.rb
249
252
  - spec/integration/braintree/braintree_gateway_spec.rb
250
253
  - spec/integration/braintree/client_api/client_token_spec.rb
251
254
  - spec/integration/braintree/client_api/spec_helper.rb
@@ -284,6 +287,7 @@ files:
284
287
  - spec/integration/braintree/transaction_payment_facilitator_spec.rb
285
288
  - spec/integration/braintree/transaction_search_spec.rb
286
289
  - spec/integration/braintree/transaction_spec.rb
290
+ - spec/integration/braintree/transaction_transfer_type_spec.rb
287
291
  - spec/integration/braintree/transaction_us_bank_account_spec.rb
288
292
  - spec/integration/braintree/us_bank_account_spec.rb
289
293
  - spec/integration/braintree/us_bank_account_verification_search_spec.rb
@@ -299,6 +303,8 @@ files:
299
303
  - spec/ssl/privateKey.key
300
304
  - spec/unit/braintree/address_spec.rb
301
305
  - spec/unit/braintree/apple_pay_card_spec.rb
306
+ - spec/unit/braintree/bank_account_instant_verification_gateway_spec.rb
307
+ - spec/unit/braintree/bank_account_instant_verification_jwt_request_spec.rb
302
308
  - spec/unit/braintree/base_module_spec.rb
303
309
  - spec/unit/braintree/client_token_spec.rb
304
310
  - spec/unit/braintree/configuration_spec.rb
@@ -370,6 +376,7 @@ files:
370
376
  - spec/unit/braintree/transaction/paypal_details_spec.rb
371
377
  - spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb
372
378
  - spec/unit/braintree/transaction/visa_checkout_card_details_spec.rb
379
+ - spec/unit/braintree/transaction_ach_mandate_spec.rb
373
380
  - spec/unit/braintree/transaction_gateway_spec.rb
374
381
  - spec/unit/braintree/transaction_search_spec.rb
375
382
  - spec/unit/braintree/transaction_spec.rb
@@ -413,7 +420,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
420
  - !ruby/object:Gem::Version
414
421
  version: '0'
415
422
  requirements: []
416
- rubygems_version: 3.2.5
423
+ rubygems_version: 3.4.19
417
424
  signing_key:
418
425
  specification_version: 4
419
426
  summary: Braintree Ruby Server SDK
@@ -1,44 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBI
3
- MQswCQYDVQQGEwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24x
4
- FzAVBgNVBAMTDlNlY3VyZVRydXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIz
5
- MTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAeBgNVBAoTF1NlY3VyZVRydXN0IENv
6
- cnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCCASIwDQYJKoZIhvcN
7
- AQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQXOZEz
8
- Zum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO
9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