braintree 3.2.0 → 4.2.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.
Files changed (150) hide show
  1. checksums.yaml +4 -4
  2. data/braintree.gemspec +3 -3
  3. data/lib/braintree.rb +6 -1
  4. data/lib/braintree/account_updater_daily_report.rb +1 -1
  5. data/lib/braintree/address.rb +2 -1
  6. data/lib/braintree/apple_pay.rb +1 -1
  7. data/lib/braintree/apple_pay_card.rb +1 -1
  8. data/lib/braintree/apple_pay_options.rb +1 -1
  9. data/lib/braintree/authorization_adjustment.rb +1 -1
  10. data/lib/braintree/client_token.rb +1 -1
  11. data/lib/braintree/configuration.rb +11 -11
  12. data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
  13. data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
  14. data/lib/braintree/credit_card.rb +2 -2
  15. data/lib/braintree/credit_card_gateway.rb +14 -4
  16. data/lib/braintree/credit_card_verification.rb +5 -5
  17. data/lib/braintree/credit_card_verification_search.rb +1 -1
  18. data/lib/braintree/customer.rb +6 -4
  19. data/lib/braintree/customer_gateway.rb +2 -0
  20. data/lib/braintree/customer_search.rb +1 -1
  21. data/lib/braintree/disbursement.rb +1 -1
  22. data/lib/braintree/dispute.rb +15 -1
  23. data/lib/braintree/dispute/paypal_message.rb +15 -0
  24. data/lib/braintree/dispute_gateway.rb +2 -2
  25. data/lib/braintree/dispute_search.rb +3 -2
  26. data/lib/braintree/document_upload.rb +1 -1
  27. data/lib/braintree/error_codes.rb +10 -6
  28. data/lib/braintree/google_pay_card.rb +1 -1
  29. data/lib/braintree/granted_payment_instrument_update.rb +1 -1
  30. data/lib/braintree/graphql_client.rb +7 -7
  31. data/lib/braintree/http.rb +3 -3
  32. data/lib/braintree/local_payment_completed.rb +1 -1
  33. data/lib/braintree/local_payment_reversed.rb +19 -0
  34. data/lib/braintree/merchant.rb +1 -1
  35. data/lib/braintree/merchant_account.rb +1 -1
  36. data/lib/braintree/merchant_account_gateway.rb +1 -1
  37. data/lib/braintree/merchant_gateway.rb +1 -1
  38. data/lib/braintree/modification.rb +1 -1
  39. data/lib/braintree/oauth_credentials.rb +1 -1
  40. data/lib/braintree/oauth_gateway.rb +5 -5
  41. data/lib/braintree/payment_instrument_type.rb +10 -10
  42. data/lib/braintree/payment_method_gateway.rb +10 -7
  43. data/lib/braintree/payment_method_nonce.rb +7 -4
  44. data/lib/braintree/payment_method_nonce_details.rb +37 -0
  45. data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
  46. data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
  47. data/lib/braintree/plan.rb +1 -1
  48. data/lib/braintree/processor_response_types.rb +3 -3
  49. data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
  50. data/lib/braintree/risk_data.rb +3 -1
  51. data/lib/braintree/samsung_pay_card.rb +1 -1
  52. data/lib/braintree/settlement_batch_summary.rb +2 -2
  53. data/lib/braintree/subscription.rb +6 -6
  54. data/lib/braintree/three_d_secure_info.rb +22 -12
  55. data/lib/braintree/transaction.rb +32 -24
  56. data/lib/braintree/transaction_gateway.rb +24 -5
  57. data/lib/braintree/transaction_line_item.rb +1 -1
  58. data/lib/braintree/transaction_search.rb +3 -1
  59. data/lib/braintree/unknown_payment_method.rb +1 -1
  60. data/lib/braintree/us_bank_account.rb +3 -3
  61. data/lib/braintree/us_bank_account_verification.rb +1 -1
  62. data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
  63. data/lib/braintree/util.rb +4 -4
  64. data/lib/braintree/venmo_account.rb +1 -1
  65. data/lib/braintree/version.rb +1 -1
  66. data/lib/braintree/visa_checkout_card.rb +2 -2
  67. data/lib/braintree/webhook_notification.rb +30 -20
  68. data/lib/braintree/webhook_notification_gateway.rb +5 -5
  69. data/lib/braintree/webhook_testing_gateway.rb +30 -0
  70. data/lib/braintree/xml/generator.rb +5 -4
  71. data/lib/braintree/xml/libxml.rb +0 -1
  72. data/lib/braintree/xml/parser.rb +22 -12
  73. data/lib/braintree/xml/rexml.rb +70 -0
  74. data/spec/integration/braintree/add_on_spec.rb +1 -1
  75. data/spec/integration/braintree/address_spec.rb +28 -24
  76. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  77. data/spec/integration/braintree/apple_pay_spec.rb +3 -3
  78. data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
  79. data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
  80. data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
  81. data/spec/integration/braintree/credit_card_spec.rb +213 -122
  82. data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
  83. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  84. data/spec/integration/braintree/customer_search_spec.rb +8 -8
  85. data/spec/integration/braintree/customer_spec.rb +282 -165
  86. data/spec/integration/braintree/dispute_search_spec.rb +28 -3
  87. data/spec/integration/braintree/dispute_spec.rb +6 -6
  88. data/spec/integration/braintree/error_codes_spec.rb +1 -1
  89. data/spec/integration/braintree/http_spec.rb +2 -2
  90. data/spec/integration/braintree/merchant_account_spec.rb +25 -26
  91. data/spec/integration/braintree/merchant_spec.rb +14 -14
  92. data/spec/integration/braintree/oauth_spec.rb +11 -11
  93. data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
  94. data/spec/integration/braintree/payment_method_spec.rb +269 -165
  95. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
  96. data/spec/integration/braintree/paypal_account_spec.rb +28 -28
  97. data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
  98. data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
  99. data/spec/integration/braintree/subscription_spec.rb +133 -133
  100. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  101. data/spec/integration/braintree/test_transaction_spec.rb +10 -10
  102. data/spec/integration/braintree/transaction_search_spec.rb +93 -67
  103. data/spec/integration/braintree/transaction_spec.rb +574 -360
  104. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
  105. data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
  106. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
  107. data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
  108. data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
  109. data/spec/integration/spec_helper.rb +9 -3
  110. data/spec/oauth_test_helper.rb +1 -1
  111. data/spec/script/httpsd.rb +6 -6
  112. data/spec/spec_helper.rb +6 -3
  113. data/spec/unit/braintree/address_spec.rb +1 -1
  114. data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
  115. data/spec/unit/braintree/client_token_spec.rb +2 -2
  116. data/spec/unit/braintree/configuration_spec.rb +42 -42
  117. data/spec/unit/braintree/credit_card_spec.rb +13 -13
  118. data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
  119. data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
  120. data/spec/unit/braintree/customer_spec.rb +20 -10
  121. data/spec/unit/braintree/disbursement_spec.rb +7 -7
  122. data/spec/unit/braintree/dispute_search_spec.rb +1 -0
  123. data/spec/unit/braintree/dispute_spec.rb +34 -9
  124. data/spec/unit/braintree/error_result_spec.rb +5 -5
  125. data/spec/unit/braintree/errors_spec.rb +8 -8
  126. data/spec/unit/braintree/http_spec.rb +5 -5
  127. data/spec/unit/braintree/merchant_account_spec.rb +1 -1
  128. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
  129. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
  130. data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
  131. data/spec/unit/braintree/payment_method_spec.rb +1 -1
  132. data/spec/unit/braintree/paypal_account_spec.rb +2 -2
  133. data/spec/unit/braintree/resource_collection_spec.rb +9 -9
  134. data/spec/unit/braintree/risk_data_spec.rb +9 -5
  135. data/spec/unit/braintree/subscription_search_spec.rb +1 -1
  136. data/spec/unit/braintree/successful_result_spec.rb +1 -1
  137. data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
  138. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
  139. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  140. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  141. data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
  142. data/spec/unit/braintree/transaction_search_spec.rb +12 -12
  143. data/spec/unit/braintree/transaction_spec.rb +25 -17
  144. data/spec/unit/braintree/util_spec.rb +18 -18
  145. data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
  146. data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
  147. data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
  148. data/spec/unit/braintree/xml_spec.rb +31 -31
  149. metadata +16 -8
  150. 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
