braintree 2.104.1 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/braintree.gemspec +7 -4
  4. data/lib/braintree.rb +7 -18
  5. data/lib/braintree/account_updater_daily_report.rb +1 -1
  6. data/lib/braintree/address.rb +1 -23
  7. data/lib/braintree/apple_pay.rb +1 -1
  8. data/lib/braintree/apple_pay_card.rb +1 -1
  9. data/lib/braintree/apple_pay_options.rb +1 -1
  10. data/lib/braintree/authorization_adjustment.rb +1 -1
  11. data/lib/braintree/base_module.rb +6 -0
  12. data/lib/braintree/bin_data.rb +9 -2
  13. data/lib/braintree/client_token.rb +1 -1
  14. data/lib/braintree/configuration.rb +12 -12
  15. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  16. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  17. data/lib/braintree/credit_card.rb +2 -77
  18. data/lib/braintree/credit_card_gateway.rb +7 -36
  19. data/lib/braintree/credit_card_verification.rb +18 -5
  20. data/lib/braintree/credit_card_verification_search.rb +1 -1
  21. data/lib/braintree/customer.rb +5 -76
  22. data/lib/braintree/customer_gateway.rb +0 -23
  23. data/lib/braintree/customer_search.rb +1 -1
  24. data/lib/braintree/disbursement.rb +1 -1
  25. data/lib/braintree/dispute.rb +2 -8
  26. data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
  27. data/lib/braintree/dispute_gateway.rb +4 -9
  28. data/lib/braintree/dispute_search.rb +2 -2
  29. data/lib/braintree/document_upload.rb +1 -1
  30. data/lib/braintree/error_codes.rb +151 -170
  31. data/lib/braintree/exceptions.rb +5 -3
  32. data/lib/braintree/gateway.rb +0 -14
  33. data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +2 -3
  34. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  35. data/lib/braintree/graphql_client.rb +7 -7
  36. data/lib/braintree/http.rb +3 -3
  37. data/lib/braintree/local_payment_completed.rb +1 -1
  38. data/lib/braintree/local_payment_reversed.rb +19 -0
  39. data/lib/braintree/merchant.rb +1 -1
  40. data/lib/braintree/merchant_account.rb +1 -1
  41. data/lib/braintree/merchant_account_gateway.rb +3 -1
  42. data/lib/braintree/merchant_gateway.rb +1 -1
  43. data/lib/braintree/modification.rb +1 -1
  44. data/lib/braintree/oauth_credentials.rb +1 -1
  45. data/lib/braintree/oauth_gateway.rb +5 -5
  46. data/lib/braintree/payment_instrument_type.rb +10 -14
  47. data/lib/braintree/payment_method_gateway.rb +8 -13
  48. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  49. data/lib/braintree/payment_method_parser.rb +1 -8
  50. data/lib/braintree/plan.rb +1 -1
  51. data/lib/braintree/processor_response_types.rb +3 -3
  52. data/lib/braintree/resource_collection.rb +8 -3
  53. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  54. data/lib/braintree/risk_data.rb +3 -1
  55. data/lib/braintree/samsung_pay_card.rb +1 -1
  56. data/lib/braintree/settlement_batch_summary.rb +2 -2
  57. data/lib/braintree/subscription.rb +11 -11
  58. data/lib/braintree/successful_result.rb +0 -1
  59. data/lib/braintree/test/credit_card.rb +1 -0
  60. data/lib/braintree/test/nonce.rb +4 -23
  61. data/lib/braintree/three_d_secure_info.rb +22 -12
  62. data/lib/braintree/transaction.rb +44 -104
  63. data/lib/braintree/transaction/disbursement_details.rb +1 -0
  64. data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
  65. data/lib/braintree/transaction/installment.rb +28 -0
  66. data/lib/braintree/transaction/installment/adjustment.rb +33 -0
  67. data/lib/braintree/transaction/paypal_details.rb +1 -0
  68. data/lib/braintree/transaction/subscription_details.rb +2 -0
  69. data/lib/braintree/transaction_gateway.rb +37 -25
  70. data/lib/braintree/transaction_line_item.rb +1 -1
  71. data/lib/braintree/transaction_search.rb +3 -2
  72. data/lib/braintree/unknown_payment_method.rb +1 -1
  73. data/lib/braintree/us_bank_account.rb +3 -3
  74. data/lib/braintree/us_bank_account_verification.rb +1 -1
  75. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  76. data/lib/braintree/util.rb +21 -6
  77. data/lib/braintree/venmo_account.rb +1 -1
  78. data/lib/braintree/version.rb +3 -3
  79. data/lib/braintree/visa_checkout_card.rb +2 -2
  80. data/lib/braintree/webhook_notification.rb +28 -29
  81. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  82. data/lib/braintree/webhook_testing_gateway.rb +10 -43
  83. data/lib/braintree/xml/generator.rb +5 -4
  84. data/lib/braintree/xml/libxml.rb +1 -0
  85. data/lib/braintree/xml/parser.rb +21 -44
  86. data/spec/integration/braintree/add_on_spec.rb +1 -1
  87. data/spec/integration/braintree/address_spec.rb +26 -113
  88. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  89. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  90. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  91. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  92. data/spec/integration/braintree/client_api/spec_helper.rb +5 -31
  93. data/spec/integration/braintree/credit_card_spec.rb +130 -593
  94. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  95. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  96. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  97. data/spec/integration/braintree/customer_spec.rb +336 -509
  98. data/spec/integration/braintree/dispute_search_spec.rb +6 -6
  99. data/spec/integration/braintree/dispute_spec.rb +6 -7
  100. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  101. data/spec/integration/braintree/http_spec.rb +2 -2
  102. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  103. data/spec/integration/braintree/merchant_spec.rb +14 -14
  104. data/spec/integration/braintree/oauth_spec.rb +11 -11
  105. data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
  106. data/spec/integration/braintree/payment_method_spec.rb +403 -269
  107. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
  108. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  109. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  110. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  111. data/spec/integration/braintree/subscription_spec.rb +144 -149
  112. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  113. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  114. data/spec/integration/braintree/transaction_search_spec.rb +96 -70
  115. data/spec/integration/braintree/transaction_spec.rb +832 -904
  116. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
  117. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  118. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  119. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  120. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  121. data/spec/integration/spec_helper.rb +10 -7
  122. data/spec/oauth_test_helper.rb +1 -1
  123. data/spec/script/httpsd.rb +6 -6
  124. data/spec/spec_helper.rb +6 -14
  125. data/spec/unit/braintree/address_spec.rb +1 -9
  126. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  127. data/spec/unit/braintree/client_token_spec.rb +2 -2
  128. data/spec/unit/braintree/configuration_spec.rb +42 -42
  129. data/spec/unit/braintree/credit_card_spec.rb +9 -28
  130. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  131. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  132. data/spec/unit/braintree/customer_spec.rb +5 -16
  133. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  134. data/spec/unit/braintree/dispute_spec.rb +9 -20
  135. data/spec/unit/braintree/error_result_spec.rb +5 -5
  136. data/spec/unit/braintree/errors_spec.rb +8 -8
  137. data/spec/unit/braintree/http_spec.rb +8 -8
  138. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  139. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  140. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  141. data/spec/unit/braintree/resource_collection_spec.rb +30 -1
  142. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  143. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  144. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  145. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  146. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  147. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  148. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  149. data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
  150. data/spec/unit/braintree/transaction/paypal_details_spec.rb +3 -1
  151. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  152. data/spec/unit/braintree/transaction_spec.rb +25 -51
  153. data/spec/unit/braintree/util_spec.rb +55 -21
  154. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  155. data/spec/unit/braintree/webhook_notification_spec.rb +73 -57
  156. data/spec/unit/braintree/xml/parser_spec.rb +21 -16
  157. data/spec/unit/braintree/xml_spec.rb +31 -31
  158. metadata +30 -31
  159. data/lib/braintree/amex_express_checkout_card.rb +0 -40
  160. data/lib/braintree/coinbase_account.rb +0 -34
  161. data/lib/braintree/europe_bank_account.rb +0 -36
  162. data/lib/braintree/europe_bank_account_gateway.rb +0 -17
  163. data/lib/braintree/ideal_payment.rb +0 -61
  164. data/lib/braintree/ideal_payment_gateway.rb +0 -19
  165. data/lib/braintree/masterpass_card.rb +0 -83
  166. data/lib/braintree/settlement_batch.rb +0 -0
  167. data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
  168. data/lib/braintree/transaction/coinbase_details.rb +0 -16
  169. data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
  170. data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
  171. data/lib/braintree/transparent_redirect.rb +0 -40
  172. data/lib/braintree/transparent_redirect_gateway.rb +0 -105
  173. data/lib/braintree/xml/rexml.rb +0 -71
  174. data/spec/hacks/tcp_socket.rb +0 -18
  175. data/spec/integration/braintree/coinbase_spec.rb +0 -34
  176. data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
  177. data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
  178. data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
  179. data/spec/unit/braintree/xml/rexml_spec.rb +0 -51
