braintree 4.28.0 → 4.30.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: f1eb371a013154345b87d1581d335e2e164844b06cfbc720574cc68819d8839f
4
- data.tar.gz: ec7325707abf2ad90b2d17ca390ece11adead95ba1f2e8cd4fb42e78470a225b
3
+ metadata.gz: 2e98c0f65f8fc26db02c0f16cbe7b86e28aa7fbf6829ec4acf23c44db5159cff
4
+ data.tar.gz: e954ce7e083b2e1ea24c7cdd06acdcec52fc90238426bfca8ca7756200514677
5
5
  SHA512:
6
- metadata.gz: 76fb4902a1ace12c7b7730bd911296143b941de6b8d0a5cc018f1dba3ecb35c1090b00a3d0387e85cf0a54938d578fb2c29b2cf9c06674556d4509572cb24636
7
- data.tar.gz: 404445aad78f100dcec0ece96b1d0e7f7f6103afc869333b23d6754bac28ef70f367ef0b1580f7716a4388f2f36129bcc4dcf3c4c547d70f83da5d6e5ad90b75
6
+ metadata.gz: acc8c82a96904ca3dd89d3719d020756540af5f7bfdc1d56340a4b382ba1b6640732bb7f4eefd0073378fa4ed1c5dbb16a44fce9fcf4ed67146bffc0acd47314
7
+ data.tar.gz: 755c3a07a8469e6ee09f189b8d0ab60bdbb11c324fea726cd0af2bc86307b7213300c64a6d94ae9eff91d5fdf628295e4f42aec1bd2845ba4e5634c46c9d61ad
@@ -32,6 +32,7 @@ module Braintree
32
32
  attr_reader :reply_by_date
33
33
  attr_reader :status
34
34
  attr_reader :status_history
35
+ attr_reader :remaining_file_evidence_storage
35
36
  attr_reader :transaction
36
37
  attr_reader :transaction_details
37
38
  attr_reader :updated_at
@@ -7,16 +7,18 @@ module Braintree
7
7
  include BaseModule
8
8
 
9
9
  attr_reader :attrs
10
+ attr_reader :session_id
10
11
  attr_reader :is_in_paypal_network
11
12
  attr_reader :recommendations
12
13
 
13
14
  def initialize(attributes)
14
- @attrs = [:is_in_paypal_network, :recommendations]
15
+ @attrs = [:session_id, :is_in_paypal_network, :recommendations]
15
16
 
16
17
  if attributes.key?(:response)
17
18
  response = attributes[:response]
18
19
  # Constructor for response map
19
20
  begin
21
+ @session_id = _get_value(response, "generateCustomerRecommendations.sessionId")
20
22
  @is_in_paypal_network = _get_value(response, "generateCustomerRecommendations.isInPayPalNetwork")
21
23
  @recommendations = _extract_recommendations(response)
22
24
  rescue => e
@@ -24,6 +26,7 @@ module Braintree
24
26
  raise
25
27
  end
26
28
  else
29
+ @session_id = attributes[:session_id]
27
30
  @is_in_paypal_network = attributes[:is_in_paypal_network]
28
31
  @recommendations = attributes[:recommendations]
29
32
  end
@@ -82,6 +82,7 @@ module Braintree
82
82
  end
83
83
  end
84
84
 
85
+ attr_reader :account_funding_transaction
85
86
  attr_reader :ach_return_code
86
87
  attr_reader :ach_return_responses
87
88
  attr_reader :acquirer_reference_number
@@ -171,6 +172,7 @@ module Braintree
171
172
  attr_reader :tax_exempt
172
173
  attr_reader :three_d_secure_info
173
174
  attr_reader :type
175
+ attr_reader :upcoming_retry_date
174
176
  attr_reader :updated_at
175
177
  attr_reader :us_bank_account_details
176
178
  attr_reader :venmo_account_details
@@ -280,6 +280,11 @@ module Braintree
280
280
  :ds_transaction_id,
