braintree 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/braintree.gemspec +2 -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/bin_data.rb +9 -2
- 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 +4 -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 +10 -2
- 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 +4 -6
- 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 +43 -26
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/paypal_details.rb +1 -0
- data/lib/braintree/transaction_gateway.rb +26 -5
- 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 +2 -2
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +28 -19
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +10 -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 +124 -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 +343 -149
- data/spec/integration/braintree/dispute_search_spec.rb +29 -4
- 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 +326 -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 +736 -380
- 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 +9 -9
- 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 +14 -4
- 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 +3 -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 +72 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +15 -19
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -5,18 +5,18 @@ describe Braintree::ApplePayGateway 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
|
|
11
11
|
result = gateway.merchant.create(
|
12
12
|
:email => "name@email.com",
|
13
13
|
:country_code_alpha3 => "USA",
|
14
|
-
:payment_methods => ["credit_card", "paypal"]
|
14
|
+
:payment_methods => ["credit_card", "paypal"],
|
15
15
|
)
|
16
16
|
|
17
17
|
@gateway = Braintree::Gateway.new(
|
18
18
|
:access_token => result.credentials.access_token,
|
19
|
-
:logger => Logger.new("/dev/null")
|
19
|
+
:logger => Logger.new("/dev/null"),
|
20
20
|
)
|
21
21
|
end
|
22
22
|
|
@@ -12,7 +12,8 @@ describe Braintree::Gateway do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "query" do
|
15
|
-
|
15
|
+
# we are temporarily skipping this test until we have a more stable CI env
|
16
|
+
xit "makes valid GraphQL queries when given a definition" do
|
16
17
|
definition = <<-GRAPHQL
|
17
18
|
mutation ExampleServerSideSingleUseToken($input: TokenizeCreditCardInput!) {
|
18
19
|
tokenizeCreditCard(input: $input) {
|
@@ -12,7 +12,7 @@ describe Braintree::ClientToken do
|
|
12
12
|
config,
|
13
13
|
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
14
14
|
:shared_customer_identifier => "fake_identifier",
|
15
|
-
:shared_customer_identifier_type => "testing"
|
15
|
+
:shared_customer_identifier_type => "testing",
|
16
16
|
)
|
17
17
|
|
18
18
|
response = http.get_payment_methods
|
@@ -49,7 +49,7 @@ describe Braintree::ClientToken do
|
|
49
49
|
:customer_id => result.customer.id,
|
50
50
|
:options => {
|
51
51
|
:verify_card => true
|
52
|
-
}
|
52
|
+
},
|
53
53
|
)
|
54
54
|
client_token = decode_client_token(raw_client_token)
|
55
55
|
|
@@ -57,7 +57,7 @@ describe Braintree::ClientToken do
|
|
57
57
|
config,
|
58
58
|
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
59
59
|
:shared_customer_identifier => "fake_identifier",
|
60
|
-
:shared_customer_identifier_type => "testing"
|
60
|
+
:shared_customer_identifier_type => "testing",
|
61
61
|
)
|
62
62
|
|
63
63
|
response = http.add_payment_method(
|
@@ -65,7 +65,7 @@ describe Braintree::ClientToken do
|
|
65
65
|
:number => "4000111111111115",
|
66
66
|
:expiration_month => "11",
|
67
67
|
:expiration_year => "2099"
|
68
|
-
}
|
68
|
+
},
|
69
69
|
)
|
70
70
|
|
71
71
|
response.code.should == "422"
|
@@ -79,7 +79,7 @@ describe Braintree::ClientToken do
|
|
79
79
|
:customer_id => customer_id,
|
80
80
|
:options => {
|
81
81
|
:make_default => true
|
82
|
-
}
|
82
|
+
},
|
83
83
|
)
|
84
84
|
client_token = decode_client_token(raw_client_token)
|
85
85
|
|
@@ -87,7 +87,7 @@ describe Braintree::ClientToken do
|
|
87
87
|
config,
|
88
88
|
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
89
89
|
:shared_customer_identifier => "fake_identifier",
|
90
|
-
:shared_customer_identifier_type => "testing"
|
90
|
+
:shared_customer_identifier_type => "testing",
|
91
91
|
)
|
92
92
|
|
93
93
|
response = http.add_payment_method(
|
@@ -95,7 +95,7 @@ describe Braintree::ClientToken do
|
|
95
95
|
:number => "4111111111111111",
|
96
96
|
:expiration_month => "11",
|
97
97
|
:expiration_year => "2099"
|
98
|
-
}
|
98
|
+
},
|
99
99
|
)
|
100
100
|
|
101
101
|
response.code.should == "201"
|
@@ -105,7 +105,7 @@ describe Braintree::ClientToken do
|
|
105
105
|
:number => "4005519200000004",
|
106
106
|
:expiration_month => "11",
|
107
107
|
:expiration_year => "2099"
|
108
|
-
}
|
108
|
+
},
|
109
109
|
)
|
110
110
|
|
111
111
|
response.code.should == "201"
|
@@ -119,7 +119,7 @@ describe Braintree::ClientToken do
|
|
119
119
|
result = Braintree::Customer.create
|
120
120
|
customer_id = result.customer.id
|
121
121
|
raw_client_token = Braintree::ClientToken.generate(
|
122
|
-
:customer_id => customer_id
|
122
|
+
:customer_id => customer_id,
|
123
123
|
)
|
124
124
|
client_token = decode_client_token(raw_client_token)
|
125
125
|
|
@@ -127,7 +127,7 @@ describe Braintree::ClientToken do
|
|
127
127
|
config,
|
128
128
|
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
129
129
|
:shared_customer_identifier => "fake_identifier",
|
130
|
-
:shared_customer_identifier_type => "testing"
|
130
|
+
:shared_customer_identifier_type => "testing",
|
131
131
|
)
|
132
132
|
|
133
133
|
response = http.add_payment_method(
|
@@ -135,7 +135,7 @@ describe Braintree::ClientToken do
|
|
135
135
|
:number => "4111111111111111",
|
136
136
|
:expiration_month => "11",
|
137
137
|
:expiration_year => "2099"
|
138
|
-
}
|
138
|
+
},
|
139
139
|
)
|
140
140
|
|
141
141
|
response.code.should == "201"
|
@@ -144,7 +144,7 @@ describe Braintree::ClientToken do
|
|
144
144
|
:customer_id => customer_id,
|
145
145
|
:options => {
|
146
146
|
:fail_on_duplicate_payment_method => true
|
147
|
-
}
|
147
|
+
},
|
148
148
|
)
|
149
149
|
second_client_token = decode_client_token(second_raw_client_token)
|
150
150
|
|
@@ -155,7 +155,7 @@ describe Braintree::ClientToken do
|
|
155
155
|
:number => "4111111111111111",
|
156
156
|
:expiration_month => "11",
|
157
157
|
:expiration_year => "2099"
|
158
|
-
}
|
158
|
+
},
|
159
159
|
)
|
160
160
|
|
161
161
|
response.code.should == "422"
|
@@ -165,7 +165,7 @@ describe Braintree::ClientToken do
|
|
165
165
|
merchant_account_id = SpecHelper::NonDefaultMerchantAccountId
|
166
166
|
|
167
167
|
raw_client_token = Braintree::ClientToken.generate(
|
168
|
-
:merchant_account_id => merchant_account_id
|
168
|
+
:merchant_account_id => merchant_account_id,
|
169
169
|
)
|
170
170
|
client_token = decode_client_token(raw_client_token)
|
171
171
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "json"
|
2
2
|
|
3
3
|
def decode_client_token(raw_client_token)
|
4
4
|
decoded_client_token_string = Base64.decode64(raw_client_token)
|
@@ -20,7 +20,7 @@ def _initialize_client(options)
|
|
20
20
|
ClientApiHttp.new(Braintree::Configuration.instantiate,
|
21
21
|
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
22
22
|
:shared_customer_identifier => "fake_identifier",
|
23
|
-
:shared_customer_identifier_type => "testing"
|
23
|
+
:shared_customer_identifier_type => "testing",
|
24
24
|
)
|
25
25
|
end
|
26
26
|
|
@@ -42,7 +42,7 @@ def nonce_for_paypal_account(paypal_account_details)
|
|
42
42
|
raw_client_token = Braintree::ClientToken.generate
|
43
43
|
client_token = decode_client_token(raw_client_token)
|
44
44
|
client = ClientApiHttp.new(Braintree::Configuration.instantiate,
|
45
|
-
:authorization_fingerprint => client_token["authorizationFingerprint"]
|
45
|
+
:authorization_fingerprint => client_token["authorizationFingerprint"],
|
46
46
|
)
|
47
47
|
|
48
48
|
response = client.create_paypal_account(paypal_account_details)
|
@@ -283,7 +283,7 @@ class ClientApiHttp
|
|
283
283
|
params.merge!(
|
284
284
|
:authorization_fingerprint => @options[:authorization_fingerprint],
|
285
285
|
:shared_customer_identifier => "fake_identifier",
|
286
|
-
:shared_customer_identifier_type => "testing"
|
286
|
+
:shared_customer_identifier_type => "testing",
|
287
287
|
)
|
288
288
|
|
289
289
|
post("/merchants/#{config.merchant_id}/client_api/v1/payment_methods/credit_cards", params)
|
@@ -292,7 +292,7 @@ class ClientApiHttp
|
|
292
292
|
def create_paypal_account(params)
|
293
293
|
params = {:paypal_account => params}
|
294
294
|
params.merge!(
|
295
|
-
:authorization_fingerprint => @options[:authorization_fingerprint]
|
295
|
+
:authorization_fingerprint => @options[:authorization_fingerprint],
|
296
296
|
)
|
297
297
|
|
298
298
|
post("/merchants/#{config.merchant_id}/client_api/v1/payment_methods/paypal_accounts", params)
|
@@ -46,7 +46,7 @@ describe Braintree::CreditCard do
|
|
46
46
|
:customer_id => customer.id,
|
47
47
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
48
48
|
:expiration_month => "05",
|
49
|
-
:expiration_year => "2012"
|
49
|
+
:expiration_year => "2012",
|
50
50
|
)
|
51
51
|
result.success?.should == true
|
52
52
|
credit_card = result.credit_card
|
@@ -63,7 +63,7 @@ describe Braintree::CreditCard do
|
|
63
63
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
64
64
|
:expiration_date => "05/2009",
|
65
65
|
:cvv => "100",
|
66
|
-
:token => token
|
66
|
+
:token => token,
|
67
67
|
)
|
68
68
|
result.success?.should == true
|
69
69
|
credit_card = result.credit_card
|
@@ -81,7 +81,7 @@ describe Braintree::CreditCard do
|
|
81
81
|
:customer_id => customer.id,
|
82
82
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
83
83
|
:expiration_date => "05/2009",
|
84
|
-
:billing_address_id => address.id
|
84
|
+
:billing_address_id => address.id,
|
85
85
|
).credit_card
|
86
86
|
|
87
87
|
credit_card.billing_address.id.should == address.id
|
@@ -95,7 +95,7 @@ describe Braintree::CreditCard do
|
|
95
95
|
:customer_id => customer.id,
|
96
96
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
97
97
|
:expiration_date => "05/2009",
|
98
|
-
:options => {}
|
98
|
+
:options => {},
|
99
99
|
)
|
100
100
|
result.success?.should == true
|
101
101
|
end
|
@@ -106,7 +106,7 @@ describe Braintree::CreditCard do
|
|
106
106
|
:customer_id => customer.id,
|
107
107
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
108
108
|
:expiration_date => "05/2009",
|
109
|
-
:options => {:verify_card => true}
|
109
|
+
:options => {:verify_card => true},
|
110
110
|
)
|
111
111
|
result.success?.should == false
|
112
112
|
result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
@@ -124,7 +124,7 @@ describe Braintree::CreditCard do
|
|
124
124
|
:customer_id => customer.id,
|
125
125
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
126
126
|
:expiration_date => "05/2009",
|
127
|
-
:options => {:verify_card => true, :verification_amount => "100.00"}
|
127
|
+
:options => {:verify_card => true, :verification_amount => "100.00"},
|
128
128
|
)
|
129
129
|
result.success?.should == false
|
130
130
|
result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
@@ -137,7 +137,7 @@ describe Braintree::CreditCard do
|
|
137
137
|
end
|
138
138
|
|
139
139
|
it "returns risk data on verification on credit_card create" do
|
140
|
-
|
140
|
+
with_fraud_protection_enterprise_merchant do
|
141
141
|
customer = Braintree::Customer.create!
|
142
142
|
credit_card = Braintree::CreditCard.create!(
|
143
143
|
:cardholder_name => "Original Holder",
|
@@ -145,13 +145,15 @@ describe Braintree::CreditCard do
|
|
145
145
|
:cvv => "123",
|
146
146
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
147
147
|
:expiration_date => "05/2020",
|
148
|
-
:options => {:verify_card => true}
|
148
|
+
:options => {:verify_card => true},
|
149
149
|
)
|
150
150
|
verification = credit_card.verification
|
151
|
-
verification.risk_data.
|
152
|
-
verification.risk_data.
|
153
|
-
verification.risk_data.
|
154
|
-
verification.risk_data.
|
151
|
+
verification.risk_data.id.should_not be_nil
|
152
|
+
verification.risk_data.decision.should_not be_nil
|
153
|
+
verification.risk_data.decision_reasons.should_not be_nil
|
154
|
+
expect(verification.risk_data).to respond_to(:device_data_captured)
|
155
|
+
expect(verification.risk_data).to respond_to(:fraud_service_provider)
|
156
|
+
expect(verification.risk_data).to respond_to(:transaction_risk_score)
|
155
157
|
end
|
156
158
|
end
|
157
159
|
|
@@ -171,7 +173,7 @@ describe Braintree::CreditCard do
|
|
171
173
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
172
174
|
:expiration_date => "05/2009",
|
173
175
|
:cvv => "200",
|
174
|
-
:options => {:verify_card => true}
|
176
|
+
:options => {:verify_card => true},
|
175
177
|
)
|
176
178
|
result.success?.should == false
|
177
179
|
result.credit_card_verification.gateway_rejection_reason.should == Braintree::CreditCardVerification::GatewayRejectionReason::CVV
|
@@ -188,7 +190,7 @@ describe Braintree::CreditCard do
|
|
188
190
|
:customer_id => customer.id,
|
189
191
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
190
192
|
:expiration_date => "05/2009",
|
191
|
-
:options => {:verify_card => true, :verification_amount => "1.01"}
|
193
|
+
:options => {:verify_card => true, :verification_amount => "1.01"},
|
192
194
|
)
|
193
195
|
result.success?.should == false
|
194
196
|
result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
@@ -209,7 +211,7 @@ describe Braintree::CreditCard do
|
|
209
211
|
:options => {
|
210
212
|
:verify_card => true,
|
211
213
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
212
|
-
}
|
214
|
+
},
|
213
215
|
)
|
214
216
|
result.success?.should == false
|
215
217
|
result.credit_card_verification.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
|
@@ -221,7 +223,7 @@ describe Braintree::CreditCard do
|
|
221
223
|
:customer_id => customer.id,
|
222
224
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
223
225
|
:expiration_date => "05/2009",
|
224
|
-
:options => {:verify_card => false}
|
226
|
+
:options => {:verify_card => false},
|
225
227
|
)
|
226
228
|
result.success?.should == true
|
227
229
|
end
|
@@ -232,15 +234,15 @@ describe Braintree::CreditCard do
|
|
232
234
|
:customer_id => customer.id,
|
233
235
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
234
236
|
:three_d_secure_pass_thru => {
|
235
|
-
:eci_flag =>
|
236
|
-
:cavv =>
|
237
|
-
:xid =>
|
238
|
-
:authentication_response =>
|
239
|
-
:directory_response =>
|
240
|
-
:cavv_algorithm =>
|
241
|
-
:ds_transaction_id =>
|
237
|
+
:eci_flag => "02",
|
238
|
+
:cavv => "some_cavv",
|
239
|
+
:xid => "some_xid",
|
240
|
+
:authentication_response => "Y",
|
241
|
+
:directory_response => "Y",
|
242
|
+
:cavv_algorithm => "2",
|
243
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
242
244
|
},
|
243
|
-
:options => {:verify_card => true}
|
245
|
+
:options => {:verify_card => true},
|
244
246
|
)
|
245
247
|
expect(result).not_to be_success
|
246
248
|
error = result.errors.for(:verification).first
|
@@ -254,16 +256,16 @@ describe Braintree::CreditCard do
|
|
254
256
|
:customer_id => customer.id,
|
255
257
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
256
258
|
:three_d_secure_pass_thru => {
|
257
|
-
:eci_flag =>
|
258
|
-
:cavv =>
|
259
|
-
:xid =>
|
260
|
-
:three_d_secure_version =>
|
261
|
-
:authentication_response =>
|
262
|
-
:directory_response =>
|
263
|
-
:cavv_algorithm =>
|
264
|
-
:ds_transaction_id =>
|
259
|
+
:eci_flag => "02",
|
260
|
+
:cavv => "some_cavv",
|
261
|
+
:xid => "some_xid",
|
262
|
+
:three_d_secure_version => "1.0.2",
|
263
|
+
:authentication_response => "Y",
|
264
|
+
:directory_response => "Y",
|
265
|
+
:cavv_algorithm => "2",
|
266
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
265
267
|
},
|
266
|
-
:options => {:verify_card => true}
|
268
|
+
:options => {:verify_card => true},
|
267
269
|
)
|
268
270
|
result.success?.should == true
|
269
271
|
|
@@ -274,7 +276,7 @@ describe Braintree::CreditCard do
|
|
274
276
|
result = Braintree::CreditCard.create(
|
275
277
|
:customer_id => customer.id,
|
276
278
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
277
|
-
:options => {:verify_card => true}
|
279
|
+
:options => {:verify_card => true},
|
278
280
|
)
|
279
281
|
result.success?.should == true
|
280
282
|
|
@@ -302,7 +304,7 @@ describe Braintree::CreditCard do
|
|
302
304
|
:locality => "Chicago",
|
303
305
|
:region => "Illinois",
|
304
306
|
:postal_code => "60622"
|
305
|
-
}
|
307
|
+
},
|
306
308
|
)
|
307
309
|
result.success?.should == true
|
308
310
|
credit_card = result.credit_card
|
@@ -321,7 +323,7 @@ describe Braintree::CreditCard do
|
|
321
323
|
:country_code_alpha2 => "US",
|
322
324
|
:country_code_alpha3 => "USA",
|
323
325
|
:country_code_numeric => "840"
|
324
|
-
}
|
326
|
+
},
|
325
327
|
)
|
326
328
|
result.success?.should == true
|
327
329
|
credit_card = result.credit_card
|
@@ -340,7 +342,7 @@ describe Braintree::CreditCard do
|
|
340
342
|
:billing_address => {
|
341
343
|
:country_name => "Mexico",
|
342
344
|
:country_code_alpha2 => "US"
|
343
|
-
}
|
345
|
+
},
|
344
346
|
)
|
345
347
|
result.success?.should == false
|
346
348
|
result.errors.for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
|
@@ -351,7 +353,7 @@ describe Braintree::CreditCard do
|
|
351
353
|
result = Braintree::CreditCard.create(
|
352
354
|
:customer_id => customer.id,
|
353
355
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
354
|
-
:expiration_date => "invalid_date"
|
356
|
+
:expiration_date => "invalid_date",
|
355
357
|
)
|
356
358
|
result.success?.should == false
|
357
359
|
result.errors.for(:credit_card).on(:expiration_date)[0].message.should == "Expiration date is invalid."
|
@@ -362,7 +364,7 @@ describe Braintree::CreditCard do
|
|
362
364
|
card1 = Braintree::CreditCard.create(
|
363
365
|
:customer_id => customer.id,
|
364
366
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
365
|
-
:expiration_date => "05/2009"
|
367
|
+
:expiration_date => "05/2009",
|
366
368
|
).credit_card
|
367
369
|
card1.should be_default
|
368
370
|
|
@@ -372,7 +374,7 @@ describe Braintree::CreditCard do
|
|
372
374
|
:expiration_date => "05/2009",
|
373
375
|
:options => {
|
374
376
|
:make_default => true
|
375
|
-
}
|
377
|
+
},
|
376
378
|
).credit_card
|
377
379
|
card2.should be_default
|
378
380
|
|
@@ -401,7 +403,7 @@ describe Braintree::CreditCard do
|
|
401
403
|
:customer_id => customer.id,
|
402
404
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
403
405
|
:expiration_date => "05/2014",
|
404
|
-
:options => {:verify_card => true}
|
406
|
+
:options => {:verify_card => true},
|
405
407
|
)
|
406
408
|
credit_card = result.credit_card
|
407
409
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Yes
|
@@ -413,7 +415,7 @@ describe Braintree::CreditCard do
|
|
413
415
|
:customer_id => customer.id,
|
414
416
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Healthcare,
|
415
417
|
:expiration_date => "05/2014",
|
416
|
-
:options => {:verify_card => true}
|
418
|
+
:options => {:verify_card => true},
|
417
419
|
)
|
418
420
|
credit_card = result.credit_card
|
419
421
|
credit_card.healthcare.should == Braintree::CreditCard::Healthcare::Yes
|
@@ -426,7 +428,7 @@ describe Braintree::CreditCard do
|
|
426
428
|
:customer_id => customer.id,
|
427
429
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::DurbinRegulated,
|
428
430
|
:expiration_date => "05/2014",
|
429
|
-
:options => {:verify_card => true}
|
431
|
+
:options => {:verify_card => true},
|
430
432
|
)
|
431
433
|
credit_card = result.credit_card
|
432
434
|
credit_card.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
|
@@ -438,7 +440,7 @@ describe Braintree::CreditCard do
|
|
438
440
|
:customer_id => customer.id,
|
439
441
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::CountryOfIssuance,
|
440
442
|
:expiration_date => "05/2014",
|
441
|
-
:options => {:verify_card => true}
|
443
|
+
:options => {:verify_card => true},
|
442
444
|
)
|
443
445
|
credit_card = result.credit_card
|
444
446
|
credit_card.country_of_issuance.should == Braintree::Test::CreditCardDefaults::CountryOfIssuance
|
@@ -450,7 +452,7 @@ describe Braintree::CreditCard do
|
|
450
452
|
:customer_id => customer.id,
|
451
453
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::IssuingBank,
|
452
454
|
:expiration_date => "05/2014",
|
453
|
-
:options => {:verify_card => true}
|
455
|
+
:options => {:verify_card => true},
|
454
456
|
)
|
455
457
|
credit_card = result.credit_card
|
456
458
|
credit_card.issuing_bank.should == Braintree::Test::CreditCardDefaults::IssuingBank
|
@@ -462,7 +464,7 @@ describe Braintree::CreditCard do
|
|
462
464
|
:customer_id => customer.id,
|
463
465
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Payroll,
|
464
466
|
:expiration_date => "05/2014",
|
465
|
-
:options => {:verify_card => true}
|
467
|
+
:options => {:verify_card => true},
|
466
468
|
)
|
467
469
|
credit_card = result.credit_card
|
468
470
|
credit_card.payroll.should == Braintree::CreditCard::Payroll::Yes
|
@@ -475,7 +477,7 @@ describe Braintree::CreditCard do
|
|
475
477
|
:customer_id => customer.id,
|
476
478
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Debit,
|
477
479
|
:expiration_date => "05/2014",
|
478
|
-
:options => {:verify_card => true}
|
480
|
+
:options => {:verify_card => true},
|
479
481
|
)
|
480
482
|
credit_card = result.credit_card
|
481
483
|
credit_card.debit.should == Braintree::CreditCard::Debit::Yes
|
@@ -487,7 +489,7 @@ describe Braintree::CreditCard do
|
|
487
489
|
:customer_id => customer.id,
|
488
490
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Commercial,
|
489
491
|
:expiration_date => "05/2014",
|
490
|
-
:options => {:verify_card => true}
|
492
|
+
:options => {:verify_card => true},
|
491
493
|
)
|
492
494
|
credit_card = result.credit_card
|
493
495
|
credit_card.commercial.should == Braintree::CreditCard::Commercial::Yes
|
@@ -499,7 +501,7 @@ describe Braintree::CreditCard do
|
|
499
501
|
:customer_id => customer.id,
|
500
502
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::No,
|
501
503
|
:expiration_date => "05/2014",
|
502
|
-
:options => {:verify_card => true}
|
504
|
+
:options => {:verify_card => true},
|
503
505
|
)
|
504
506
|
credit_card = result.credit_card
|
505
507
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::No
|
@@ -517,7 +519,7 @@ describe Braintree::CreditCard do
|
|
517
519
|
:customer_id => customer.id,
|
518
520
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Unknown,
|
519
521
|
:expiration_date => "05/2014",
|
520
|
-
:options => {:verify_card => true}
|
522
|
+
:options => {:verify_card => true},
|
521
523
|
)
|
522
524
|
credit_card = result.credit_card
|
523
525
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
|
@@ -538,7 +540,7 @@ describe Braintree::CreditCard do
|
|
538
540
|
customer = Braintree::Customer.create!
|
539
541
|
result = Braintree::CreditCard.create(
|
540
542
|
:customer_id => customer.id,
|
541
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode
|
543
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode,
|
542
544
|
)
|
543
545
|
result.success?.should == true
|
544
546
|
result.credit_card.venmo_sdk?.should == false
|
@@ -550,7 +552,7 @@ describe Braintree::CreditCard do
|
|
550
552
|
customer = Braintree::Customer.create!
|
551
553
|
result = Braintree::CreditCard.create(
|
552
554
|
:customer_id => customer.id,
|
553
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode
|
555
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode,
|
554
556
|
)
|
555
557
|
|
556
558
|
result.success?.should == false
|
@@ -569,7 +571,7 @@ describe Braintree::CreditCard do
|
|
569
571
|
:cvv => "100",
|
570
572
|
:options => {
|
571
573
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::Session
|
572
|
-
}
|
574
|
+
},
|
573
575
|
)
|
574
576
|
result.success?.should == true
|
575
577
|
result.credit_card.venmo_sdk?.should == false
|
@@ -584,7 +586,7 @@ describe Braintree::CreditCard do
|
|
584
586
|
:cvv => "100",
|
585
587
|
:options => {
|
586
588
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::InvalidSession
|
587
|
-
}
|
589
|
+
},
|
588
590
|
)
|
589
591
|
result.success?.should == true
|
590
592
|
result.credit_card.venmo_sdk?.should == false
|
@@ -600,12 +602,12 @@ describe Braintree::CreditCard do
|
|
600
602
|
:expiration_month => "11",
|
601
603
|
:expiration_year => "2099",
|
602
604
|
},
|
603
|
-
:share => true
|
605
|
+
:share => true,
|
604
606
|
)
|
605
607
|
customer = Braintree::Customer.create!
|
606
608
|
result = Braintree::CreditCard.create(
|
607
609
|
:customer_id => customer.id,
|
608
|
-
:payment_method_nonce => nonce
|
610
|
+
:payment_method_nonce => nonce,
|
609
611
|
)
|
610
612
|
|
611
613
|
result.success?.should == true
|
@@ -642,7 +644,7 @@ describe Braintree::CreditCard do
|
|
642
644
|
:verify_card => true,
|
643
645
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
644
646
|
:verification_account_type => "debit",
|
645
|
-
}
|
647
|
+
},
|
646
648
|
)
|
647
649
|
|
648
650
|
expect(result).to be_success
|
@@ -659,7 +661,7 @@ describe Braintree::CreditCard do
|
|
659
661
|
:verify_card => true,
|
660
662
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
661
663
|
:verification_account_type => "credit",
|
662
|
-
}
|
664
|
+
},
|
663
665
|
)
|
664
666
|
|
665
667
|
expect(result).to be_success
|
@@ -675,7 +677,7 @@ describe Braintree::CreditCard do
|
|
675
677
|
:verify_card => true,
|
676
678
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
677
679
|
:verification_account_type => "ach",
|
678
|
-
}
|
680
|
+
},
|
679
681
|
)
|
680
682
|
|
681
683
|
expect(result).to_not be_success
|
@@ -691,7 +693,7 @@ describe Braintree::CreditCard do
|
|
691
693
|
:options => {
|
692
694
|
:verify_card => true,
|
693
695
|
:verification_account_type => "credit",
|
694
|
-
}
|
696
|
+
},
|
695
697
|
)
|
696
698
|
|
697
699
|
expect(result).to_not be_success
|
@@ -707,7 +709,7 @@ describe Braintree::CreditCard do
|
|
707
709
|
:customer_id => customer.id,
|
708
710
|
:cardholder_name => "Adam Davis",
|
709
711
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
710
|
-
:expiration_date => "05/2009"
|
712
|
+
:expiration_date => "05/2009",
|
711
713
|
)
|
712
714
|
credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
713
715
|
credit_card.cardholder_name.should == "Adam Davis"
|
@@ -721,7 +723,7 @@ describe Braintree::CreditCard do
|
|
721
723
|
Braintree::CreditCard.create!(
|
722
724
|
:customer_id => customer.id,
|
723
725
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
724
|
-
:expiration_date => "invalid_date"
|
726
|
+
:expiration_date => "invalid_date",
|
725
727
|
)
|
726
728
|
end.to raise_error(Braintree::ValidationsFailed)
|
727
729
|
end
|
@@ -733,11 +735,11 @@ describe Braintree::CreditCard do
|
|
733
735
|
:credit_card => {
|
734
736
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
735
737
|
:expiration_date => "05/2010"
|
736
|
-
}
|
738
|
+
},
|
737
739
|
)
|
738
740
|
result = Braintree::CreditCard.credit(
|
739
741
|
customer.credit_cards[0].token,
|
740
|
-
:amount => "100.00"
|
742
|
+
:amount => "100.00",
|
741
743
|
)
|
742
744
|
result.success?.should == true
|
743
745
|
result.transaction.amount.should == BigDecimal("100.00")
|
@@ -756,11 +758,11 @@ describe Braintree::CreditCard do
|
|
756
758
|
:credit_card => {
|
757
759
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
758
760
|
:expiration_date => "05/2010"
|
759
|
-
}
|
761
|
+
},
|
760
762
|
)
|
761
763
|
transaction = Braintree::CreditCard.credit!(
|
762
764
|
customer.credit_cards[0].token,
|
763
|
-
:amount => "100.00"
|
765
|
+
:amount => "100.00",
|
764
766
|
)
|
765
767
|
transaction.amount.should == BigDecimal("100.00")
|
766
768
|
transaction.type.should == "credit"
|
@@ -780,13 +782,13 @@ describe Braintree::CreditCard do
|
|
780
782
|
:customer_id => customer.id,
|
781
783
|
:cvv => "123",
|
782
784
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
783
|
-
:expiration_date => "05/2012"
|
785
|
+
:expiration_date => "05/2012",
|
784
786
|
)
|
785
787
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
786
788
|
:cardholder_name => "New Holder",
|
787
789
|
:cvv => "456",
|
788
790
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
789
|
-
:expiration_date => "06/2013"
|
791
|
+
:expiration_date => "06/2013",
|
790
792
|
)
|
791
793
|
update_result.success?.should == true
|
792
794
|
update_result.credit_card.should == credit_card
|
@@ -804,20 +806,20 @@ describe Braintree::CreditCard do
|
|
804
806
|
:customer_id => customer.id,
|
805
807
|
:cvv => "123",
|
806
808
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
807
|
-
:expiration_date => "05/2012"
|
809
|
+
:expiration_date => "05/2012",
|
808
810
|
)
|
809
811
|
result = Braintree::CreditCard.update(credit_card.token,
|
810
812
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
811
813
|
:three_d_secure_pass_thru => {
|
812
|
-
:eci_flag =>
|
813
|
-
:cavv =>
|
814
|
-
:xid =>
|
815
|
-
:authentication_response =>
|
816
|
-
:directory_response =>
|
817
|
-
:cavv_algorithm =>
|
818
|
-
:ds_transaction_id =>
|
814
|
+
:eci_flag => "02",
|
815
|
+
:cavv => "some_cavv",
|
816
|
+
:xid => "some_xid",
|
817
|
+
:authentication_response => "Y",
|
818
|
+
:directory_response => "Y",
|
819
|
+
:cavv_algorithm => "2",
|
820
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
819
821
|
},
|
820
|
-
:options => {:verify_card => true}
|
822
|
+
:options => {:verify_card => true},
|
821
823
|
)
|
822
824
|
expect(result).not_to be_success
|
823
825
|
error = result.errors.for(:verification).first
|
@@ -832,21 +834,21 @@ describe Braintree::CreditCard do
|
|
832
834
|
:customer_id => customer.id,
|
833
835
|
:cvv => "123",
|
834
836
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
835
|
-
:expiration_date => "05/2012"
|
837
|
+
:expiration_date => "05/2012",
|
836
838
|
)
|
837
839
|
result = Braintree::CreditCard.update(credit_card.token,
|
838
840
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
839
841
|
:three_d_secure_pass_thru => {
|
840
|
-
:eci_flag =>
|
841
|
-
:cavv =>
|
842
|
+
:eci_flag => "02",
|
843
|
+
:cavv => "some_cavv",
|
842
844
|
:three_d_secure_version=> "2.1.0",
|
843
|
-
:xid =>
|
844
|
-
:authentication_response =>
|
845
|
-
:directory_response =>
|
846
|
-
:cavv_algorithm =>
|
847
|
-
:ds_transaction_id =>
|
845
|
+
:xid => "some_xid",
|
846
|
+
:authentication_response => "Y",
|
847
|
+
:directory_response => "Y",
|
848
|
+
:cavv_algorithm => "2",
|
849
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
848
850
|
},
|
849
|
-
:options => {:verify_card => true}
|
851
|
+
:options => {:verify_card => true},
|
850
852
|
)
|
851
853
|
|
852
854
|
result.success?.should == true
|
@@ -862,12 +864,12 @@ describe Braintree::CreditCard do
|
|
862
864
|
:expiration_date => "05/2012",
|
863
865
|
:billing_address => {
|
864
866
|
:street_address => "123 Nigeria Ave"
|
865
|
-
}
|
867
|
+
},
|
866
868
|
)
|
867
869
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
868
870
|
:billing_address => {
|
869
871
|
:region => "IL"
|
870
|
-
}
|
872
|
+
},
|
871
873
|
)
|
872
874
|
update_result.success?.should == true
|
873
875
|
updated_credit_card = update_result.credit_card
|
@@ -884,13 +886,13 @@ describe Braintree::CreditCard do
|
|
884
886
|
:expiration_date => "05/2012",
|
885
887
|
:billing_address => {
|
886
888
|
:street_address => "123 Nigeria Ave"
|
887
|
-
}
|
889
|
+
},
|
888
890
|
)
|
889
891
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
890
892
|
:billing_address => {
|
891
893
|
:region => "IL",
|
892
894
|
:options => {:update_existing => true}
|
893
|
-
}
|
895
|
+
},
|
894
896
|
)
|
895
897
|
update_result.success?.should == true
|
896
898
|
updated_credit_card = update_result.credit_card
|
@@ -907,7 +909,7 @@ describe Braintree::CreditCard do
|
|
907
909
|
:expiration_date => "05/2012",
|
908
910
|
:billing_address => {
|
909
911
|
:street_address => "123 Nigeria Ave"
|
910
|
-
}
|
912
|
+
},
|
911
913
|
)
|
912
914
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
913
915
|
:billing_address => {
|
@@ -916,7 +918,7 @@ describe Braintree::CreditCard do
|
|
916
918
|
:country_code_alpha3 => "ASM",
|
917
919
|
:country_code_numeric => "016",
|
918
920
|
:options => {:update_existing => true}
|
919
|
-
}
|
921
|
+
},
|
920
922
|
)
|
921
923
|
update_result.success?.should == true
|
922
924
|
updated_credit_card = update_result.credit_card
|
@@ -932,12 +934,12 @@ describe Braintree::CreditCard do
|
|
932
934
|
credit_card = Braintree::CreditCard.create!(
|
933
935
|
:customer_id => customer.id,
|
934
936
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
935
|
-
:expiration_date => "05/2012"
|
937
|
+
:expiration_date => "05/2012",
|
936
938
|
)
|
937
939
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
938
940
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
939
941
|
:expiration_month => "07",
|
940
|
-
:expiration_year => "2011"
|
942
|
+
:expiration_year => "2011",
|
941
943
|
)
|
942
944
|
update_result.success?.should == true
|
943
945
|
update_result.credit_card.should == credit_card
|
@@ -953,14 +955,14 @@ describe Braintree::CreditCard do
|
|
953
955
|
:customer_id => customer.id,
|
954
956
|
:cvv => "123",
|
955
957
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
956
|
-
:expiration_date => "05/2012"
|
958
|
+
:expiration_date => "05/2012",
|
957
959
|
)
|
958
960
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
959
961
|
:cardholder_name => "New Holder",
|
960
962
|
:cvv => "456",
|
961
963
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
|
962
964
|
:expiration_date => "06/2013",
|
963
|
-
:options => {:verify_card => true}
|
965
|
+
:options => {:verify_card => true},
|
964
966
|
)
|
965
967
|
update_result.success?.should == false
|
966
968
|
update_result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
@@ -985,7 +987,7 @@ describe Braintree::CreditCard do
|
|
985
987
|
:region => "Old State",
|
986
988
|
:postal_code => "12345",
|
987
989
|
:country_name => "Canada"
|
988
|
-
}
|
990
|
+
},
|
989
991
|
)
|
990
992
|
result = Braintree::CreditCard.update(credit_card.token,
|
991
993
|
:options => {:verify_card => false},
|
@@ -999,7 +1001,7 @@ describe Braintree::CreditCard do
|
|
999
1001
|
:region => "New State",
|
1000
1002
|
:postal_code => "56789",
|
1001
1003
|
:country_name => "United States of America"
|
1002
|
-
}
|
1004
|
+
},
|
1003
1005
|
)
|
1004
1006
|
result.success?.should == true
|
1005
1007
|
address = result.credit_card.billing_address
|
@@ -1020,12 +1022,12 @@ describe Braintree::CreditCard do
|
|
1020
1022
|
:cardholder_name => "Original Holder",
|
1021
1023
|
:customer_id => customer.id,
|
1022
1024
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1023
|
-
:expiration_date => "05/2012"
|
1025
|
+
:expiration_date => "05/2012",
|
1024
1026
|
)
|
1025
1027
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
1026
1028
|
:cardholder_name => "New Holder",
|
1027
1029
|
:number => "invalid",
|
1028
|
-
:expiration_date => "05/2014"
|
1030
|
+
:expiration_date => "05/2014",
|
1029
1031
|
)
|
1030
1032
|
update_result.success?.should == false
|
1031
1033
|
update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
|
@@ -1036,12 +1038,12 @@ describe Braintree::CreditCard do
|
|
1036
1038
|
card1 = Braintree::CreditCard.create(
|
1037
1039
|
:customer_id => customer.id,
|
1038
1040
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1039
|
-
:expiration_date => "05/2009"
|
1041
|
+
:expiration_date => "05/2009",
|
1040
1042
|
).credit_card
|
1041
1043
|
card2 = Braintree::CreditCard.create(
|
1042
1044
|
:customer_id => customer.id,
|
1043
1045
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1044
|
-
:expiration_date => "05/2009"
|
1046
|
+
:expiration_date => "05/2009",
|
1045
1047
|
).credit_card
|
1046
1048
|
|
1047
1049
|
card1.should be_default
|
@@ -1099,12 +1101,12 @@ describe Braintree::CreditCard do
|
|
1099
1101
|
:cardholder_name => "Original Holder",
|
1100
1102
|
:customer_id => customer.id,
|
1101
1103
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1102
|
-
:expiration_date => "05/2012"
|
1104
|
+
:expiration_date => "05/2012",
|
1103
1105
|
)
|
1104
1106
|
updated_credit_card = Braintree::CreditCard.update!(credit_card.token,
|
1105
1107
|
:cardholder_name => "New Holder",
|
1106
1108
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
1107
|
-
:expiration_date => "06/2013"
|
1109
|
+
:expiration_date => "06/2013",
|
1108
1110
|
)
|
1109
1111
|
updated_credit_card.token.should == credit_card.token
|
1110
1112
|
updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
|
@@ -1120,13 +1122,13 @@ describe Braintree::CreditCard do
|
|
1120
1122
|
:cardholder_name => "Original Holder",
|
1121
1123
|
:customer_id => customer.id,
|
1122
1124
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1123
|
-
:expiration_date => "05/2012"
|
1125
|
+
:expiration_date => "05/2012",
|
1124
1126
|
)
|
1125
1127
|
expect do
|
1126
1128
|
Braintree::CreditCard.update!(credit_card.token,
|
1127
1129
|
:cardholder_name => "New Holder",
|
1128
1130
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
1129
|
-
:expiration_date => "invalid/date"
|
1131
|
+
:expiration_date => "invalid/date",
|
1130
1132
|
)
|
1131
1133
|
end.to raise_error(Braintree::ValidationsFailed)
|
1132
1134
|
end
|
@@ -1138,7 +1140,7 @@ describe Braintree::CreditCard do
|
|
1138
1140
|
result = Braintree::CreditCard.create(
|
1139
1141
|
:customer_id => customer.id,
|
1140
1142
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1141
|
-
:expiration_date => "05/2012"
|
1143
|
+
:expiration_date => "05/2012",
|
1142
1144
|
)
|
1143
1145
|
|
1144
1146
|
result.success?.should == true
|
@@ -1158,7 +1160,7 @@ describe Braintree::CreditCard do
|
|
1158
1160
|
Braintree::CreditCard.create!(
|
1159
1161
|
:customer_id => customer.id,
|
1160
1162
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1161
|
-
:expiration_date => "01/#{Time.now.year - 3}"
|
1163
|
+
:expiration_date => "01/#{Time.now.year - 3}",
|
1162
1164
|
)
|
1163
1165
|
end
|
1164
1166
|
|
@@ -1189,14 +1191,14 @@ describe Braintree::CreditCard do
|
|
1189
1191
|
Braintree::CreditCard.create!(
|
1190
1192
|
:customer_id => customer.id,
|
1191
1193
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1192
|
-
:expiration_date => "01/2010"
|
1194
|
+
:expiration_date => "01/2010",
|
1193
1195
|
)
|
1194
1196
|
end
|
1195
1197
|
|
1196
1198
|
collection = Braintree::CreditCard.expiring_between(Time.mktime(2010, 1, 1), Time.mktime(2010,3, 1))
|
1197
1199
|
collection.maximum_size.should > 100
|
1198
1200
|
|
1199
|
-
credit_card_ids = collection.map {|c| c.token }.uniq.compact
|
1201
|
+
credit_card_ids = collection.map { |c| c.token }.uniq.compact
|
1200
1202
|
credit_card_ids.size.should == collection.maximum_size
|
1201
1203
|
end
|
1202
1204
|
end
|
@@ -1207,7 +1209,7 @@ describe Braintree::CreditCard do
|
|
1207
1209
|
result = Braintree::CreditCard.create(
|
1208
1210
|
:customer_id => customer.id,
|
1209
1211
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1210
|
-
:expiration_date => "05/2012"
|
1212
|
+
:expiration_date => "05/2012",
|
1211
1213
|
)
|
1212
1214
|
result.success?.should == true
|
1213
1215
|
credit_card = Braintree::CreditCard.find(result.credit_card.token)
|
@@ -1222,13 +1224,13 @@ describe Braintree::CreditCard do
|
|
1222
1224
|
credit_card = Braintree::CreditCard.create(
|
1223
1225
|
:customer_id => customer.id,
|
1224
1226
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1225
|
-
:expiration_date => "05/2012"
|
1227
|
+
:expiration_date => "05/2012",
|
1226
1228
|
).credit_card
|
1227
1229
|
|
1228
1230
|
subscription = Braintree::Subscription.create(
|
1229
1231
|
:payment_method_token => credit_card.token,
|
1230
1232
|
:plan_id => "integration_trialless_plan",
|
1231
|
-
:price => "1.00"
|
1233
|
+
:price => "1.00",
|
1232
1234
|
).subscription
|
1233
1235
|
|
1234
1236
|
found_card = Braintree::CreditCard.find(credit_card.token)
|
@@ -1272,7 +1274,7 @@ describe Braintree::CreditCard do
|
|
1272
1274
|
:expiration_month => "11",
|
1273
1275
|
:expiration_year => "2099",
|
1274
1276
|
},
|
1275
|
-
:client_token_options => {:customer_id => customer.id}
|
1277
|
+
:client_token_options => {:customer_id => customer.id},
|
1276
1278
|
)
|
1277
1279
|
|
1278
1280
|
credit_card = Braintree::CreditCard.from_nonce(nonce)
|
@@ -1286,7 +1288,7 @@ describe Braintree::CreditCard do
|
|
1286
1288
|
:number => "4111111111111111",
|
1287
1289
|
:expiration_month => "11",
|
1288
1290
|
:expiration_year => "2099",
|
1289
|
-
}
|
1291
|
+
},
|
1290
1292
|
)
|
1291
1293
|
expect do
|
1292
1294
|
Braintree::CreditCard.from_nonce(nonce)
|
@@ -1301,7 +1303,7 @@ describe Braintree::CreditCard do
|
|
1301
1303
|
:expiration_month => "11",
|
1302
1304
|
:expiration_year => "2099",
|
1303
1305
|
},
|
1304
|
-
:client_token_options => {:customer_id => customer.id}
|
1306
|
+
:client_token_options => {:customer_id => customer.id},
|
1305
1307
|
)
|
1306
1308
|
|
1307
1309
|
Braintree::CreditCard.from_nonce(nonce)
|
@@ -1317,7 +1319,7 @@ describe Braintree::CreditCard do
|
|
1317
1319
|
:credit_card => {
|
1318
1320
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1319
1321
|
:expiration_date => "05/2010"
|
1320
|
-
}
|
1322
|
+
},
|
1321
1323
|
)
|
1322
1324
|
result = Braintree::CreditCard.sale(customer.credit_cards[0].token, :amount => "100.00")
|
1323
1325
|
|
@@ -1336,13 +1338,13 @@ describe Braintree::CreditCard do
|
|
1336
1338
|
:credit_card => {
|
1337
1339
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1338
1340
|
:expiration_date => "05/2010"
|
1339
|
-
}
|
1341
|
+
},
|
1340
1342
|
)
|
1341
1343
|
result = Braintree::CreditCard.sale(customer.credit_cards[0].token,
|
1342
1344
|
:amount => "100.00",
|
1343
1345
|
:credit_card => {
|
1344
1346
|
:cvv => "301"
|
1345
|
-
}
|
1347
|
+
},
|
1346
1348
|
)
|
1347
1349
|
|
1348
1350
|
result.success?.should == true
|
@@ -1360,7 +1362,7 @@ describe Braintree::CreditCard do
|
|
1360
1362
|
:credit_card => {
|
1361
1363
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1362
1364
|
:expiration_date => "05/2010"
|
1363
|
-
}
|
1365
|
+
},
|
1364
1366
|
)
|
1365
1367
|
transaction = Braintree::CreditCard.sale!(customer.credit_cards[0].token, :amount => "100.00")
|
1366
1368
|
transaction.amount.should == BigDecimal("100.00")
|
@@ -1380,7 +1382,7 @@ describe Braintree::CreditCard do
|
|
1380
1382
|
:cardholder_name => "Original Holder",
|
1381
1383
|
:customer_id => customer.id,
|
1382
1384
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1383
|
-
:expiration_date => "05/2012"
|
1385
|
+
:expiration_date => "05/2012",
|
1384
1386
|
)
|
1385
1387
|
|
1386
1388
|
credit_card.nonce.should_not be_nil
|
@@ -1398,7 +1400,7 @@ describe Braintree::CreditCard do
|
|
1398
1400
|
credit_card = Braintree::CreditCard.create(
|
1399
1401
|
:customer_id => customer.id,
|
1400
1402
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1401
|
-
:expiration_date => "05/2009"
|
1403
|
+
:expiration_date => "05/2009",
|
1402
1404
|
).credit_card
|
1403
1405
|
credit_card_vaulted = Braintree::CreditCard.find(credit_card.token)
|
1404
1406
|
credit_card_vaulted.is_network_tokenized?.should == false
|