@@ -10,7 +10,7 @@ module Braintree
10
10
  def self.create_token(gateway, params)
11
11
  code = create_grant(gateway, params)
12
12
  gateway.oauth.create_token_from_code(
13
- :code => code
13
+ :code => code,
14
14
  )
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
- require 'webrick'
3
- require 'webrick/https'
4
- require 'openssl'
2
+ require "webrick"
3
+ require "webrick/https"
4
+ require "openssl"
5
5
 
6
6
  private_key_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "privateKey.key"))
7
7
  cert_file = File.expand_path(File.join(File.dirname(__FILE__), "..", "ssl", "certificate.crt"))
@@ -12,7 +12,7 @@ cert = OpenSSL::X509::Certificate.new(File.read(cert_file))
12
12
  pid_file = ARGV[0]
13
13
 
14
14
  s = WEBrick::HTTPServer.new(
15
- :Port => (ENV['SSL_TEST_PORT'] || 8444),
15
+ :Port => (ENV["SSL_TEST_PORT"] || 8444),
16
16
  :Logger => WEBrick::Log::new(nil, WEBrick::Log::ERROR),
17
17
  :DocumentRoot => File.join(File.dirname(__FILE__)),
18
18
  :ServerType => WEBrick::Daemon,
@@ -21,7 +21,7 @@ s = WEBrick::HTTPServer.new(
21
21
  :SSLCertificate => cert,
22
22
  :SSLPrivateKey => pkey,
23
23
  :SSLCertName => [ [ "CN",WEBrick::Utils::getservername ] ],
24
- :StartCallback => proc { File.open(pid_file, "w") { |f| f.write $$.to_s }}
24
+ :StartCallback => proc { File.open(pid_file, "w") { |f| f.write $$.to_s } },
25
25
  )
26
- trap("INT"){ s.shutdown }
26
+ trap("INT") { s.shutdown }
27
27
  s.start
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,6 @@ unless defined?(SPEC_HELPER_LOADED)
4
4
  require "rubygems"
5
5
  require "bundler/setup"
6
6
  require "rspec"
7
- require "libxml"
8
7
  require "pry"
9
8
 
10
9
  braintree_lib = "#{project_root}/lib"
@@ -28,10 +27,6 @@ unless defined?(SPEC_HELPER_LOADED)
28
27
  end
29
28
  end
30
29
 
31
- def now_in_eastern
32
- (Time.now.utc - 5*60*60).strftime("%Y-%m-%d")
33
- end
34
-
35
30
  module SpecHelper
36
31
 
37
32
  DefaultMerchantAccountId = "sandbox_credit_card"
@@ -44,6 +39,8 @@ unless defined?(SPEC_HELPER_LOADED)
44
39
  AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
45
40
  AdyenMerchantAccountId = "adyen_ma"
46
41
  HiperBRLMerchantAccountId = "hiper_brl"
42
+ CardProcessorBRLMerchantAccountId = "card_processor_brl"
43
+ FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
47
44
 
48
45
  TrialPlan = {
49
46
  :description => "Plan for integration tests -- with trial",
@@ -92,13 +89,13 @@ unless defined?(SPEC_HELPER_LOADED)
92
89
  :environment => Braintree::Configuration.environment,
93
90
  :merchant_id => "test_merchant_id",
94
91
  :public_key => "test_public_key",
95
- :private_key => "test_private_key"
92
+ :private_key => "test_private_key",
96
93
  )
97
94
 
98
95
  def self.make_past_due(subscription, number_of_days_past_due = 1)
99
96
  config = Braintree::Configuration.instantiate
100
97
  config.http.put(
101
- "#{config.base_merchant_path}/subscriptions/#{subscription.id}/make_past_due?days_past_due=#{number_of_days_past_due}"
98
+ "#{config.base_merchant_path}/subscriptions/#{subscription.id}/make_past_due?days_past_due=#{number_of_days_past_due}",
102
99
  )
103
100
  end
104
101
 
@@ -117,7 +114,7 @@ unless defined?(SPEC_HELPER_LOADED)
117
114
  gateway = Braintree::Gateway.new(
118
115
  :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
119
116
  :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
120
- :logger => Logger.new("/dev/null")
117
+ :logger => Logger.new("/dev/null"),
121
118
  )
122
119
 
123
120
  gateway.merchant.create({
@@ -188,16 +185,11 @@ unless defined?(SPEC_HELPER_LOADED)
188
185
  end
189
186
 
190
187
  def matches?(xml_string)
191
- @libxml_parse = Braintree::Xml::Parser.hash_from_xml(xml_string, Braintree::Xml::Libxml)
192
- @rexml_parse = Braintree::Xml::Parser.hash_from_xml(xml_string, Braintree::Xml::Rexml)
188
+ @libxml_parse = Braintree::Xml::Parser.hash_from_xml(xml_string)
193
189
  if @libxml_parse != @expected_hash
194
190
  @results = @libxml_parse
195
191
  @failed_parser = "libxml"
196
192
  false
197
- elsif @rexml_parse != @expected_hash
198
- @results = @rexml_parse
199
- @failed_parser = "rexml"
200
- false
201
193
  else
202
194
  true
203
195
  end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
3
3
  describe Braintree::Address do
4
4
  describe "==" do
5
5
  it "returns true if given an address with the same id and customer_id" do
6
- first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => 'a1')
6
+ first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
7
7
  second = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
8
8
 
9
9
  first.should == second
@@ -94,12 +94,4 @@ describe Braintree::Address do
94
94
  end.to raise_error(NoMethodError, /protected method .new/)
95
95
  end
96
96
  end
97
-
98
- describe "update" do
99
- it "raises an exception if hash includes an invalid key" do
100
- expect do
101
- Braintree::Address._new(Braintree::Configuration.gateway, {}).update(:street_address => "456 E Main", :invalid_key2 => "foo")
102
- end.to raise_error(ArgumentError, "invalid keys: invalid_key2")
103
- end
104
- end
105
97
  end
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
3
3
  describe Braintree::ApplePayCard do
4
4
  describe "bin" do
5
5
  it "returns Apple pay card bin" do
6
- Braintree::ApplePayCard._new(:gateway, bin: '411111').bin.should == '411111'
6
+ Braintree::ApplePayCard._new(:gateway, bin: "411111").bin.should == "411111"
7
7
  end
8
8
  end
9
9
 
@@ -16,7 +16,7 @@ module Braintree
16
16
  expect {
17
17
  client_token = Braintree::ClientToken.generate(
18
18
  :public_key => "bad_key",
19
- :created_at => "bad_time"
19
+ :created_at => "bad_time",
20
20
  )
21
21
  }.to raise_error(ArgumentError, /created_at, public_key/)
22
22
  end
@@ -27,7 +27,7 @@ module Braintree
27
27
  it "raises an ArgumentError if #{option_name} is present" do
28
28
  expect do
29
29
  Braintree::ClientToken.generate(
30
- option_name.to_sym => true
30
+ option_name.to_sym => true,
31
31
  )
32
32
  end.to raise_error(ArgumentError, /#{option_name}/)
33
33
  end
@@ -1,4 +1,4 @@
1
- require 'stringio'
1
+ require "stringio"
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
4
4
 
@@ -22,26 +22,26 @@ describe Braintree::Configuration do
22
22
  describe "initialize" do
23
23
  it "accepts merchant credentials" do
24
24
  config = Braintree::Configuration.new(
25
- :merchant_id => 'merchant_id',
26
- :public_key => 'public_key',
27
- :private_key => 'private_key'
25
+ :merchant_id => "merchant_id",
26
+ :public_key => "public_key",
27
+ :private_key => "private_key",
28
28
  )
29
29
 
30
- config.merchant_id.should == 'merchant_id'
31
- config.public_key.should == 'public_key'
32
- config.private_key.should == 'private_key'
30
+ config.merchant_id.should == "merchant_id"
31
+ config.public_key.should == "public_key"
32
+ config.private_key.should == "private_key"
33
33
  end
34
34
 
35
35
  it "accepts partner credentials" do
36
36
  config = Braintree::Configuration.new(
37
- :partner_id => 'partner_id',
38
- :public_key => 'public_key',
39
- :private_key => 'private_key'
37
+ :partner_id => "partner_id",
38
+ :public_key => "public_key",
39
+ :private_key => "private_key",
40
40
  )
41
41
 
42
- config.merchant_id.should == 'partner_id'
43
- config.public_key.should == 'public_key'
44
- config.private_key.should == 'private_key'
42
+ config.merchant_id.should == "partner_id"
43
+ config.public_key.should == "public_key"
44
+ config.private_key.should == "private_key"
45
45
  end
46
46
 
47
47
  it "raises if combining client_id/secret with access_token" do
@@ -49,7 +49,7 @@ describe Braintree::Configuration do
49
49
  Braintree::Configuration.new(
50
50
  :client_id => "client_id$development$integration_client_id",
51
51
  :client_secret => "client_secret$development$integration_client_secret",
52
- :access_token => "access_token$development$integration_merchant_id$fb27c79dd"
52
+ :access_token => "access_token$development$integration_merchant_id$fb27c79dd",
53
53
  )
54
54
  end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
55
55
  end
@@ -62,7 +62,7 @@ describe Braintree::Configuration do
62
62
  :merchant_id => "merchant_id",
63
63
  :public_key => "public_key",
64
64
  :private_key => "private_key",
65
- :environment => "development"
65
+ :environment => "development",
66
66
  )
67
67
  end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
68
68
  end
@@ -96,21 +96,21 @@ describe Braintree::Configuration do
96
96
 
97
97
  it "accepts proxy params" do
98
98
  config = Braintree::Configuration.new(
99
- :proxy_address => 'localhost',
99
+ :proxy_address => "localhost",
100
100
  :proxy_port => 8080,
101
- :proxy_user => 'user',
102
- :proxy_pass => 'test'
101
+ :proxy_user => "user",
102
+ :proxy_pass => "test",
103
103
  )
104
104
 
105
- config.proxy_address.should == 'localhost'
105
+ config.proxy_address.should == "localhost"
106
106
  config.proxy_port.should == 8080
107
- config.proxy_user.should == 'user'
108
- config.proxy_pass.should == 'test'
107
+ config.proxy_user.should == "user"
108
+ config.proxy_pass.should == "test"
109
109
  end
110
110
 
111
111
  it "accepts ssl version" do
112
112
  config = Braintree::Configuration.new(
113
- :ssl_version => :TLSv1_2
113
+ :ssl_version => :TLSv1_2,
114
114
  )
115
115
 
116
116
  config.ssl_version.should == :TLSv1_2
@@ -146,14 +146,14 @@ describe Braintree::Configuration do
146
146
  Braintree::Configuration.environment = :sandbox
147
147
  ca_file = Braintree::Configuration.instantiate.ca_file
148
148
  ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
149
- File.exists?(ca_file).should == true
149
+ File.exist?(ca_file).should == true
150
150
  end
151
151
 
152
152
  it "production" do
153
153
  Braintree::Configuration.environment = :production
154
154
  ca_file = Braintree::Configuration.instantiate.ca_file
155
155
  ca_file.should match(/api_braintreegateway_com\.ca\.crt$/)
156
- File.exists?(ca_file).should == true
156
+ File.exist?(ca_file).should == true
157
157
  end
158
158
  end
159
159
 
@@ -238,12 +238,12 @@ describe Braintree::Configuration do
238
238
 
239
239
  it "allows the environment to be set with a string value" do
240
240
  expect do
241
- Braintree::Configuration.environment = 'sandbox'
241
+ Braintree::Configuration.environment = "sandbox"
242
242
  end.not_to raise_error
243
243
  end
244
244
 
245
245
  it "sets the environment as a symbol" do
246
- Braintree::Configuration.environment = 'sandbox'
246
+ Braintree::Configuration.environment = "sandbox"
247
247
  expect(Braintree::Configuration.environment).to eq :sandbox
248
248
  end
249
249
  end
@@ -326,15 +326,15 @@ describe Braintree::Configuration do
326
326
 
327
327
  it "is 3000 or GATEWAY_PORT environment variable for development" do
328
328
  Braintree::Configuration.environment = :development
329
- old_gateway_port = ENV['GATEWAY_PORT']
329
+ old_gateway_port = ENV["GATEWAY_PORT"]
330
330
  begin
331
- ENV['GATEWAY_PORT'] = nil
331
+ ENV["GATEWAY_PORT"] = nil
332
332
  Braintree::Configuration.instantiate.port.should == 3000
333
333
 
334
- ENV['GATEWAY_PORT'] = '1234'
335
- Braintree::Configuration.instantiate.port.should == '1234'
334
+ ENV["GATEWAY_PORT"] = "1234"
335
+ Braintree::Configuration.instantiate.port.should == "1234"
336
336
  ensure
337
- ENV['GATEWAY_PORT'] = old_gateway_port
337
+ ENV["GATEWAY_PORT"] = old_gateway_port
338
338
  end
339
339
  end
340
340
  end
@@ -359,15 +359,15 @@ describe Braintree::Configuration do
359
359
  describe "graphql_server" do
360
360
  it "is localhost or GRAPHQL_HOST environment variable for development" do
361
361
  Braintree::Configuration.environment = :development
362
- old_gateway_url = ENV['GRAPHQL_HOST']
362
+ old_gateway_url = ENV["GRAPHQL_HOST"]
363
363
  begin
364
- ENV['GRAPHQL_HOST'] = nil
364
+ ENV["GRAPHQL_HOST"] = nil
365
365
  Braintree::Configuration.instantiate.graphql_server.should == "graphql.bt.local"
366
366
 
367
- ENV['GRAPHQL_HOST'] = 'gateway'
368
- Braintree::Configuration.instantiate.graphql_server.should == 'gateway'
367
+ ENV["GRAPHQL_HOST"] = "gateway"
368
+ Braintree::Configuration.instantiate.graphql_server.should == "gateway"
369
369
  ensure
370
- ENV['GRAPHQL_HOST'] = old_gateway_url
370
+ ENV["GRAPHQL_HOST"] = old_gateway_url
371
371
  end
372
372
  end
373
373
  end
@@ -375,15 +375,15 @@ describe Braintree::Configuration do
375
375
  describe "server" do
376
376
  it "is localhost or GATEWAY_HOST environment variable for development" do
377
377
  Braintree::Configuration.environment = :development
378
- old_gateway_url = ENV['GATEWAY_HOST']
378
+ old_gateway_url = ENV["GATEWAY_HOST"]
379
379
  begin
380
- ENV['GATEWAY_HOST'] = nil
380
+ ENV["GATEWAY_HOST"] = nil
381
381
  Braintree::Configuration.instantiate.server.should == "localhost"
382
382
 
383
- ENV['GATEWAY_HOST'] = 'gateway'
384
- Braintree::Configuration.instantiate.server.should == 'gateway'
383
+ ENV["GATEWAY_HOST"] = "gateway"
384
+ Braintree::Configuration.instantiate.server.should == "gateway"
385
385
  ensure
386
- ENV['GATEWAY_HOST'] = old_gateway_url
386
+ ENV["GATEWAY_HOST"] = old_gateway_url
387
387
  end
388
388
  end
389
389
 
@@ -468,7 +468,7 @@ describe Braintree::Configuration do
468
468
  it "masks the private_key" do
469
469
  config = Braintree::Configuration.new(:private_key => "secret_key")
470
470
  config.inspect.should include('@private_key="[FILTERED]"')
471
- config.inspect.should_not include('secret_key')
471
+ config.inspect.should_not include("secret_key")
472
472
  end
473
473
  end
474
474
 
@@ -4,7 +4,7 @@ describe Braintree::CreditCard 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
- Braintree::CreditCard.create(:invalid_key => 'val')
7
+ Braintree::CreditCard.create(:invalid_key => "val")
8
8
  end.to raise_error(ArgumentError, "invalid keys: invalid_key")
9
9
  end
10
10
  end
@@ -15,7 +15,6 @@ describe Braintree::CreditCard do
15
15
  :billing_address_id,
16
16
  :cardholder_name,
17
17
  :cvv,
18
- :device_session_id,
19
18
  :expiration_date,
20
19
  :expiration_month,
21
20
  :expiration_year,
@@ -23,10 +22,9 @@ describe Braintree::CreditCard do
23
22
  :token,
24
23
  :venmo_sdk_payment_method_code,
25
24
  :device_data,
26
- :fraud_merchant_id,
27
25
  :payment_method_nonce,
28
26
  {:external_vault=>[:network_transaction_id]},
29
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
27
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
30
28
  {:billing_address => [
31
29
  :company,
32
30
  :country_code_alpha2,
@@ -63,7 +61,6 @@ describe Braintree::CreditCard do
63
61
  :billing_address_id,
64
62
  :cardholder_name,
65
63
  :cvv,
66
- :device_session_id,
67
64
  :expiration_date,
68
65
  :expiration_month,
69
66
  :expiration_year,
@@ -71,10 +68,9 @@ describe Braintree::CreditCard do
71
68
  :token,
72
69
  :venmo_sdk_payment_method_code,
73
70
  :device_data,
74
- :fraud_merchant_id,
75
71
  :payment_method_nonce,
76
72
  {:external_vault=>[:network_transaction_id]},
77
- {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
73
+ {:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
78
74
  {:billing_address => [
79
75
  :company,
80
76
  :country_code_alpha2,
@@ -105,21 +101,6 @@ describe Braintree::CreditCard do
105
101
  end
106
102
  end
107
103
 
108
- describe "self.create_from_transparent_redirect" do
109
- it "raises an exception if the query string is forged" do
110
- expect do
111
- Braintree::CreditCard.create_from_transparent_redirect("http_status=200&forged=query_string")
112
- end.to raise_error(Braintree::ForgedQueryString)
113
- end
114
- end
115
-
116
- describe "self.create_credit_card_url" do
117
- it "returns the url" do
118
- config = Braintree::Configuration.instantiate
119
- Braintree::CreditCard.create_credit_card_url.should == "http#{config.ssl? ? 's' : ''}://#{config.server}:#{config.port}/merchants/integration_merchant_id/payment_methods/all/create_via_transparent_redirect_request"
120
- end
121
- end
122
-
123
104
  describe "==" do
124
105
  it "returns true if given a credit card with the same token" do
125
106
  first = Braintree::CreditCard._new(:gateway, :token => 123)
@@ -222,7 +203,7 @@ describe Braintree::CreditCard do
222
203
  credit_card = Braintree::CreditCard._new(
223
204
  :gateway,
224
205
  :bin => "510510",
225
- :last_4 => "5100"
206
+ :last_4 => "5100",
226
207
  )
227
208
  credit_card.masked_number.should == "510510******5100"
228
209
  end
@@ -234,7 +215,7 @@ describe Braintree::CreditCard do
234
215
  :gateway,
235
216
  :bin => "510510",
236
217
  :last_4 => "5100",
237
- :is_network_tokenized => true
218
+ :is_network_tokenized => true,
238
219
  )
239
220
  credit_card.is_network_tokenized?.should == true
240
221
  end
@@ -244,7 +225,7 @@ describe Braintree::CreditCard do
244
225
  :gateway,
245
226
  :bin => "510510",
246
227
  :last_4 => "5100",
247
- :is_network_tokenized => false
228
+ :is_network_tokenized => false,
248
229
  )
249
230
  credit_card.is_network_tokenized?.should == false
250
231
  end
@@ -253,7 +234,7 @@ describe Braintree::CreditCard do
253
234
  describe "self.update" do
254
235
  it "raises an exception if attributes contain an invalid key" do
255
236
  expect do
256
- Braintree::CreditCard._new(Braintree::Configuration.gateway, {}).update(:invalid_key => 'val')
237
+ Braintree::CreditCard.update(:gateway, :invalid_key => "val")
257
238
  end.to raise_error(ArgumentError, "invalid keys: invalid_key")
258
239
  end
259
240
  end
@@ -269,8 +250,8 @@ describe Braintree::CreditCard do
269
250
  describe "self._new" do
270
251
  describe "initializing verification" do
271
252
  it "picks the youngest verification" do
272
- verification1 = { :created_at => Time.now, :id => 123 }
273
- verification2 = { :created_at => Time.now - 3600, :id => 456 }
253
+ verification1 = {:created_at => Time.now, :id => 123}
254
+ verification2 = {:created_at => Time.now - 3600, :id => 456}
274
255
  credit_card = Braintree::CreditCard._new(Braintree::Configuration.gateway, {:verifications => [verification1, verification2]})
275
256
  credit_card.verification.id.should == 123
276
257
  end