281
281
  ]
282
282
  },
283
+ {
284
+ :transfer => [
285
+ :type,
286
+ ]
287
+ },
283
288
  ]
284
289
  end
285
290
 
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 28
4
+ Minor = 30
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -57,6 +57,7 @@ module Braintree
57
57
  SubscriptionWentPastDue = "subscription_went_past_due"
58
58
 
59
59
  TransactionDisbursed = "transaction_disbursed"
60
+ TransactionRetried = "transaction_retried"
60
61
  TransactionReviewed = "transaction_reviewed"
61
62
  TransactionSettlementDeclined = "transaction_settlement_declined"
62
63
  TransactionSettled = "transaction_settled"
@@ -60,6 +60,8 @@ module Braintree
60
60
  _oauth_access_revoked_sample_xml(id)
61
61
  when Braintree::WebhookNotification::Kind::TransactionDisbursed
62
62
  _transaction_disbursed_sample_xml(id)
63
+ when Braintree::WebhookNotification::Kind::TransactionRetried
64
+ _transaction_retried_sample_xml(id)
63
65
  when Braintree::WebhookNotification::Kind::TransactionReviewed
64
66
  _transaction_reviewed_sample_xml(id)
65
67
  when Braintree::WebhookNotification::Kind::TransactionSettled
@@ -269,6 +271,20 @@ module Braintree
269
271
  XML
270
272
  end
271
273
 
274
+ def _transaction_retried_sample_xml(id)
275
+
276
+ <<-XML
277
+ <transaction>
278
+ <id>#{id}</id>
279
+ <amount>100</amount>
280
+ <status>submitted_for_settlement</status>
281
+ <type>sale</type>
282
+ <currency-iso-code>USD</currency-iso-code>
283
+ <retried-transaction-id>original_txn_id</retried-transaction-id>
284
+ </transaction>
285
+ XML
286
+ end
287
+
272
288
  def _transaction_reviewed_sample_xml(id)
273
289
 
274
290
  <<-XML
@@ -102,6 +102,7 @@ describe Braintree::CustomerSessionGateway do
102
102
 
103
103
  expect(result.success?).to eq(true)
104
104
  payload = result.customer_recommendations
105
+ expect(payload.session_id).to eq("94f0b2db-5323-4d86-add3-paypal000000")
105
106
  expect(payload.is_in_paypal_network).to eq(true)
106
107
 
107
108
  recommendation = payload.recommendations.payment_recommendations[0]
@@ -32,8 +32,8 @@ describe Braintree::Dispute do
32
32
 
33
33
  expect(result.success?).to eq(true)
34
34
 
35
- refreshed_dispute = Braintree::Dispute.find(dispute.id)
36
- expect(refreshed_dispute.status).to eq(Braintree::Dispute::Status::Accepted)
35
+ updated_dispute = Braintree::Dispute.find(dispute.id)
36
+ expect(updated_dispute.status).to eq(Braintree::Dispute::Status::Accepted)
37
37
 
38
38
  dispute_from_transaction = Braintree::Transaction.find(dispute.transaction.id).disputes[0]
39
39
  expect(dispute_from_transaction.status).to eq(Braintree::Dispute::Status::Accepted)
@@ -99,6 +99,17 @@ describe Braintree::Dispute do
99
99
  expect(result.evidence.category).to eq("GENERAL")
100
100
  expect(result.evidence.url).to include("bt_logo.png")
101
101
  end
102
+
103
+ it "reflects the updated remaining_file_evidence_storage" do
104
+ initial_storage = dispute.remaining_file_evidence_storage
105
+ expect(initial_storage).not_to be_nil
106
+
107
+ Braintree::Dispute.add_file_evidence(dispute.id, document_upload.id)
108
+
109
+ refreshed_dispute = Braintree::Dispute.find(dispute.id)
110
+ updated_storage = refreshed_dispute.remaining_file_evidence_storage
111
+ expect(updated_storage).to be < initial_storage
112
+ end
102
113
  end
