braintree 4.19.0 → 4.20.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/client_token_gateway.rb +1 -0
- data/lib/braintree/credit_card.rb +12 -0
- data/lib/braintree/credit_card_gateway.rb +6 -0
- data/lib/braintree/error_codes.rb +2 -0
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +28 -0
- data/spec/integration/braintree/credit_card_spec.rb +6 -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
|
|
@@ -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/version.rb
CHANGED
@@ -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})
|
@@ -707,6 +707,8 @@ describe Braintree::CreditCard do
|
|
707
707
|
end
|
708
708
|
end
|
709
709
|
|
710
|
+
# NEXT_MAJOR_VERSION remove this test
|
711
|
+
# CreditCard.credit has been deprecated in favor of Transaction.credit
|
710
712
|
describe "self.credit" do
|
711
713
|
it "creates a credit transaction using the payment method token, returning a result object" do
|
712
714
|
customer = Braintree::Customer.create!(
|
@@ -1338,6 +1340,8 @@ describe Braintree::CreditCard do
|
|
1338
1340
|
end
|
1339
1341
|
end
|
1340
1342
|
|
1343
|
+
# NEXT_MAJOR_VERSION remove these tests
|
1344
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
1341
1345
|
describe "self.sale" do
|
1342
1346
|
it "creates a sale transaction using the credit card, returning a result object" do
|
1343
1347
|
customer = Braintree::Customer.create!(
|
@@ -1381,6 +1385,8 @@ describe Braintree::CreditCard do
|
|
1381
1385
|
end
|
1382
1386
|
end
|
1383
1387
|
|
1388
|
+
# NEXT_MAJOR_VERSION remove this test
|
1389
|
+
# CreditCard.sale has been deprecated in favor of Transaction.sale
|
1384
1390
|
describe "self.sale!" do
|
1385
1391
|
it "creates a sale transaction using the credit card, returning the transaction" do
|
1386
1392
|
customer = Braintree::Customer.create!(
|
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-03-
|
11
|
+
date: 2024-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: builder
|