@@ -32,6 +32,7 @@ describe Braintree::PaymentMethodNonce do
32
32
  result.payment_method_nonce.should_not be_nil
33
33
  result.payment_method_nonce.nonce.should_not be_nil
34
34
  result.payment_method_nonce.details.should_not be_nil
35
+ result.payment_method_nonce.default?.should be_truthy
35
36
  end
36
37
 
37
38
  it "correctly raises and exception for a non existent token" do
@@ -49,12 +50,12 @@ describe Braintree::PaymentMethodNonce do
49
50
  :number => "4111111111111111",
50
51
  :expiration_month => "11",
51
52
  :expiration_year => "2099",
52
- }
53
+ },
53
54
  )
54
55
 
55
56
  payment_method = Braintree::PaymentMethod.create!(
56
57
  :payment_method_nonce => nonce,
57
- :customer_id => customer.id
58
+ :customer_id => customer.id,
58
59
  )
59
60
 
60
61
  payment_method.should be_a(Braintree::CreditCard)
@@ -67,6 +68,7 @@ describe Braintree::PaymentMethodNonce do
67
68
  payment_method_nonce.should_not be_nil
68
69
  payment_method_nonce.nonce.should_not be_nil
69
70
  payment_method_nonce.details.should_not be_nil
71
+ payment_method_nonce.default?.should be_truthy
70
72
  end
71
73
  end
72
74
 
@@ -79,33 +81,24 @@ describe Braintree::PaymentMethodNonce do
79
81
  result.should be_success
80
82
  nonce.nonce.should == "fake-valid-nonce"
81
83
  nonce.type.should == "CreditCard"
82
- nonce.details.fetch(:last_two).should == "81"
83
- nonce.details.fetch(:card_type).should == "Visa"
84
+ nonce.details.bin.should == "401288"
85
+ nonce.details.card_type.should == "Visa"
86
+ nonce.details.expiration_month.should == "12"
87
+ nonce.details.expiration_year.should == "2022"
88
+ nonce.details.is_network_tokenized?.should be_nil
89
+ nonce.details.last_two.should == "81"
90
+ nonce.details.payer_info.should be_nil
84
91
  end
85
92
 
86
93
  it "return paypal details if details exist" do
87
94
  result = Braintree::PaymentMethodNonce.find("fake-paypal-one-time-nonce")
88
95
  nonce = result.payment_method_nonce
89
-
90
- nonce.details.fetch(:cobranded_card_label).should_not be_nil
91
- nonce.details.fetch(:shipping_option_id).should_not be_nil
92
- nonce.details.fetch(:billing_address).fetch(:recipient_name).should_not be_nil
93
- nonce.details.fetch(:shipping_address).fetch(:recipient_name).should_not be_nil
94
-
95
- nonce.details.fetch(:payer_info).fetch(:first_name).should_not be_nil
96
- nonce.details.fetch(:payer_info).fetch(:last_name).should_not be_nil
97
- nonce.details.fetch(:payer_info).fetch(:email).should_not be_nil
98
- nonce.details.fetch(:payer_info).fetch(:payer_id).should_not be_nil
99
- end
100
-
101
- it "return venmo details if details exist" do
102
- result = Braintree::PaymentMethodNonce.find("fake-venmo-account-nonce")
103
-
104
- nonce = result.payment_method_nonce
105
-
106
- nonce.details.fetch(:last_two).should == "99"
107
- nonce.details.fetch(:username).should == "venmojoe"
108
- nonce.details.fetch(:venmo_user_id).should == "Venmo-Joe-1"
96
+ nonce.details.payer_info.billing_agreement_id.should be_nil
97
+ nonce.details.payer_info.country_code.should be_nil
98
+ nonce.details.payer_info.email.should_not be_nil
99
+ nonce.details.payer_info.first_name.should_not be_nil
100
+ nonce.details.payer_info.last_name.should_not be_nil
101
+ nonce.details.payer_info.payer_id.should_not be_nil
109
102
  end
110
103
 
111
104
  it "returns null 3ds_info if there isn't any" do
@@ -114,7 +107,7 @@ describe Braintree::PaymentMethodNonce do
114
107
  :number => "4111111111111111",
115
108
  :expiration_month => "11",
116
109
  :expiration_year => "2099",
117
- }
110
+ },
118
111
  )
119
112
 
120
113
  result = Braintree::PaymentMethodNonce.find(nonce)
@@ -131,7 +124,7 @@ describe Braintree::PaymentMethodNonce do
131
124
  nonce = result.payment_method_nonce
132
125
  result.should be_success
133
126
  nonce.details.should_not be_nil
134
- nonce.details[:bin].should == "401288"
127
+ nonce.details.bin.should == "401288"
135
128
  end
136
129
 
137
130
  it "returns bin_data with commercial set to Yes" do
@@ -257,19 +250,19 @@ describe Braintree::PaymentMethodNonce do
257
250
  context "regulation environments" do
258
251
  it "can get unregulated" do
259
252
  expect(
260
- request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment]
253
+ request_authentication_insights(european_merchant_token, indian_payment_token)[:regulation_environment],
261
254
  ).to eq "unregulated"
262
255
  end
263
256
 
264
257
  it "can get psd2" do
265
258
  expect(
266
- request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment]
259
+ request_authentication_insights(european_merchant_token, european_payment_token)[:regulation_environment],
267
260
  ).to eq "psd2"
268
261
  end
269
262
 
270
263
  it "can get rbi" do
271
264
  expect(
272
- request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment]
265
+ request_authentication_insights(indian_merchant_token, indian_payment_token)[:regulation_environment],
273
266
  ).to eq "rbi"
274
267
  end
275
268
  end
@@ -277,19 +270,19 @@ describe Braintree::PaymentMethodNonce do
277
270
  context "sca_indicator" do
278
271
  it "can get unavailable" do
279
272
  expect(
280
- request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator]
273
+ request_authentication_insights(indian_merchant_token, indian_payment_token)[:sca_indicator],
281
274
  ).to eq "unavailable"