103
114
 
104
115
  describe "self.add_text_evidence" do
@@ -183,10 +183,8 @@ describe Braintree::Transaction, "search" do
183
183
  collection = Braintree::Transaction.search do |search|
184
184
  search.reason_code.in reason_code
185
185
  end
186
-
187
- expect(collection.maximum_size).to eq(1)
188
- expect(collection.first.id).to eq(transaction_id)
189
- expect(collection.first.ach_return_responses.first[:reason_code]).to eq("R01")
186
+ item = collection.find { |t| t.id == transaction_id }
187
+ expect(item.ach_return_responses.first[:reason_code]).to eq("R01")
190
188
  end
191
189
 
192
190
  it "searches on reason_codes" do
@@ -196,7 +194,7 @@ describe Braintree::Transaction, "search" do
196
194
  search.reason_code.is reason_code
197
195
  end
198
196
 
199
- expect(collection.maximum_size).to eq(2)
197
+ expect(collection.maximum_size).to eq(4)
200
198
  end
201
199
 
202
200
  context "multiple value fields" do
@@ -590,17 +588,18 @@ describe Braintree::Transaction, "search" do
590
588
  expect(collection.first.id).to eq(transaction_id)
591
589
  end
592
590
 
593
- it "searches on reason_codes for 2 items" do
591
+ it "searches on reason_codes for 3 items" do
594
592
  reason_code = ["R01", "R02"]
595
593
 
596
594
  collection = Braintree::Transaction.search do |search|
597
595
  search.reason_code.in reason_code
598
596
  end
599
597
 
600
- expect(collection.maximum_size).to eq(2)
598
+ expect(collection.maximum_size).to eq(3)
601
599
  end
602
600
 
603
- it "searches on a reason_code" do
601
+ xit "searches on a reason_code" do
602
+ # duplicate test
604
603
  reason_code = ["R01"]
605
604
  transaction_id = "ach_txn_ret1"
606
605
 
@@ -855,7 +854,7 @@ describe Braintree::Transaction, "search" do
855
854
  search.ach_return_responses_created_at.between(DateTime.now - 1.0, DateTime.now + 1.0)
856
855
  end
857
856
 
858
- expect(date_search.maximum_size).to eq(2)
857
+ expect(date_search.maximum_size).to eq(4)
859
858
  end
860
859
 
861
860
  it "it does not find records not within date range of the custom field" do
@@ -1513,6 +1512,7 @@ describe Braintree::Transaction, "search" do
1513
1512
 
1514
1513
  collection = Braintree::Transaction.search do |search|
1515
1514
  search.payment_instrument_type.in ["MetaCheckout"]
1515
+ search.ids.in [meta_checkout_card_transaction.id, meta_checkout_token_transaction.id]
1516
1516
  end
1517
1517
 
1518
1518
  collection.maximum_size.should == 2
@@ -3368,13 +3368,13 @@ describe Braintree::Transaction do
3368
3368
  config = Braintree::Configuration.instantiate
3369
3369
  config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3370
3370
  result = Braintree::Transaction.refund(transaction.id, :amount => "2046.00")
3371
- expect(result.success?).to eq(false)
3371
+ expect(result.success?).to eq(true)
3372
3372
  expect(result.transaction.id).to match(/^\w{6,}$/)
3373
3373
  expect(result.transaction.type).to eq("credit")
3374
- expect(result.transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
3375
- expect(result.transaction.processor_response_code).to eq("2046")
3376
- expect(result.transaction.processor_response_text).to eq("Declined")
3377
- expect(result.transaction.processor_response_type).to eq(Braintree::ProcessorResponseTypes::SoftDeclined)
3374
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
3375
+ expect(result.transaction.processor_response_code).to eq("1005")
3376
+ expect(result.transaction.processor_response_text).to eq("Auth Declined but Settlement Captured")
3377
+ expect(result.transaction.processor_response_type).to eq(Braintree::ProcessorResponseTypes::Approved)
3378
3378
  expect(result.transaction.additional_processor_response).to eq("2046 : Declined")
3379
3379
  end
3380
3380
 
@@ -3388,15 +3388,15 @@ describe Braintree::Transaction do
3388
3388
  )
