braintree 4.18.0 → 4.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/advanced_search.rb +1 -2
- data/lib/braintree/client_token_gateway.rb +1 -0
- data/lib/braintree/configuration.rb +1 -1
- data/lib/braintree/credit_card.rb +12 -0
- data/lib/braintree/credit_card_gateway.rb +6 -0
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +1 -0
- data/lib/braintree/error_codes.rb +2 -0
- data/lib/braintree/http.rb +2 -4
- data/lib/braintree/util.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +4 -3
- data/lib/braintree/webhook_testing_gateway.rb +78 -6
- data/lib/braintree/xml/parser.rb +2 -2
- data/spec/integration/braintree/address_spec.rb +3 -3
- data/spec/integration/braintree/advanced_search_spec.rb +3 -3
- data/spec/integration/braintree/client_api/client_token_spec.rb +28 -2
- data/spec/integration/braintree/client_api/spec_helper.rb +1 -1
- data/spec/integration/braintree/credit_card_spec.rb +13 -10
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_spec.rb +8 -8
- data/spec/integration/braintree/dispute_search_spec.rb +0 -1
- data/spec/integration/braintree/dispute_spec.rb +1 -1
- data/spec/integration/braintree/document_upload_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +0 -2
- data/spec/integration/braintree/oauth_spec.rb +1 -1
- data/spec/integration/braintree/payment_method_spec.rb +10 -12
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +3 -3
- data/spec/integration/braintree/paypal_account_spec.rb +6 -6
- data/spec/integration/braintree/plan_spec.rb +0 -1
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +0 -2
- data/spec/integration/braintree/subscription_spec.rb +5 -6
- data/spec/integration/braintree/transaction_search_spec.rb +3 -7
- data/spec/integration/braintree/transaction_spec.rb +6 -22
- data/spec/unit/braintree/client_token_spec.rb +1 -1
- data/spec/unit/braintree/digest_spec.rb +0 -1
- data/spec/unit/braintree/error_result_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +1 -1
- data/spec/unit/braintree/transaction_spec.rb +2 -2
- data/spec/unit/braintree/webhook_notification_spec.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5738048bf9abc767f859d8f10d42baa075a3f5986dca2a1fe6bb86b744a2a29a
|
4
|
+
data.tar.gz: 994d4b0dce9d1d6da5cbf929cb4debd0460b85087396c6400ca854af3c5fb882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96280a78f3e0fbabdbf95f950ca6bd417c7ab02c10e23169cb3a9b829dddc59b125fbb36d6164ef108a52aaba199b5677e1e9c3f2c95e8e6e4e1468ec6ce10b8
|
7
|
+
data.tar.gz: 1a9ca31d02662aaa179da5e2031bf096ecebcdef55d0f9a514cb20693d44c378933f6430ae95cc395b57da0e7b026221ee2ac0ba9061142b595db866437a5db9
|
@@ -81,11 +81,17 @@ module Braintree
|
|
81
81
|
Configuration.gateway.credit_card.create!(*args)
|
82
82
|
end
|
83
83
|
|
84
|
+
# NEXT_MAJOR_VERSION remove this method
|
85
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
84
86
|
def self.credit(token, transaction_attributes)
|
87
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
85
88
|
Transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
86
89
|
end
|
87
90
|
|
91
|
+
# NEXT_MAJOR_VERSION remove this method
|
92
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
88
93
|
def self.credit!(token, transaction_attributes)
|
94
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
89
95
|
return_object_or_raise(:transaction) { credit(token, transaction_attributes) }
|
90
96
|
end
|
91
97
|
|
@@ -109,11 +115,17 @@ module Braintree
|
|
109
115
|
Configuration.gateway.credit_card.from_nonce(*args)
|
110
116
|
end
|
111
117
|
|
118
|
+
# NEXT_MAJOR_VERSION remove this method
|
119
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
112
120
|
def self.sale(token, transaction_attributes)
|
121
|
+
warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
|
113
122
|
Configuration.gateway.transaction.sale(transaction_attributes.merge(:payment_method_token => token))
|
114
123
|
end
|
115
124
|
|
125
|
+
# NEXT_MAJOR_VERSION remove this method
|
126
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
116
127
|
def self.sale!(token, transaction_attributes)
|
128
|
+
warn "[DEPRECATED] CreditCard.sale is deprecated. Use Transaction.sale instead"
|
117
129
|
return_object_or_raise(:transaction) { sale(token, transaction_attributes) }
|
118
130
|
end
|
119
131
|
|
@@ -24,11 +24,17 @@ module Braintree
|
|
24
24
|
return_object_or_raise(:credit_card) { create(*args) }
|
25
25
|
end
|
26
26
|
|
27
|
+
# NEXT_MAJOR_VERSION remove this method
|
28
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
27
29
|
def credit(token, transaction_attributes)
|
30
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
28
31
|
@gateway.transaction.credit(transaction_attributes.merge(:payment_method_token => token))
|
29
32
|
end
|
30
33
|
|
34
|
+
# NEXT_MAJOR_VERSION remove this method
|
35
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
31
36
|
def credit!(*args)
|
37
|
+
warn "[DEPRECATED] CreditCard.credit is deprecated. Use Transaction.credit instead"
|
32
38
|
return_object_or_raise(:transaction) { credit(*args) }
|
33
39
|
end
|
34
40
|
|
data/lib/braintree/dispute.rb
CHANGED
@@ -708,9 +708,11 @@ module Braintree
|
|
708
708
|
module ClientToken
|
709
709
|
CustomerDoesNotExist = "92804"
|
710
710
|
FailOnDuplicatePaymentMethodRequiresCustomerId = "92803"
|
711
|
+
InvalidDomainFormat = "92011"
|
711
712
|
MakeDefaultRequiresCustomerId = "92801"
|
712
713
|
MerchantAccountDoesNotExist = "92807"
|
713
714
|
ProxyMerchantDoesNotExist = "92805"
|
715
|
+
TooManyDomains = "92810"
|
714
716
|
UnsupportedVersion = "92806"
|
715
717
|
VerifyCardRequiresCustomerId = "92802"
|
716
718
|
end
|
data/lib/braintree/http.rb
CHANGED
@@ -8,7 +8,6 @@ module Braintree
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def delete(path, query_params = {})
|
11
|
-
full_path = path + _build_query_string(query_params)
|
12
11
|
response = _http_do Net::HTTP::Delete, path
|
13
12
|
if response.code.to_i == 200 || response.code.to_i == 204
|
14
13
|
true
|
@@ -20,7 +19,6 @@ module Braintree
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def get(path, query_params = {})
|
23
|
-
full_path = path + _build_query_string(query_params)
|
24
22
|
response = _http_do Net::HTTP::Get, path
|
25
23
|
if response.code.to_i == 200 || response.code.to_i == 422
|
26
24
|
Xml.hash_from_xml(_body(response))
|
@@ -69,7 +67,7 @@ module Braintree
|
|
69
67
|
|
70
68
|
def _setup_connection(server = @config.server, port = @config.port)
|
71
69
|
if @config.proxy_address
|
72
|
-
|
70
|
+
Net::HTTP.new(
|
73
71
|
server,
|
74
72
|
port,
|
75
73
|
@config.proxy_address,
|
@@ -78,7 +76,7 @@ module Braintree
|
|
78
76
|
@config.proxy_pass,
|
79
77
|
)
|
80
78
|
else
|
81
|
-
|
79
|
+
Net::HTTP.new(server, port)
|
82
80
|
end
|
83
81
|
end
|
84
82
|
|
data/lib/braintree/util.rb
CHANGED
@@ -191,7 +191,7 @@ module Braintree
|
|
191
191
|
def self._get_invalid_keys(valid_keys, hash)
|
192
192
|
flattened_valid_keys = _flatten_valid_keys(valid_keys)
|
193
193
|
keys = _flatten_hash_keys(hash) - flattened_valid_keys
|
194
|
-
|
194
|
+
_remove_wildcard_keys(flattened_valid_keys, keys)
|
195
195
|
end
|
196
196
|
|
197
197
|
module IdEquality
|
data/lib/braintree/version.rb
CHANGED
@@ -15,13 +15,14 @@ module Braintree
|
|
15
15
|
Disbursement = "disbursement"
|
16
16
|
DisbursementException = "disbursement_exception"
|
17
17
|
|
18
|
-
DisputeOpened = "dispute_opened"
|
19
|
-
DisputeLost = "dispute_lost"
|
20
|
-
DisputeWon = "dispute_won"
|
21
18
|
DisputeAccepted = "dispute_accepted"
|
22
19
|
DisputeAutoAccepted = "dispute_auto_accepted"
|
23
20
|
DisputeDisputed = "dispute_disputed"
|
24
21
|
DisputeExpired = "dispute_expired"
|
22
|
+
DisputeLost = "dispute_lost"
|
23
|
+
DisputeOpened = "dispute_opened"
|
24
|
+
DisputeUnderReview = "dispute_under_review"
|
25
|
+
DisputeWon = "dispute_won"
|
25
26
|
|
26
27
|
GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
|
27
28
|
|
@@ -34,12 +34,6 @@ module Braintree
|
|
34
34
|
case kind
|
35
35
|
when Braintree::WebhookNotification::Kind::Check
|
36
36
|
_check
|
37
|
-
when Braintree::WebhookNotification::Kind::DisputeOpened
|
38
|
-
_dispute_opened_sample_xml(id)
|
39
|
-
when Braintree::WebhookNotification::Kind::DisputeLost
|
40
|
-
_dispute_lost_sample_xml(id)
|
41
|
-
when Braintree::WebhookNotification::Kind::DisputeWon
|
42
|
-
_dispute_won_sample_xml(id)
|
43
37
|
when Braintree::WebhookNotification::Kind::DisputeAccepted
|
44
38
|
_dispute_accepted_sample_xml(id)
|
45
39
|
when Braintree::WebhookNotification::Kind::DisputeAutoAccepted
|
@@ -48,6 +42,14 @@ module Braintree
|
|
48
42
|
_dispute_disputed_sample_xml(id)
|
49
43
|
when Braintree::WebhookNotification::Kind::DisputeExpired
|
50
44
|
_dispute_expired_sample_xml(id)
|
45
|
+
when Braintree::WebhookNotification::Kind::DisputeLost
|
46
|
+
_dispute_lost_sample_xml(id)
|
47
|
+
when Braintree::WebhookNotification::Kind::DisputeOpened
|
48
|
+
_dispute_opened_sample_xml(id)
|
49
|
+
when Braintree::WebhookNotification::Kind::DisputeUnderReview
|
50
|
+
_dispute_under_review_sample_xml(id)
|
51
|
+
when Braintree::WebhookNotification::Kind::DisputeWon
|
52
|
+
_dispute_won_sample_xml(id)
|
51
53
|
when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
|
52
54
|
_partner_merchant_connected_sample_xml(id)
|
53
55
|
when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
|
@@ -324,6 +326,14 @@ module Braintree
|
|
324
326
|
XML
|
325
327
|
end
|
326
328
|
|
329
|
+
def _dispute_under_review_sample_xml(id)
|
330
|
+
if id == "legacy_dispute_id"
|
331
|
+
_old_dispute_under_review_sample_xml(id)
|
332
|
+
else
|
333
|
+
_new_dispute_under_review_sample_xml(id)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
327
337
|
def _dispute_opened_sample_xml(id)
|
328
338
|
if id == "legacy_dispute_id"
|
329
339
|
_old_dispute_opened_sample_xml(id)
|
@@ -380,6 +390,26 @@ module Braintree
|
|
380
390
|
end
|
381
391
|
end
|
382
392
|
|
393
|
+
def _old_dispute_under_review_sample_xml(id)
|
394
|
+
<<-XML
|
395
|
+
<dispute>
|
396
|
+
<amount>100.00</amount>
|
397
|
+
<currency-iso-code>USD</currency-iso-code>
|
398
|
+
<received-date type="date">2014-03-01</received-date>
|
399
|
+
<reply-by-date type="date">2014-03-21</reply-by-date>
|
400
|
+
<kind>chargeback</kind>
|
401
|
+
<status>under_review</status>
|
402
|
+
<reason>fraud</reason>
|
403
|
+
<id>#{id}</id>
|
404
|
+
<transaction>
|
405
|
+
<id>#{id}</id>
|
406
|
+
<amount>100.00</amount>
|
407
|
+
</transaction>
|
408
|
+
<date-opened type=\"date\">2014-03-21</date-opened>
|
409
|
+
</dispute>
|
410
|
+
XML
|
411
|
+
end
|
412
|
+
|
383
413
|
def _old_dispute_opened_sample_xml(id)
|
384
414
|
<<-XML
|
385
415
|
<dispute>
|
@@ -521,6 +551,48 @@ module Braintree
|
|
521
551
|
XML
|
522
552
|
end
|
523
553
|
|
554
|
+
def _new_dispute_under_review_sample_xml(id)
|
555
|
+
<<-XML
|
556
|
+
<dispute>
|
557
|
+
<id>#{id}</id>
|
558
|
+
<amount>100.00</amount>
|
559
|
+
<amount-disputed>100.00</amount-disputed>
|
560
|
+
<amount-won>95.00</amount-won>
|
561
|
+
<case-number>CASE-12345</case-number>
|
562
|
+
<created-at type="datetime">2017-06-16T20:44:41Z</created-at>
|
563
|
+
<currency-iso-code>USD</currency-iso-code>
|
564
|
+
<forwarded-comments nil="true"/>
|
565
|
+
<kind>chargeback</kind>
|
566
|
+
<merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
|
567
|
+
<reason>fraud</reason>
|
568
|
+
<reason-code nil="true"/>
|
569
|
+
<reason-description nil="true"/>
|
570
|
+
<received-date type="date">2016-02-15</received-date>
|
571
|
+
<reference-number>REF-9876</reference-number>
|
572
|
+
<reply-by-date type="date">2016-02-22</reply-by-date>
|
573
|
+
<status>under_review</status>
|
574
|
+
<updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
|
575
|
+
<original-dispute-id>9qde5qgp</original-dispute-id>
|
576
|
+
<status-history type="array">
|
577
|
+
<status-history>
|
578
|
+
<status>under_review</status>
|
579
|
+
<timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
|
580
|
+
</status-history>
|
581
|
+
</status-history>
|
582
|
+
<evidence type="array"/>
|
583
|
+
<transaction>
|
584
|
+
<id>#{id}</id>
|
585
|
+
<amount>100.00</amount>
|
586
|
+
<created-at>2017-06-21T20:44:41Z</created-at>
|
587
|
+
<order-id nil="true"/>
|
588
|
+
<purchase-order-number nil="true"/>
|
589
|
+
<payment-instrument-subtype>Visa</payment-instrument-subtype>
|
590
|
+
</transaction>
|
591
|
+
<date-opened type=\"date\">2014-03-21</date-opened>
|
592
|
+
</dispute>
|
593
|
+
XML
|
594
|
+
end
|
595
|
+
|
524
596
|
def _new_dispute_opened_sample_xml(id)
|
525
597
|
<<-XML
|
526
598
|
<dispute>
|
data/lib/braintree/xml/parser.rb
CHANGED
@@ -32,7 +32,7 @@ module Braintree
|
|
32
32
|
case value.class.to_s
|
33
33
|
when "Hash"
|
34
34
|
if value["type"] == "array"
|
35
|
-
|
35
|
+
_child_key, entries = value.detect { |k,_v| k != "type" } # child_key is throwaway
|
36
36
|
if entries.nil? || ((c = value[CONTENT_ROOT]) && c.strip.empty?)
|
37
37
|
[]
|
38
38
|
else
|
@@ -47,7 +47,7 @@ module Braintree
|
|
47
47
|
end
|
48
48
|
elsif value.has_key?(CONTENT_ROOT)
|
49
49
|
content = value[CONTENT_ROOT]
|
50
|
-
if (
|
50
|
+
if (XML_PARSING[value["type"]])
|
51
51
|
XML_PARSING[value["type"]].call(content)
|
52
52
|
else
|
53
53
|
content
|
@@ -203,7 +203,7 @@ describe Braintree::Address do
|
|
203
203
|
|
204
204
|
it "raises a NotFoundError if it cannot be found because of address id" do
|
205
205
|
customer = Braintree::Customer.create!(:last_name => "Wilson")
|
206
|
-
|
206
|
+
Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
|
207
207
|
expect do
|
208
208
|
Braintree::Address.find(customer, "invalid")
|
209
209
|
end.to raise_error(
|
@@ -215,7 +215,7 @@ describe Braintree::Address do
|
|
215
215
|
describe "self.update" do
|
216
216
|
it "raises NotFoundError if the address can't be found" do
|
217
217
|
customer = Braintree::Customer.create!(:last_name => "Wilson")
|
218
|
-
|
218
|
+
Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
|
219
219
|
expect do
|
220
220
|
Braintree::Address.update(customer.id, "bad-id", {})
|
221
221
|
end.to raise_error(Braintree::NotFoundError)
|
@@ -293,7 +293,7 @@ describe Braintree::Address do
|
|
293
293
|
describe "self.update!" do
|
294
294
|
it "raises NotFoundError if the address can't be found" do
|
295
295
|
customer = Braintree::Customer.create!(:last_name => "Wilson")
|
296
|
-
|
296
|
+
Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
|
297
297
|
expect do
|
298
298
|
Braintree::Address.update!(customer.id, "bad-id", {})
|
299
299
|
end.to raise_error(Braintree::NotFoundError)
|
@@ -263,19 +263,19 @@ describe Braintree::AdvancedSearch do
|
|
263
263
|
context "multiple_value_or_text_field" do
|
264
264
|
describe "in" do
|
265
265
|
it "works for the in operator" do
|
266
|
-
|
266
|
+
Braintree::Subscription.create(
|
267
267
|
:payment_method_token => @credit_card.token,
|
268
268
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
269
269
|
:price => "17",
|
270
270
|
).subscription
|
271
271
|
|
272
|
-
|
272
|
+
Braintree::Subscription.create(
|
273
273
|
:payment_method_token => @credit_card.token,
|
274
274
|
:plan_id => SpecHelper::TrialPlan[:id],
|
275
275
|
:price => "17",
|
276
276
|
).subscription
|
277
277
|
|
278
|
-
|
278
|
+
Braintree::Subscription.create(
|
279
279
|
:payment_method_token => @credit_card.token,
|
280
280
|
:plan_id => SpecHelper::AddOnDiscountPlan[:id],
|
281
281
|
:price => "17",
|
@@ -20,6 +20,34 @@ describe Braintree::ClientToken do
|
|
20
20
|
expect(response.code).to eq("200")
|
21
21
|
end
|
22
22
|
|
23
|
+
describe "domains" do
|
24
|
+
it "allows a domain to be specified" do
|
25
|
+
client_token_string = Braintree::ClientToken.generate(:domains => ["example.com"])
|
26
|
+
client_token = decode_client_token(client_token_string)
|
27
|
+
authorization_fingerprint = Base64.decode64(client_token["authorizationFingerprint"])
|
28
|
+
expect(authorization_fingerprint.include? "example.com").to eq(true)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "raises ClientTokenTooManyDomains on too many domains" do
|
32
|
+
expect do
|
33
|
+
Braintree::ClientToken.generate(
|
34
|
+
:domains => ["example1.com",
|
35
|
+
"example2.com",
|
36
|
+
"example3.com",
|
37
|
+
"example4.com",
|
38
|
+
"example5.com",
|
39
|
+
"example6.com"
|
40
|
+
])
|
41
|
+
end.to raise_error(ArgumentError, "Cannot specify more than 5 client token domains")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "raises ClientTokenInvalidDomainFormat on invalid format" do
|
45
|
+
expect do
|
46
|
+
Braintree::ClientToken.generate(:domains => ["example"])
|
47
|
+
end.to raise_error(ArgumentError, "Client token domains must be valid domain names (RFC 1035), e.g. example.com")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
23
51
|
it "raises ArgumentError on invalid parameters (422)" do
|
24
52
|
expect do
|
25
53
|
Braintree::ClientToken.generate(:options => {:make_default => true})
|
@@ -28,14 +56,12 @@ describe Braintree::ClientToken do
|
|
28
56
|
|
29
57
|
describe "version" do
|
30
58
|
it "allows a client token version to be specified" do
|
31
|
-
config = Braintree::Configuration.instantiate
|
32
59
|
client_token_string = Braintree::ClientToken.generate(:version => 1)
|
33
60
|
client_token = JSON.parse(client_token_string)
|
34
61
|
expect(client_token["version"]).to eq(1)
|
35
62
|
end
|
36
63
|
|
37
64
|
it "defaults to 2" do
|
38
|
-
config = Braintree::Configuration.instantiate
|
39
65
|
client_token_string = Braintree::ClientToken.generate
|
40
66
|
client_token = decode_client_token(client_token_string)
|
41
67
|
expect(client_token["version"]).to eq(2)
|
@@ -144,7 +144,7 @@ def generate_invalid_us_bank_account_nonce
|
|
144
144
|
nonce_characters = "bcdfghjkmnpqrstvwxyz23456789".chars.to_a
|
145
145
|
nonce = "tokenusbankacct_"
|
146
146
|
nonce += 4.times.map { sample(nonce_characters) }.join("_")
|
147
|
-
nonce
|
147
|
+
nonce + "_xxx"
|
148
148
|
end
|
149
149
|
|
150
150
|
def _cosmos_post(token, url, payload)
|
@@ -322,16 +322,15 @@ describe Braintree::CreditCard do
|
|
322
322
|
expect(result.success?).to eq(true)
|
323
323
|
|
324
324
|
three_d_secure_info = result.credit_card.verification.three_d_secure_info
|
325
|
-
expect(three_d_secure_info.
|
325
|
+
expect(three_d_secure_info.status).to eq("authenticate_successful")
|
326
326
|
expect(three_d_secure_info).to be_liability_shifted
|
327
327
|
expect(three_d_secure_info).to be_liability_shift_possible
|
328
|
-
expect(three_d_secure_info.
|
329
|
-
expect(three_d_secure_info.cavv).to
|
330
|
-
expect(three_d_secure_info.xid).to
|
331
|
-
expect(three_d_secure_info.eci_flag).to
|
332
|
-
expect(three_d_secure_info.three_d_secure_version).to
|
333
|
-
expect(three_d_secure_info.
|
334
|
-
expect(three_d_secure_info.three_d_secure_authentication_id).not_to be_nil
|
328
|
+
expect(three_d_secure_info.enrolled).to be_a(String)
|
329
|
+
expect(three_d_secure_info.cavv).to be_a(String)
|
330
|
+
expect(three_d_secure_info.xid).to be_a(String)
|
331
|
+
expect(three_d_secure_info.eci_flag).to be_a(String)
|
332
|
+
expect(three_d_secure_info.three_d_secure_version).to be_a(String)
|
333
|
+
expect(three_d_secure_info.three_d_secure_authentication_id).to be_a(String)
|
335
334
|
end
|
336
335
|
|
337
336
|
it "adds credit card with billing address to customer" do
|
@@ -649,7 +648,6 @@ describe Braintree::CreditCard do
|
|
649
648
|
end
|
650
649
|
|
651
650
|
it "errors with invalid account_type" do
|
652
|
-
customer = Braintree::Customer.create!
|
653
651
|
result = Braintree::CreditCard.create(
|
654
652
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
655
653
|
:expiration_month => "11",
|
@@ -666,7 +664,6 @@ describe Braintree::CreditCard do
|
|
666
664
|
end
|
667
665
|
|
668
666
|
it "errors when account_type not supported by merchant" do
|
669
|
-
customer = Braintree::Customer.create!
|
670
667
|
result = Braintree::CreditCard.create(
|
671
668
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
672
669
|
:expiration_month => "11",
|
@@ -710,6 +707,8 @@ describe Braintree::CreditCard do
|
|
710
707
|
end
|
711
708
|
end
|
712
709
|
|
710
|
+
# NEXT_MAJOR_VERSION remove this test
|
711
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
713
712
|
describe "self.credit" do
|
714
713
|
it "creates a credit transaction using the payment method token, returning a result object" do
|
715
714
|
customer = Braintree::Customer.create!(
|
@@ -1341,6 +1340,8 @@ describe Braintree::CreditCard do
|
|
1341
1340
|
end
|
1342
1341
|
end
|
1343
1342
|
|
1343
|
+
# NEXT_MAJOR_VERSION remove these tests
|
1344
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
1344
1345
|
describe "self.sale" do
|
1345
1346
|
it "creates a sale transaction using the credit card, returning a result object" do
|
1346
1347
|
customer = Braintree::Customer.create!(
|
@@ -1384,6 +1385,8 @@ describe Braintree::CreditCard do
|
|
1384
1385
|
end
|
1385
1386
|
end
|
1386
1387
|
|
1388
|
+
# NEXT_MAJOR_VERSION remove this test
|
1389
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
1387
1390
|
describe "self.sale!" do
|
1388
1391
|
it "creates a sale transaction using the credit card, returning the transaction" do
|
1389
1392
|
customer = Braintree::Customer.create!(
|
@@ -283,7 +283,7 @@ describe Braintree::CreditCardVerification, "search" do
|
|
283
283
|
it "returns prepaid on a prepaid card" do
|
284
284
|
cardholder_name = "Tom #{rand(1_000_000)} Smith"
|
285
285
|
|
286
|
-
|
286
|
+
Braintree::Customer.create(
|
287
287
|
:credit_card => {
|
288
288
|
:cardholder_name => cardholder_name,
|
289
289
|
:expiration_date => "05/2012",
|
@@ -924,11 +924,11 @@ describe Braintree::Customer do
|
|
924
924
|
},
|
925
925
|
).credit_card
|
926
926
|
|
927
|
-
|
927
|
+
Braintree::Subscription.create(
|
928
928
|
:payment_method_token => credit_card.token,
|
929
929
|
:plan_id => "integration_trialless_plan",
|
930
930
|
:price => "1.00",
|
931
|
-
)
|
931
|
+
)
|
932
932
|
|
933
933
|
found_customer = Braintree::Customer.find(customer.id, {
|
934
934
|
:association_filter_id => "customernoassociations"
|
@@ -958,11 +958,11 @@ describe Braintree::Customer do
|
|
958
958
|
},
|
959
959
|
).credit_card
|
960
960
|
|
961
|
-
|
961
|
+
Braintree::Subscription.create(
|
962
962
|
:payment_method_token => credit_card.token,
|
963
963
|
:plan_id => "integration_trialless_plan",
|
964
964
|
:price => "1.00",
|
965
|
-
)
|
965
|
+
)
|
966
966
|
|
967
967
|
found_customer = Braintree::Customer.find(customer.id, {
|
968
968
|
:association_filter_id => "customertoplevelassociations"
|
@@ -1233,7 +1233,7 @@ describe Braintree::Customer do
|
|
1233
1233
|
|
1234
1234
|
token1 = random_payment_method_token
|
1235
1235
|
|
1236
|
-
|
1236
|
+
Braintree::PaymentMethod.create(
|
1237
1237
|
:customer_id => customer.id,
|
1238
1238
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
1239
1239
|
:token => token1,
|
@@ -1244,7 +1244,7 @@ describe Braintree::Customer do
|
|
1244
1244
|
|
1245
1245
|
token2 = random_payment_method_token
|
1246
1246
|
|
1247
|
-
|
1247
|
+
Braintree::PaymentMethod.create(
|
1248
1248
|
:customer_id => customer.id,
|
1249
1249
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
|
1250
1250
|
:token => token2,
|
@@ -1266,7 +1266,7 @@ describe Braintree::Customer do
|
|
1266
1266
|
|
1267
1267
|
token1 = random_payment_method_token
|
1268
1268
|
|
1269
|
-
|
1269
|
+
Braintree::PaymentMethod.create(
|
1270
1270
|
:customer_id => customer.id,
|
1271
1271
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
1272
1272
|
:token => token1,
|
@@ -1277,7 +1277,7 @@ describe Braintree::Customer do
|
|
1277
1277
|
|
1278
1278
|
token2 = random_payment_method_token
|
1279
1279
|
|
1280
|
-
|
1280
|
+
Braintree::PaymentMethod.create(
|
1281
1281
|
:customer_id => customer.id,
|
1282
1282
|
:payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
|
1283
1283
|
:token => token2,
|
@@ -6,7 +6,7 @@ describe Braintree::Dispute do
|
|
6
6
|
let(:document_upload) do
|
7
7
|
file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/bt_logo.png", "r")
|
8
8
|
response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
|
9
|
-
|
9
|
+
response.document_upload
|
10
10
|
end
|
11
11
|
|
12
12
|
let(:transaction) do
|
@@ -67,7 +67,7 @@ describe Braintree::DocumentUploadGateway do
|
|
67
67
|
|
68
68
|
it "returns invalid keys error if signature is invalid" do
|
69
69
|
expect do
|
70
|
-
|
70
|
+
Braintree::DocumentUpload.create({:invalid_key => "do not add", :kind => Braintree::DocumentUpload::Kind::EvidenceDocument})
|
71
71
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
72
72
|
end
|
73
73
|
end
|
@@ -255,7 +255,6 @@ describe Braintree::Http do
|
|
255
255
|
old_logger = Braintree::Configuration.logger
|
256
256
|
output = StringIO.new
|
257
257
|
Braintree::Configuration.logger = Logger.new(output)
|
258
|
-
utc_or_gmt = Time.now.utc.strftime("%Z")
|
259
258
|
context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
|
260
259
|
context.error = 19
|
261
260
|
expect(Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context)).to eq(false)
|
@@ -270,7 +269,6 @@ describe Braintree::Http do
|
|
270
269
|
old_logger = Braintree::Configuration.logger
|
271
270
|
output = StringIO.new
|
272
271
|
Braintree::Configuration.logger = Logger.new(output)
|
273
|
-
utc_or_gmt = Time.now.utc.strftime("%Z")
|
274
272
|
context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
|
275
273
|
expect do
|
276
274
|
Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context)
|
@@ -36,7 +36,7 @@ describe "OAuth" do
|
|
36
36
|
)
|
37
37
|
|
38
38
|
expect(result).not_to be_success
|
39
|
-
|
39
|
+
expect(result.errors.for(:credentials).on(:code)[0].code).to eq(Braintree::ErrorCodes::OAuth::InvalidGrant)
|
40
40
|
expect(result.message).to match(/Invalid grant: code not found/)
|
41
41
|
end
|
42
42
|
|
@@ -390,15 +390,14 @@ describe Braintree::PaymentMethod do
|
|
390
390
|
expect(result.success?).to eq(true)
|
391
391
|
|
392
392
|
three_d_secure_info = result.payment_method.verification.three_d_secure_info
|
393
|
-
expect(three_d_secure_info.
|
393
|
+
expect(three_d_secure_info.status).to eq("authenticate_successful")
|
394
394
|
expect(three_d_secure_info).to be_liability_shifted
|
395
395
|
expect(three_d_secure_info).to be_liability_shift_possible
|
396
|
-
expect(three_d_secure_info.
|
397
|
-
expect(three_d_secure_info.cavv).to
|
398
|
-
expect(three_d_secure_info.xid).to
|
399
|
-
expect(three_d_secure_info.eci_flag).to
|
400
|
-
expect(three_d_secure_info.three_d_secure_version).to
|
401
|
-
expect(three_d_secure_info.ds_transaction_id).to eq(nil)
|
396
|
+
expect(three_d_secure_info.enrolled).to be_a(String)
|
397
|
+
expect(three_d_secure_info.cavv).to be_a(String)
|
398
|
+
expect(three_d_secure_info.xid).to be_a(String)
|
399
|
+
expect(three_d_secure_info.eci_flag).to be_a(String)
|
400
|
+
expect(three_d_secure_info.three_d_secure_version).to be_a(String)
|
402
401
|
end
|
403
402
|
|
404
403
|
it "respects fail_on_duplicate_payment_method when included outside of the nonce" do
|
@@ -1409,7 +1408,6 @@ describe Braintree::PaymentMethod do
|
|
1409
1408
|
|
1410
1409
|
it "raises a NotFoundError exception if payment method cannot be found" do
|
1411
1410
|
token = make_token
|
1412
|
-
customer = Braintree::Customer.create!
|
1413
1411
|
|
1414
1412
|
expect do
|
1415
1413
|
Braintree::PaymentMethod.delete(token)
|
@@ -1878,7 +1876,7 @@ describe Braintree::PaymentMethod do
|
|
1878
1876
|
)
|
1879
1877
|
|
1880
1878
|
updated_token = make_token
|
1881
|
-
|
1879
|
+
Braintree::PaymentMethod.update(
|
1882
1880
|
original_token,
|
1883
1881
|
:token => updated_token,
|
1884
1882
|
)
|
@@ -1907,7 +1905,7 @@ describe Braintree::PaymentMethod do
|
|
1907
1905
|
:customer_id => customer.id,
|
1908
1906
|
).payment_method.token
|
1909
1907
|
|
1910
|
-
|
1908
|
+
Braintree::PaymentMethod.update(
|
1911
1909
|
original_token,
|
1912
1910
|
:options => {:make_default => true},
|
1913
1911
|
)
|
@@ -1925,7 +1923,7 @@ describe Braintree::PaymentMethod do
|
|
1925
1923
|
:consent_code => "consent-code",
|
1926
1924
|
:token => first_token,
|
1927
1925
|
)
|
1928
|
-
|
1926
|
+
Braintree::PaymentMethod.create(
|
1929
1927
|
:payment_method_nonce => first_nonce,
|
1930
1928
|
:customer_id => customer.id,
|
1931
1929
|
)
|
@@ -1934,7 +1932,7 @@ describe Braintree::PaymentMethod do
|
|
1934
1932
|
:consent_code => "consent-code",
|
1935
1933
|
:token => second_token,
|
1936
1934
|
)
|
1937
|
-
|
1935
|
+
Braintree::PaymentMethod.create(
|
1938
1936
|
:payment_method_nonce => second_nonce,
|
1939
1937
|
:customer_id => customer.id,
|
1940
1938
|
)
|
@@ -116,7 +116,7 @@ describe Braintree::PaymentMethod do
|
|
116
116
|
|
117
117
|
it "returns additional processor response for failed NetworkCheck" do
|
118
118
|
customer = Braintree::Customer.create.customer
|
119
|
-
invalid_nonce = generate_non_plaid_us_bank_account_nonce(
|
119
|
+
invalid_nonce = generate_non_plaid_us_bank_account_nonce("1000000005")
|
120
120
|
result = Braintree::PaymentMethod.create(
|
121
121
|
:payment_method_nonce => invalid_nonce,
|
122
122
|
:customer_id => customer.id,
|
@@ -189,7 +189,7 @@ describe Braintree::PaymentMethod do
|
|
189
189
|
context "unverified token" do
|
190
190
|
let(:payment_method) do
|
191
191
|
customer = Braintree::Customer.create.customer
|
192
|
-
|
192
|
+
Braintree::PaymentMethod.create(
|
193
193
|
:payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
|
194
194
|
:customer_id => customer.id,
|
195
195
|
:options => {
|
@@ -260,7 +260,7 @@ describe Braintree::PaymentMethod do
|
|
260
260
|
context "unverified token" do
|
261
261
|
let(:payment_method) do
|
262
262
|
customer = Braintree::Customer.create.customer
|
263
|
-
|
263
|
+
Braintree::PaymentMethod.create(
|
264
264
|
:payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
|
265
265
|
:customer_id => customer.id,
|
266
266
|
:options => {
|
@@ -51,7 +51,7 @@ describe Braintree::PayPalAccount do
|
|
51
51
|
|
52
52
|
it "does not return a different payment method type" do
|
53
53
|
customer = Braintree::Customer.create!
|
54
|
-
|
54
|
+
Braintree::CreditCard.create(
|
55
55
|
:customer_id => customer.id,
|
56
56
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
57
57
|
:expiration_date => "05/2009",
|
@@ -171,7 +171,7 @@ describe Braintree::PayPalAccount do
|
|
171
171
|
)
|
172
172
|
|
173
173
|
updated_token = "UPDATED_TOKEN-" + rand(36**3).to_s(36)
|
174
|
-
|
174
|
+
Braintree::PayPalAccount.update(
|
175
175
|
original_token,
|
176
176
|
:token => updated_token,
|
177
177
|
)
|
@@ -200,7 +200,7 @@ describe Braintree::PayPalAccount do
|
|
200
200
|
:customer_id => customer.id,
|
201
201
|
).payment_method.token
|
202
202
|
|
203
|
-
|
203
|
+
Braintree::PayPalAccount.update(
|
204
204
|
original_token,
|
205
205
|
:options => {:make_default => true},
|
206
206
|
)
|
@@ -218,7 +218,7 @@ describe Braintree::PayPalAccount do
|
|
218
218
|
:consent_code => "consent-code",
|
219
219
|
:token => first_token,
|
220
220
|
)
|
221
|
-
|
221
|
+
Braintree::PaymentMethod.create(
|
222
222
|
:payment_method_nonce => first_nonce,
|
223
223
|
:customer_id => customer.id,
|
224
224
|
)
|
@@ -227,7 +227,7 @@ describe Braintree::PayPalAccount do
|
|
227
227
|
:consent_code => "consent-code",
|
228
228
|
:token => second_token,
|
229
229
|
)
|
230
|
-
|
230
|
+
Braintree::PaymentMethod.create(
|
231
231
|
:payment_method_nonce => second_nonce,
|
232
232
|
:customer_id => customer.id,
|
233
233
|
)
|
@@ -256,7 +256,7 @@ describe Braintree::PayPalAccount do
|
|
256
256
|
:customer_id => customer.id,
|
257
257
|
)
|
258
258
|
|
259
|
-
|
259
|
+
Braintree::PayPalAccount.delete(token)
|
260
260
|
|
261
261
|
expect do
|
262
262
|
Braintree::PayPalAccount.find(token)
|
@@ -53,8 +53,6 @@ describe Braintree::SepaDirectDebitAccount do
|
|
53
53
|
|
54
54
|
context "subscriptions" do
|
55
55
|
it "returns subscriptions associated with a SEPA direct debit account" do
|
56
|
-
customer = Braintree::Customer.create!
|
57
|
-
|
58
56
|
subscription1 = Braintree::Subscription.create(
|
59
57
|
:payment_method_token => token,
|
60
58
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
@@ -136,7 +136,6 @@ describe Braintree::Subscription do
|
|
136
136
|
end
|
137
137
|
|
138
138
|
it "returns an error if the payment_method_nonce hasn't been vaulted" do
|
139
|
-
customer = Braintree::Customer.create!
|
140
139
|
result = Braintree::Subscription.create(
|
141
140
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
142
141
|
:plan_id => SpecHelper::TriallessPlan[:id],
|
@@ -937,17 +936,17 @@ describe Braintree::Subscription do
|
|
937
936
|
|
938
937
|
it "has validation errors on duplicate id" do
|
939
938
|
duplicate_id = "new_id_#{rand(36**6).to_s(36)}"
|
940
|
-
|
939
|
+
Braintree::Subscription.create(
|
941
940
|
:payment_method_token => @credit_card.token,
|
942
941
|
:plan_id => SpecHelper::TrialPlan[:id],
|
943
942
|
:id => duplicate_id,
|
944
943
|
)
|
945
|
-
|
944
|
+
duplicate = Braintree::Subscription.update(
|
946
945
|
@subscription.id,
|
947
946
|
:id => duplicate_id,
|
948
947
|
)
|
949
|
-
expect(
|
950
|
-
expect(
|
948
|
+
expect(duplicate.success?).to eq(false)
|
949
|
+
expect(duplicate.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
|
951
950
|
end
|
952
951
|
|
953
952
|
it "cannot update a canceled subscription" do
|
@@ -1203,7 +1202,7 @@ describe Braintree::Subscription do
|
|
1203
1202
|
|
1204
1203
|
it "returns a validation error if record not found" do
|
1205
1204
|
expect {
|
1206
|
-
|
1205
|
+
Braintree::Subscription.cancel("noSuchSubscription")
|
1207
1206
|
}.to raise_error(Braintree::NotFoundError, 'subscription with id "noSuchSubscription" not found')
|
1208
1207
|
end
|
1209
1208
|
|
@@ -640,7 +640,7 @@ describe Braintree::Transaction, "search" do
|
|
640
640
|
context "invalid search" do
|
641
641
|
it "raises an exception on invalid transaction type" do
|
642
642
|
expect do
|
643
|
-
|
643
|
+
Braintree::Transaction.search do |search|
|
644
644
|
search.customer_id.is "9171566"
|
645
645
|
search.type.is "settled"
|
646
646
|
end
|
@@ -649,7 +649,7 @@ describe Braintree::Transaction, "search" do
|
|
649
649
|
|
650
650
|
it "raises an exception on invalid debit network" do
|
651
651
|
expect do
|
652
|
-
|
652
|
+
Braintree::Transaction.search do |search|
|
653
653
|
search.debit_network.is "invalid_network"
|
654
654
|
end
|
655
655
|
end.to raise_error(ArgumentError)
|
@@ -849,8 +849,6 @@ describe Braintree::Transaction, "search" do
|
|
849
849
|
|
850
850
|
context "ach return response created at" do
|
851
851
|
it "it finds records within date range of the custom field" do
|
852
|
-
reason_code = "any_reason_code"
|
853
|
-
|
854
852
|
date_search = Braintree::Transaction.search do |search|
|
855
853
|
search.ach_return_responses_created_at.between(DateTime.now - 1.0, DateTime.now + 1.0)
|
856
854
|
end
|
@@ -859,8 +857,6 @@ describe Braintree::Transaction, "search" do
|
|
859
857
|
end
|
860
858
|
|
861
859
|
it "it does not find records not within date range of the custom field" do
|
862
|
-
reason_code = "any_reason_code"
|
863
|
-
|
864
860
|
neg_date_search = Braintree::Transaction.search do |search|
|
865
861
|
search.ach_return_responses_created_at.between(DateTime.now + 1.0, DateTime.now - 1.0)
|
866
862
|
end
|
@@ -1488,7 +1484,7 @@ describe Braintree::Transaction, "search" do
|
|
1488
1484
|
context "when the search times out" do
|
1489
1485
|
it "raises a UnexpectedError" do
|
1490
1486
|
expect {
|
1491
|
-
|
1487
|
+
Braintree::Transaction.search do |search|
|
1492
1488
|
search.amount.is(-10)
|
1493
1489
|
end
|
1494
1490
|
}.to raise_error(Braintree::UnexpectedError)
|
@@ -2098,7 +2098,6 @@ describe Braintree::Transaction do
|
|
2098
2098
|
end
|
2099
2099
|
|
2100
2100
|
it "can create a transaction with a params nonce with PayPal account params" do
|
2101
|
-
customer = Braintree::Customer.create!
|
2102
2101
|
nonce = nonce_for_new_payment_method(
|
2103
2102
|
:paypal_account => {
|
2104
2103
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2174,7 +2173,6 @@ describe Braintree::Transaction do
|
|
2174
2173
|
end
|
2175
2174
|
|
2176
2175
|
it "can create a transaction with a fake apple pay nonce" do
|
2177
|
-
customer = Braintree::Customer.create!
|
2178
2176
|
result = Braintree::Transaction.create(
|
2179
2177
|
:type => "sale",
|
2180
2178
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2203,7 +2201,6 @@ describe Braintree::Transaction do
|
|
2203
2201
|
end
|
2204
2202
|
|
2205
2203
|
it "can create a vaulted transaction with a fake apple pay nonce" do
|
2206
|
-
customer = Braintree::Customer.create!
|
2207
2204
|
result = Braintree::Transaction.create(
|
2208
2205
|
:type => "sale",
|
2209
2206
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2225,7 +2222,6 @@ describe Braintree::Transaction do
|
|
2225
2222
|
end
|
2226
2223
|
|
2227
2224
|
it "can create a transaction with a fake google pay proxy card nonce" do
|
2228
|
-
customer = Braintree::Customer.create!
|
2229
2225
|
result = Braintree::Transaction.create(
|
2230
2226
|
:type => "sale",
|
2231
2227
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2257,7 +2253,6 @@ describe Braintree::Transaction do
|
|
2257
2253
|
end
|
2258
2254
|
|
2259
2255
|
it "can create a vaulted transaction with a fake google pay proxy card nonce" do
|
2260
|
-
customer = Braintree::Customer.create!
|
2261
2256
|
result = Braintree::Transaction.create(
|
2262
2257
|
:type => "sale",
|
2263
2258
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2282,7 +2277,6 @@ describe Braintree::Transaction do
|
|
2282
2277
|
end
|
2283
2278
|
|
2284
2279
|
it "can create a transaction with a fake google pay network token nonce" do
|
2285
|
-
customer = Braintree::Customer.create!
|
2286
2280
|
result = Braintree::Transaction.create(
|
2287
2281
|
:type => "sale",
|
2288
2282
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2335,7 +2329,6 @@ describe Braintree::Transaction do
|
|
2335
2329
|
end
|
2336
2330
|
|
2337
2331
|
it "can create a transaction with an unknown nonce" do
|
2338
|
-
customer = Braintree::Customer.create!
|
2339
2332
|
result = Braintree::Transaction.create(
|
2340
2333
|
:type => "sale",
|
2341
2334
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
@@ -2364,7 +2357,6 @@ describe Braintree::Transaction do
|
|
2364
2357
|
end
|
2365
2358
|
|
2366
2359
|
it "can create a transaction with a payee id" do
|
2367
|
-
customer = Braintree::Customer.create!
|
2368
2360
|
nonce = nonce_for_new_payment_method(
|
2369
2361
|
:paypal_account => {
|
2370
2362
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2388,7 +2380,6 @@ describe Braintree::Transaction do
|
|
2388
2380
|
end
|
2389
2381
|
|
2390
2382
|
it "can create a transaction with a payee id in the options params" do
|
2391
|
-
customer = Braintree::Customer.create!
|
2392
2383
|
nonce = nonce_for_new_payment_method(
|
2393
2384
|
:paypal_account => {
|
2394
2385
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2413,7 +2404,6 @@ describe Braintree::Transaction do
|
|
2413
2404
|
end
|
2414
2405
|
|
2415
2406
|
it "can create a transaction with a payee id in options.paypal" do
|
2416
|
-
customer = Braintree::Customer.create!
|
2417
2407
|
nonce = nonce_for_new_payment_method(
|
2418
2408
|
:paypal_account => {
|
2419
2409
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2439,7 +2429,6 @@ describe Braintree::Transaction do
|
|
2439
2429
|
end
|
2440
2430
|
|
2441
2431
|
it "can create a transaction with a payee email" do
|
2442
|
-
customer = Braintree::Customer.create!
|
2443
2432
|
nonce = nonce_for_new_payment_method(
|
2444
2433
|
:paypal_account => {
|
2445
2434
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2463,7 +2452,6 @@ describe Braintree::Transaction do
|
|
2463
2452
|
end
|
2464
2453
|
|
2465
2454
|
it "can create a transaction with a payee email in the options params" do
|
2466
|
-
customer = Braintree::Customer.create!
|
2467
2455
|
nonce = nonce_for_new_payment_method(
|
2468
2456
|
:paypal_account => {
|
2469
2457
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2488,7 +2476,6 @@ describe Braintree::Transaction do
|
|
2488
2476
|
end
|
2489
2477
|
|
2490
2478
|
it "can create a transaction with a payee email in options.paypal" do
|
2491
|
-
customer = Braintree::Customer.create!
|
2492
2479
|
nonce = nonce_for_new_payment_method(
|
2493
2480
|
:paypal_account => {
|
2494
2481
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2514,7 +2501,6 @@ describe Braintree::Transaction do
|
|
2514
2501
|
end
|
2515
2502
|
|
2516
2503
|
it "can create a transaction with a paypal custom field" do
|
2517
|
-
customer = Braintree::Customer.create!
|
2518
2504
|
nonce = nonce_for_new_payment_method(
|
2519
2505
|
:paypal_account => {
|
2520
2506
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2540,7 +2526,6 @@ describe Braintree::Transaction do
|
|
2540
2526
|
end
|
2541
2527
|
|
2542
2528
|
it "can create a transaction with a paypal description" do
|
2543
|
-
customer = Braintree::Customer.create!
|
2544
2529
|
nonce = nonce_for_new_payment_method(
|
2545
2530
|
:paypal_account => {
|
2546
2531
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -2566,7 +2551,6 @@ describe Braintree::Transaction do
|
|
2566
2551
|
end
|
2567
2552
|
|
2568
2553
|
it "can create a transaction with STC supplementary data" do
|
2569
|
-
customer = Braintree::Customer.create!
|
2570
2554
|
nonce = nonce_for_new_payment_method(
|
2571
2555
|
:paypal_account => {
|
2572
2556
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
@@ -3300,7 +3284,7 @@ describe Braintree::Transaction do
|
|
3300
3284
|
)
|
3301
3285
|
|
3302
3286
|
config = Braintree::Configuration.instantiate
|
3303
|
-
|
3287
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
3304
3288
|
transaction = Braintree::Transaction.find(transaction.id)
|
3305
3289
|
|
3306
3290
|
result = Braintree::Transaction.refund(
|
@@ -3390,7 +3374,7 @@ describe Braintree::Transaction do
|
|
3390
3374
|
},
|
3391
3375
|
)
|
3392
3376
|
config = Braintree::Configuration.instantiate
|
3393
|
-
|
3377
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
3394
3378
|
result = Braintree::Transaction.refund(transaction.id, :amount => "2046.00")
|
3395
3379
|
expect(result.success?).to eq(false)
|
3396
3380
|
expect(result.transaction.id).to match(/^\w{6,}$/)
|
@@ -3411,7 +3395,7 @@ describe Braintree::Transaction do
|
|
3411
3395
|
},
|
3412
3396
|
)
|
3413
3397
|
config = Braintree::Configuration.instantiate
|
3414
|
-
|
3398
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
3415
3399
|
result = Braintree::Transaction.refund(transaction.id, :amount => "2009.00")
|
3416
3400
|
expect(result.success?).to eq(false)
|
3417
3401
|
expect(result.transaction.id).to match(/^\w{6,}$/)
|
@@ -7256,7 +7240,7 @@ describe Braintree::Transaction do
|
|
7256
7240
|
)
|
7257
7241
|
|
7258
7242
|
config = Braintree::Configuration.instantiate
|
7259
|
-
|
7243
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
7260
7244
|
Braintree::Transaction.find(transaction.id)
|
7261
7245
|
end
|
7262
7246
|
|
@@ -7287,8 +7271,8 @@ describe Braintree::Transaction do
|
|
7287
7271
|
)
|
7288
7272
|
|
7289
7273
|
config = Braintree::Configuration.instantiate
|
7290
|
-
|
7291
|
-
|
7274
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
|
7275
|
+
config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/escrow")
|
7292
7276
|
Braintree::Transaction.find(transaction.id)
|
7293
7277
|
end
|
7294
7278
|
|
@@ -3,7 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
3
3
|
describe Braintree::Digest do
|
4
4
|
describe "self.hexdigest" do
|
5
5
|
it "returns the sha1 hmac of the input string (test case 6 from RFC 2202)" do
|
6
|
-
original_key = Braintree::Configuration.private_key
|
7
6
|
private_key = "\xaa" * 80
|
8
7
|
data = "Test Using Larger Than Block-Size Key - Hash Key First"
|
9
8
|
expect(Braintree::Digest.hexdigest(private_key, data)).to eq("aa4ae5e15272d00e95705637ce8a3b55ed402112")
|
@@ -5,7 +5,7 @@ describe Braintree::ErrorResult do
|
|
5
5
|
it "ignores data other than params, errors, and message" do
|
6
6
|
# so that we can add more data into the response in the future without breaking the client lib
|
7
7
|
expect do
|
8
|
-
|
8
|
+
Braintree::ErrorResult.new(
|
9
9
|
:gateway,
|
10
10
|
:params => "params",
|
11
11
|
:errors => {:errors => []},
|
@@ -4,7 +4,7 @@ describe Braintree::PayPalAccount do
|
|
4
4
|
describe "self.create" do
|
5
5
|
it "raises an exception if attributes contain an invalid key" do
|
6
6
|
expect do
|
7
|
-
|
7
|
+
Braintree::PayPalAccount.create(
|
8
8
|
:invalid_key => "bad stuff",
|
9
9
|
:options => {
|
10
10
|
:invalid_option => "bad option",
|
@@ -200,8 +200,8 @@ describe Braintree::Transaction do
|
|
200
200
|
},
|
201
201
|
)
|
202
202
|
|
203
|
-
expect(transaction.three_d_secure_info.enrolled).to eq("Y")
|
204
203
|
expect(transaction.three_d_secure_info.status).to eq("authenticate_successful")
|
204
|
+
expect(transaction.three_d_secure_info.enrolled).to eq("Y")
|
205
205
|
expect(transaction.three_d_secure_info.liability_shifted).to eq(true)
|
206
206
|
expect(transaction.three_d_secure_info.liability_shift_possible).to eq(true)
|
207
207
|
end
|
@@ -258,7 +258,7 @@ describe Braintree::Transaction do
|
|
258
258
|
end
|
259
259
|
|
260
260
|
it "handles receiving custom as an empty string" do
|
261
|
-
|
261
|
+
Braintree::Transaction._new(
|
262
262
|
:gateway,
|
263
263
|
:custom => "\n ",
|
264
264
|
)
|
@@ -168,6 +168,22 @@ describe Braintree::WebhookNotification do
|
|
168
168
|
expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
|
169
169
|
end
|
170
170
|
|
171
|
+
it "builds a sample notification for a dispute under_review webhook" do
|
172
|
+
sample_notification = Braintree::WebhookTesting.sample_notification(
|
173
|
+
Braintree::WebhookNotification::Kind::DisputeUnderReview,
|
174
|
+
dispute_id,
|
175
|
+
)
|
176
|
+
|
177
|
+
notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
|
178
|
+
|
179
|
+
expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeUnderReview)
|
180
|
+
|
181
|
+
dispute = notification.dispute
|
182
|
+
expect(dispute.status).to eq(Braintree::Dispute::Status::UnderReview)
|
183
|
+
expect(dispute.id).to eq(dispute_id)
|
184
|
+
expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
|
185
|
+
end
|
186
|
+
|
171
187
|
it "builds a sample notification for a dispute won webhook" do
|
172
188
|
sample_notification = Braintree::WebhookTesting.sample_notification(
|
173
189
|
Braintree::WebhookNotification::Kind::DisputeWon,
|
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.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|