braintree 3.1.0 → 4.1.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/braintree.gemspec +3 -3
- data/lib/braintree.rb +8 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +12 -4
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +11 -8
- data/lib/braintree/payment_method_nonce.rb +1 -1
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +40 -24
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction_gateway.rb +27 -6
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +433 -149
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
- data/spec/integration/braintree/payment_method_spec.rb +430 -149
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +752 -383
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +21 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +18 -8
- data/lib/braintree/settlement_batch.rb +0 -0
data/spec/oauth_test_helper.rb
CHANGED
data/spec/script/httpsd.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
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[
|
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
@@ -3,6 +3,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
3
3
|
project_root = File.expand_path(File.dirname(__FILE__) + "/..")
|
4
4
|
require "rubygems"
|
5
5
|
require "bundler/setup"
|
6
|
+
require "libxml"
|
6
7
|
require "rspec"
|
7
8
|
require "pry"
|
8
9
|
|
@@ -39,6 +40,8 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
39
40
|
AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
|
40
41
|
AdyenMerchantAccountId = "adyen_ma"
|
41
42
|
HiperBRLMerchantAccountId = "hiper_brl"
|
43
|
+
CardProcessorBRLMerchantAccountId = "card_processor_brl"
|
44
|
+
FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
|
42
45
|
|
43
46
|
TrialPlan = {
|
44
47
|
:description => "Plan for integration tests -- with trial",
|
@@ -87,13 +90,13 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
87
90
|
:environment => Braintree::Configuration.environment,
|
88
91
|
:merchant_id => "test_merchant_id",
|
89
92
|
:public_key => "test_public_key",
|
90
|
-
:private_key => "test_private_key"
|
93
|
+
:private_key => "test_private_key",
|
91
94
|
)
|
92
95
|
|
93
96
|
def self.make_past_due(subscription, number_of_days_past_due = 1)
|
94
97
|
config = Braintree::Configuration.instantiate
|
95
98
|
config.http.put(
|
96
|
-
"#{config.base_merchant_path}/subscriptions/#{subscription.id}/make_past_due?days_past_due=#{number_of_days_past_due}"
|
99
|
+
"#{config.base_merchant_path}/subscriptions/#{subscription.id}/make_past_due?days_past_due=#{number_of_days_past_due}",
|
97
100
|
)
|
98
101
|
end
|
99
102
|
|
@@ -112,7 +115,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
112
115
|
gateway = Braintree::Gateway.new(
|
113
116
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
114
117
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
115
|
-
:logger => Logger.new("/dev/null")
|
118
|
+
:logger => Logger.new("/dev/null"),
|
116
119
|
)
|
117
120
|
|
118
121
|
gateway.merchant.create({
|
@@ -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 =>
|
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
|
@@ -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:
|
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
|
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 =>
|
26
|
-
:public_key =>
|
27
|
-
: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 ==
|
31
|
-
config.public_key.should ==
|
32
|
-
config.private_key.should ==
|
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 =>
|
38
|
-
:public_key =>
|
39
|
-
: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 ==
|
43
|
-
config.public_key.should ==
|
44
|
-
config.private_key.should ==
|
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 =>
|
99
|
+
:proxy_address => "localhost",
|
100
100
|
:proxy_port => 8080,
|
101
|
-
:proxy_user =>
|
102
|
-
:proxy_pass =>
|
101
|
+
:proxy_user => "user",
|
102
|
+
:proxy_pass => "test",
|
103
103
|
)
|
104
104
|
|
105
|
-
config.proxy_address.should ==
|
105
|
+
config.proxy_address.should == "localhost"
|
106
106
|
config.proxy_port.should == 8080
|
107
|
-
config.proxy_user.should ==
|
108
|
-
config.proxy_pass.should ==
|
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.
|
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.
|
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 =
|
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 =
|
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[
|
329
|
+
old_gateway_port = ENV["GATEWAY_PORT"]
|
330
330
|
begin
|
331
|
-
ENV[
|
331
|
+
ENV["GATEWAY_PORT"] = nil
|
332
332
|
Braintree::Configuration.instantiate.port.should == 3000
|
333
333
|
|
334
|
-
ENV[
|
335
|
-
Braintree::Configuration.instantiate.port.should ==
|
334
|
+
ENV["GATEWAY_PORT"] = "1234"
|
335
|
+
Braintree::Configuration.instantiate.port.should == "1234"
|
336
336
|
ensure
|
337
|
-
ENV[
|
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[
|
362
|
+
old_gateway_url = ENV["GRAPHQL_HOST"]
|
363
363
|
begin
|
364
|
-
ENV[
|
364
|
+
ENV["GRAPHQL_HOST"] = nil
|
365
365
|
Braintree::Configuration.instantiate.graphql_server.should == "graphql.bt.local"
|
366
366
|
|
367
|
-
ENV[
|
368
|
-
Braintree::Configuration.instantiate.graphql_server.should ==
|
367
|
+
ENV["GRAPHQL_HOST"] = "gateway"
|
368
|
+
Braintree::Configuration.instantiate.graphql_server.should == "gateway"
|
369
369
|
ensure
|
370
|
-
ENV[
|
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[
|
378
|
+
old_gateway_url = ENV["GATEWAY_HOST"]
|
379
379
|
begin
|
380
|
-
ENV[
|
380
|
+
ENV["GATEWAY_HOST"] = nil
|
381
381
|
Braintree::Configuration.instantiate.server.should == "localhost"
|
382
382
|
|
383
|
-
ENV[
|
384
|
-
Braintree::Configuration.instantiate.server.should ==
|
383
|
+
ENV["GATEWAY_HOST"] = "gateway"
|
384
|
+
Braintree::Configuration.instantiate.server.should == "gateway"
|
385
385
|
ensure
|
386
|
-
ENV[
|
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(
|
471
|
+
config.inspect.should_not include("secret_key")
|
472
472
|
end
|
473
473
|
end
|
474
474
|
|
@@ -4,14 +4,14 @@ 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 =>
|
7
|
+
Braintree::CreditCard.create(:invalid_key => "val")
|
8
8
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "self.create_signature" do
|
13
13
|
it "should be what we expect" do
|
14
|
-
Braintree::CreditCardGateway._create_signature.
|
14
|
+
expect(Braintree::CreditCardGateway._create_signature).to match([
|
15
15
|
:billing_address_id,
|
16
16
|
:cardholder_name,
|
17
17
|
:cvv,
|
@@ -24,7 +24,7 @@ describe Braintree::CreditCard do
|
|
24
24
|
:device_data,
|
25
25
|
:payment_method_nonce,
|
26
26
|
{:external_vault=>[:network_transaction_id]},
|
27
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
27
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
28
28
|
{:billing_address => [
|
29
29
|
:company,
|
30
30
|
:country_code_alpha2,
|
@@ -51,13 +51,13 @@ describe Braintree::CreditCard do
|
|
51
51
|
:ds_transaction_id,
|
52
52
|
]},
|
53
53
|
:customer_id,
|
54
|
-
]
|
54
|
+
])
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "self.update_signature" do
|
59
59
|
it "should be what we expect" do
|
60
|
-
Braintree::CreditCardGateway._update_signature.
|
60
|
+
expect(Braintree::CreditCardGateway._update_signature).to match([
|
61
61
|
:billing_address_id,
|
62
62
|
:cardholder_name,
|
63
63
|
:cvv,
|
@@ -70,7 +70,7 @@ describe Braintree::CreditCard do
|
|
70
70
|
:device_data,
|
71
71
|
:payment_method_nonce,
|
72
72
|
{:external_vault=>[:network_transaction_id]},
|
73
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
73
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
74
74
|
{:billing_address => [
|
75
75
|
:company,
|
76
76
|
:country_code_alpha2,
|
@@ -97,7 +97,7 @@ describe Braintree::CreditCard do
|
|
97
97
|
:cavv_algorithm,
|
98
98
|
:ds_transaction_id,
|
99
99
|
]},
|
100
|
-
]
|
100
|
+
])
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
@@ -203,7 +203,7 @@ describe Braintree::CreditCard do
|
|
203
203
|
credit_card = Braintree::CreditCard._new(
|
204
204
|
:gateway,
|
205
205
|
:bin => "510510",
|
206
|
-
:last_4 => "5100"
|
206
|
+
:last_4 => "5100",
|
207
207
|
)
|
208
208
|
credit_card.masked_number.should == "510510******5100"
|
209
209
|
end
|
@@ -215,7 +215,7 @@ describe Braintree::CreditCard do
|
|
215
215
|
:gateway,
|
216
216
|
:bin => "510510",
|
217
217
|
:last_4 => "5100",
|
218
|
-
:is_network_tokenized => true
|
218
|
+
:is_network_tokenized => true,
|
219
219
|
)
|
220
220
|
credit_card.is_network_tokenized?.should == true
|
221
221
|
end
|
@@ -225,7 +225,7 @@ describe Braintree::CreditCard do
|
|
225
225
|
:gateway,
|
226
226
|
:bin => "510510",
|
227
227
|
:last_4 => "5100",
|
228
|
-
:is_network_tokenized => false
|
228
|
+
:is_network_tokenized => false,
|
229
229
|
)
|
230
230
|
credit_card.is_network_tokenized?.should == false
|
231
231
|
end
|
@@ -234,7 +234,7 @@ describe Braintree::CreditCard do
|
|
234
234
|
describe "self.update" do
|
235
235
|
it "raises an exception if attributes contain an invalid key" do
|
236
236
|
expect do
|
237
|
-
Braintree::CreditCard.update(:gateway, :invalid_key =>
|
237
|
+
Braintree::CreditCard.update(:gateway, :invalid_key => "val")
|
238
238
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
239
239
|
end
|
240
240
|
end
|
@@ -250,8 +250,8 @@ describe Braintree::CreditCard do
|
|
250
250
|
describe "self._new" do
|
251
251
|
describe "initializing verification" do
|
252
252
|
it "picks the youngest verification" do
|
253
|
-
verification1 = {
|
254
|
-
verification2 = {
|
253
|
+
verification1 = {:created_at => Time.now, :id => 123}
|
254
|
+
verification2 = {:created_at => Time.now - 3600, :id => 456}
|
255
255
|
credit_card = Braintree::CreditCard._new(Braintree::Configuration.gateway, {:verifications => [verification1, verification2]})
|
256
256
|
credit_card.verification.id.should == 123
|
257
257
|
end
|
@@ -30,7 +30,7 @@ describe Braintree::CreditCardVerification do
|
|
30
30
|
:cvv_response_code => "I",
|
31
31
|
:processor_response_code => "2000",
|
32
32
|
:processor_response_text => "Do Not Honor",
|
33
|
-
:merchant_account_id => "some_id"
|
33
|
+
:merchant_account_id => "some_id",
|
34
34
|
)
|
35
35
|
|
36
36
|
verification.status.should == Braintree::CreditCardVerification::Status::Verified
|
@@ -44,7 +44,7 @@ describe Braintree::CreditCardVerification do
|
|
44
44
|
|
45
45
|
it "accepts network_transaction_id" do
|
46
46
|
verification = Braintree::CreditCardVerification._new(
|
47
|
-
:network_transaction_id => "123456789012345"
|
47
|
+
:network_transaction_id => "123456789012345",
|
48
48
|
)
|
49
49
|
expect(verification.network_transaction_id).to eq "123456789012345"
|
50
50
|
end
|
@@ -117,14 +117,18 @@ describe Braintree::CreditCardVerification do
|
|
117
117
|
verification = Braintree::CreditCardVerification._new(:risk_data => {
|
118
118
|
:id => "123",
|
119
119
|
:decision => "WOO YOU WON $1000 dollars",
|
120
|
+
:decision_reasons => ["reason"],
|
120
121
|
:device_data_captured => true,
|
121
|
-
:fraud_service_provider => "
|
122
|
+
:fraud_service_provider => "paypal_fraud_protection",
|
123
|
+
:transaction_risk_score => "12",
|
122
124
|
})
|
123
125
|
|
124
126
|
verification.risk_data.id.should == "123"
|
125
127
|
verification.risk_data.decision.should == "WOO YOU WON $1000 dollars"
|
128
|
+
verification.risk_data.decision_reasons.should == ["reason"]
|
126
129
|
verification.risk_data.device_data_captured.should == true
|
127
|
-
verification.risk_data.fraud_service_provider.should == "
|
130
|
+
verification.risk_data.fraud_service_provider.should == "paypal_fraud_protection"
|
131
|
+
verification.risk_data.transaction_risk_score.should == "12"
|
128
132
|
end
|
129
133
|
|
130
134
|
it "handles a nil risk_data" do
|