3389
3389
  config = Braintree::Configuration.instantiate
3390
3390
  config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3391
- result = Braintree::Transaction.refund(transaction.id, :amount => "2009.00")
3391
+ result = Braintree::Transaction.refund(transaction.id, :amount => "2004.00")
3392
3392
  expect(result.success?).to eq(false)
3393
3393
  expect(result.transaction.id).to match(/^\w{6,}$/)
3394
3394
  expect(result.transaction.type).to eq("credit")
3395
3395
  expect(result.transaction.status).to eq(Braintree::Transaction::Status::ProcessorDeclined)
3396
- expect(result.transaction.processor_response_code).to eq("2009")
3397
- expect(result.transaction.processor_response_text).to eq("No Such Issuer")
3396
+ expect(result.transaction.processor_response_code).to eq("2004")
3397
+ expect(result.transaction.processor_response_text).to eq("Expired Card")
3398
3398
  expect(result.transaction.processor_response_type).to eq(Braintree::ProcessorResponseTypes::HardDeclined)
3399
- expect(result.transaction.additional_processor_response).to eq("2009 : No Such Issuer")
3399
+ expect(result.transaction.additional_processor_response).to eq("2004 : Expired Card")
3400
3400
  end
3401
3401
  end
3402
3402
 
@@ -5888,7 +5888,8 @@ describe Braintree::Transaction do
5888
5888
  end
5889
5889
 
5890
5890
  context "Pinless debit transaction" do
5891
- it "succesfully submits for settlement" do
5891
+ xit "succesfully submits for settlement" do
5892
+ # Flaky test
5892
5893
  result = Braintree::Transaction.sale(
5893
5894
  :amount => Braintree::Test::TransactionAmounts::Authorize,
5894
5895
  :merchant_account_id => SpecHelper::PinlessDebitMerchantAccountId,
@@ -7754,4 +7755,13 @@ describe Braintree::Transaction do
7754
7755
  expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
7755
7756
  end
7756
7757
  end
7758
+
7759
+ describe "upcoming_retry_date" do
7760
+ it "returns the upcoming retry date for ACH transactions" do
7761
+ transaction = Braintree::Transaction.find("first_attempted_ach_transaction")
7762
+
7763
+ tomorrow = Date.today + 1
7764
+ expect(transaction.upcoming_retry_date).to eq(tomorrow.to_s)
7765
+ end
7766
+ end
7757
7767
  end
@@ -0,0 +1,46 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
3
+
4
+ describe Braintree::Transaction do
5
+ describe "self.transfer type" do
6
+ it "should create a transaction with valid transfer types and merchant account id" do
7
+ transaction_params = {
8
+ :type => "sale",
9
+ :amount => "100.00",
10
+ :merchant_account_id => "aft_first_data_wallet_transfer",
11
+ :credit_card => {
12
+ :number => "4111111111111111",
13
+ :expiration_date => "06/2026",
14
+ :cvv => "123"
15
+ },
16
+ :transfer => {
17
+ :type => "wallet_transfer",
18
+ },
19
+ }
20
+
21
+ result = Braintree::Transaction.sale(transaction_params)
22
+ expect(result.success?).to eq(true)
23
+ expect(result.transaction.account_funding_transaction).to eq(true)
24
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
25
+ end
26
+
27
+ it "should fail on transaction with non brazil merchant" do
28
+ transaction_params = {
29
+ :type => "sale",
30
+ :amount => "100.00",
31
+ :merchant_account_id => "aft_first_data_wallet_transfer",
32
+ :credit_card => {
33
+ :number => "4111111111111111",
34
+ :expiration_date => "06/2026",
35
+ :cvv => "123"
36
+ },
37
+ :transfer => {
38
+ :type => "invalid_transfer",
39
+ },
40
+ }
41
+
42
+ result = Braintree::Transaction.sale(transaction_params)
43
+ expect(result.success?).to eq(false)
44
+ end
45
+ end
46
+ end
@@ -113,6 +113,7 @@ describe Braintree::CustomerSessionGateway do
113
113
  result = customer_session_gateway.get_customer_recommendations(customer_recommendations_input)
114
114
  expect(result).to be_a(Braintree::SuccessfulResult)
115
115
  expect(result.customer_recommendations.is_in_paypal_network).to eq(true)
116
+ expect(result.customer_recommendations.session_id).to eq("session_id")
116
117
  expect(result.customer_recommendations.recommendations.payment_recommendations[0].payment_option).to eq("PAYPAL")
117
118
  expect(result.customer_recommendations.recommendations.payment_recommendations[0].recommended_priority).to eq(1)
118
119
  end
@@ -40,6 +40,7 @@ describe Braintree::Dispute do
40
40
  :timestamp => Time.utc(2009, 3, 9, 10, 50, 39),
41
41
  }