282
275
  end
283
276
 
284
277
  it "can get sca_required" do
285
278
  expect(
286
- request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator]
279
+ request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2001})[:sca_indicator],
287
280
  ).to eq "sca_required"
288
281
  end
289
282
 
290
283
  it "can get sca_optional" do
291
284
  expect(
292
- request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator]
285
+ request_authentication_insights(indian_merchant_token, indian_payment_token, {amount: 2000, recurring_customer_consent: true, recurring_max_amount: 2000})[:sca_indicator],
293
286
 
294
287
  ).to eq "sca_optional"
295
288
  end
@@ -309,7 +302,7 @@ describe Braintree::PaymentMethodNonce do
309
302
 
310
303
  result = Braintree::PaymentMethodNonce.create(
311
304
  payment_method_token,
312
- payment_method_nonce: nonce_request
305
+ payment_method_nonce: nonce_request,
313
306
  )
314
307
  result.should be_success
315
308
 
@@ -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 => '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',
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 => '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',
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
@@ -527,6 +527,58 @@ describe Braintree::PaymentMethod do
527
527
  found_credit_card.billing_address.street_address.should == "456 Xyz Way"
528
528
  end
529
529
 
530
+ it "includes risk data when skip_advanced_fraud_checking is false" do
531
+ with_fraud_protection_enterprise_merchant do
532
+ customer = Braintree::Customer.create!
533
+
534
+ nonce = nonce_for_new_payment_method(
535
+ :credit_card => {
536
+ :cvv => "123",
537
+ :number => Braintree::Test::CreditCardNumbers::Visa,
538
+ :expiration_date => "05/2009",
539
+ },
540
+ )
541
+ result = Braintree::PaymentMethod.create(
542
+ :payment_method_nonce => nonce,
543
+ :customer_id => customer.id,
544
+ :options => {
545
+ :verify_card => true,
546
+ :skip_advanced_fraud_checking => false,
547
+ },
548
+ )
549
+
550
+ expect(result).to be_success
551
+ verification = result.payment_method.verification
552
+ expect(verification.risk_data).not_to be_nil
553
+ end
554
+ end
555
+
556
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
557
+ with_fraud_protection_enterprise_merchant do
558
+ customer = Braintree::Customer.create!
559
+
560
+ nonce = nonce_for_new_payment_method(
561
+ :credit_card => {
562
+ :cvv => "123",
563
+ :number => Braintree::Test::CreditCardNumbers::Visa,
564
+ :expiration_date => "05/2009",
565
+ },
566
+ )
567
+ result = Braintree::PaymentMethod.create(
568
+ :payment_method_nonce => nonce,
569
+ :customer_id => customer.id,
570
+ :options => {
571
+ :verify_card => true,
572
+ :skip_advanced_fraud_checking => true,
573
+ },
574
+ )
575
+
576
+ expect(result).to be_success
577
+ verification = result.payment_method.verification
578
+ expect(verification.risk_data).to be_nil
579
+ end
580
+ end
581
+
530
582
  context "account_type" do
531
583
  it "verifies card with account_type debit" do
532
584
  nonce = nonce_for_new_payment_method(
@@ -534,7 +586,7 @@ describe Braintree::PaymentMethod do
534
586
  :number => Braintree::Test::CreditCardNumbers::Hiper,
535
587
  :expiration_month => "11",
536
588
  :expiration_year => "2099",
537
- }
589
+ },
538
590
  )
539
591
  customer = Braintree::Customer.create!
540
592
  result = Braintree::PaymentMethod.create(
@@ -544,7 +596,7 @@ describe Braintree::PaymentMethod do
544
596
  :verify_card => true,
545
597
  :verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
546
598
  :verification_account_type => "debit",
547
- }
599
+ },
548
600
  )
549
601
 
550
602
  result.should be_success
@@ -557,7 +609,7 @@ describe Braintree::PaymentMethod do
557
609
  :number => Braintree::Test::CreditCardNumbers::Hiper,
558
610
  :expiration_month => "11",
559
611
  :expiration_year => "2099",
560
- }
612
+ },
561
613
  )
562
614
  customer = Braintree::Customer.create!
563
615
  result = Braintree::PaymentMethod.create(
@@ -567,7 +619,7 @@ describe Braintree::PaymentMethod do
567
619
  :verify_card => true,
568
620
  :verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
569
621
  :verification_account_type => "credit",
570
- }
622
+ },
571
623
  )
572
624
 
573
625
  result.should be_success
@@ -580,7 +632,7 @@ describe Braintree::PaymentMethod do
580
632
  :number => Braintree::Test::CreditCardNumbers::Hiper,
581
633
  :expiration_month => "11",
582
634
  :expiration_year => "2099",
583
- }
635
+ },
584
636
  )
585
637
  customer = Braintree::Customer.create!
586
638
  result = Braintree::PaymentMethod.create(
@@ -590,7 +642,7 @@ describe Braintree::PaymentMethod do
590
642
  :verify_card => true,
591
643
  :verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
592
644
  :verification_account_type => "ach",
593
- }
645
+ },
594
646
  )
595
647
 
596
648
  result.should_not be_success
@@ -603,7 +655,7 @@ describe Braintree::PaymentMethod do
603
655
  :number => Braintree::Test::CreditCardNumbers::Visa,
604
656
  :expiration_month => "11",
605
657
  :expiration_year => "2099",
606
- }
658
+ },
607
659
  )
608
660
  customer = Braintree::Customer.create!
609
661
  result = Braintree::PaymentMethod.create(
@@ -612,7 +664,7 @@ describe Braintree::PaymentMethod do
612
664
  :options => {
613
665
  :verify_card => true,
614
666
  :verification_account_type => "credit",
615
- }
667
+ },
616
668
  )
617
669
 
618
670
  result.should_not be_success
@@ -626,7 +678,7 @@ describe Braintree::PaymentMethod do
626
678
  :customer_id => customer.id,
627
679
  :cvv => "123",
628
680
  :number => Braintree::Test::CreditCardNumbers::Visa,
629
- :expiration_date => "05/2012"
681
+ :expiration_date => "05/2012",
630
682
  )
631
683
  update_result = Braintree::PaymentMethod.update(credit_card.token,
632
684
  :cardholder_name => "New Holder",
@@ -650,7 +702,7 @@ describe Braintree::PaymentMethod do
650
702
  :customer_id => customer.id,
651
703
  :cvv => "123",
652
704
  :number => Braintree::Test::CreditCardNumbers::Visa,
653
- :expiration_date => "05/2012"
705
+ :expiration_date => "05/2012",
654
706
  )
