braintree 2.104.0 → 4.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -23
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +11 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/base_module.rb +6 -0
- data/lib/braintree/bin_data.rb +9 -2
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +12 -12
- 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 -77
- data/lib/braintree/credit_card_gateway.rb +17 -36
- data/lib/braintree/credit_card_verification.rb +18 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +9 -78
- data/lib/braintree/customer_gateway.rb +2 -23
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute.rb +32 -8
- data/lib/braintree/dispute_gateway.rb +4 -9
- data/lib/braintree/dispute_search.rb +6 -3
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +150 -171
- data/lib/braintree/exceptions.rb +5 -3
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/gateway.rb +4 -14
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +11 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +4 -3
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- 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 +3 -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 -14
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +15 -17
- data/lib/braintree/payment_method_nonce.rb +7 -4
- 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/payment_method_parser.rb +1 -8
- data/lib/braintree/plan.rb +21 -1
- data/lib/braintree/plan_gateway.rb +100 -0
- 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/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +5 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +11 -11
- data/lib/braintree/successful_result.rb +3 -2
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/test/nonce.rb +4 -23
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction/disbursement_details.rb +1 -0
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +1 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/paypal_details.rb +3 -0
- data/lib/braintree/transaction/subscription_details.rb +2 -0
- data/lib/braintree/transaction.rb +65 -120
- data/lib/braintree/transaction_gateway.rb +39 -27
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +5 -3
- 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 +21 -6
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/venmo_profile_data.rb +23 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +44 -30
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +104 -43
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/parser.rb +22 -35
- data/lib/braintree/xml/rexml.rb +4 -5
- data/lib/braintree.rb +28 -23
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +30 -113
- 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 -31
- data/spec/integration/braintree/credit_card_spec.rb +219 -593
- 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 +484 -513
- data/spec/integration/braintree/dispute_search_spec.rb +35 -6
- data/spec/integration/braintree/dispute_spec.rb +6 -7
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +28 -29
- 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 +29 -35
- data/spec/integration/braintree/payment_method_spec.rb +535 -270
- 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/plan_spec.rb +82 -0
- 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 +144 -149
- 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 +175 -70
- data/spec/integration/braintree/transaction_spec.rb +955 -894
- 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 +16 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +8 -14
- data/spec/unit/braintree/address_spec.rb +1 -9
- data/spec/unit/braintree/apple_pay_card_spec.rb +7 -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 -32
- 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 -22
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +3 -0
- data/spec/unit/braintree/dispute_spec.rb +75 -21
- data/spec/unit/braintree/enriched_customer_data_spec.rb +32 -0
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +10 -8
- data/spec/unit/braintree/local_payment_completed_spec.rb +14 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- 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_nonce_spec.rb +40 -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/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- 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 +7 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +36 -54
- data/spec/unit/braintree/util_spec.rb +55 -21
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/venmo_profile_data_spec.rb +32 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +166 -57
- data/spec/unit/braintree/xml/parser_spec.rb +21 -16
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +62 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -40
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -83
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -49
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -5,7 +5,7 @@ describe "OAuth" do
|
|
5
5
|
@gateway = Braintree::Gateway.new(
|
6
6
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
7
7
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
8
|
-
:logger => Logger.new("/dev/null")
|
8
|
+
:logger => Logger.new("/dev/null"),
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
@@ -18,7 +18,7 @@ describe "OAuth" do
|
|
18
18
|
|
19
19
|
result = @gateway.oauth.create_token_from_code(
|
20
20
|
:code => code,
|
21
|
-
:scope => "read_write"
|
21
|
+
:scope => "read_write",
|
22
22
|
)
|
23
23
|
|
24
24
|
result.should be_success
|
@@ -32,7 +32,7 @@ describe "OAuth" do
|
|
32
32
|
it "returns validation errors for bad params" do
|
33
33
|
result = @gateway.oauth.create_token_from_code(
|
34
34
|
:code => "bad_code",
|
35
|
-
:scope => "read_write"
|
35
|
+
:scope => "read_write",
|
36
36
|
)
|
37
37
|
|
38
38
|
result.should_not be_success
|
@@ -43,13 +43,13 @@ describe "OAuth" do
|
|
43
43
|
it "raises with a helpful error if client_id and client_secret are not set" do
|
44
44
|
gateway = Braintree::Gateway.new(
|
45
45
|
:access_token => "access_token$development$integration_merchant_id$fb27c79dd",
|
46
|
-
:logger => Logger.new("/dev/null")
|
46
|
+
:logger => Logger.new("/dev/null"),
|
47
47
|
)
|
48
48
|
|
49
49
|
expect do
|
50
50
|
gateway.oauth.create_token_from_code(
|
51
51
|
:code => "some code",
|
52
|
-
:scope => "read_write"
|
52
|
+
:scope => "read_write",
|
53
53
|
)
|
54
54
|
end.to raise_error(Braintree::ConfigurationError, /client_id and client_secret are required/);
|
55
55
|
end
|
@@ -63,12 +63,12 @@ describe "OAuth" do
|
|
63
63
|
})
|
64
64
|
refresh_token = @gateway.oauth.create_token_from_code(
|
65
65
|
:code => code,
|
66
|
-
:scope => "read_write"
|
66
|
+
:scope => "read_write",
|
67
67
|
).credentials.refresh_token
|
68
68
|
|
69
69
|
result = @gateway.oauth.create_token_from_refresh_token(
|
70
70
|
:refresh_token => refresh_token,
|
71
|
-
:scope => "read_write"
|
71
|
+
:scope => "read_write",
|
72
72
|
)
|
73
73
|
|
74
74
|
result.should be_success
|
@@ -88,7 +88,7 @@ describe "OAuth" do
|
|
88
88
|
})
|
89
89
|
access_token = @gateway.oauth.create_token_from_code(
|
90
90
|
:code => code,
|
91
|
-
:scope => "read_write"
|
91
|
+
:scope => "read_write",
|
92
92
|
).credentials.access_token
|
93
93
|
|
94
94
|
result = @gateway.oauth.revoke_access_token(access_token)
|
@@ -96,7 +96,7 @@ describe "OAuth" do
|
|
96
96
|
|
97
97
|
gateway = Braintree::Gateway.new(
|
98
98
|
:access_token => access_token,
|
99
|
-
:logger => Logger.new("/dev/null")
|
99
|
+
:logger => Logger.new("/dev/null"),
|
100
100
|
)
|
101
101
|
|
102
102
|
expect do
|
@@ -146,7 +146,7 @@ describe "OAuth" do
|
|
146
146
|
:currency => "USD",
|
147
147
|
:website => "http://example.com"
|
148
148
|
},
|
149
|
-
:payment_methods => ["credit_card", "paypal"]
|
149
|
+
:payment_methods => ["credit_card", "paypal"],
|
150
150
|
)
|
151
151
|
|
152
152
|
uri = URI.parse(url)
|
@@ -201,7 +201,7 @@ describe "OAuth" do
|
|
201
201
|
:redirect_uri => "http://bar.example.com",
|
202
202
|
:scope => "read_write",
|
203
203
|
:state => "baz_state",
|
204
|
-
:payment_methods => ["credit_card", "paypal"]
|
204
|
+
:payment_methods => ["credit_card", "paypal"],
|
205
205
|
)
|
206
206
|
|
207
207
|
uri = URI.parse(url)
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
3
|
+
require "date"
|
3
4
|
|
4
5
|
describe Braintree::PaymentMethodNonce do
|
5
6
|
let(:config) { Braintree::Configuration.instantiate }
|
@@ -12,12 +13,12 @@ describe Braintree::PaymentMethodNonce do
|
|
12
13
|
:number => "4111111111111111",
|
13
14
|
:expiration_month => "11",
|
14
15
|
:expiration_year => "2099",
|
15
|
-
}
|
16
|
+
},
|
16
17
|
)
|
17
18
|
|
18
19
|
result = Braintree::PaymentMethod.create(
|
19
20
|
:payment_method_nonce => nonce,
|
20
|
-
:customer_id => customer.id
|
21
|
+
:customer_id => customer.id,
|
21
22
|
)
|
22
23
|
|
23
24
|
result.should be_success
|
@@ -32,6 +33,7 @@ describe Braintree::PaymentMethodNonce do
|
|
32
33
|
result.payment_method_nonce.should_not be_nil
|
33
34
|
result.payment_method_nonce.nonce.should_not be_nil
|
34
35
|
result.payment_method_nonce.details.should_not be_nil
|
36
|
+
result.payment_method_nonce.default?.should be_truthy
|
35
37
|
end
|
36
38
|
|
37
39
|
it "correctly raises and exception for a non existent token" do
|
@@ -49,12 +51,12 @@ describe Braintree::PaymentMethodNonce do
|
|
49
51
|
:number => "4111111111111111",
|
50
52
|
:expiration_month => "11",
|
51
53
|
:expiration_year => "2099",
|
52
|
-
}
|
54
|
+
},
|
53
55
|
)
|
54
56
|
|
55
57
|
payment_method = Braintree::PaymentMethod.create!(
|
56
58
|
:payment_method_nonce => nonce,
|
57
|
-
:customer_id => customer.id
|
59
|
+
:customer_id => customer.id,
|
58
60
|
)
|
59
61
|
|
60
62
|
payment_method.should be_a(Braintree::CreditCard)
|
@@ -67,6 +69,7 @@ describe Braintree::PaymentMethodNonce do
|
|
67
69
|
payment_method_nonce.should_not be_nil
|
68
70
|
payment_method_nonce.nonce.should_not be_nil
|
69
71
|
payment_method_nonce.details.should_not be_nil
|
72
|
+
payment_method_nonce.default?.should be_truthy
|
70
73
|
end
|
71
74
|
end
|
72
75
|
|
@@ -79,33 +82,24 @@ describe Braintree::PaymentMethodNonce do
|
|
79
82
|
result.should be_success
|
80
83
|
nonce.nonce.should == "fake-valid-nonce"
|
81
84
|
nonce.type.should == "CreditCard"
|
82
|
-
nonce.details.
|
83
|
-
nonce.details.
|
85
|
+
nonce.details.bin.should == "401288"
|
86
|
+
nonce.details.card_type.should == "Visa"
|
87
|
+
nonce.details.expiration_month.should == "12"
|
88
|
+
nonce.details.expiration_year.should == Date.today.next_year.year.to_s
|
89
|
+
nonce.details.is_network_tokenized?.should be_nil
|
90
|
+
nonce.details.last_two.should == "81"
|
91
|
+
nonce.details.payer_info.should be_nil
|
84
92
|
end
|
85
93
|
|
86
94
|
it "return paypal details if details exist" do
|
87
95
|
result = Braintree::PaymentMethodNonce.find("fake-paypal-one-time-nonce")
|
88
96
|
nonce = result.payment_method_nonce
|
89
|
-
|
90
|
-
nonce.details.
|
91
|
-
nonce.details.
|
92
|
-
nonce.details.
|
93
|
-
nonce.details.
|
94
|
-
|
95
|
-
nonce.details.fetch(:payer_info).fetch(:first_name).should_not be_nil
|
96
|
-
nonce.details.fetch(:payer_info).fetch(:last_name).should_not be_nil
|
97
|
-
nonce.details.fetch(:payer_info).fetch(:email).should_not be_nil
|
98
|
-
nonce.details.fetch(:payer_info).fetch(:payer_id).should_not be_nil
|
99
|
-
end
|
100
|
-
|
101
|
-
it "return venmo details if details exist" do
|
102
|
-
result = Braintree::PaymentMethodNonce.find("fake-venmo-account-nonce")
|
103
|
-
|
104
|
-
nonce = result.payment_method_nonce
|
105
|
-
|
106
|
-
nonce.details.fetch(:last_two).should == "99"
|
107
|
-
nonce.details.fetch(:username).should == "venmojoe"
|
108
|
-
nonce.details.fetch(:venmo_user_id).should == "Venmo-Joe-1"
|
97
|
+
nonce.details.payer_info.billing_agreement_id.should be_nil
|
98
|
+
nonce.details.payer_info.country_code.should be_nil
|
99
|
+
nonce.details.payer_info.email.should_not be_nil
|
100
|
+
nonce.details.payer_info.first_name.should_not be_nil
|
101
|
+
nonce.details.payer_info.last_name.should_not be_nil
|
102
|
+
nonce.details.payer_info.payer_id.should_not be_nil
|
109
103
|
end
|
110
104
|
|
111
105
|
it "returns null 3ds_info if there isn't any" do
|
@@ -114,7 +108,7 @@ describe Braintree::PaymentMethodNonce do
|
|
114
108
|
:number => "4111111111111111",
|
115
109
|
:expiration_month => "11",
|
116
110
|
:expiration_year => "2099",
|
117
|
-
}
|
111
|
+
},
|
118
112
|
)
|
119
113
|
|
120
114
|
result = Braintree::PaymentMethodNonce.find(nonce)
|
@@ -131,7 +125,7 @@ describe Braintree::PaymentMethodNonce do
|
|
131
125
|
nonce = result.payment_method_nonce
|
132
126
|
result.should be_success
|
133
127
|
nonce.details.should_not be_nil
|
134
|
-
nonce.details
|
128
|
+
nonce.details.bin.should == "401288"
|
135
129
|
end
|
136
130
|
|
137
131
|
it "returns bin_data with commercial set to Yes" do
|
@@ -257,19 +251,19 @@ describe Braintree::PaymentMethodNonce do
|
|
257
251
|
context "regulation environments" do
|
258
252
|
it "can get unregulated" do
|
259
253
|
expect(
|
260
|
-
request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment]
|
254
|
+
request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment],
|
261
255
|
).to eq "unregulated"
|
262
256
|
end
|
263
257
|
|
264
258
|
it "can get psd2" do
|
265
259
|
expect(
|
266
|
-
request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment]
|
260
|
+
request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment],
|
267
261
|
).to eq "psd2"
|
268
262
|
end
|
269
263
|
|
270
264
|
it "can get rbi" do
|
271
265
|
expect(
|
272
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment]
|
266
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment],
|
273
267
|
).to eq "rbi"
|
274
268
|
end
|
275
269
|
end
|
@@ -277,19 +271,19 @@ describe Braintree::PaymentMethodNonce do
|
|
277
271
|
context "sca_indicator" do
|
278
272
|
it "can get unavailable" do
|
279
273
|
expect(
|
280
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator]
|
274
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator],
|
281
275
|
).to eq "unavailable"
|
282
276
|
end
|
283
277
|
|
284
278
|
it "can get sca_required" do
|
285
279
|
expect(
|
286
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator]
|
280
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator],
|
287
281
|
).to eq "sca_required"
|
288
282
|
end
|
289
283
|
|
290
284
|
it "can get sca_optional" do
|
291
285
|
expect(
|
292
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator]
|
286
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator],
|
293
287
|
|
294
288
|
).to eq "sca_optional"
|
295
289
|
end
|
@@ -309,7 +303,7 @@ describe Braintree::PaymentMethodNonce do
|
|
309
303
|
|
310
304
|
result = Braintree::PaymentMethodNonce.create(
|
311
305
|
payment_method_token,
|
312
|
-
payment_method_nonce: nonce_request
|
306
|
+
payment_method_nonce: nonce_request,
|
313
307
|
)
|
314
308
|
result.should be_success
|
315
309
|
|