42
42
  ],
43
+ :remaining_file_evidence_storage => 341029,
43
44
  :transaction => {
44
45
  :amount => "31.00",
45
46
  :id => "open_disputed_transaction",
@@ -436,6 +437,11 @@ describe Braintree::Dispute do
436
437
 
437
438
  expect(dispute.pre_dispute_program).to eq(Braintree::Dispute::PreDisputeProgram::VisaRdr)
438
439
  end
440
+
441
+ it "checks that the remaining_file_evidence_storage field is set correctly" do
442
+ dispute = Braintree::Dispute._new(attributes)
443
+ dispute.remaining_file_evidence_storage.should == 341029
444
+ end
439
445
  end
440
446
 
441
447
  describe "==" do
@@ -129,6 +129,11 @@ describe Braintree::TransactionGateway do
129
129
  :ds_transaction_id,
130
130
  ]
131
131
  },
132
+ {
133
+ :transfer => [
134
+ :type,
135
+ ]
136
+ },
132
137
  ])
133
138
  end
134
139
 
@@ -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,
@@ -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.28.0
4
+ version: 4.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-05-28 00:00:00.000000000 Z
11
+ date: 2025-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
@@ -284,6 +284,7 @@ files:
284
284
  - spec/integration/braintree/transaction_payment_facilitator_spec.rb
285
285
  - spec/integration/braintree/transaction_search_spec.rb
286
286
  - spec/integration/braintree/transaction_spec.rb
287
+ - spec/integration/braintree/transaction_transfer_type_spec.rb
287
288
  - spec/integration/braintree/transaction_us_bank_account_spec.rb
288
289
  - spec/integration/braintree/us_bank_account_spec.rb
289
290
  - spec/integration/braintree/us_bank_account_verification_search_spec.rb
@@ -398,7 +399,7 @@ metadata:
398
399
  changelog_uri: https://github.com/braintree/braintree_ruby/blob/master/CHANGELOG.md
399
400
  source_code_uri: https://github.com/braintree/braintree_ruby
400
401
  documentation_uri: https://developer.paypal.com/braintree/docs
401
- post_install_message:
402
+ post_install_message:
402
403
  rdoc_options: []
403
404
  require_paths:
404
405
  - lib
@@ -413,8 +414,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
413
414
  - !ruby/object:Gem::Version
414
415
  version: '0'
415
416
  requirements: []
416
- rubygems_version: 3.2.5
417
- signing_key:
417
+ rubygems_version: 3.3.15
418
+ signing_key:
418
419
  specification_version: 4
419
420
  summary: Braintree Ruby Server SDK
420
421
  test_files: []