655
707
  update_result = Braintree::PaymentMethod.update(credit_card.token,
656
708
  :cardholder_name => "New Holder",
@@ -674,7 +726,7 @@ describe Braintree::PaymentMethod do
674
726
  customer = Braintree::Customer.create.customer
675
727
  result = Braintree::PaymentMethod.create(
676
728
  :payment_method_nonce => nonce,
677
- :customer_id => customer.id
729
+ :customer_id => customer.id,
678
730
  )
679
731
 
680
732
  result.should be_success
@@ -751,7 +803,7 @@ describe Braintree::PaymentMethod do
751
803
  nonce = nonce_for_paypal_account(:access_token => "PAYPAL_ACCESS_TOKEN")
752
804
  result = Braintree::PaymentMethod.create(
753
805
  :payment_method_nonce => nonce,
754
- :customer_id => customer.id
806
+ :customer_id => customer.id,
755
807
  )
756
808
 
757
809
  result.should_not be_success
@@ -766,7 +818,7 @@ describe Braintree::PaymentMethod do
766
818
  :customer_id => customer.id,
767
819
  :billing_address => {
768
820
  :street_address => "123 Abc Way"
769
- }
821
+ },
770
822
  )
771
823
 
772
824
  result.should be_success
@@ -784,7 +836,7 @@ describe Braintree::PaymentMethod do
784
836
  result = Braintree::PaymentMethod.create(
785
837
  :payment_method_nonce => nonce,
786
838
  :customer_id => customer.id,
787
- :billing_address_id => "address_id"
839
+ :billing_address_id => "address_id",
788
840
  )
789
841
 
790
842
  result.should be_success
@@ -801,7 +853,7 @@ describe Braintree::PaymentMethod do
801
853
  nonce = nonce_for_paypal_account(:token => "PAYPAL_TOKEN")
802
854
  result = Braintree::PaymentMethod.create(
803
855
  :payment_method_nonce => nonce,
804
- :customer_id => customer.id
856
+ :customer_id => customer.id,
805
857
  )
806
858
 
807
859
  result.should_not be_success
@@ -815,7 +867,7 @@ describe Braintree::PaymentMethod do
815
867
  original_token = random_payment_method_token
816
868
  nonce = nonce_for_paypal_account(
817
869
  :consent_code => "consent-code",
818
- :token => original_token
870
+ :token => original_token,
819
871
  )
820
872
 
821
873
  result = Braintree::PaymentMethod.create(
@@ -825,7 +877,7 @@ describe Braintree::PaymentMethod do
825
877
  :verify_card => true,
826
878
  :fail_on_duplicate_payment_method => true,
827
879
  :verification_merchant_account_id => "not_a_real_merchant_account_id"
828
- }
880
+ },
829
881
  )
830
882
 
831
883
  result.should be_success
@@ -839,7 +891,7 @@ describe Braintree::PaymentMethod do
839
891
  result = Braintree::PaymentMethod.create(
840
892
  :payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
841
893
  :customer_id => customer.id,
842
- :token => token
894
+ :token => token,
843
895
  )
844
896
 
845
897
  result.should be_success
@@ -857,7 +909,7 @@ describe Braintree::PaymentMethod do
857
909
  :number => Braintree::Test::CreditCardNumbers::Visa,
858
910
  :expiration_month => "11",
859
911
  :expiration_year => "2099",
860
- }
912
+ },
861
913
  )
862
914
  customer = Braintree::Customer.create!
863
915
  result = Braintree::PaymentMethod.create(
@@ -866,7 +918,7 @@ describe Braintree::PaymentMethod do
866
918
  :options => {
867
919
  :verify_card => true,
868
920
  :verification_currency_iso_code => "USD"
869
- }
921
+ },
870
922
  )
871
923
 
872
924
  result.should be_success
@@ -879,7 +931,7 @@ describe Braintree::PaymentMethod do
879
931
  :number => Braintree::Test::CreditCardNumbers::Visa,
880
932
  :expiration_month => "11",
881
933
  :expiration_year => "2099",
882
- }
934
+ },
883
935
  )
884
936
  customer = Braintree::Customer.create!
885
937
  result = Braintree::PaymentMethod.create(
@@ -889,7 +941,7 @@ describe Braintree::PaymentMethod do
889
941
  :verify_card => true,
890
942
  :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
891
943
  :verification_currency_iso_code => "USD"
892
- }
944
+ },
893
945
  )
894
946
 
895
947
  result.should be_success
@@ -904,7 +956,7 @@ describe Braintree::PaymentMethod do
904
956
  :number => Braintree::Test::CreditCardNumbers::Visa,
905
957
  :expiration_month => "11",
906
958
  :expiration_year => "2099",
907
- }
959
+ },
908
960
  )
909
961
  customer = Braintree::Customer.create!
910
962
  result = Braintree::PaymentMethod.create(
@@ -913,7 +965,7 @@ describe Braintree::PaymentMethod do
913
965
  :options => {
914
966
  :verify_card => true,
915
967
  :verification_currency_iso_code => "GBP"
916
- }
968
+ },
917
969
  )
918
970
  result.should_not be_success
919
971
  result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
@@ -925,7 +977,7 @@ describe Braintree::PaymentMethod do
925
977
  :number => Braintree::Test::CreditCardNumbers::Visa,
926
978
  :expiration_month => "11",
927
979
  :expiration_year => "2099",
928
- }
980
+ },
929
981
  )
930
982
  customer = Braintree::Customer.create!
931
983
  result = Braintree::PaymentMethod.create(
@@ -935,7 +987,7 @@ describe Braintree::PaymentMethod do
935
987
  :verify_card => true,
936
988
  :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId,
937
989
  :verification_currency_iso_code => "GBP"
938
- }
990
+ },
939
991
  )
940
992
 
941
993
  result.should_not be_success
@@ -955,20 +1007,20 @@ describe Braintree::PaymentMethod do
955
1007
  config,
956
1008
  :authorization_fingerprint => authorization_fingerprint,
957
1009
  :shared_customer_identifier => "fake_identifier",
958
- :shared_customer_identifier_type => "testing"
1010
+ :shared_customer_identifier_type => "testing",
959
1011
  )
960
1012
 
961
1013
  response = http.create_credit_card(
962
1014
  :number => 4111111111111111,
963
1015
  :expirationMonth => 12,
964
- :expirationYear => 2020
1016
+ :expirationYear => 2020,
965
1017
  )
966
1018
  response.code.should == "201"
967
1019
 
968
1020
  nonce = JSON.parse(response.body)["creditCards"].first["nonce"]
969
1021
  payment_method = Braintree::PaymentMethod.create!(
970
1022
  :payment_method_nonce => nonce,
971
- :customer_id => customer.id
1023
+ :customer_id => customer.id,
972
1024
  )
973
1025
 
974
1026
  payment_method.should be_a(Braintree::CreditCard)
@@ -986,7 +1038,7 @@ describe Braintree::PaymentMethod do
986
1038
  result = Braintree::CreditCard.create(
987
1039
  :customer_id => customer.id,
988
1040
  :number => Braintree::Test::CreditCardNumbers::Visa,
989
- :expiration_date => "05/2012"
1041
+ :expiration_date => "05/2012",
990
1042
  )
991
1043
  result.success?.should == true
992
1044
 
@@ -1002,13 +1054,13 @@ describe Braintree::PaymentMethod do
1002
1054
  credit_card = Braintree::CreditCard.create(
1003
1055
  :customer_id => customer.id,
1004
1056
  :number => Braintree::Test::CreditCardNumbers::Visa,
1005
- :expiration_date => "05/2012"
1057
+ :expiration_date => "05/2012",
1006
1058
  ).credit_card
1007
1059
 
