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
|
@@ -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
|
|
@@ -145,14 +145,14 @@ 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
151
|
verification.risk_data.id.should_not be_nil
|
|
152
152
|
verification.risk_data.decision.should_not be_nil
|
|
153
153
|
verification.risk_data.decision_reasons.should_not be_nil
|
|
154
|
-
verification.risk_data.device_data_captured
|
|
155
|
-
verification.risk_data.fraud_service_provider
|
|
154
|
+
expect(verification.risk_data).to respond_to(:device_data_captured)
|
|
155
|
+
expect(verification.risk_data).to respond_to(:fraud_service_provider)
|
|
156
156
|
expect(verification.risk_data).to respond_to(:transaction_risk_score)
|
|
157
157
|
end
|
|
158
158
|
end
|
|
@@ -173,7 +173,7 @@ describe Braintree::CreditCard do
|
|
|
173
173
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
174
174
|
:expiration_date => "05/2009",
|
|
175
175
|
:cvv => "200",
|
|
176
|
-
:options => {:verify_card => true}
|
|
176
|
+
:options => {:verify_card => true},
|
|
177
177
|
)
|
|
178
178
|
result.success?.should == false
|
|
179
179
|
result.credit_card_verification.gateway_rejection_reason.should == Braintree::CreditCardVerification::GatewayRejectionReason::CVV
|
|
@@ -190,7 +190,7 @@ describe Braintree::CreditCard do
|
|
|
190
190
|
:customer_id => customer.id,
|
|
191
191
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
|
192
192
|
:expiration_date => "05/2009",
|
|
193
|
-
:options => {:verify_card => true, :verification_amount => "1.01"}
|
|
193
|
+
:options => {:verify_card => true, :verification_amount => "1.01"},
|
|
194
194
|
)
|
|
195
195
|
result.success?.should == false
|
|
196
196
|
result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
|
@@ -211,7 +211,7 @@ describe Braintree::CreditCard do
|
|
|
211
211
|
:options => {
|
|
212
212
|
:verify_card => true,
|
|
213
213
|
:verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
|
|
214
|
-
}
|
|
214
|
+
},
|
|
215
215
|
)
|
|
216
216
|
result.success?.should == false
|
|
217
217
|
result.credit_card_verification.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
|
|
@@ -223,7 +223,7 @@ describe Braintree::CreditCard do
|
|
|
223
223
|
:customer_id => customer.id,
|
|
224
224
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
|
|
225
225
|
:expiration_date => "05/2009",
|
|
226
|
-
:options => {:verify_card => false}
|
|
226
|
+
:options => {:verify_card => false},
|
|
227
227
|
)
|
|
228
228
|
result.success?.should == true
|
|
229
229
|
end
|
|
@@ -234,15 +234,15 @@ describe Braintree::CreditCard do
|
|
|
234
234
|
:customer_id => customer.id,
|
|
235
235
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
236
236
|
:three_d_secure_pass_thru => {
|
|
237
|
-
:eci_flag =>
|
|
238
|
-
:cavv =>
|
|
239
|
-
:xid =>
|
|
240
|
-
:authentication_response =>
|
|
241
|
-
:directory_response =>
|
|
242
|
-
:cavv_algorithm =>
|
|
243
|
-
: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",
|
|
244
244
|
},
|
|
245
|
-
:options => {:verify_card => true}
|
|
245
|
+
:options => {:verify_card => true},
|
|
246
246
|
)
|
|
247
247
|
expect(result).not_to be_success
|
|
248
248
|
error = result.errors.for(:verification).first
|
|
@@ -256,16 +256,16 @@ describe Braintree::CreditCard do
|
|
|
256
256
|
:customer_id => customer.id,
|
|
257
257
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
258
258
|
:three_d_secure_pass_thru => {
|
|
259
|
-
:eci_flag =>
|
|
260
|
-
:cavv =>
|
|
261
|
-
:xid =>
|
|
262
|
-
:three_d_secure_version =>
|
|
263
|
-
:authentication_response =>
|
|
264
|
-
:directory_response =>
|
|
265
|
-
:cavv_algorithm =>
|
|
266
|
-
: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",
|
|
267
267
|
},
|
|
268
|
-
:options => {:verify_card => true}
|
|
268
|
+
:options => {:verify_card => true},
|
|
269
269
|
)
|
|
270
270
|
result.success?.should == true
|
|
271
271
|
|
|
@@ -276,7 +276,7 @@ describe Braintree::CreditCard do
|
|
|
276
276
|
result = Braintree::CreditCard.create(
|
|
277
277
|
:customer_id => customer.id,
|
|
278
278
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
|
279
|
-
:options => {:verify_card => true}
|
|
279
|
+
:options => {:verify_card => true},
|
|
280
280
|
)
|
|
281
281
|
result.success?.should == true
|
|
282
282
|
|
|
@@ -304,7 +304,7 @@ describe Braintree::CreditCard do
|
|
|
304
304
|
:locality => "Chicago",
|
|
305
305
|
:region => "Illinois",
|
|
306
306
|
:postal_code => "60622"
|
|
307
|
-
}
|
|
307
|
+
},
|
|
308
308
|
)
|
|
309
309
|
result.success?.should == true
|
|
310
310
|
credit_card = result.credit_card
|
|
@@ -323,7 +323,7 @@ describe Braintree::CreditCard do
|
|
|
323
323
|
:country_code_alpha2 => "US",
|
|
324
324
|
:country_code_alpha3 => "USA",
|
|
325
325
|
:country_code_numeric => "840"
|
|
326
|
-
}
|
|
326
|
+
},
|
|
327
327
|
)
|
|
328
328
|
result.success?.should == true
|
|
329
329
|
credit_card = result.credit_card
|
|
@@ -342,7 +342,7 @@ describe Braintree::CreditCard do
|
|
|
342
342
|
:billing_address => {
|
|
343
343
|
:country_name => "Mexico",
|
|
344
344
|
:country_code_alpha2 => "US"
|
|
345
|
-
}
|
|
345
|
+
},
|
|
346
346
|
)
|
|
347
347
|
result.success?.should == false
|
|
348
348
|
result.errors.for(:credit_card).for(:billing_address).on(:base).map { |e| e.code }.should include(Braintree::ErrorCodes::Address::InconsistentCountry)
|
|
@@ -353,7 +353,7 @@ describe Braintree::CreditCard do
|
|
|
353
353
|
result = Braintree::CreditCard.create(
|
|
354
354
|
:customer_id => customer.id,
|
|
355
355
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
356
|
-
:expiration_date => "invalid_date"
|
|
356
|
+
:expiration_date => "invalid_date",
|
|
357
357
|
)
|
|
358
358
|
result.success?.should == false
|
|
359
359
|
result.errors.for(:credit_card).on(:expiration_date)[0].message.should == "Expiration date is invalid."
|
|
@@ -364,7 +364,7 @@ describe Braintree::CreditCard do
|
|
|
364
364
|
card1 = Braintree::CreditCard.create(
|
|
365
365
|
:customer_id => customer.id,
|
|
366
366
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
367
|
-
:expiration_date => "05/2009"
|
|
367
|
+
:expiration_date => "05/2009",
|
|
368
368
|
).credit_card
|
|
369
369
|
card1.should be_default
|
|
370
370
|
|
|
@@ -374,7 +374,7 @@ describe Braintree::CreditCard do
|
|
|
374
374
|
:expiration_date => "05/2009",
|
|
375
375
|
:options => {
|
|
376
376
|
:make_default => true
|
|
377
|
-
}
|
|
377
|
+
},
|
|
378
378
|
).credit_card
|
|
379
379
|
card2.should be_default
|
|
380
380
|
|
|
@@ -403,7 +403,7 @@ describe Braintree::CreditCard do
|
|
|
403
403
|
:customer_id => customer.id,
|
|
404
404
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
|
405
405
|
:expiration_date => "05/2014",
|
|
406
|
-
:options => {:verify_card => true}
|
|
406
|
+
:options => {:verify_card => true},
|
|
407
407
|
)
|
|
408
408
|
credit_card = result.credit_card
|
|
409
409
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Yes
|
|
@@ -415,7 +415,7 @@ describe Braintree::CreditCard do
|
|
|
415
415
|
:customer_id => customer.id,
|
|
416
416
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Healthcare,
|
|
417
417
|
:expiration_date => "05/2014",
|
|
418
|
-
:options => {:verify_card => true}
|
|
418
|
+
:options => {:verify_card => true},
|
|
419
419
|
)
|
|
420
420
|
credit_card = result.credit_card
|
|
421
421
|
credit_card.healthcare.should == Braintree::CreditCard::Healthcare::Yes
|
|
@@ -428,7 +428,7 @@ describe Braintree::CreditCard do
|
|
|
428
428
|
:customer_id => customer.id,
|
|
429
429
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::DurbinRegulated,
|
|
430
430
|
:expiration_date => "05/2014",
|
|
431
|
-
:options => {:verify_card => true}
|
|
431
|
+
:options => {:verify_card => true},
|
|
432
432
|
)
|
|
433
433
|
credit_card = result.credit_card
|
|
434
434
|
credit_card.durbin_regulated.should == Braintree::CreditCard::DurbinRegulated::Yes
|
|
@@ -440,7 +440,7 @@ describe Braintree::CreditCard do
|
|
|
440
440
|
:customer_id => customer.id,
|
|
441
441
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::CountryOfIssuance,
|
|
442
442
|
:expiration_date => "05/2014",
|
|
443
|
-
:options => {:verify_card => true}
|
|
443
|
+
:options => {:verify_card => true},
|
|
444
444
|
)
|
|
445
445
|
credit_card = result.credit_card
|
|
446
446
|
credit_card.country_of_issuance.should == Braintree::Test::CreditCardDefaults::CountryOfIssuance
|
|
@@ -452,7 +452,7 @@ describe Braintree::CreditCard do
|
|
|
452
452
|
:customer_id => customer.id,
|
|
453
453
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::IssuingBank,
|
|
454
454
|
:expiration_date => "05/2014",
|
|
455
|
-
:options => {:verify_card => true}
|
|
455
|
+
:options => {:verify_card => true},
|
|
456
456
|
)
|
|
457
457
|
credit_card = result.credit_card
|
|
458
458
|
credit_card.issuing_bank.should == Braintree::Test::CreditCardDefaults::IssuingBank
|
|
@@ -464,7 +464,7 @@ describe Braintree::CreditCard do
|
|
|
464
464
|
:customer_id => customer.id,
|
|
465
465
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Payroll,
|
|
466
466
|
:expiration_date => "05/2014",
|
|
467
|
-
:options => {:verify_card => true}
|
|
467
|
+
:options => {:verify_card => true},
|
|
468
468
|
)
|
|
469
469
|
credit_card = result.credit_card
|
|
470
470
|
credit_card.payroll.should == Braintree::CreditCard::Payroll::Yes
|
|
@@ -477,7 +477,7 @@ describe Braintree::CreditCard do
|
|
|
477
477
|
:customer_id => customer.id,
|
|
478
478
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Debit,
|
|
479
479
|
:expiration_date => "05/2014",
|
|
480
|
-
:options => {:verify_card => true}
|
|
480
|
+
:options => {:verify_card => true},
|
|
481
481
|
)
|
|
482
482
|
credit_card = result.credit_card
|
|
483
483
|
credit_card.debit.should == Braintree::CreditCard::Debit::Yes
|
|
@@ -489,7 +489,7 @@ describe Braintree::CreditCard do
|
|
|
489
489
|
:customer_id => customer.id,
|
|
490
490
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Commercial,
|
|
491
491
|
:expiration_date => "05/2014",
|
|
492
|
-
:options => {:verify_card => true}
|
|
492
|
+
:options => {:verify_card => true},
|
|
493
493
|
)
|
|
494
494
|
credit_card = result.credit_card
|
|
495
495
|
credit_card.commercial.should == Braintree::CreditCard::Commercial::Yes
|
|
@@ -501,7 +501,7 @@ describe Braintree::CreditCard do
|
|
|
501
501
|
:customer_id => customer.id,
|
|
502
502
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::No,
|
|
503
503
|
:expiration_date => "05/2014",
|
|
504
|
-
:options => {:verify_card => true}
|
|
504
|
+
:options => {:verify_card => true},
|
|
505
505
|
)
|
|
506
506
|
credit_card = result.credit_card
|
|
507
507
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::No
|
|
@@ -519,7 +519,7 @@ describe Braintree::CreditCard do
|
|
|
519
519
|
:customer_id => customer.id,
|
|
520
520
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Unknown,
|
|
521
521
|
:expiration_date => "05/2014",
|
|
522
|
-
:options => {:verify_card => true}
|
|
522
|
+
:options => {:verify_card => true},
|
|
523
523
|
)
|
|
524
524
|
credit_card = result.credit_card
|
|
525
525
|
credit_card.prepaid.should == Braintree::CreditCard::Prepaid::Unknown
|
|
@@ -540,7 +540,7 @@ describe Braintree::CreditCard do
|
|
|
540
540
|
customer = Braintree::Customer.create!
|
|
541
541
|
result = Braintree::CreditCard.create(
|
|
542
542
|
:customer_id => customer.id,
|
|
543
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode
|
|
543
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::VisaPaymentMethodCode,
|
|
544
544
|
)
|
|
545
545
|
result.success?.should == true
|
|
546
546
|
result.credit_card.venmo_sdk?.should == false
|
|
@@ -552,7 +552,7 @@ describe Braintree::CreditCard do
|
|
|
552
552
|
customer = Braintree::Customer.create!
|
|
553
553
|
result = Braintree::CreditCard.create(
|
|
554
554
|
:customer_id => customer.id,
|
|
555
|
-
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode
|
|
555
|
+
:venmo_sdk_payment_method_code => Braintree::Test::VenmoSDK::InvalidPaymentMethodCode,
|
|
556
556
|
)
|
|
557
557
|
|
|
558
558
|
result.success?.should == false
|
|
@@ -571,7 +571,7 @@ describe Braintree::CreditCard do
|
|
|
571
571
|
:cvv => "100",
|
|
572
572
|
:options => {
|
|
573
573
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::Session
|
|
574
|
-
}
|
|
574
|
+
},
|
|
575
575
|
)
|
|
576
576
|
result.success?.should == true
|
|
577
577
|
result.credit_card.venmo_sdk?.should == false
|
|
@@ -586,7 +586,7 @@ describe Braintree::CreditCard do
|
|
|
586
586
|
:cvv => "100",
|
|
587
587
|
:options => {
|
|
588
588
|
:venmo_sdk_session => Braintree::Test::VenmoSDK::InvalidSession
|
|
589
|
-
}
|
|
589
|
+
},
|
|
590
590
|
)
|
|
591
591
|
result.success?.should == true
|
|
592
592
|
result.credit_card.venmo_sdk?.should == false
|
|
@@ -602,12 +602,12 @@ describe Braintree::CreditCard do
|
|
|
602
602
|
:expiration_month => "11",
|
|
603
603
|
:expiration_year => "2099",
|
|
604
604
|
},
|
|
605
|
-
:share => true
|
|
605
|
+
:share => true,
|
|
606
606
|
)
|
|
607
607
|
customer = Braintree::Customer.create!
|
|
608
608
|
result = Braintree::CreditCard.create(
|
|
609
609
|
:customer_id => customer.id,
|
|
610
|
-
:payment_method_nonce => nonce
|
|
610
|
+
:payment_method_nonce => nonce,
|
|
611
611
|
)
|
|
612
612
|
|
|
613
613
|
result.success?.should == true
|
|
@@ -644,7 +644,7 @@ describe Braintree::CreditCard do
|
|
|
644
644
|
:verify_card => true,
|
|
645
645
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
646
646
|
:verification_account_type => "debit",
|
|
647
|
-
}
|
|
647
|
+
},
|
|
648
648
|
)
|
|
649
649
|
|
|
650
650
|
expect(result).to be_success
|
|
@@ -661,7 +661,7 @@ describe Braintree::CreditCard do
|
|
|
661
661
|
:verify_card => true,
|
|
662
662
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
663
663
|
:verification_account_type => "credit",
|
|
664
|
-
}
|
|
664
|
+
},
|
|
665
665
|
)
|
|
666
666
|
|
|
667
667
|
expect(result).to be_success
|
|
@@ -677,7 +677,7 @@ describe Braintree::CreditCard do
|
|
|
677
677
|
:verify_card => true,
|
|
678
678
|
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
679
679
|
:verification_account_type => "ach",
|
|
680
|
-
}
|
|
680
|
+
},
|
|
681
681
|
)
|
|
682
682
|
|
|
683
683
|
expect(result).to_not be_success
|
|
@@ -693,7 +693,7 @@ describe Braintree::CreditCard do
|
|
|
693
693
|
:options => {
|
|
694
694
|
:verify_card => true,
|
|
695
695
|
:verification_account_type => "credit",
|
|
696
|
-
}
|
|
696
|
+
},
|
|
697
697
|
)
|
|
698
698
|
|
|
699
699
|
expect(result).to_not be_success
|
|
@@ -709,7 +709,7 @@ describe Braintree::CreditCard do
|
|
|
709
709
|
:customer_id => customer.id,
|
|
710
710
|
:cardholder_name => "Adam Davis",
|
|
711
711
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
712
|
-
:expiration_date => "05/2009"
|
|
712
|
+
:expiration_date => "05/2009",
|
|
713
713
|
)
|
|
714
714
|
credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa[0, 6]
|
|
715
715
|
credit_card.cardholder_name.should == "Adam Davis"
|
|
@@ -723,7 +723,7 @@ describe Braintree::CreditCard do
|
|
|
723
723
|
Braintree::CreditCard.create!(
|
|
724
724
|
:customer_id => customer.id,
|
|
725
725
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
726
|
-
:expiration_date => "invalid_date"
|
|
726
|
+
:expiration_date => "invalid_date",
|
|
727
727
|
)
|
|
728
728
|
end.to raise_error(Braintree::ValidationsFailed)
|
|
729
729
|
end
|
|
@@ -735,11 +735,11 @@ describe Braintree::CreditCard do
|
|
|
735
735
|
:credit_card => {
|
|
736
736
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
737
737
|
:expiration_date => "05/2010"
|
|
738
|
-
}
|
|
738
|
+
},
|
|
739
739
|
)
|
|
740
740
|
result = Braintree::CreditCard.credit(
|
|
741
741
|
customer.credit_cards[0].token,
|
|
742
|
-
:amount => "100.00"
|
|
742
|
+
:amount => "100.00",
|
|
743
743
|
)
|
|
744
744
|
result.success?.should == true
|
|
745
745
|
result.transaction.amount.should == BigDecimal("100.00")
|
|
@@ -758,11 +758,11 @@ describe Braintree::CreditCard do
|
|
|
758
758
|
:credit_card => {
|
|
759
759
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
760
760
|
:expiration_date => "05/2010"
|
|
761
|
-
}
|
|
761
|
+
},
|
|
762
762
|
)
|
|
763
763
|
transaction = Braintree::CreditCard.credit!(
|
|
764
764
|
customer.credit_cards[0].token,
|
|
765
|
-
:amount => "100.00"
|
|
765
|
+
:amount => "100.00",
|
|
766
766
|
)
|
|
767
767
|
transaction.amount.should == BigDecimal("100.00")
|
|
768
768
|
transaction.type.should == "credit"
|
|
@@ -782,13 +782,13 @@ describe Braintree::CreditCard do
|
|
|
782
782
|
:customer_id => customer.id,
|
|
783
783
|
:cvv => "123",
|
|
784
784
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
785
|
-
:expiration_date => "05/2012"
|
|
785
|
+
:expiration_date => "05/2012",
|
|
786
786
|
)
|
|
787
787
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
788
788
|
:cardholder_name => "New Holder",
|
|
789
789
|
:cvv => "456",
|
|
790
790
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
791
|
-
:expiration_date => "06/2013"
|
|
791
|
+
:expiration_date => "06/2013",
|
|
792
792
|
)
|
|
793
793
|
update_result.success?.should == true
|
|
794
794
|
update_result.credit_card.should == credit_card
|
|
@@ -806,20 +806,20 @@ describe Braintree::CreditCard do
|
|
|
806
806
|
:customer_id => customer.id,
|
|
807
807
|
:cvv => "123",
|
|
808
808
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
809
|
-
:expiration_date => "05/2012"
|
|
809
|
+
:expiration_date => "05/2012",
|
|
810
810
|
)
|
|
811
811
|
result = Braintree::CreditCard.update(credit_card.token,
|
|
812
812
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
813
813
|
:three_d_secure_pass_thru => {
|
|
814
|
-
:eci_flag =>
|
|
815
|
-
:cavv =>
|
|
816
|
-
:xid =>
|
|
817
|
-
:authentication_response =>
|
|
818
|
-
:directory_response =>
|
|
819
|
-
:cavv_algorithm =>
|
|
820
|
-
: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",
|
|
821
821
|
},
|
|
822
|
-
:options => {:verify_card => true}
|
|
822
|
+
:options => {:verify_card => true},
|
|
823
823
|
)
|
|
824
824
|
expect(result).not_to be_success
|
|
825
825
|
error = result.errors.for(:verification).first
|
|
@@ -834,21 +834,21 @@ describe Braintree::CreditCard do
|
|
|
834
834
|
:customer_id => customer.id,
|
|
835
835
|
:cvv => "123",
|
|
836
836
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
837
|
-
:expiration_date => "05/2012"
|
|
837
|
+
:expiration_date => "05/2012",
|
|
838
838
|
)
|
|
839
839
|
result = Braintree::CreditCard.update(credit_card.token,
|
|
840
840
|
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
841
841
|
:three_d_secure_pass_thru => {
|
|
842
|
-
:eci_flag =>
|
|
843
|
-
:cavv =>
|
|
842
|
+
:eci_flag => "02",
|
|
843
|
+
:cavv => "some_cavv",
|
|
844
844
|
:three_d_secure_version=> "2.1.0",
|
|
845
|
-
:xid =>
|
|
846
|
-
:authentication_response =>
|
|
847
|
-
:directory_response =>
|
|
848
|
-
:cavv_algorithm =>
|
|
849
|
-
: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",
|
|
850
850
|
},
|
|
851
|
-
:options => {:verify_card => true}
|
|
851
|
+
:options => {:verify_card => true},
|
|
852
852
|
)
|
|
853
853
|
|
|
854
854
|
result.success?.should == true
|
|
@@ -864,12 +864,12 @@ describe Braintree::CreditCard do
|
|
|
864
864
|
:expiration_date => "05/2012",
|
|
865
865
|
:billing_address => {
|
|
866
866
|
:street_address => "123 Nigeria Ave"
|
|
867
|
-
}
|
|
867
|
+
},
|
|
868
868
|
)
|
|
869
869
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
870
870
|
:billing_address => {
|
|
871
871
|
:region => "IL"
|
|
872
|
-
}
|
|
872
|
+
},
|
|
873
873
|
)
|
|
874
874
|
update_result.success?.should == true
|
|
875
875
|
updated_credit_card = update_result.credit_card
|
|
@@ -886,13 +886,13 @@ describe Braintree::CreditCard do
|
|
|
886
886
|
:expiration_date => "05/2012",
|
|
887
887
|
:billing_address => {
|
|
888
888
|
:street_address => "123 Nigeria Ave"
|
|
889
|
-
}
|
|
889
|
+
},
|
|
890
890
|
)
|
|
891
891
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
892
892
|
:billing_address => {
|
|
893
893
|
:region => "IL",
|
|
894
894
|
:options => {:update_existing => true}
|
|
895
|
-
}
|
|
895
|
+
},
|
|
896
896
|
)
|
|
897
897
|
update_result.success?.should == true
|
|
898
898
|
updated_credit_card = update_result.credit_card
|
|
@@ -909,7 +909,7 @@ describe Braintree::CreditCard do
|
|
|
909
909
|
:expiration_date => "05/2012",
|
|
910
910
|
:billing_address => {
|
|
911
911
|
:street_address => "123 Nigeria Ave"
|
|
912
|
-
}
|
|
912
|
+
},
|
|
913
913
|
)
|
|
914
914
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
915
915
|
:billing_address => {
|
|
@@ -918,7 +918,7 @@ describe Braintree::CreditCard do
|
|
|
918
918
|
:country_code_alpha3 => "ASM",
|
|
919
919
|
:country_code_numeric => "016",
|
|
920
920
|
:options => {:update_existing => true}
|
|
921
|
-
}
|
|
921
|
+
},
|
|
922
922
|
)
|
|
923
923
|
update_result.success?.should == true
|
|
924
924
|
updated_credit_card = update_result.credit_card
|
|
@@ -934,12 +934,12 @@ describe Braintree::CreditCard do
|
|
|
934
934
|
credit_card = Braintree::CreditCard.create!(
|
|
935
935
|
:customer_id => customer.id,
|
|
936
936
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
937
|
-
:expiration_date => "05/2012"
|
|
937
|
+
:expiration_date => "05/2012",
|
|
938
938
|
)
|
|
939
939
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
940
940
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
941
941
|
:expiration_month => "07",
|
|
942
|
-
:expiration_year => "2011"
|
|
942
|
+
:expiration_year => "2011",
|
|
943
943
|
)
|
|
944
944
|
update_result.success?.should == true
|
|
945
945
|
update_result.credit_card.should == credit_card
|
|
@@ -955,14 +955,14 @@ describe Braintree::CreditCard do
|
|
|
955
955
|
:customer_id => customer.id,
|
|
956
956
|
:cvv => "123",
|
|
957
957
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
958
|
-
:expiration_date => "05/2012"
|
|
958
|
+
:expiration_date => "05/2012",
|
|
959
959
|
)
|
|
960
960
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
961
961
|
:cardholder_name => "New Holder",
|
|
962
962
|
:cvv => "456",
|
|
963
963
|
:number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
|
|
964
964
|
:expiration_date => "06/2013",
|
|
965
|
-
:options => {:verify_card => true}
|
|
965
|
+
:options => {:verify_card => true},
|
|
966
966
|
)
|
|
967
967
|
update_result.success?.should == false
|
|
968
968
|
update_result.credit_card_verification.status.should == Braintree::CreditCardVerification::Status::ProcessorDeclined
|
|
@@ -987,7 +987,7 @@ describe Braintree::CreditCard do
|
|
|
987
987
|
:region => "Old State",
|
|
988
988
|
:postal_code => "12345",
|
|
989
989
|
:country_name => "Canada"
|
|
990
|
-
}
|
|
990
|
+
},
|
|
991
991
|
)
|
|
992
992
|
result = Braintree::CreditCard.update(credit_card.token,
|
|
993
993
|
:options => {:verify_card => false},
|
|
@@ -1001,7 +1001,7 @@ describe Braintree::CreditCard do
|
|
|
1001
1001
|
:region => "New State",
|
|
1002
1002
|
:postal_code => "56789",
|
|
1003
1003
|
:country_name => "United States of America"
|
|
1004
|
-
}
|
|
1004
|
+
},
|
|
1005
1005
|
)
|
|
1006
1006
|
result.success?.should == true
|
|
1007
1007
|
address = result.credit_card.billing_address
|
|
@@ -1022,12 +1022,12 @@ describe Braintree::CreditCard do
|
|
|
1022
1022
|
:cardholder_name => "Original Holder",
|
|
1023
1023
|
:customer_id => customer.id,
|
|
1024
1024
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1025
|
-
:expiration_date => "05/2012"
|
|
1025
|
+
:expiration_date => "05/2012",
|
|
1026
1026
|
)
|
|
1027
1027
|
update_result = Braintree::CreditCard.update(credit_card.token,
|
|
1028
1028
|
:cardholder_name => "New Holder",
|
|
1029
1029
|
:number => "invalid",
|
|
1030
|
-
:expiration_date => "05/2014"
|
|
1030
|
+
:expiration_date => "05/2014",
|
|
1031
1031
|
)
|
|
1032
1032
|
update_result.success?.should == false
|
|
1033
1033
|
update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
|
|
@@ -1038,12 +1038,12 @@ describe Braintree::CreditCard do
|
|
|
1038
1038
|
card1 = Braintree::CreditCard.create(
|
|
1039
1039
|
:customer_id => customer.id,
|
|
1040
1040
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1041
|
-
:expiration_date => "05/2009"
|
|
1041
|
+
:expiration_date => "05/2009",
|
|
1042
1042
|
).credit_card
|
|
1043
1043
|
card2 = Braintree::CreditCard.create(
|
|
1044
1044
|
:customer_id => customer.id,
|
|
1045
1045
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1046
|
-
:expiration_date => "05/2009"
|
|
1046
|
+
:expiration_date => "05/2009",
|
|
1047
1047
|
).credit_card
|
|
1048
1048
|
|
|
1049
1049
|
card1.should be_default
|
|
@@ -1101,12 +1101,12 @@ describe Braintree::CreditCard do
|
|
|
1101
1101
|
:cardholder_name => "Original Holder",
|
|
1102
1102
|
:customer_id => customer.id,
|
|
1103
1103
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1104
|
-
:expiration_date => "05/2012"
|
|
1104
|
+
:expiration_date => "05/2012",
|
|
1105
1105
|
)
|
|
1106
1106
|
updated_credit_card = Braintree::CreditCard.update!(credit_card.token,
|
|
1107
1107
|
:cardholder_name => "New Holder",
|
|
1108
1108
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1109
|
-
:expiration_date => "06/2013"
|
|
1109
|
+
:expiration_date => "06/2013",
|
|
1110
1110
|
)
|
|
1111
1111
|
updated_credit_card.token.should == credit_card.token
|
|
1112
1112
|
updated_credit_card.bin.should == Braintree::Test::CreditCardNumbers::MasterCard[0, 6]
|
|
@@ -1122,13 +1122,13 @@ describe Braintree::CreditCard do
|
|
|
1122
1122
|
:cardholder_name => "Original Holder",
|
|
1123
1123
|
:customer_id => customer.id,
|
|
1124
1124
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1125
|
-
:expiration_date => "05/2012"
|
|
1125
|
+
:expiration_date => "05/2012",
|
|
1126
1126
|
)
|
|
1127
1127
|
expect do
|
|
1128
1128
|
Braintree::CreditCard.update!(credit_card.token,
|
|
1129
1129
|
:cardholder_name => "New Holder",
|
|
1130
1130
|
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
|
1131
|
-
:expiration_date => "invalid/date"
|
|
1131
|
+
:expiration_date => "invalid/date",
|
|
1132
1132
|
)
|
|
1133
1133
|
end.to raise_error(Braintree::ValidationsFailed)
|
|
1134
1134
|
end
|
|
@@ -1140,7 +1140,7 @@ describe Braintree::CreditCard do
|
|
|
1140
1140
|
result = Braintree::CreditCard.create(
|
|
1141
1141
|
:customer_id => customer.id,
|
|
1142
1142
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1143
|
-
:expiration_date => "05/2012"
|
|
1143
|
+
:expiration_date => "05/2012",
|
|
1144
1144
|
)
|
|
1145
1145
|
|
|
1146
1146
|
result.success?.should == true
|
|
@@ -1160,7 +1160,7 @@ describe Braintree::CreditCard do
|
|
|
1160
1160
|
Braintree::CreditCard.create!(
|
|
1161
1161
|
:customer_id => customer.id,
|
|
1162
1162
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1163
|
-
:expiration_date => "01/#{Time.now.year - 3}"
|
|
1163
|
+
:expiration_date => "01/#{Time.now.year - 3}",
|
|
1164
1164
|
)
|
|
1165
1165
|
end
|
|
1166
1166
|
|
|
@@ -1191,14 +1191,14 @@ describe Braintree::CreditCard do
|
|
|
1191
1191
|
Braintree::CreditCard.create!(
|
|
1192
1192
|
:customer_id => customer.id,
|
|
1193
1193
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1194
|
-
:expiration_date => "01/2010"
|
|
1194
|
+
:expiration_date => "01/2010",
|
|
1195
1195
|
)
|
|
1196
1196
|
end
|
|
1197
1197
|
|
|
1198
1198
|
collection = Braintree::CreditCard.expiring_between(Time.mktime(2010, 1, 1), Time.mktime(2010,3, 1))
|
|
1199
1199
|
collection.maximum_size.should > 100
|
|
1200
1200
|
|
|
1201
|
-
credit_card_ids = collection.map {|c| c.token }.uniq.compact
|
|
1201
|
+
credit_card_ids = collection.map { |c| c.token }.uniq.compact
|
|
1202
1202
|
credit_card_ids.size.should == collection.maximum_size
|
|
1203
1203
|
end
|
|
1204
1204
|
end
|
|
@@ -1209,7 +1209,7 @@ describe Braintree::CreditCard do
|
|
|
1209
1209
|
result = Braintree::CreditCard.create(
|
|
1210
1210
|
:customer_id => customer.id,
|
|
1211
1211
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1212
|
-
:expiration_date => "05/2012"
|
|
1212
|
+
:expiration_date => "05/2012",
|
|
1213
1213
|
)
|
|
1214
1214
|
result.success?.should == true
|
|
1215
1215
|
credit_card = Braintree::CreditCard.find(result.credit_card.token)
|
|
@@ -1224,13 +1224,13 @@ describe Braintree::CreditCard do
|
|
|
1224
1224
|
credit_card = Braintree::CreditCard.create(
|
|
1225
1225
|
:customer_id => customer.id,
|
|
1226
1226
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1227
|
-
:expiration_date => "05/2012"
|
|
1227
|
+
:expiration_date => "05/2012",
|
|
1228
1228
|
).credit_card
|
|
1229
1229
|
|
|
1230
1230
|
subscription = Braintree::Subscription.create(
|
|
1231
1231
|
:payment_method_token => credit_card.token,
|
|
1232
1232
|
:plan_id => "integration_trialless_plan",
|
|
1233
|
-
:price => "1.00"
|
|
1233
|
+
:price => "1.00",
|
|
1234
1234
|
).subscription
|
|
1235
1235
|
|
|
1236
1236
|
found_card = Braintree::CreditCard.find(credit_card.token)
|
|
@@ -1274,7 +1274,7 @@ describe Braintree::CreditCard do
|
|
|
1274
1274
|
:expiration_month => "11",
|
|
1275
1275
|
:expiration_year => "2099",
|
|
1276
1276
|
},
|
|
1277
|
-
:client_token_options => {:customer_id => customer.id}
|
|
1277
|
+
:client_token_options => {:customer_id => customer.id},
|
|
1278
1278
|
)
|
|
1279
1279
|
|
|
1280
1280
|
credit_card = Braintree::CreditCard.from_nonce(nonce)
|
|
@@ -1288,7 +1288,7 @@ describe Braintree::CreditCard do
|
|
|
1288
1288
|
:number => "4111111111111111",
|
|
1289
1289
|
:expiration_month => "11",
|
|
1290
1290
|
:expiration_year => "2099",
|
|
1291
|
-
}
|
|
1291
|
+
},
|
|
1292
1292
|
)
|
|
1293
1293
|
expect do
|
|
1294
1294
|
Braintree::CreditCard.from_nonce(nonce)
|
|
@@ -1303,7 +1303,7 @@ describe Braintree::CreditCard do
|
|
|
1303
1303
|
:expiration_month => "11",
|
|
1304
1304
|
:expiration_year => "2099",
|
|
1305
1305
|
},
|
|
1306
|
-
:client_token_options => {:customer_id => customer.id}
|
|
1306
|
+
:client_token_options => {:customer_id => customer.id},
|
|
1307
1307
|
)
|
|
1308
1308
|
|
|
1309
1309
|
Braintree::CreditCard.from_nonce(nonce)
|
|
@@ -1319,7 +1319,7 @@ describe Braintree::CreditCard do
|
|
|
1319
1319
|
:credit_card => {
|
|
1320
1320
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1321
1321
|
:expiration_date => "05/2010"
|
|
1322
|
-
}
|
|
1322
|
+
},
|
|
1323
1323
|
)
|
|
1324
1324
|
result = Braintree::CreditCard.sale(customer.credit_cards[0].token, :amount => "100.00")
|
|
1325
1325
|
|
|
@@ -1338,13 +1338,13 @@ describe Braintree::CreditCard do
|
|
|
1338
1338
|
:credit_card => {
|
|
1339
1339
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1340
1340
|
:expiration_date => "05/2010"
|
|
1341
|
-
}
|
|
1341
|
+
},
|
|
1342
1342
|
)
|
|
1343
1343
|
result = Braintree::CreditCard.sale(customer.credit_cards[0].token,
|
|
1344
1344
|
:amount => "100.00",
|
|
1345
1345
|
:credit_card => {
|
|
1346
1346
|
:cvv => "301"
|
|
1347
|
-
}
|
|
1347
|
+
},
|
|
1348
1348
|
)
|
|
1349
1349
|
|
|
1350
1350
|
result.success?.should == true
|
|
@@ -1362,7 +1362,7 @@ describe Braintree::CreditCard do
|
|
|
1362
1362
|
:credit_card => {
|
|
1363
1363
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1364
1364
|
:expiration_date => "05/2010"
|
|
1365
|
-
}
|
|
1365
|
+
},
|
|
1366
1366
|
)
|
|
1367
1367
|
transaction = Braintree::CreditCard.sale!(customer.credit_cards[0].token, :amount => "100.00")
|
|
1368
1368
|
transaction.amount.should == BigDecimal("100.00")
|
|
@@ -1382,7 +1382,7 @@ describe Braintree::CreditCard do
|
|
|
1382
1382
|
:cardholder_name => "Original Holder",
|
|
1383
1383
|
:customer_id => customer.id,
|
|
1384
1384
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1385
|
-
:expiration_date => "05/2012"
|
|
1385
|
+
:expiration_date => "05/2012",
|
|
1386
1386
|
)
|
|
1387
1387
|
|
|
1388
1388
|
credit_card.nonce.should_not be_nil
|
|
@@ -1400,7 +1400,7 @@ describe Braintree::CreditCard do
|
|
|
1400
1400
|
credit_card = Braintree::CreditCard.create(
|
|
1401
1401
|
:customer_id => customer.id,
|
|
1402
1402
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1403
|
-
:expiration_date => "05/2009"
|
|
1403
|
+
:expiration_date => "05/2009",
|
|
1404
1404
|
).credit_card
|
|
1405
1405
|
credit_card_vaulted = Braintree::CreditCard.find(credit_card.token)
|
|
1406
1406
|
credit_card_vaulted.is_network_tokenized?.should == false
|