braintree 3.3.0 → 3.4.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 +1 -1
- data/lib/braintree.rb +2 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +1 -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 +3 -3
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +2 -2
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +1 -1
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +2 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +7 -0
- 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 +3 -3
- 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/revoked_payment_method_metadata.rb +1 -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/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +23 -4
- 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 +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 +1 -1
- data/lib/braintree/xml/parser.rb +10 -10
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +24 -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 +119 -119
- 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 +165 -165
- data/spec/integration/braintree/dispute_search_spec.rb +3 -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 +12 -12
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +12 -12
- data/spec/integration/braintree/payment_method_spec.rb +165 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- 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 +498 -344
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- 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 +2 -2
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +4 -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 +7 -7
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +2 -2
- data/spec/unit/braintree/customer_spec.rb +3 -3
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_spec.rb +8 -8
- 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_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +9 -9
- 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 +1 -1
- 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/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 +72 -56
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +3 -3
- data/lib/braintree/settlement_batch.rb +0 -0
|
@@ -12,12 +12,12 @@ describe Braintree::PaymentMethodNonce do
|
|
|
12
12
|
:number => "4111111111111111",
|
|
13
13
|
:expiration_month => "11",
|
|
14
14
|
:expiration_year => "2099",
|
|
15
|
-
}
|
|
15
|
+
},
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
result = Braintree::PaymentMethod.create(
|
|
19
19
|
:payment_method_nonce => nonce,
|
|
20
|
-
:customer_id => customer.id
|
|
20
|
+
:customer_id => customer.id,
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
result.should be_success
|
|
@@ -49,12 +49,12 @@ describe Braintree::PaymentMethodNonce do
|
|
|
49
49
|
:number => "4111111111111111",
|
|
50
50
|
:expiration_month => "11",
|
|
51
51
|
:expiration_year => "2099",
|
|
52
|
-
}
|
|
52
|
+
},
|
|
53
53
|
)
|
|
54
54
|
|
|
55
55
|
payment_method = Braintree::PaymentMethod.create!(
|
|
56
56
|
:payment_method_nonce => nonce,
|
|
57
|
-
:customer_id => customer.id
|
|
57
|
+
:customer_id => customer.id,
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
payment_method.should be_a(Braintree::CreditCard)
|
|
@@ -114,7 +114,7 @@ describe Braintree::PaymentMethodNonce do
|
|
|
114
114
|
:number => "4111111111111111",
|
|
115
115
|
:expiration_month => "11",
|
|
116
116
|
:expiration_year => "2099",
|
|
117
|
-
}
|
|
117
|
+
},
|
|
118
118
|
)
|
|
119
119
|
|
|
120
120
|
result = Braintree::PaymentMethodNonce.find(nonce)
|
|
@@ -257,19 +257,19 @@ describe Braintree::PaymentMethodNonce do
|
|
|
257
257
|
context "regulation environments" do
|
|
258
258
|
it "can get unregulated" do
|
|
259
259
|
expect(
|
|
260
|
-
request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment]
|
|
260
|
+
request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment],
|
|
261
261
|
).to eq "unregulated"
|
|
262
262
|
end
|
|
263
263
|
|
|
264
264
|
it "can get psd2" do
|
|
265
265
|
expect(
|
|
266
|
-
request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment]
|
|
266
|
+
request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment],
|
|
267
267
|
).to eq "psd2"
|
|
268
268
|
end
|
|
269
269
|
|
|
270
270
|
it "can get rbi" do
|
|
271
271
|
expect(
|
|
272
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment]
|
|
272
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment],
|
|
273
273
|
).to eq "rbi"
|
|
274
274
|
end
|
|
275
275
|
end
|
|
@@ -277,19 +277,19 @@ describe Braintree::PaymentMethodNonce do
|
|
|
277
277
|
context "sca_indicator" do
|
|
278
278
|
it "can get unavailable" do
|
|
279
279
|
expect(
|
|
280
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator]
|
|
280
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator],
|
|
281
281
|
).to eq "unavailable"
|
|
282
282
|
end
|
|
283
283
|
|
|
284
284
|
it "can get sca_required" do
|
|
285
285
|
expect(
|
|
286
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator]
|
|
286
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator],
|
|
287
287
|
).to eq "sca_required"
|
|
288
288
|
end
|
|
289
289
|
|
|
290
290
|
it "can get sca_optional" do
|
|
291
291
|
expect(
|
|
292
|
-
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator]
|
|
292
|
+
request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator],
|
|
293
293
|
|
|
294
294
|
).to eq "sca_optional"
|
|
295
295
|
end
|
|
@@ -309,7 +309,7 @@ describe Braintree::PaymentMethodNonce do
|
|
|
309
309
|
|
|
310
310
|
result = Braintree::PaymentMethodNonce.create(
|
|
311
311
|
payment_method_token,
|
|
312
|
-
payment_method_nonce: nonce_request
|
|
312
|
+
payment_method_nonce: nonce_request,
|
|
313
313
|
)
|
|
314
314
|
result.should be_success
|
|
315
315
|
|
|
@@ -17,20 +17,20 @@ describe Braintree::PaymentMethod do
|
|
|
17
17
|
config,
|
|
18
18
|
:authorization_fingerprint => authorization_fingerprint,
|
|
19
19
|
:shared_customer_identifier => "fake_identifier",
|
|
20
|
-
:shared_customer_identifier_type => "testing"
|
|
20
|
+
:shared_customer_identifier_type => "testing",
|
|
21
21
|
)
|
|
22
22
|
|
|
23
23
|
response = http.create_credit_card(
|
|
24
24
|
:number => 4111111111111111,
|
|
25
25
|
:expirationMonth => 12,
|
|
26
|
-
:expirationYear => 2020
|
|
26
|
+
:expirationYear => 2020,
|
|
27
27
|
)
|
|
28
28
|
response.code.should == "201"
|
|
29
29
|
|
|
30
30
|
nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
|
|
31
31
|
result = Braintree::PaymentMethod.create(
|
|
32
32
|
:payment_method_nonce => nonce,
|
|
33
|
-
:customer_id => customer.id
|
|
33
|
+
:customer_id => customer.id,
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
result.should be_success
|
|
@@ -51,21 +51,21 @@ describe Braintree::PaymentMethod do
|
|
|
51
51
|
config,
|
|
52
52
|
:authorization_fingerprint => authorization_fingerprint,
|
|
53
53
|
:shared_customer_identifier => "fake_identifier",
|
|
54
|
-
:shared_customer_identifier_type => "testing"
|
|
54
|
+
:shared_customer_identifier_type => "testing",
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
response = http.create_credit_card(
|
|
58
58
|
:number => "4111111111111111",
|
|
59
59
|
:expirationMonth => "12",
|
|
60
60
|
:expirationYear => "2020",
|
|
61
|
-
:options => {:validate => false}
|
|
61
|
+
:options => {:validate => false},
|
|
62
62
|
)
|
|
63
63
|
response.code.should == "202"
|
|
64
64
|
|
|
65
65
|
nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
|
|
66
66
|
result = Braintree::PaymentMethod.create(
|
|
67
67
|
:payment_method_nonce => nonce,
|
|
68
|
-
:customer_id => customer.id
|
|
68
|
+
:customer_id => customer.id,
|
|
69
69
|
)
|
|
70
70
|
|
|
71
71
|
result.should be_success
|
|
@@ -82,7 +82,7 @@ describe Braintree::PaymentMethod do
|
|
|
82
82
|
result = Braintree::PaymentMethod.create(
|
|
83
83
|
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
|
|
84
84
|
:customer_id => customer.id,
|
|
85
|
-
:token => token
|
|
85
|
+
:token => token,
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
result.should be_success
|
|
@@ -107,7 +107,7 @@ describe Braintree::PaymentMethod do
|
|
|
107
107
|
result = Braintree::PaymentMethod.create(
|
|
108
108
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
|
109
109
|
:customer_id => customer.id,
|
|
110
|
-
:token => token
|
|
110
|
+
:token => token,
|
|
111
111
|
)
|
|
112
112
|
|
|
113
113
|
result.should be_success
|
|
@@ -135,7 +135,7 @@ describe Braintree::PaymentMethod do
|
|
|
135
135
|
result = Braintree::PaymentMethod.create(
|
|
136
136
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
|
|
137
137
|
:customer_id => customer.id,
|
|
138
|
-
:token => token
|
|
138
|
+
:token => token,
|
|
139
139
|
)
|
|
140
140
|
|
|
141
141
|
result.should be_success
|
|
@@ -163,7 +163,7 @@ describe Braintree::PaymentMethod do
|
|
|
163
163
|
result = Braintree::PaymentMethod.create(
|
|
164
164
|
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
|
165
165
|
:customer_id => customer.id,
|
|
166
|
-
:token => token
|
|
166
|
+
:token => token,
|
|
167
167
|
)
|
|
168
168
|
|
|
169
169
|
result.should be_success
|
|
@@ -185,7 +185,7 @@ describe Braintree::PaymentMethod do
|
|
|
185
185
|
:customer_id => customer.id,
|
|
186
186
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
187
187
|
:expiration_date => "05/2009",
|
|
188
|
-
:cvv => "100"
|
|
188
|
+
:cvv => "100",
|
|
189
189
|
)
|
|
190
190
|
result.success?.should == true
|
|
191
191
|
original_payment_method = result.credit_card
|
|
@@ -195,7 +195,7 @@ describe Braintree::PaymentMethod do
|
|
|
195
195
|
result = Braintree::PaymentMethod.create(
|
|
196
196
|
:payment_method_nonce => nonce,
|
|
197
197
|
:customer_id => customer.id,
|
|
198
|
-
:options => {:make_default => true}
|
|
198
|
+
:options => {:make_default => true},
|
|
199
199
|
)
|
|
200
200
|
|
|
201
201
|
result.should be_success
|
|
@@ -210,12 +210,12 @@ describe Braintree::PaymentMethod do
|
|
|
210
210
|
second_token = make_token
|
|
211
211
|
nonce = nonce_for_paypal_account(
|
|
212
212
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
|
213
|
-
:token => first_token
|
|
213
|
+
:token => first_token,
|
|
214
214
|
)
|
|
215
215
|
result = Braintree::PaymentMethod.create(
|
|
216
216
|
:payment_method_nonce => nonce,
|
|
217
217
|
:customer_id => customer.id,
|
|
218
|
-
:token => second_token
|
|
218
|
+
:token => second_token,
|
|
219
219
|
)
|
|
220
220
|
|
|
221
221
|
result.should be_success
|
|
@@ -229,7 +229,7 @@ describe Braintree::PaymentMethod do
|
|
|
229
229
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
|
230
230
|
:expiration_month => "11",
|
|
231
231
|
:expiration_year => "2099",
|
|
232
|
-
}
|
|
232
|
+
},
|
|
233
233
|
)
|
|
234
234
|
customer = Braintree::Customer.create!
|
|
235
235
|
result = Braintree::PaymentMethod.create(
|
|
@@ -238,7 +238,7 @@ describe Braintree::PaymentMethod do
|
|
|
238
238
|
:options => {
|
|
239
239
|
:verify_card => true,
|
|
240
240
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
|
241
|
-
}
|
|
241
|
+
},
|
|
242
242
|
)
|
|
243
243
|
|
|
244
244
|
result.should_not be_success
|
|
@@ -254,7 +254,7 @@ describe Braintree::PaymentMethod do
|
|
|
254
254
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
|
255
255
|
:expiration_month => "11",
|
|
256
256
|
:expiration_year => "2099",
|
|
257
|
-
}
|
|
257
|
+
},
|
|
258
258
|
)
|
|
259
259
|
customer = Braintree::Customer.create!
|
|
260
260
|
result = Braintree::PaymentMethod.create(
|
|
@@ -263,7 +263,7 @@ describe Braintree::PaymentMethod do
|
|
|
263
263
|
:options => {
|
|
264
264
|
:verify_card => true,
|
|
265
265
|
:verification_amount => "100.00"
|
|
266
|
-
}
|
|
266
|
+
},
|
|
267
267
|
)
|
|
268
268
|
|
|
269
269
|
result.should_not be_success
|
|
@@ -279,16 +279,16 @@ describe Braintree::PaymentMethod do
|
|
|
279
279
|
:customer_id => customer.id,
|
|
280
280
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
281
281
|
:three_d_secure_pass_thru => {
|
|
282
|
-
:eci_flag =>
|
|
283
|
-
:cavv =>
|
|
284
|
-
:xid =>
|
|
285
|
-
:three_d_secure_version =>
|
|
286
|
-
:authentication_response =>
|
|
287
|
-
:directory_response =>
|
|
288
|
-
:cavv_algorithm =>
|
|
289
|
-
:ds_transaction_id =>
|
|
282
|
+
:eci_flag => "02",
|
|
283
|
+
:cavv => "some_cavv",
|
|
284
|
+
:xid => "some_xid",
|
|
285
|
+
:three_d_secure_version => "xx",
|
|
286
|
+
:authentication_response => "Y",
|
|
287
|
+
:directory_response => "Y",
|
|
288
|
+
:cavv_algorithm => "2",
|
|
289
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
290
290
|
},
|
|
291
|
-
:options => {:verify_card => true}
|
|
291
|
+
:options => {:verify_card => true},
|
|
292
292
|
)
|
|
293
293
|
expect(result).not_to be_success
|
|
294
294
|
error = result.errors.for(:verification).first
|
|
@@ -302,16 +302,16 @@ describe Braintree::PaymentMethod do
|
|
|
302
302
|
:customer_id => customer.id,
|
|
303
303
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
304
304
|
:three_d_secure_pass_thru => {
|
|
305
|
-
:eci_flag =>
|
|
306
|
-
:cavv =>
|
|
307
|
-
:xid =>
|
|
308
|
-
:three_d_secure_version =>
|
|
309
|
-
:authentication_response =>
|
|
310
|
-
:directory_response =>
|
|
311
|
-
:cavv_algorithm =>
|
|
312
|
-
:ds_transaction_id =>
|
|
305
|
+
:eci_flag => "02",
|
|
306
|
+
:cavv => "some_cavv",
|
|
307
|
+
:xid => "some_xid",
|
|
308
|
+
:three_d_secure_version => "1.0.2",
|
|
309
|
+
:authentication_response => "Y",
|
|
310
|
+
:directory_response => "Y",
|
|
311
|
+
:cavv_algorithm => "2",
|
|
312
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
313
313
|
},
|
|
314
|
-
:options => {:verify_card => true}
|
|
314
|
+
:options => {:verify_card => true},
|
|
315
315
|
)
|
|
316
316
|
|
|
317
317
|
expect(result).to be_success
|
|
@@ -343,7 +343,7 @@ describe Braintree::PaymentMethod do
|
|
|
343
343
|
result = Braintree::CreditCard.create(
|
|
344
344
|
:customer_id => customer.id,
|
|
345
345
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
346
|
-
:expiration_date => "05/2012"
|
|
346
|
+
:expiration_date => "05/2012",
|
|
347
347
|
)
|
|
348
348
|
result.should be_success
|
|
349
349
|
|
|
@@ -351,14 +351,14 @@ describe Braintree::PaymentMethod do
|
|
|
351
351
|
:credit_card => {
|
|
352
352
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
353
353
|
:expiration_date => "05/2012"
|
|
354
|
-
}
|
|
354
|
+
},
|
|
355
355
|
)
|
|
356
356
|
result = Braintree::PaymentMethod.create(
|
|
357
357
|
:payment_method_nonce => nonce,
|
|
358
358
|
:customer_id => customer.id,
|
|
359
359
|
:options => {
|
|
360
360
|
:fail_on_duplicate_payment_method => true
|
|
361
|
-
}
|
|
361
|
+
},
|
|
362
362
|
)
|
|
363
363
|
|
|
364
364
|
result.should_not be_success
|
|
@@ -375,14 +375,14 @@ describe Braintree::PaymentMethod do
|
|
|
375
375
|
config,
|
|
376
376
|
:authorization_fingerprint => authorization_fingerprint,
|
|
377
377
|
:shared_customer_identifier => "fake_identifier",
|
|
378
|
-
:shared_customer_identifier_type => "testing"
|
|
378
|
+
:shared_customer_identifier_type => "testing",
|
|
379
379
|
)
|
|
380
380
|
|
|
381
381
|
response = http.create_credit_card(
|
|
382
382
|
:number => "4111111111111111",
|
|
383
383
|
:expirationMonth => "12",
|
|
384
384
|
:expirationYear => "2020",
|
|
385
|
-
:options => {:validate => false}
|
|
385
|
+
:options => {:validate => false},
|
|
386
386
|
)
|
|
387
387
|
response.code.should == "202"
|
|
388
388
|
|
|
@@ -392,7 +392,7 @@ describe Braintree::PaymentMethod do
|
|
|
392
392
|
:customer_id => customer.id,
|
|
393
393
|
:billing_address => {
|
|
394
394
|
:street_address => "123 Abc Way"
|
|
395
|
-
}
|
|
395
|
+
},
|
|
396
396
|
)
|
|
397
397
|
|
|
398
398
|
result.should be_success
|
|
@@ -414,14 +414,14 @@ describe Braintree::PaymentMethod do
|
|
|
414
414
|
config,
|
|
415
415
|
:authorization_fingerprint => authorization_fingerprint,
|
|
416
416
|
:shared_customer_identifier => "fake_identifier",
|
|
417
|
-
:shared_customer_identifier_type => "testing"
|
|
417
|
+
:shared_customer_identifier_type => "testing",
|
|
418
418
|
)
|
|
419
419
|
|
|
420
420
|
response = http.create_credit_card(
|
|
421
421
|
:number => "4111111111111111",
|
|
422
422
|
:expirationMonth => "12",
|
|
423
423
|
:expirationYear => "2020",
|
|
424
|
-
:options => {:validate => false}
|
|
424
|
+
:options => {:validate => false},
|
|
425
425
|
)
|
|
426
426
|
response.code.should == "202"
|
|
427
427
|
|
|
@@ -431,7 +431,7 @@ describe Braintree::PaymentMethod do
|
|
|
431
431
|
result = Braintree::PaymentMethod.create(
|
|
432
432
|
:payment_method_nonce => nonce,
|
|
433
433
|
:customer_id => customer.id,
|
|
434
|
-
:billing_address_id => address.id
|
|
434
|
+
:billing_address_id => address.id,
|
|
435
435
|
)
|
|
436
436
|
|
|
437
437
|
result.should be_success
|
|
@@ -454,7 +454,7 @@ describe Braintree::PaymentMethod do
|
|
|
454
454
|
config,
|
|
455
455
|
:authorization_fingerprint => authorization_fingerprint,
|
|
456
456
|
:shared_customer_identifier => "fake_identifier",
|
|
457
|
-
:shared_customer_identifier_type => "testing"
|
|
457
|
+
:shared_customer_identifier_type => "testing",
|
|
458
458
|
)
|
|
459
459
|
|
|
460
460
|
response = http.create_credit_card(
|
|
@@ -464,7 +464,7 @@ describe Braintree::PaymentMethod do
|
|
|
464
464
|
:options => {:validate => false},
|
|
465
465
|
:billing_address => {
|
|
466
466
|
:street_address => "456 Xyz Way"
|
|
467
|
-
}
|
|
467
|
+
},
|
|
468
468
|
)
|
|
469
469
|
response.code.should == "202"
|
|
470
470
|
|
|
@@ -474,7 +474,7 @@ describe Braintree::PaymentMethod do
|
|
|
474
474
|
:customer_id => customer.id,
|
|
475
475
|
:billing_address => {
|
|
476
476
|
:street_address => "123 Abc Way"
|
|
477
|
-
}
|
|
477
|
+
},
|
|
478
478
|
)
|
|
479
479
|
|
|
480
480
|
result.should be_success
|
|
@@ -496,7 +496,7 @@ describe Braintree::PaymentMethod do
|
|
|
496
496
|
config,
|
|
497
497
|
:authorization_fingerprint => authorization_fingerprint,
|
|
498
498
|
:shared_customer_identifier => "fake_identifier",
|
|
499
|
-
:shared_customer_identifier_type => "testing"
|
|
499
|
+
:shared_customer_identifier_type => "testing",
|
|
500
500
|
)
|
|
501
501
|
|
|
502
502
|
response = http.create_credit_card(
|
|
@@ -505,7 +505,7 @@ describe Braintree::PaymentMethod do
|
|
|
505
505
|
:expirationYear => 2020,
|
|
506
506
|
:billing_address => {
|
|
507
507
|
:street_address => "456 Xyz Way"
|
|
508
|
-
}
|
|
508
|
+
},
|
|
509
509
|
)
|
|
510
510
|
response.code.should == "201"
|
|
511
511
|
|
|
@@ -515,7 +515,7 @@ describe Braintree::PaymentMethod do
|
|
|
515
515
|
:customer_id => customer.id,
|
|
516
516
|
:billing_address => {
|
|
517
517
|
:street_address => "123 Abc Way"
|
|
518
|
-
}
|
|
518
|
+
},
|
|
519
519
|
)
|
|
520
520
|
|
|
521
521
|
result.should be_success
|
|
@@ -534,7 +534,7 @@ describe Braintree::PaymentMethod do
|
|
|
534
534
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
535
535
|
:expiration_month => "11",
|
|
536
536
|
:expiration_year => "2099",
|
|
537
|
-
}
|
|
537
|
+
},
|
|
538
538
|
)
|
|
539
539
|
customer = Braintree::Customer.create!
|
|
540
540
|
result = Braintree::PaymentMethod.create(
|
|
@@ -544,7 +544,7 @@ describe Braintree::PaymentMethod do
|
|
|
544
544
|
:verify_card => true,
|
|
545
545
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
546
546
|
:verification_account_type => "debit",
|
|
547
|
-
}
|
|
547
|
+
},
|
|
548
548
|
)
|
|
549
549
|
|
|
550
550
|
result.should be_success
|
|
@@ -557,7 +557,7 @@ describe Braintree::PaymentMethod do
|
|
|
557
557
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
558
558
|
:expiration_month => "11",
|
|
559
559
|
:expiration_year => "2099",
|
|
560
|
-
}
|
|
560
|
+
},
|
|
561
561
|
)
|
|
562
562
|
customer = Braintree::Customer.create!
|
|
563
563
|
result = Braintree::PaymentMethod.create(
|
|
@@ -567,7 +567,7 @@ describe Braintree::PaymentMethod do
|
|
|
567
567
|
:verify_card => true,
|
|
568
568
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
569
569
|
:verification_account_type => "credit",
|
|
570
|
-
}
|
|
570
|
+
},
|
|
571
571
|
)
|
|
572
572
|
|
|
573
573
|
result.should be_success
|
|
@@ -580,7 +580,7 @@ describe Braintree::PaymentMethod do
|
|
|
580
580
|
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
581
581
|
:expiration_month => "11",
|
|
582
582
|
:expiration_year => "2099",
|
|
583
|
-
}
|
|
583
|
+
},
|
|
584
584
|
)
|
|
585
585
|
customer = Braintree::Customer.create!
|
|
586
586
|
result = Braintree::PaymentMethod.create(
|
|
@@ -590,7 +590,7 @@ describe Braintree::PaymentMethod do
|
|
|
590
590
|
:verify_card => true,
|
|
591
591
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
592
592
|
:verification_account_type => "ach",
|
|
593
|
-
}
|
|
593
|
+
},
|
|
594
594
|
)
|
|
595
595
|
|
|
596
596
|
result.should_not be_success
|
|
@@ -603,7 +603,7 @@ describe Braintree::PaymentMethod do
|
|
|
603
603
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
604
604
|
:expiration_month => "11",
|
|
605
605
|
:expiration_year => "2099",
|
|
606
|
-
}
|
|
606
|
+
},
|
|
607
607
|
)
|
|
608
608
|
customer = Braintree::Customer.create!
|
|
609
609
|
result = Braintree::PaymentMethod.create(
|
|
@@ -612,7 +612,7 @@ describe Braintree::PaymentMethod do
|
|
|
612
612
|
:options => {
|
|
613
613
|
:verify_card => true,
|
|
614
614
|
:verification_account_type => "credit",
|
|
615
|
-
}
|
|
615
|
+
},
|
|
616
616
|
)
|
|
617
617
|
|
|
618
618
|
result.should_not be_success
|
|
@@ -626,7 +626,7 @@ describe Braintree::PaymentMethod do
|
|
|
626
626
|
:customer_id => customer.id,
|
|
627
627
|
:cvv => "123",
|
|
628
628
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
629
|
-
:expiration_date => "05/2012"
|
|
629
|
+
:expiration_date => "05/2012",
|
|
630
630
|
)
|
|
631
631
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
632
632
|
:cardholder_name => "New Holder",
|
|
@@ -650,7 +650,7 @@ describe Braintree::PaymentMethod do
|
|
|
650
650
|
:customer_id => customer.id,
|
|
651
651
|
:cvv => "123",
|
|
652
652
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
653
|
-
:expiration_date => "05/2012"
|
|
653
|
+
:expiration_date => "05/2012",
|
|
654
654
|
)
|
|
655
655
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
656
656
|
:cardholder_name => "New Holder",
|
|
@@ -674,7 +674,7 @@ describe Braintree::PaymentMethod do
|
|
|
674
674
|
customer = Braintree::Customer.create.customer
|
|
675
675
|
result = Braintree::PaymentMethod.create(
|
|
676
676
|
:payment_method_nonce => nonce,
|
|
677
|
-
:customer_id => customer.id
|
|
677
|
+
:customer_id => customer.id,
|
|
678
678
|
)
|
|
679
679
|
|
|
680
680
|
result.should be_success
|
|
@@ -751,7 +751,7 @@ describe Braintree::PaymentMethod do
|
|
|
751
751
|
nonce = nonce_for_paypal_account(:access_token => "PAYPAL_ACCESS_TOKEN")
|
|
752
752
|
result = Braintree::PaymentMethod.create(
|
|
753
753
|
:payment_method_nonce => nonce,
|
|
754
|
-
:customer_id => customer.id
|
|
754
|
+
:customer_id => customer.id,
|
|
755
755
|
)
|
|
756
756
|
|
|
757
757
|
result.should_not be_success
|
|
@@ -766,7 +766,7 @@ describe Braintree::PaymentMethod do
|
|
|
766
766
|
:customer_id => customer.id,
|
|
767
767
|
:billing_address => {
|
|
768
768
|
:street_address => "123 Abc Way"
|
|
769
|
-
}
|
|
769
|
+
},
|
|
770
770
|
)
|
|
771
771
|
|
|
772
772
|
result.should be_success
|
|
@@ -784,7 +784,7 @@ describe Braintree::PaymentMethod do
|
|
|
784
784
|
result = Braintree::PaymentMethod.create(
|
|
785
785
|
:payment_method_nonce => nonce,
|
|
786
786
|
:customer_id => customer.id,
|
|
787
|
-
:billing_address_id => "address_id"
|
|
787
|
+
:billing_address_id => "address_id",
|
|
788
788
|
)
|
|
789
789
|
|
|
790
790
|
result.should be_success
|
|
@@ -801,7 +801,7 @@ describe Braintree::PaymentMethod do
|
|
|
801
801
|
nonce = nonce_for_paypal_account(:token => "PAYPAL_TOKEN")
|
|
802
802
|
result = Braintree::PaymentMethod.create(
|
|
803
803
|
:payment_method_nonce => nonce,
|
|
804
|
-
:customer_id => customer.id
|
|
804
|
+
:customer_id => customer.id,
|
|
805
805
|
)
|
|
806
806
|
|
|
807
807
|
result.should_not be_success
|
|
@@ -815,7 +815,7 @@ describe Braintree::PaymentMethod do
|
|
|
815
815
|
original_token = random_payment_method_token
|
|
816
816
|
nonce = nonce_for_paypal_account(
|
|
817
817
|
:consent_code => "consent-code",
|
|
818
|
-
:token => original_token
|
|
818
|
+
:token => original_token,
|
|
819
819
|
)
|
|
820
820
|
|
|
821
821
|
result = Braintree::PaymentMethod.create(
|
|
@@ -825,7 +825,7 @@ describe Braintree::PaymentMethod do
|
|
|
825
825
|
:verify_card => true,
|
|
826
826
|
:fail_on_duplicate_payment_method => true,
|
|
827
827
|
:verification_merchant_account_id => "not_a_real_merchant_account_id"
|
|
828
|
-
}
|
|
828
|
+
},
|
|
829
829
|
)
|
|
830
830
|
|
|
831
831
|
result.should be_success
|
|
@@ -839,7 +839,7 @@ describe Braintree::PaymentMethod do
|
|
|
839
839
|
result = Braintree::PaymentMethod.create(
|
|
840
840
|
:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
|
|
841
841
|
:customer_id => customer.id,
|
|
842
|
-
:token => token
|
|
842
|
+
:token => token,
|
|
843
843
|
)
|
|
844
844
|
|
|
845
845
|
result.should be_success
|
|
@@ -857,7 +857,7 @@ describe Braintree::PaymentMethod do
|
|
|
857
857
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
858
858
|
:expiration_month => "11",
|
|
859
859
|
:expiration_year => "2099",
|
|
860
|
-
}
|
|
860
|
+
},
|
|
861
861
|
)
|
|
862
862
|
customer = Braintree::Customer.create!
|
|
863
863
|
result = Braintree::PaymentMethod.create(
|
|
@@ -866,7 +866,7 @@ describe Braintree::PaymentMethod do
|
|
|
866
866
|
:options => {
|
|
867
867
|
:verify_card => true,
|
|
868
868
|
:verification_currency_iso_code => "USD"
|
|
869
|
-
}
|
|
869
|
+
},
|
|
870
870
|
)
|
|
871
871
|
|
|
872
872
|
result.should be_success
|
|
@@ -879,7 +879,7 @@ describe Braintree::PaymentMethod do
|
|
|
879
879
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
880
880
|
:expiration_month => "11",
|
|
881
881
|
:expiration_year => "2099",
|
|
882
|
-
}
|
|
882
|
+
},
|
|
883
883
|
)
|
|
884
884
|
customer = Braintree::Customer.create!
|
|
885
885
|
result = Braintree::PaymentMethod.create(
|
|
@@ -889,7 +889,7 @@ describe Braintree::PaymentMethod do
|
|
|
889
889
|
:verify_card => true,
|
|
890
890
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
|
891
891
|
:verification_currency_iso_code => "USD"
|
|
892
|
-
}
|
|
892
|
+
},
|
|
893
893
|
)
|
|
894
894
|
|
|
895
895
|
result.should be_success
|
|
@@ -904,7 +904,7 @@ describe Braintree::PaymentMethod do
|
|
|
904
904
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
905
905
|
:expiration_month => "11",
|
|
906
906
|
:expiration_year => "2099",
|
|
907
|
-
}
|
|
907
|
+
},
|
|
908
908
|
)
|
|
909
909
|
customer = Braintree::Customer.create!
|
|
910
910
|
result = Braintree::PaymentMethod.create(
|
|
@@ -913,7 +913,7 @@ describe Braintree::PaymentMethod do
|
|
|
913
913
|
:options => {
|
|
914
914
|
:verify_card => true,
|
|
915
915
|
:verification_currency_iso_code => "GBP"
|
|
916
|
-
}
|
|
916
|
+
},
|
|
917
917
|
)
|
|
918
918
|
result.should_not be_success
|
|
919
919
|
result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
|
@@ -925,7 +925,7 @@ describe Braintree::PaymentMethod do
|
|
|
925
925
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
926
926
|
:expiration_month => "11",
|
|
927
927
|
:expiration_year => "2099",
|
|
928
|
-
}
|
|
928
|
+
},
|
|
929
929
|
)
|
|
930
930
|
customer = Braintree::Customer.create!
|
|
931
931
|
result = Braintree::PaymentMethod.create(
|
|
@@ -935,7 +935,7 @@ describe Braintree::PaymentMethod do
|
|
|
935
935
|
:verify_card => true,
|
|
936
936
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
|
|
937
937
|
:verification_currency_iso_code => "GBP"
|
|
938
|
-
}
|
|
938
|
+
},
|
|
939
939
|
)
|
|
940
940
|
|
|
941
941
|
result.should_not be_success
|
|
@@ -955,20 +955,20 @@ describe Braintree::PaymentMethod do
|
|
|
955
955
|
config,
|
|
956
956
|
:authorization_fingerprint => authorization_fingerprint,
|
|
957
957
|
:shared_customer_identifier => "fake_identifier",
|
|
958
|
-
:shared_customer_identifier_type => "testing"
|
|
958
|
+
:shared_customer_identifier_type => "testing",
|
|
959
959
|
)
|
|
960
960
|
|
|
961
961
|
response = http.create_credit_card(
|
|
962
962
|
:number => 4111111111111111,
|
|
963
963
|
:expirationMonth => 12,
|
|
964
|
-
:expirationYear => 2020
|
|
964
|
+
:expirationYear => 2020,
|
|
965
965
|
)
|
|
966
966
|
response.code.should == "201"
|
|
967
967
|
|
|
968
968
|
nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
|
|
969
969
|
payment_method = Braintree::PaymentMethod.create!(
|
|
970
970
|
:payment_method_nonce => nonce,
|
|
971
|
-
:customer_id => customer.id
|
|
971
|
+
:customer_id => customer.id,
|
|
972
972
|
)
|
|
973
973
|
|
|
974
974
|
payment_method.should be_a(Braintree::CreditCard)
|
|
@@ -986,7 +986,7 @@ describe Braintree::PaymentMethod do
|
|
|
986
986
|
result = Braintree::CreditCard.create(
|
|
987
987
|
:customer_id => customer.id,
|
|
988
988
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
989
|
-
:expiration_date => "05/2012"
|
|
989
|
+
:expiration_date => "05/2012",
|
|
990
990
|
)
|
|
991
991
|
result.success?.should == true
|
|
992
992
|
|
|
@@ -1002,13 +1002,13 @@ describe Braintree::PaymentMethod do
|
|
|
1002
1002
|
credit_card = Braintree::CreditCard.create(
|
|
1003
1003
|
:customer_id => customer.id,
|
|
1004
1004
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1005
|
-
:expiration_date => "05/2012"
|
|
1005
|
+
:expiration_date => "05/2012",
|
|
1006
1006
|
).credit_card
|
|
1007
1007
|
|
|
1008
1008
|
subscription = Braintree::Subscription.create(
|
|
1009
1009
|
:payment_method_token => credit_card.token,
|
|
1010
1010
|
:plan_id => "integration_trialless_plan",
|
|
1011
|
-
:price => "1.00"
|
|
1011
|
+
:price => "1.00",
|
|
1012
1012
|
).subscription
|
|
1013
1013
|
|
|
1014
1014
|
found_card = Braintree::PaymentMethod.find(credit_card.token)
|
|
@@ -1025,11 +1025,11 @@ describe Braintree::PaymentMethod do
|
|
|
1025
1025
|
payment_method_token = make_token
|
|
1026
1026
|
nonce = nonce_for_paypal_account(
|
|
1027
1027
|
:consent_code => "consent-code",
|
|
1028
|
-
:token => payment_method_token
|
|
1028
|
+
:token => payment_method_token,
|
|
1029
1029
|
)
|
|
1030
1030
|
result = Braintree::PaymentMethod.create(
|
|
1031
1031
|
:payment_method_nonce => nonce,
|
|
1032
|
-
:customer_id => customer.id
|
|
1032
|
+
:customer_id => customer.id,
|
|
1033
1033
|
)
|
|
1034
1034
|
result.should be_success
|
|
1035
1035
|
|
|
@@ -1048,7 +1048,7 @@ describe Braintree::PaymentMethod do
|
|
|
1048
1048
|
result = Braintree::PaymentMethod.create(
|
|
1049
1049
|
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
|
|
1050
1050
|
:customer_id => customer.id,
|
|
1051
|
-
:token => payment_method_token
|
|
1051
|
+
:token => payment_method_token,
|
|
1052
1052
|
)
|
|
1053
1053
|
result.should be_success
|
|
1054
1054
|
|
|
@@ -1073,7 +1073,7 @@ describe Braintree::PaymentMethod do
|
|
|
1073
1073
|
result = Braintree::PaymentMethod.create(
|
|
1074
1074
|
:payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
|
|
1075
1075
|
:customer_id => customer.id,
|
|
1076
|
-
:token => payment_method_token
|
|
1076
|
+
:token => payment_method_token,
|
|
1077
1077
|
)
|
|
1078
1078
|
result.should be_success
|
|
1079
1079
|
|
|
@@ -1083,8 +1083,8 @@ describe Braintree::PaymentMethod do
|
|
|
1083
1083
|
venmo_account.token.should == payment_method_token
|
|
1084
1084
|
venmo_account.default.should == true
|
|
1085
1085
|
venmo_account.image_url.should =~ /venmo/
|
|
1086
|
-
venmo_account.username.should ==
|
|
1087
|
-
venmo_account.venmo_user_id.should ==
|
|
1086
|
+
venmo_account.username.should == "venmojoe"
|
|
1087
|
+
venmo_account.venmo_user_id.should == "Venmo-Joe-1"
|
|
1088
1088
|
venmo_account.source_description.should == "Venmo Account: venmojoe"
|
|
1089
1089
|
venmo_account.customer_id.should == customer.id
|
|
1090
1090
|
end
|
|
@@ -1097,7 +1097,7 @@ describe Braintree::PaymentMethod do
|
|
|
1097
1097
|
result = Braintree::PaymentMethod.create(
|
|
1098
1098
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
|
1099
1099
|
:customer_id => customer.id,
|
|
1100
|
-
:token => payment_method_token
|
|
1100
|
+
:token => payment_method_token,
|
|
1101
1101
|
)
|
|
1102
1102
|
result.should be_success
|
|
1103
1103
|
|
|
@@ -1125,7 +1125,7 @@ describe Braintree::PaymentMethod do
|
|
|
1125
1125
|
result = Braintree::PaymentMethod.create(
|
|
1126
1126
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
|
|
1127
1127
|
:customer_id => customer.id,
|
|
1128
|
-
:token => payment_method_token
|
|
1128
|
+
:token => payment_method_token,
|
|
1129
1129
|
)
|
|
1130
1130
|
result.should be_success
|
|
1131
1131
|
|
|
@@ -1155,7 +1155,7 @@ describe Braintree::PaymentMethod do
|
|
|
1155
1155
|
result = Braintree::PaymentMethod.create(
|
|
1156
1156
|
:payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
|
|
1157
1157
|
:customer_id => customer.id,
|
|
1158
|
-
:token => payment_method_token
|
|
1158
|
+
:token => payment_method_token,
|
|
1159
1159
|
)
|
|
1160
1160
|
result.should be_success
|
|
1161
1161
|
|
|
@@ -1181,7 +1181,7 @@ describe Braintree::PaymentMethod do
|
|
|
1181
1181
|
|
|
1182
1182
|
create_result = Braintree::PaymentMethod.create(
|
|
1183
1183
|
:payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
|
|
1184
|
-
:customer_id => customer.id
|
|
1184
|
+
:customer_id => customer.id,
|
|
1185
1185
|
)
|
|
1186
1186
|
|
|
1187
1187
|
token = create_result.payment_method.token
|
|
@@ -1202,7 +1202,7 @@ describe Braintree::PaymentMethod do
|
|
|
1202
1202
|
|
|
1203
1203
|
create_result = Braintree::PaymentMethod.create(
|
|
1204
1204
|
:payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
|
|
1205
|
-
:customer_id => customer.id
|
|
1205
|
+
:customer_id => customer.id,
|
|
1206
1206
|
)
|
|
1207
1207
|
token = create_result.payment_method.token
|
|
1208
1208
|
|
|
@@ -1223,11 +1223,11 @@ describe Braintree::PaymentMethod do
|
|
|
1223
1223
|
|
|
1224
1224
|
nonce = nonce_for_paypal_account(
|
|
1225
1225
|
:consent_code => "PAYPAL_CONSENT_CODE",
|
|
1226
|
-
:token => paypal_account_token
|
|
1226
|
+
:token => paypal_account_token,
|
|
1227
1227
|
)
|
|
1228
1228
|
Braintree::PaymentMethod.create(
|
|
1229
1229
|
:payment_method_nonce => nonce,
|
|
1230
|
-
:customer_id => customer.id
|
|
1230
|
+
:customer_id => customer.id,
|
|
1231
1231
|
)
|
|
1232
1232
|
|
|
1233
1233
|
paypal_account = Braintree::PaymentMethod.find(paypal_account_token)
|
|
@@ -1256,7 +1256,7 @@ describe Braintree::PaymentMethod do
|
|
|
1256
1256
|
|
|
1257
1257
|
Braintree::PaymentMethod.create(
|
|
1258
1258
|
:payment_method_nonce => nonce,
|
|
1259
|
-
:customer_id => customer.id
|
|
1259
|
+
:customer_id => customer.id,
|
|
1260
1260
|
)
|
|
1261
1261
|
|
|
1262
1262
|
result = Braintree::PaymentMethod.delete(token)
|
|
@@ -1293,14 +1293,14 @@ describe Braintree::PaymentMethod do
|
|
|
1293
1293
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1294
1294
|
:expiration_date => "06/2013",
|
|
1295
1295
|
:three_d_secure_pass_thru => {
|
|
1296
|
-
:eci_flag =>
|
|
1297
|
-
:cavv =>
|
|
1298
|
-
:xid =>
|
|
1299
|
-
:three_d_secure_version =>
|
|
1300
|
-
:authentication_response =>
|
|
1301
|
-
:directory_response =>
|
|
1302
|
-
:cavv_algorithm =>
|
|
1303
|
-
:ds_transaction_id =>
|
|
1296
|
+
:eci_flag => "02",
|
|
1297
|
+
:cavv => "some_cavv",
|
|
1298
|
+
:xid => "some_xid",
|
|
1299
|
+
:three_d_secure_version => "xx",
|
|
1300
|
+
:authentication_response => "Y",
|
|
1301
|
+
:directory_response => "Y",
|
|
1302
|
+
:cavv_algorithm => "2",
|
|
1303
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
1304
1304
|
},
|
|
1305
1305
|
:options => {:verify_card => true},
|
|
1306
1306
|
)
|
|
@@ -1324,14 +1324,14 @@ describe Braintree::PaymentMethod do
|
|
|
1324
1324
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1325
1325
|
:expiration_date => "06/2013",
|
|
1326
1326
|
:three_d_secure_pass_thru => {
|
|
1327
|
-
:eci_flag =>
|
|
1328
|
-
:cavv =>
|
|
1329
|
-
:xid =>
|
|
1330
|
-
:three_d_secure_version =>
|
|
1331
|
-
:authentication_response =>
|
|
1332
|
-
:directory_response =>
|
|
1333
|
-
:cavv_algorithm =>
|
|
1334
|
-
:ds_transaction_id =>
|
|
1327
|
+
:eci_flag => "02",
|
|
1328
|
+
:cavv => "some_cavv",
|
|
1329
|
+
:xid => "some_xid",
|
|
1330
|
+
:three_d_secure_version => "1.0.2",
|
|
1331
|
+
:authentication_response => "Y",
|
|
1332
|
+
:directory_response => "Y",
|
|
1333
|
+
:cavv_algorithm => "2",
|
|
1334
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
1335
1335
|
},
|
|
1336
1336
|
:options => {:verify_card => true},
|
|
1337
1337
|
)
|
|
@@ -1351,13 +1351,13 @@ describe Braintree::PaymentMethod do
|
|
|
1351
1351
|
:customer_id => customer.id,
|
|
1352
1352
|
:cvv => "123",
|
|
1353
1353
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1354
|
-
:expiration_date => "05/2012"
|
|
1354
|
+
:expiration_date => "05/2012",
|
|
1355
1355
|
)
|
|
1356
1356
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1357
1357
|
:cardholder_name => "New Holder",
|
|
1358
1358
|
:cvv => "456",
|
|
1359
1359
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1360
|
-
:expiration_date => "06/2013"
|
|
1360
|
+
:expiration_date => "06/2013",
|
|
1361
1361
|
)
|
|
1362
1362
|
update_result.success?.should == true
|
|
1363
1363
|
update_result.payment_method.should == credit_card
|
|
@@ -1376,14 +1376,14 @@ describe Braintree::PaymentMethod do
|
|
|
1376
1376
|
:customer_id => customer.id,
|
|
1377
1377
|
:cvv => "123",
|
|
1378
1378
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1379
|
-
:expiration_date => "05/2012"
|
|
1379
|
+
:expiration_date => "05/2012",
|
|
1380
1380
|
)
|
|
1381
1381
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1382
1382
|
:cardholder_name => "New Holder",
|
|
1383
1383
|
:cvv => "456",
|
|
1384
1384
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1385
1385
|
:expiration_date => "06/2013",
|
|
1386
|
-
:options => {:verify_card => true, :verification_currency_iso_code => "USD"}
|
|
1386
|
+
:options => {:verify_card => true, :verification_currency_iso_code => "USD"},
|
|
1387
1387
|
)
|
|
1388
1388
|
update_result.success?.should == true
|
|
1389
1389
|
update_result.payment_method.verification.currency_iso_code == "USD"
|
|
@@ -1396,14 +1396,14 @@ describe Braintree::PaymentMethod do
|
|
|
1396
1396
|
:customer_id => customer.id,
|
|
1397
1397
|
:cvv => "123",
|
|
1398
1398
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1399
|
-
:expiration_date => "05/2012"
|
|
1399
|
+
:expiration_date => "05/2012",
|
|
1400
1400
|
)
|
|
1401
1401
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1402
1402
|
:cardholder_name => "New Holder",
|
|
1403
1403
|
:cvv => "456",
|
|
1404
1404
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1405
1405
|
:expiration_date => "06/2013",
|
|
1406
|
-
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"}
|
|
1406
|
+
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"},
|
|
1407
1407
|
)
|
|
1408
1408
|
update_result.success?.should == true
|
|
1409
1409
|
update_result.payment_method.verification.currency_iso_code == "USD"
|
|
@@ -1417,14 +1417,14 @@ describe Braintree::PaymentMethod do
|
|
|
1417
1417
|
:customer_id => customer.id,
|
|
1418
1418
|
:cvv => "123",
|
|
1419
1419
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1420
|
-
:expiration_date => "05/2012"
|
|
1420
|
+
:expiration_date => "05/2012",
|
|
1421
1421
|
)
|
|
1422
1422
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1423
1423
|
:cardholder_name => "New Holder",
|
|
1424
1424
|
:cvv => "456",
|
|
1425
1425
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1426
1426
|
:expiration_date => "06/2013",
|
|
1427
|
-
:options => {:verify_card => true, :verification_currency_iso_code => "GBP"}
|
|
1427
|
+
:options => {:verify_card => true, :verification_currency_iso_code => "GBP"},
|
|
1428
1428
|
)
|
|
1429
1429
|
expect(update_result).to_not be_success
|
|
1430
1430
|
update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
|
@@ -1437,14 +1437,14 @@ describe Braintree::PaymentMethod do
|
|
|
1437
1437
|
:customer_id => customer.id,
|
|
1438
1438
|
:cvv => "123",
|
|
1439
1439
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1440
|
-
:expiration_date => "05/2012"
|
|
1440
|
+
:expiration_date => "05/2012",
|
|
1441
1441
|
)
|
|
1442
1442
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1443
1443
|
:cardholder_name => "New Holder",
|
|
1444
1444
|
:cvv => "456",
|
|
1445
1445
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1446
1446
|
:expiration_date => "06/2013",
|
|
1447
|
-
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"}
|
|
1447
|
+
:options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"},
|
|
1448
1448
|
)
|
|
1449
1449
|
expect(update_result).to_not be_success
|
|
1450
1450
|
update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
|
|
@@ -1461,12 +1461,12 @@ describe Braintree::PaymentMethod do
|
|
|
1461
1461
|
:expiration_date => "05/2012",
|
|
1462
1462
|
:billing_address => {
|
|
1463
1463
|
:street_address => "123 Nigeria Ave"
|
|
1464
|
-
}
|
|
1464
|
+
},
|
|
1465
1465
|
)
|
|
1466
1466
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1467
1467
|
:billing_address => {
|
|
1468
1468
|
:region => "IL"
|
|
1469
|
-
}
|
|
1469
|
+
},
|
|
1470
1470
|
)
|
|
1471
1471
|
update_result.success?.should == true
|
|
1472
1472
|
updated_credit_card = update_result.payment_method
|
|
@@ -1483,13 +1483,13 @@ describe Braintree::PaymentMethod do
|
|
|
1483
1483
|
:expiration_date => "05/2012",
|
|
1484
1484
|
:billing_address => {
|
|
1485
1485
|
:street_address => "123 Nigeria Ave"
|
|
1486
|
-
}
|
|
1486
|
+
},
|
|
1487
1487
|
)
|
|
1488
1488
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1489
1489
|
:billing_address => {
|
|
1490
1490
|
:region => "IL",
|
|
1491
1491
|
:options => {:update_existing => true}
|
|
1492
|
-
}
|
|
1492
|
+
},
|
|
1493
1493
|
)
|
|
1494
1494
|
update_result.success?.should == true
|
|
1495
1495
|
updated_credit_card = update_result.payment_method
|
|
@@ -1506,7 +1506,7 @@ describe Braintree::PaymentMethod do
|
|
|
1506
1506
|
:expiration_date => "05/2012",
|
|
1507
1507
|
:billing_address => {
|
|
1508
1508
|
:street_address => "123 Nigeria Ave"
|
|
1509
|
-
}
|
|
1509
|
+
},
|
|
1510
1510
|
)
|
|
1511
1511
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1512
1512
|
:billing_address => {
|
|
@@ -1515,7 +1515,7 @@ describe Braintree::PaymentMethod do
|
|
|
1515
1515
|
:country_code_alpha3 => "ASM",
|
|
1516
1516
|
:country_code_numeric => "016",
|
|
1517
1517
|
:options => {:update_existing => true}
|
|
1518
|
-
}
|
|
1518
|
+
},
|
|
1519
1519
|
)
|
|
1520
1520
|
update_result.success?.should == true
|
|
1521
1521
|
updated_credit_card = update_result.payment_method
|
|
@@ -1531,12 +1531,12 @@ describe Braintree::PaymentMethod do
|
|
|
1531
1531
|
credit_card = Braintree::CreditCard.create!(
|
|
1532
1532
|
:customer_id => customer.id,
|
|
1533
1533
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1534
|
-
:expiration_date => "05/2012"
|
|
1534
|
+
:expiration_date => "05/2012",
|
|
1535
1535
|
)
|
|
1536
1536
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1537
1537
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1538
1538
|
:expiration_month => "07",
|
|
1539
|
-
:expiration_year => "2011"
|
|
1539
|
+
:expiration_year => "2011",
|
|
1540
1540
|
)
|
|
1541
1541
|
update_result.success?.should == true
|
|
1542
1542
|
update_result.payment_method.should == credit_card
|
|
@@ -1552,14 +1552,14 @@ describe Braintree::PaymentMethod do
|
|
|
1552
1552
|
:customer_id => customer.id,
|
|
1553
1553
|
:cvv => "123",
|
|
1554
1554
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1555
|
-
:expiration_date => "05/2012"
|
|
1555
|
+
:expiration_date => "05/2012",
|
|
1556
1556
|
)
|
|
1557
1557
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1558
1558
|
:cardholder_name => "New Holder",
|
|
1559
1559
|
:cvv => "456",
|
|
1560
1560
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
|
|
1561
1561
|
:expiration_date => "06/2013",
|
|
1562
|
-
:options => {:verify_card => true}
|
|
1562
|
+
:options => {:verify_card => true},
|
|
1563
1563
|
)
|
|
1564
1564
|
update_result.success?.should == false
|
|
1565
1565
|
update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
|
@@ -1573,11 +1573,11 @@ describe Braintree::PaymentMethod do
|
|
|
1573
1573
|
:customer_id => customer.id,
|
|
1574
1574
|
:cvv => "123",
|
|
1575
1575
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1576
|
-
:expiration_date => "05/2020"
|
|
1576
|
+
:expiration_date => "05/2020",
|
|
1577
1577
|
)
|
|
1578
1578
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1579
1579
|
:payment_method_nonce => Braintree::Test::Nonce::ProcessorDeclinedMasterCard,
|
|
1580
|
-
:options => {:verify_card => true, :verification_amount => "2.34"}
|
|
1580
|
+
:options => {:verify_card => true, :verification_amount => "2.34"},
|
|
1581
1581
|
)
|
|
1582
1582
|
update_result.success?.should == false
|
|
1583
1583
|
update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
|
@@ -1603,7 +1603,7 @@ describe Braintree::PaymentMethod do
|
|
|
1603
1603
|
:region => "Old State",
|
|
1604
1604
|
:postal_code => "12345",
|
|
1605
1605
|
:country_name => "Canada"
|
|
1606
|
-
}
|
|
1606
|
+
},
|
|
1607
1607
|
)
|
|
1608
1608
|
result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1609
1609
|
:options => {:verify_card => false},
|
|
@@ -1617,7 +1617,7 @@ describe Braintree::PaymentMethod do
|
|
|
1617
1617
|
:region => "New State",
|
|
1618
1618
|
:postal_code => "56789",
|
|
1619
1619
|
:country_name => "United States of America"
|
|
1620
|
-
}
|
|
1620
|
+
},
|
|
1621
1621
|
)
|
|
1622
1622
|
result.success?.should == true
|
|
1623
1623
|
address = result.payment_method.billing_address
|
|
@@ -1638,12 +1638,12 @@ describe Braintree::PaymentMethod do
|
|
|
1638
1638
|
:cardholder_name => "Original Holder",
|
|
1639
1639
|
:customer_id => customer.id,
|
|
1640
1640
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1641
|
-
:expiration_date => "05/2012"
|
|
1641
|
+
:expiration_date => "05/2012",
|
|
1642
1642
|
)
|
|
1643
1643
|
update_result = Braintree::PaymentMethod.update(credit_card.token,
|
|
1644
1644
|
:cardholder_name => "New Holder",
|
|
1645
1645
|
:number => "invalid",
|
|
1646
|
-
:expiration_date => "05/2014"
|
|
1646
|
+
:expiration_date => "05/2014",
|
|
1647
1647
|
)
|
|
1648
1648
|
update_result.success?.should == false
|
|
1649
1649
|
update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
|
|
@@ -1654,12 +1654,12 @@ describe Braintree::PaymentMethod do
|
|
|
1654
1654
|
card1 = Braintree::CreditCard.create(
|
|
1655
1655
|
:customer_id => customer.id,
|
|
1656
1656
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1657
|
-
:expiration_date => "05/2009"
|
|
1657
|
+
:expiration_date => "05/2009",
|
|
1658
1658
|
).credit_card
|
|
1659
1659
|
card2 = Braintree::CreditCard.create(
|
|
1660
1660
|
:customer_id => customer.id,
|
|
1661
1661
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1662
|
-
:expiration_date => "05/2009"
|
|
1662
|
+
:expiration_date => "05/2009",
|
|
1663
1663
|
).credit_card
|
|
1664
1664
|
|
|
1665
1665
|
card1.should be_default
|
|
@@ -1678,17 +1678,17 @@ describe Braintree::PaymentMethod do
|
|
|
1678
1678
|
original_token = random_payment_method_token
|
|
1679
1679
|
nonce = nonce_for_paypal_account(
|
|
1680
1680
|
:consent_code => "consent-code",
|
|
1681
|
-
:token => original_token
|
|
1681
|
+
:token => original_token,
|
|
1682
1682
|
)
|
|
1683
1683
|
original_result = Braintree::PaymentMethod.create(
|
|
1684
1684
|
:payment_method_nonce => nonce,
|
|
1685
|
-
:customer_id => customer.id
|
|
1685
|
+
:customer_id => customer.id,
|
|
1686
1686
|
)
|
|
1687
1687
|
|
|
1688
1688
|
updated_token = make_token
|
|
1689
1689
|
updated_result = Braintree::PaymentMethod.update(
|
|
1690
1690
|
original_token,
|
|
1691
|
-
:token => updated_token
|
|
1691
|
+
:token => updated_token,
|
|
1692
1692
|
)
|
|
1693
1693
|
|
|
1694
1694
|
updated_paypal_account = Braintree::PayPalAccount.find(updated_token)
|
|
@@ -1705,19 +1705,19 @@ describe Braintree::PaymentMethod do
|
|
|
1705
1705
|
:customer_id => customer.id,
|
|
1706
1706
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1707
1707
|
:expiration_date => "05/2009",
|
|
1708
|
-
:options => {:make_default => true}
|
|
1708
|
+
:options => {:make_default => true},
|
|
1709
1709
|
)
|
|
1710
1710
|
result.should be_success
|
|
1711
1711
|
|
|
1712
1712
|
nonce = nonce_for_paypal_account(:consent_code => "consent-code")
|
|
1713
1713
|
original_token = Braintree::PaymentMethod.create(
|
|
1714
1714
|
:payment_method_nonce => nonce,
|
|
1715
|
-
:customer_id => customer.id
|
|
1715
|
+
:customer_id => customer.id,
|
|
1716
1716
|
).payment_method.token
|
|
1717
1717
|
|
|
1718
1718
|
updated_result = Braintree::PaymentMethod.update(
|
|
1719
1719
|
original_token,
|
|
1720
|
-
:options => {:make_default => true}
|
|
1720
|
+
:options => {:make_default => true},
|
|
1721
1721
|
)
|
|
1722
1722
|
|
|
1723
1723
|
updated_paypal_account = Braintree::PayPalAccount.find(original_token)
|
|
@@ -1731,25 +1731,25 @@ describe Braintree::PaymentMethod do
|
|
|
1731
1731
|
|
|
1732
1732
|
first_nonce = nonce_for_paypal_account(
|
|
1733
1733
|
:consent_code => "consent-code",
|
|
1734
|
-
:token => first_token
|
|
1734
|
+
:token => first_token,
|
|
1735
1735
|
)
|
|
1736
1736
|
first_result = Braintree::PaymentMethod.create(
|
|
1737
1737
|
:payment_method_nonce => first_nonce,
|
|
1738
|
-
:customer_id => customer.id
|
|
1738
|
+
:customer_id => customer.id,
|
|
1739
1739
|
)
|
|
1740
1740
|
|
|
1741
1741
|
second_nonce = nonce_for_paypal_account(
|
|
1742
1742
|
:consent_code => "consent-code",
|
|
1743
|
-
:token => second_token
|
|
1743
|
+
:token => second_token,
|
|
1744
1744
|
)
|
|
1745
1745
|
second_result = Braintree::PaymentMethod.create(
|
|
1746
1746
|
:payment_method_nonce => second_nonce,
|
|
1747
|
-
:customer_id => customer.id
|
|
1747
|
+
:customer_id => customer.id,
|
|
1748
1748
|
)
|
|
1749
1749
|
|
|
1750
1750
|
updated_result = Braintree::PaymentMethod.update(
|
|
1751
1751
|
first_token,
|
|
1752
|
-
:token => second_token
|
|
1752
|
+
:token => second_token,
|
|
1753
1753
|
)
|
|
1754
1754
|
|
|
1755
1755
|
updated_result.should_not be_success
|
|
@@ -1766,13 +1766,13 @@ describe Braintree::PaymentMethod do
|
|
|
1766
1766
|
:customer_id => customer.id,
|
|
1767
1767
|
:cvv => "123",
|
|
1768
1768
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1769
|
-
:expiration_date => "05/2012"
|
|
1769
|
+
:expiration_date => "05/2012",
|
|
1770
1770
|
)
|
|
1771
1771
|
payment_method = Braintree::PaymentMethod.update!(credit_card.token,
|
|
1772
1772
|
:cardholder_name => "New Holder",
|
|
1773
1773
|
:cvv => "456",
|
|
1774
1774
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1775
|
-
:expiration_date => "06/2013"
|
|
1775
|
+
:expiration_date => "06/2013",
|
|
1776
1776
|
)
|
|
1777
1777
|
payment_method.should == credit_card
|
|
1778
1778
|
payment_method.cardholder_name.should == "New Holder"
|
|
@@ -1789,7 +1789,7 @@ describe Braintree::PaymentMethod do
|
|
|
1789
1789
|
:public_key => "oauth_app_partner_user_public_key",
|
|
1790
1790
|
:private_key => "oauth_app_partner_user_private_key",
|
|
1791
1791
|
:environment => Braintree::Configuration.environment,
|
|
1792
|
-
:logger => Logger.new("/dev/null")
|
|
1792
|
+
:logger => Logger.new("/dev/null"),
|
|
1793
1793
|
)
|
|
1794
1794
|
customer = @partner_merchant_gateway.customer.create(
|
|
1795
1795
|
:first_name => "Joe",
|
|
@@ -1798,19 +1798,19 @@ describe Braintree::PaymentMethod do
|
|
|
1798
1798
|
:email => "joe@example.com",
|
|
1799
1799
|
:phone => "312.555.1234",
|
|
1800
1800
|
:fax => "614.555.5678",
|
|
1801
|
-
:website => "www.example.com"
|
|
1801
|
+
:website => "www.example.com",
|
|
1802
1802
|
).customer
|
|
1803
1803
|
@credit_card = @partner_merchant_gateway.credit_card.create(
|
|
1804
1804
|
:customer_id => customer.id,
|
|
1805
1805
|
:cardholder_name => "Adam Davis",
|
|
1806
1806
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1807
|
-
:expiration_date => "05/2009"
|
|
1807
|
+
:expiration_date => "05/2009",
|
|
1808
1808
|
).credit_card
|
|
1809
1809
|
|
|
1810
1810
|
@oauth_gateway = Braintree::Gateway.new(
|
|
1811
1811
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
|
1812
1812
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
|
1813
|
-
:logger => Logger.new("/dev/null")
|
|
1813
|
+
:logger => Logger.new("/dev/null"),
|
|
1814
1814
|
)
|
|
1815
1815
|
access_token = Braintree::OAuthTestHelper.create_token(@oauth_gateway, {
|
|
1816
1816
|
:merchant_public_id => "integration_merchant_id",
|
|
@@ -1819,7 +1819,7 @@ describe Braintree::PaymentMethod do
|
|
|
1819
1819
|
|
|
1820
1820
|
@granting_gateway = Braintree::Gateway.new(
|
|
1821
1821
|
:access_token => access_token,
|
|
1822
|
-
:logger => Logger.new("/dev/null")
|
|
1822
|
+
:logger => Logger.new("/dev/null"),
|
|
1823
1823
|
)
|
|
1824
1824
|
end
|
|
1825
1825
|
|
|
@@ -1835,13 +1835,13 @@ describe Braintree::PaymentMethod do
|
|
|
1835
1835
|
|
|
1836
1836
|
result = Braintree::Transaction.sale(
|
|
1837
1837
|
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1838
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
|
1838
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1839
1839
|
)
|
|
1840
1840
|
result.should be_success
|
|
1841
1841
|
|
|
1842
1842
|
result2 = Braintree::Transaction.sale(
|
|
1843
1843
|
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1844
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize
|
|
1844
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1845
1845
|
)
|
|
1846
1846
|
result2.should_not be_success
|
|
1847
1847
|
end
|
|
@@ -1853,7 +1853,7 @@ describe Braintree::PaymentMethod do
|
|
|
1853
1853
|
|
|
1854
1854
|
result = Braintree::PaymentMethod.create(
|
|
1855
1855
|
:customer_id => customer_result.customer.id,
|
|
1856
|
-
:payment_method_nonce => grant_result.payment_method_nonce.nonce
|
|
1856
|
+
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1857
1857
|
)
|
|
1858
1858
|
result.should_not be_success
|
|
1859
1859
|
end
|
|
@@ -1865,7 +1865,7 @@ describe Braintree::PaymentMethod do
|
|
|
1865
1865
|
|
|
1866
1866
|
result = Braintree::PaymentMethod.create(
|
|
1867
1867
|
:customer_id => customer_result.customer.id,
|
|
1868
|
-
:payment_method_nonce => grant_result.payment_method_nonce.nonce
|
|
1868
|
+
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1869
1869
|
)
|
|
1870
1870
|
result.should be_success
|
|
1871
1871
|
end
|
|
@@ -1900,7 +1900,7 @@ describe Braintree::PaymentMethod do
|
|
|
1900
1900
|
|
|
1901
1901
|
result = Braintree::PaymentMethod.create(
|
|
1902
1902
|
:customer_id => customer_result.customer.id,
|
|
1903
|
-
:payment_method_nonce => grant_result.payment_method_nonce.nonce
|
|
1903
|
+
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1904
1904
|
)
|
|
1905
1905
|
result.should_not be_success
|
|
1906
1906
|
end
|
|
@@ -1914,7 +1914,7 @@ describe Braintree::PaymentMethod do
|
|
|
1914
1914
|
|
|
1915
1915
|
result = Braintree::PaymentMethod.create(
|
|
1916
1916
|
:customer_id => customer_result.customer.id,
|
|
1917
|
-
:payment_method_nonce => grant_result.payment_method_nonce.nonce
|
|
1917
|
+
:payment_method_nonce => grant_result.payment_method_nonce.nonce,
|
|
1918
1918
|
)
|
|
1919
1919
|
result.should_not be_success
|
|
1920
1920
|
end
|