1008
1060
  subscription = Braintree::Subscription.create(
1009
1061
  :payment_method_token => credit_card.token,
1010
1062
  :plan_id => "integration_trialless_plan",
1011
- :price => "1.00"
1063
+ :price => "1.00",
1012
1064
  ).subscription
1013
1065
 
1014
1066
  found_card = Braintree::PaymentMethod.find(credit_card.token)
@@ -1025,11 +1077,11 @@ describe Braintree::PaymentMethod do
1025
1077
  payment_method_token = make_token
1026
1078
  nonce = nonce_for_paypal_account(
1027
1079
  :consent_code => "consent-code",
1028
- :token => payment_method_token
1080
+ :token => payment_method_token,
1029
1081
  )
1030
1082
  result = Braintree::PaymentMethod.create(
1031
1083
  :payment_method_nonce => nonce,
1032
- :customer_id => customer.id
1084
+ :customer_id => customer.id,
1033
1085
  )
1034
1086
  result.should be_success
1035
1087
 
@@ -1048,7 +1100,7 @@ describe Braintree::PaymentMethod do
1048
1100
  result = Braintree::PaymentMethod.create(
1049
1101
  :payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
1050
1102
  :customer_id => customer.id,
1051
- :token => payment_method_token
1103
+ :token => payment_method_token,
1052
1104
  )
1053
1105
  result.should be_success
1054
1106
 
@@ -1073,7 +1125,7 @@ describe Braintree::PaymentMethod do
1073
1125
  result = Braintree::PaymentMethod.create(
1074
1126
  :payment_method_nonce => Braintree::Test::Nonce::VenmoAccount,
1075
1127
  :customer_id => customer.id,
1076
- :token => payment_method_token
1128
+ :token => payment_method_token,
1077
1129
  )
1078
1130
  result.should be_success
1079
1131
 
@@ -1083,8 +1135,8 @@ describe Braintree::PaymentMethod do
1083
1135
  venmo_account.token.should == payment_method_token
1084
1136
  venmo_account.default.should == true
1085
1137
  venmo_account.image_url.should =~ /venmo/
1086
- venmo_account.username.should == 'venmojoe'
1087
- venmo_account.venmo_user_id.should == 'Venmo-Joe-1'
1138
+ venmo_account.username.should == "venmojoe"
1139
+ venmo_account.venmo_user_id.should == "Venmo-Joe-1"
1088
1140
  venmo_account.source_description.should == "Venmo Account: venmojoe"
1089
1141
  venmo_account.customer_id.should == customer.id
1090
1142
  end
@@ -1097,7 +1149,7 @@ describe Braintree::PaymentMethod do
1097
1149
  result = Braintree::PaymentMethod.create(
1098
1150
  :payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
1099
1151
  :customer_id => customer.id,
1100
- :token => payment_method_token
1152
+ :token => payment_method_token,
1101
1153
  )
1102
1154
  result.should be_success
1103
1155
 
@@ -1125,7 +1177,7 @@ describe Braintree::PaymentMethod do
1125
1177
  result = Braintree::PaymentMethod.create(
1126
1178
  :payment_method_nonce => Braintree::Test::Nonce::GooglePayMasterCard,
1127
1179
  :customer_id => customer.id,
1128
- :token => payment_method_token
1180
+ :token => payment_method_token,
1129
1181
  )
1130
1182
  result.should be_success
1131
1183
 
@@ -1155,7 +1207,7 @@ describe Braintree::PaymentMethod do
1155
1207
  result = Braintree::PaymentMethod.create(
1156
1208
  :payment_method_nonce => Braintree::Test::Nonce::AbstractTransactable,
1157
1209
  :customer_id => customer.id,
1158
- :token => payment_method_token
1210
+ :token => payment_method_token,
1159
1211
  )
1160
1212
  result.should be_success
1161
1213
 
@@ -1181,7 +1233,7 @@ describe Braintree::PaymentMethod do
1181
1233
 
1182
1234
  create_result = Braintree::PaymentMethod.create(
1183
1235
  :payment_method_nonce => Braintree::Test::Nonce::GooglePayDiscover,
1184
- :customer_id => customer.id
1236
+ :customer_id => customer.id,
1185
1237
  )
1186
1238
 
1187
1239
  token = create_result.payment_method.token
@@ -1202,7 +1254,7 @@ describe Braintree::PaymentMethod do
1202
1254
 
1203
1255
  create_result = Braintree::PaymentMethod.create(
1204
1256
  :payment_method_nonce => Braintree::Test::Nonce::ApplePayAmEx,
1205
- :customer_id => customer.id
1257
+ :customer_id => customer.id,
1206
1258
  )
1207
1259
  token = create_result.payment_method.token
1208
1260
 
@@ -1223,11 +1275,11 @@ describe Braintree::PaymentMethod do
1223
1275
 
1224
1276
  nonce = nonce_for_paypal_account(
1225
1277
  :consent_code => "PAYPAL_CONSENT_CODE",
1226
- :token => paypal_account_token
1278
+ :token => paypal_account_token,
1227
1279
  )
1228
1280
  Braintree::PaymentMethod.create(
1229
1281
  :payment_method_nonce => nonce,
1230
- :customer_id => customer.id
1282
+ :customer_id => customer.id,
1231
1283
  )
1232
1284
 
1233
1285
  paypal_account = Braintree::PaymentMethod.find(paypal_account_token)
@@ -1256,7 +1308,7 @@ describe Braintree::PaymentMethod do
1256
1308
 
1257
1309
  Braintree::PaymentMethod.create(
1258
1310
  :payment_method_nonce => nonce,
1259
- :customer_id => customer.id
1311
+ :customer_id => customer.id,
1260
1312
  )
1261
1313
 
1262
1314
  result = Braintree::PaymentMethod.delete(token)
@@ -1293,14 +1345,14 @@ describe Braintree::PaymentMethod do
1293
1345
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1294
1346
  :expiration_date => "06/2013",
1295
1347
  :three_d_secure_pass_thru => {
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',
1348
+ :eci_flag => "02",
1349
+ :cavv => "some_cavv",
1350
+ :xid => "some_xid",
1351
+ :three_d_secure_version => "xx",
1352
+ :authentication_response => "Y",
1353
+ :directory_response => "Y",
1354
+ :cavv_algorithm => "2",
1355
+ :ds_transaction_id => "some_ds_transaction_id",
1304
1356
  },
1305
1357
  :options => {:verify_card => true},
1306
1358
  )
@@ -1324,14 +1376,14 @@ describe Braintree::PaymentMethod do
1324
1376
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1325
1377
  :expiration_date => "06/2013",
1326
1378
  :three_d_secure_pass_thru => {
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',
1379
+ :eci_flag => "02",
1380
+ :cavv => "some_cavv",
1381
+ :xid => "some_xid",
1382
+ :three_d_secure_version => "1.0.2",
1383
+ :authentication_response => "Y",
1384
+ :directory_response => "Y",
1385
+ :cavv_algorithm => "2",
1386
+ :ds_transaction_id => "some_ds_transaction_id",
1335
1387
  },
1336
1388
  :options => {:verify_card => true},
1337
1389
  )
