braintree 4.19.0 → 4.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f43df747b2db22253268db6e5f01b79ea162b6c0911125b056b7bab73684dd3f
4
- data.tar.gz: 6fad0280817f00e0c0e3e8c6ef3761a5bd20d3e3a777a9f91182e556fad59aba
3
+ metadata.gz: 5738048bf9abc767f859d8f10d42baa075a3f5986dca2a1fe6bb86b744a2a29a
4
+ data.tar.gz: 994d4b0dce9d1d6da5cbf929cb4debd0460b85087396c6400ca854af3c5fb882
5
5
  SHA512:
6
- metadata.gz: 7e6aa6b5b10734d82c66f9f7f315c5759700412ddda2642e2424f71c8be71aca06d35aa77b69936514c8e3d0ddc2e5dd24d479e8c4359ff9d67e43222ebe0256
7
- data.tar.gz: f762c62cadc6476aebfc9f0f2aee72bd254b32b93c1c069c22c67661482ac433b2598ff1f86f2f1cad943dcf28878bac4f3293025d7b45e26cb34aec3c6fbc81
6
+ metadata.gz: 96280a78f3e0fbabdbf95f950ca6bd417c7ab02c10e23169cb3a9b829dddc59b125fbb36d6164ef108a52aaba199b5677e1e9c3f2c95e8e6e4e1468ec6ce10b8
7
+ data.tar.gz: 1a9ca31d02662aaa179da5e2031bf096ecebcdef55d0f9a514cb20693d44c378933f6430ae95cc395b57da0e7b026221ee2ac0ba9061142b595db866437a5db9
@@ -29,6 +29,7 @@ module Braintree
29
29
  [
30
30
  :address_id, :customer_id, :proxy_merchant_id, :merchant_account_id,
31
31
  :version,
32
+ {:domains => [:_any_key_]},
32
33
  {:options => [:make_default, :verify_card, :fail_on_duplicate_payment_method]}
33
34
  ]
34
35
  end
@@ -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
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 19
4
+ Minor = 20
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -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.19.0
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-06 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder