braintree 4.29.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 +4 -4
- data/lib/braintree/dispute.rb +1 -0
- data/lib/braintree/transaction.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +5 -0
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +1 -0
- data/lib/braintree/webhook_testing_gateway.rb +16 -0
- data/spec/integration/braintree/dispute_spec.rb +13 -2
- data/spec/integration/braintree/transaction_spec.rb +9 -0
- data/spec/integration/braintree/transaction_transfer_type_spec.rb +46 -0
- data/spec/unit/braintree/dispute_spec.rb +6 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +5 -0
- data/spec/unit/braintree/transaction_spec.rb +8 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +17 -0
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e98c0f65f8fc26db02c0f16cbe7b86e28aa7fbf6829ec4acf23c44db5159cff
|
4
|
+
data.tar.gz: e954ce7e083b2e1ea24c7cdd06acdcec52fc90238426bfca8ca7756200514677
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acc8c82a96904ca3dd89d3719d020756540af5f7bfdc1d56340a4b382ba1b6640732bb7f4eefd0073378fa4ed1c5dbb16a44fce9fcf4ed67146bffc0acd47314
|
7
|
+
data.tar.gz: 755c3a07a8469e6ee09f189b8d0ab60bdbb11c324fea726cd0af2bc86307b7213300c64a6d94ae9eff91d5fdf628295e4f42aec1bd2845ba4e5634c46c9d61ad
|
data/lib/braintree/dispute.rb
CHANGED
@@ -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
|
data/lib/braintree/version.rb
CHANGED
@@ -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
|
@@ -32,8 +32,8 @@ describe Braintree::Dispute do
|
|
32
32
|
|
33
33
|
expect(result.success?).to eq(true)
|
34
34
|
|
35
|
-
|
36
|
-
expect(
|
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
|
@@ -7755,4 +7755,13 @@ describe Braintree::Transaction do
|
|
7755
7755
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
7756
7756
|
end
|
7757
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
|
7758
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
|
@@ -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
|
@@ -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.
|
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-
|
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.
|
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: []
|