@@ -1351,13 +1403,13 @@ describe Braintree::PaymentMethod do
1351
1403
  :customer_id => customer.id,
1352
1404
  :cvv => "123",
1353
1405
  :number => Braintree::Test::CreditCardNumbers::Visa,
1354
- :expiration_date => "05/2012"
1406
+ :expiration_date => "05/2012",
1355
1407
  )
1356
1408
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1357
1409
  :cardholder_name => "New Holder",
1358
1410
  :cvv => "456",
1359
1411
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1360
- :expiration_date => "06/2013"
1412
+ :expiration_date => "06/2013",
1361
1413
  )
1362
1414
  update_result.success?.should == true
1363
1415
  update_result.payment_method.should == credit_card
@@ -1368,6 +1420,58 @@ describe Braintree::PaymentMethod do
1368
1420
  updated_credit_card.expiration_date.should == "06/2013"
1369
1421
  end
1370
1422
 
1423
+ it "includes risk data when skip_advanced_fraud_checking is false" do
1424
+ with_fraud_protection_enterprise_merchant do
1425
+ customer = Braintree::Customer.create!
1426
+ credit_card = Braintree::CreditCard.create!(
1427
+ :customer_id => customer.id,
1428
+ :cvv => "123",
1429
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1430
+ :expiration_date => "05/2012",
1431
+ )
1432
+ update_result = Braintree::PaymentMethod.update(
1433
+ credit_card.token,
1434
+ :cvv => "456",
1435
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
1436
+ :expiration_date => "06/2013",
1437
+ :options => {
1438
+ :verify_card => true,
1439
+ :skip_advanced_fraud_checking => false
1440
+ },
1441
+ )
1442
+
1443
+ expect(update_result).to be_success
1444
+ verification = update_result.payment_method.verification
1445
+ expect(verification.risk_data).not_to be_nil
1446
+ end
1447
+ end
1448
+
1449
+ it "does not include risk data when skip_advanced_fraud_checking is true" do
1450
+ with_fraud_protection_enterprise_merchant do
1451
+ customer = Braintree::Customer.create!
1452
+ credit_card = Braintree::CreditCard.create!(
1453
+ :customer_id => customer.id,
1454
+ :cvv => "123",
1455
+ :number => Braintree::Test::CreditCardNumbers::Visa,
1456
+ :expiration_date => "05/2012",
1457
+ )
1458
+ update_result = Braintree::PaymentMethod.update(
1459
+ credit_card.token,
1460
+ :cvv => "456",
1461
+ :number => Braintree::Test::CreditCardNumbers::MasterCard,
1462
+ :expiration_date => "06/2013",
1463
+ :options => {
1464
+ :verify_card => true,
1465
+ :skip_advanced_fraud_checking => true
1466
+ },
1467
+ )
1468
+
1469
+ expect(update_result).to be_success
1470
+ verification = update_result.payment_method.verification
1471
+ expect(verification.risk_data).to be_nil
1472
+ end
1473
+ end
1474
+
1371
1475
  context "verification_currency_iso_code" do
1372
1476
  it "validates verification_currency_iso_code and updates the credit card " do
1373
1477
  customer = Braintree::Customer.create!
@@ -1376,14 +1480,14 @@ describe Braintree::PaymentMethod do
1376
1480
  :customer_id => customer.id,
1377
1481
  :cvv => "123",
1378
1482
  :number => Braintree::Test::CreditCardNumbers::Visa,
1379
- :expiration_date => "05/2012"
1483
+ :expiration_date => "05/2012",
1380
1484
  )
1381
1485
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1382
1486
  :cardholder_name => "New Holder",
1383
1487
  :cvv => "456",
1384
1488
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1385
1489
  :expiration_date => "06/2013",
1386
- :options => {:verify_card => true, :verification_currency_iso_code => "USD"}
1490
+ :options => {:verify_card => true, :verification_currency_iso_code => "USD"},
1387
1491
  )
1388
1492
  update_result.success?.should == true
1389
1493
  update_result.payment_method.verification.currency_iso_code == "USD"
@@ -1396,14 +1500,14 @@ describe Braintree::PaymentMethod do
1396
1500
  :customer_id => customer.id,
1397
1501
  :cvv => "123",
1398
1502
  :number => Braintree::Test::CreditCardNumbers::Visa,
1399
- :expiration_date => "05/2012"
1503
+ :expiration_date => "05/2012",
1400
1504
  )
1401
1505
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1402
1506
  :cardholder_name => "New Holder",
1403
1507
  :cvv => "456",
1404
1508
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1405
1509
  :expiration_date => "06/2013",
1406
- :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"}
1510
+ :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "USD"},
1407
1511
  )
1408
1512
  update_result.success?.should == true
1409
1513
  update_result.payment_method.verification.currency_iso_code == "USD"
@@ -1417,14 +1521,14 @@ describe Braintree::PaymentMethod do
1417
1521
  :customer_id => customer.id,
1418
1522
  :cvv => "123",
1419
1523
  :number => Braintree::Test::CreditCardNumbers::Visa,
1420
- :expiration_date => "05/2012"
1524
+ :expiration_date => "05/2012",
1421
1525
  )
1422
1526
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1423
1527
  :cardholder_name => "New Holder",
1424
1528
  :cvv => "456",
1425
1529
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1426
1530
  :expiration_date => "06/2013",
1427
- :options => {:verify_card => true, :verification_currency_iso_code => "GBP"}
1531
+ :options => {:verify_card => true, :verification_currency_iso_code => "GBP"},
1428
1532
  )
1429
1533
  expect(update_result).to_not be_success
1430
1534
  update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
@@ -1437,14 +1541,14 @@ describe Braintree::PaymentMethod do
1437
1541
  :customer_id => customer.id,
1438
1542
  :cvv => "123",
1439
1543
  :number => Braintree::Test::CreditCardNumbers::Visa,
1440
- :expiration_date => "05/2012"
1544
+ :expiration_date => "05/2012",
1441
1545
  )
1442
1546
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1443
1547
  :cardholder_name => "New Holder",
1444
1548
  :cvv => "456",
1445
1549
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1446
1550
  :expiration_date => "06/2013",
1447
- :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"}
1551
+ :options => {:verify_card => true, :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId, :verification_currency_iso_code => "GBP"},
1448
1552
  )
1449
1553
  expect(update_result).to_not be_success
1450
1554
  update_result.errors.for(:credit_card).for(:options).on(:verification_currency_iso_code)[0].code.should == Braintree::ErrorCodes::CreditCard::CurrencyCodeNotSupportedByMerchantAccount
@@ -1461,12 +1565,12 @@ describe Braintree::PaymentMethod do
1461
1565
  :expiration_date => "05/2012",
1462
1566
  :billing_address => {
1463
1567
  :street_address => "123 Nigeria Ave"
1464
- }
1568
+ },
1465
1569
  )
1466
1570
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1467
1571
  :billing_address => {
1468
1572
  :region => "IL"
1469
- }
1573
+ },
1470
1574
  )
1471
1575
  update_result.success?.should == true
1472
1576
  updated_credit_card = update_result.payment_method
@@ -1483,13 +1587,13 @@ describe Braintree::PaymentMethod do
1483
1587
  :expiration_date => "05/2012",
1484
1588
  :billing_address => {
1485
1589
  :street_address => "123 Nigeria Ave"
1486
- }
1590
+ },
1487
1591
  )
1488
1592
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1489
1593
  :billing_address => {
1490
1594
  :region => "IL",
1491
1595
  :options => {:update_existing => true}
1492
- }
1596
+ },
1493
1597
  )
1494
1598
  update_result.success?.should == true
1495
1599
  updated_credit_card = update_result.payment_method
@@ -1506,7 +1610,7 @@ describe Braintree::PaymentMethod do
1506
1610
  :expiration_date => "05/2012",
1507
1611
  :billing_address => {
1508
1612
  :street_address => "123 Nigeria Ave"
1509
- }
1613
+ },
1510
1614
  )
1511
1615
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1512
1616
  :billing_address => {
@@ -1515,7 +1619,7 @@ describe Braintree::PaymentMethod do
1515
1619
  :country_code_alpha3 => "ASM",
1516
1620
  :country_code_numeric => "016",
1517
1621
  :options => {:update_existing => true}
1518
- }
1622
+ },
1519
1623
  )
1520
1624
  update_result.success?.should == true
1521
1625
  updated_credit_card = update_result.payment_method
@@ -1531,12 +1635,12 @@ describe Braintree::PaymentMethod do
1531
1635
  credit_card = Braintree::CreditCard.create!(
1532
1636
  :customer_id => customer.id,
1533
1637
  :number => Braintree::Test::CreditCardNumbers::Visa,
1534
- :expiration_date => "05/2012"
1638
+ :expiration_date => "05/2012",
1535
1639
  )
1536
1640
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1537
1641
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1538
1642
  :expiration_month => "07",
1539
- :expiration_year => "2011"
1643
+ :expiration_year => "2011",
1540
1644
  )
1541
1645
  update_result.success?.should == true
1542
1646
  update_result.payment_method.should == credit_card
@@ -1552,14 +1656,14 @@ describe Braintree::PaymentMethod do
1552
1656
  :customer_id => customer.id,
1553
1657
  :cvv => "123",
1554
1658
  :number => Braintree::Test::CreditCardNumbers::Visa,
1555
- :expiration_date => "05/2012"
1659
+ :expiration_date => "05/2012",
1556
1660
  )
1557
1661
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1558
1662
  :cardholder_name => "New Holder",
1559
1663
  :cvv => "456",
1560
1664
  :number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
1561
1665
  :expiration_date => "06/2013",
1562
- :options => {:verify_card => true}
1666
+ :options => {:verify_card => true},
1563
1667
  )
1564
1668
  update_result.success?.should == false
1565
1669
  update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
@@ -1573,11 +1677,11 @@ describe Braintree::PaymentMethod do
1573
1677
  :customer_id => customer.id,
1574
1678
  :cvv => "123",
1575
1679
  :number => Braintree::Test::CreditCardNumbers::Visa,
1576
- :expiration_date => "05/2020"
1680
+ :expiration_date => "05/2020",
1577
1681
  )
1578
1682
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1579
1683
  :payment_method_nonce => Braintree::Test::Nonce::ProcessorDeclinedMasterCard,
1580
- :options => {:verify_card => true, :verification_amount => "2.34"}
1684
+ :options => {:verify_card => true, :verification_amount => "2.34"},
1581
1685
  )
1582
1686
  update_result.success?.should == false
1583
1687
  update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
@@ -1603,7 +1707,7 @@ describe Braintree::PaymentMethod do
1603
1707
  :region => "Old State",
1604
1708
  :postal_code => "12345",
1605
1709
  :country_name => "Canada"
1606
- }
1710
+ },
1607
1711
  )
1608
1712
  result = Braintree::PaymentMethod.update(credit_card.token,
1609
1713
  :options => {:verify_card => false},
@@ -1617,7 +1721,7 @@ describe Braintree::PaymentMethod do
1617
1721
  :region => "New State",
1618
1722
  :postal_code => "56789",
1619
1723
  :country_name => "United States of America"
1620
- }
1724
+ },
1621
1725
  )
1622
1726
  result.success?.should == true
1623
1727
  address = result.payment_method.billing_address
@@ -1638,12 +1742,12 @@ describe Braintree::PaymentMethod do
1638
1742
  :cardholder_name => "Original Holder",
1639
1743
  :customer_id => customer.id,
1640
1744
  :number => Braintree::Test::CreditCardNumbers::Visa,
1641
- :expiration_date => "05/2012"
1745
+ :expiration_date => "05/2012",
1642
1746
  )
1643
1747
  update_result = Braintree::PaymentMethod.update(credit_card.token,
1644
1748
  :cardholder_name => "New Holder",
1645
1749
  :number => "invalid",
1646
- :expiration_date => "05/2014"
1750
+ :expiration_date => "05/2014",
1647
1751
  )
1648
1752
  update_result.success?.should == false
1649
1753
  update_result.errors.for(:credit_card).on(:number)[0].message.should == "Credit card number must be 12-19 digits."
@@ -1654,12 +1758,12 @@ describe Braintree::PaymentMethod do
1654
1758
  card1 = Braintree::CreditCard.create(
1655
1759
  :customer_id => customer.id,
1656
1760
  :number => Braintree::Test::CreditCardNumbers::Visa,
1657
- :expiration_date => "05/2009"
1761
+ :expiration_date => "05/2009",
1658
1762
  ).credit_card
1659
1763
  card2 = Braintree::CreditCard.create(
1660
1764
  :customer_id => customer.id,
1661
1765
  :number => Braintree::Test::CreditCardNumbers::Visa,
1662
- :expiration_date => "05/2009"
1766
+ :expiration_date => "05/2009",
1663
1767
  ).credit_card
1664
1768
 
1665
1769
  card1.should be_default
@@ -1678,17 +1782,17 @@ describe Braintree::PaymentMethod do
1678
1782
  original_token = random_payment_method_token
1679
1783
  nonce = nonce_for_paypal_account(
1680
1784
  :consent_code => "consent-code",
1681
- :token => original_token
1785
+ :token => original_token,
1682
1786
  )
1683
1787
  original_result = Braintree::PaymentMethod.create(
1684
1788
  :payment_method_nonce => nonce,
1685
- :customer_id => customer.id
1789
+ :customer_id => customer.id,
1686
1790
  )
1687
1791
 
1688
1792
  updated_token = make_token
1689
1793
  updated_result = Braintree::PaymentMethod.update(
1690
1794
  original_token,
1691
- :token => updated_token
1795
+ :token => updated_token,
1692
1796
  )
1693
1797
 
1694
1798
  updated_paypal_account = Braintree::PayPalAccount.find(updated_token)
@@ -1705,19 +1809,19 @@ describe Braintree::PaymentMethod do
1705
1809
  :customer_id => customer.id,
1706
1810
  :number => Braintree::Test::CreditCardNumbers::Visa,
1707
1811
  :expiration_date => "05/2009",
1708
- :options => {:make_default => true}
1812
+ :options => {:make_default => true},
1709
1813
  )
1710
1814
  result.should be_success
1711
1815
 
1712
1816
  nonce = nonce_for_paypal_account(:consent_code => "consent-code")
1713
1817
  original_token = Braintree::PaymentMethod.create(
1714
1818
  :payment_method_nonce => nonce,
1715
- :customer_id => customer.id
1819
+ :customer_id => customer.id,
1716
1820
  ).payment_method.token
1717
1821
 
1718
1822
  updated_result = Braintree::PaymentMethod.update(
1719
1823
  original_token,
1720
- :options => {:make_default => true}
1824
+ :options => {:make_default => true},
1721
1825
  )
1722
1826
 
1723
1827
  updated_paypal_account = Braintree::PayPalAccount.find(original_token)
@@ -1731,25 +1835,25 @@ describe Braintree::PaymentMethod do
1731
1835
 
1732
1836
  first_nonce = nonce_for_paypal_account(
1733
1837
  :consent_code => "consent-code",
1734
- :token => first_token
1838
+ :token => first_token,
1735
1839
  )
1736
1840
  first_result = Braintree::PaymentMethod.create(
1737
1841
  :payment_method_nonce => first_nonce,
1738
- :customer_id => customer.id
1842
+ :customer_id => customer.id,
1739
1843
  )
1740
1844
 
1741
1845
  second_nonce = nonce_for_paypal_account(
1742
1846
  :consent_code => "consent-code",
1743
- :token => second_token
1847
+ :token => second_token,
1744
1848
  )
1745
1849
  second_result = Braintree::PaymentMethod.create(
1746
1850
  :payment_method_nonce => second_nonce,
1747
- :customer_id => customer.id
1851
+ :customer_id => customer.id,
1748
1852
  )
1749
1853
 
1750
1854
  updated_result = Braintree::PaymentMethod.update(
1751
1855
  first_token,
1752
- :token => second_token
1856
+ :token => second_token,
1753
1857
  )
1754
1858
 
1755
1859
  updated_result.should_not be_success
@@ -1766,13 +1870,13 @@ describe Braintree::PaymentMethod do
1766
1870
  :customer_id => customer.id,
1767
1871
  :cvv => "123",
1768
1872
  :number => Braintree::Test::CreditCardNumbers::Visa,
1769
- :expiration_date => "05/2012"
1873
+ :expiration_date => "05/2012",
1770
1874
  )
1771
1875
  payment_method = Braintree::PaymentMethod.update!(credit_card.token,
1772
1876
  :cardholder_name => "New Holder",
1773
1877
  :cvv => "456",
1774
1878
  :number => Braintree::Test::CreditCardNumbers::MasterCard,
1775
- :expiration_date => "06/2013"
1879
+ :expiration_date => "06/2013",
1776
1880
  )
1777
1881
  payment_method.should == credit_card
1778
1882
  payment_method.cardholder_name.should == "New Holder"
@@ -1789,7 +1893,7 @@ describe Braintree::PaymentMethod do
1789
1893
  :public_key => "oauth_app_partner_user_public_key",
1790
1894
  :private_key => "oauth_app_partner_user_private_key",
1791
1895
  :environment => Braintree::Configuration.environment,
1792
- :logger => Logger.new("/dev/null")
1896
+ :logger => Logger.new("/dev/null"),
1793
1897
  )
1794
1898
  customer = @partner_merchant_gateway.customer.create(
1795
1899
  :first_name => "Joe",
@@ -1798,19 +1902,19 @@ describe Braintree::PaymentMethod do
1798
1902
  :email => "joe@example.com",
1799
1903
  :phone => "312.555.1234",
1800
1904
  :fax => "614.555.5678",
1801
- :website => "www.example.com"
1905
+ :website => "www.example.com",
1802
1906
  ).customer
1803
1907
  @credit_card = @partner_merchant_gateway.credit_card.create(
1804
1908
  :customer_id => customer.id,
1805
1909
  :cardholder_name => "Adam Davis",
1806
1910
  :number => Braintree::Test::CreditCardNumbers::Visa,
1807
- :expiration_date => "05/2009"
1911
+ :expiration_date => "05/2009",
1808
1912
  ).credit_card
1809
1913
 
1810
1914
  @oauth_gateway = Braintree::Gateway.new(
1811
1915
  :client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
1812
1916
  :client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
1813
- :logger => Logger.new("/dev/null")
1917
+ :logger => Logger.new("/dev/null"),
1814
1918
  )
1815
1919
  access_token = Braintree::OAuthTestHelper.create_token(@oauth_gateway, {
1816
1920
  :merchant_public_id => "integration_merchant_id",
@@ -1819,7 +1923,7 @@ describe Braintree::PaymentMethod do
1819
1923
 
1820
1924
  @granting_gateway = Braintree::Gateway.new(
1821
1925
  :access_token => access_token,
1822
- :logger => Logger.new("/dev/null")
1926
+ :logger => Logger.new("/dev/null"),
1823
1927
  )
1824
1928
  end
1825
1929
 
@@ -1835,13 +1939,13 @@ describe Braintree::PaymentMethod do
1835
1939
 
1836
1940
  result = Braintree::Transaction.sale(
1837
1941
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1838
- :amount => Braintree::Test::TransactionAmounts::Authorize
1942
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
1839
1943
  )
1840
1944
  result.should be_success
1841
1945
 
1842
1946
  result2 = Braintree::Transaction.sale(
1843
1947
  :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1844
- :amount => Braintree::Test::TransactionAmounts::Authorize
1948
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
1845
1949
  )
1846
1950
  result2.should_not be_success
1847
1951
  end
@@ -1853,7 +1957,7 @@ describe Braintree::PaymentMethod do
1853
1957
 
1854
1958
  result = Braintree::PaymentMethod.create(
1855
1959
  :customer_id => customer_result.customer.id,
1856
- :payment_method_nonce => grant_result.payment_method_nonce.nonce
1960
+ :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1857
1961
  )
1858
1962
  result.should_not be_success
1859
1963
  end
@@ -1865,7 +1969,7 @@ describe Braintree::PaymentMethod do
1865
1969
 
1866
1970
  result = Braintree::PaymentMethod.create(
1867
1971
  :customer_id => customer_result.customer.id,
1868
- :payment_method_nonce => grant_result.payment_method_nonce.nonce
1972
+ :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1869
1973
  )
1870
1974
  result.should be_success
1871
1975
  end
@@ -1900,7 +2004,7 @@ describe Braintree::PaymentMethod do
1900
2004
 
1901
2005
  result = Braintree::PaymentMethod.create(
1902
2006
  :customer_id => customer_result.customer.id,
1903
- :payment_method_nonce => grant_result.payment_method_nonce.nonce
2007
+ :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1904
2008
  )
1905
2009
  result.should_not be_success
1906
2010
  end
@@ -1914,7 +2018,7 @@ describe Braintree::PaymentMethod do
1914
2018
 
1915
2019
  result = Braintree::PaymentMethod.create(
1916
2020
  :customer_id => customer_result.customer.id,
1917
- :payment_method_nonce => grant_result.payment_method_nonce.nonce
2021
+ :payment_method_nonce => grant_result.payment_method_nonce.nonce,
1918
2022
  )
1919
2023
  result.should_not be_success
1920
2024
  end