braintree 4.14.0 → 4.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/credit_card.rb +13 -0
  3. data/lib/braintree/credit_card_gateway.rb +15 -3
  4. data/lib/braintree/payment_method_gateway.rb +15 -3
  5. data/lib/braintree/test/nonce.rb +1 -0
  6. data/lib/braintree/test/venmo_sdk.rb +2 -0
  7. data/lib/braintree/transaction/credit_card_details.rb +3 -0
  8. data/lib/braintree/transaction/local_payment_details.rb +2 -0
  9. data/lib/braintree/transaction.rb +5 -4
  10. data/lib/braintree/transaction_gateway.rb +15 -3
  11. data/lib/braintree/transaction_search.rb +6 -5
  12. data/lib/braintree/version.rb +1 -1
  13. data/lib/braintree/webhook_notification.rb +1 -0
  14. data/lib/braintree/webhook_testing_gateway.rb +17 -0
  15. data/spec/integration/braintree/add_on_spec.rb +9 -9
  16. data/spec/integration/braintree/address_spec.rb +69 -69
  17. data/spec/integration/braintree/advanced_search_spec.rb +45 -45
  18. data/spec/integration/braintree/apple_pay_spec.rb +8 -8
  19. data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
  20. data/spec/integration/braintree/credit_card_spec.rb +223 -223
  21. data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
  22. data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
  23. data/spec/integration/braintree/customer_search_spec.rb +20 -20
  24. data/spec/integration/braintree/customer_spec.rb +313 -313
  25. data/spec/integration/braintree/disbursement_spec.rb +2 -2
  26. data/spec/integration/braintree/discount_spec.rb +9 -9
  27. data/spec/integration/braintree/dispute_spec.rb +87 -87
  28. data/spec/integration/braintree/document_upload_spec.rb +17 -17
  29. data/spec/integration/braintree/error_codes_spec.rb +2 -2
  30. data/spec/integration/braintree/http_spec.rb +28 -28
  31. data/spec/integration/braintree/merchant_account_spec.rb +127 -127
  32. data/spec/integration/braintree/merchant_spec.rb +103 -103
  33. data/spec/integration/braintree/oauth_spec.rb +61 -61
  34. data/spec/integration/braintree/payment_method_nonce_spec.rb +73 -73
  35. data/spec/integration/braintree/payment_method_spec.rb +389 -389
  36. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +78 -78
  37. data/spec/integration/braintree/paypal_account_spec.rb +38 -38
  38. data/spec/integration/braintree/plan_spec.rb +15 -15
  39. data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
  40. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
  41. data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
  42. data/spec/integration/braintree/subscription_spec.rb +364 -364
  43. data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
  44. data/spec/integration/braintree/test_transaction_spec.rb +19 -19
  45. data/spec/integration/braintree/transaction_line_item_spec.rb +6 -6
  46. data/spec/integration/braintree/transaction_search_spec.rb +198 -165
  47. data/spec/integration/braintree/transaction_spec.rb +1315 -1149
  48. data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
  49. data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
  50. data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
  51. data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
  52. data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
  53. data/spec/spec_helper.rb +9 -8
  54. data/spec/unit/braintree/address_spec.rb +8 -8
  55. data/spec/unit/braintree/base_module_spec.rb +4 -4
  56. data/spec/unit/braintree/client_token_spec.rb +2 -2
  57. data/spec/unit/braintree/configuration_spec.rb +57 -57
  58. data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
  59. data/spec/unit/braintree/credit_card_spec.rb +31 -29
  60. data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +28 -28
  61. data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
  62. data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
  63. data/spec/unit/braintree/customer_spec.rb +41 -40
  64. data/spec/unit/braintree/digest_spec.rb +5 -5
  65. data/spec/unit/braintree/disbursement_spec.rb +11 -11
  66. data/spec/unit/braintree/dispute_search_spec.rb +2 -2
  67. data/spec/unit/braintree/dispute_spec.rb +56 -56
  68. data/spec/unit/braintree/document_upload_spec.rb +8 -8
  69. data/spec/unit/braintree/enriched_customer_data_spec.rb +2 -2
  70. data/spec/unit/braintree/error_result_spec.rb +5 -5
  71. data/spec/unit/braintree/errors_spec.rb +9 -9
  72. data/spec/unit/braintree/http_spec.rb +8 -8
  73. data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
  74. data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
  75. data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
  76. data/spec/unit/braintree/merchant_account_spec.rb +4 -4
  77. data/spec/unit/braintree/modification_spec.rb +1 -1
  78. data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
  79. data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
  80. data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
  81. data/spec/unit/braintree/payment_method_spec.rb +19 -19
  82. data/spec/unit/braintree/paypal_account_spec.rb +4 -4
  83. data/spec/unit/braintree/resource_collection_spec.rb +7 -7
  84. data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
  85. data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
  86. data/spec/unit/braintree/signature_service_spec.rb +2 -2
  87. data/spec/unit/braintree/subscription_search_spec.rb +17 -17
  88. data/spec/unit/braintree/subscription_spec.rb +8 -8
  89. data/spec/unit/braintree/successful_result_spec.rb +5 -5
  90. data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
  91. data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
  92. data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
  93. data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
  94. data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
  95. data/spec/unit/braintree/transaction_gateway_spec.rb +9 -6
  96. data/spec/unit/braintree/transaction_search_spec.rb +2 -2
  97. data/spec/unit/braintree/transaction_spec.rb +101 -93
  98. data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
  99. data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
  100. data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
  101. data/spec/unit/braintree/us_bank_account_verification_spec.rb +7 -7
  102. data/spec/unit/braintree/util_spec.rb +27 -27
  103. data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
  104. data/spec/unit/braintree/validation_error_spec.rb +4 -4
  105. data/spec/unit/braintree/venmo_profile_data_spec.rb +5 -5
  106. data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
  107. data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
  108. data/spec/unit/braintree/xml/parser_spec.rb +8 -8
  109. data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
  110. data/spec/unit/braintree/xml_spec.rb +17 -17
  111. data/spec/unit/braintree_spec.rb +2 -2
  112. metadata +3 -2
@@ -84,8 +84,8 @@ describe Braintree::MerchantAccount do
84
84
  )
85
85
 
86
86
  result = gateway.merchant_account.all
87
- result.should be_success
88
- result.merchant_accounts.count.should > 20
87
+ expect(result).to be_success
88
+ expect(result.merchant_accounts.count).to be > 20
89
89
  end
90
90
 
91
91
  it "returns merchant account with correct attributes" do
@@ -107,11 +107,11 @@ describe Braintree::MerchantAccount do
107
107
  )
108
108
 
109
109
  result = gateway.merchant_account.all
110
- result.should be_success
111
- result.merchant_accounts.count.should == 1
112
- result.merchant_accounts.first.currency_iso_code.should == "USD"
113
- result.merchant_accounts.first.status.should == "active"
114
- result.merchant_accounts.first.default.should == true
110
+ expect(result).to be_success
111
+ expect(result.merchant_accounts.count).to eq(1)
112
+ expect(result.merchant_accounts.first.currency_iso_code).to eq("USD")
113
+ expect(result.merchant_accounts.first.status).to eq("active")
114
+ expect(result.merchant_accounts.first.default).to eq(true)
115
115
  end
116
116
 
117
117
  it "returns all merchant accounts for read_only scoped grants" do
@@ -137,8 +137,8 @@ describe Braintree::MerchantAccount do
137
137
  )
138
138
 
139
139
  result = gateway.merchant_account.all
140
- result.should be_success
141
- result.merchant_accounts.count.should > 20
140
+ expect(result).to be_success
141
+ expect(result.merchant_accounts.count).to be > 20
142
142
  end
143
143
  end
144
144
 
@@ -146,17 +146,17 @@ describe Braintree::MerchantAccount do
146
146
  it "accepts the deprecated parameters" do
147
147
  result = Braintree::MerchantAccount.create(DEPRECATED_APPLICATION_PARAMS)
148
148
 
149
- result.should be_success
150
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
151
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
149
+ expect(result).to be_success
150
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
151
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
152
152
  end
153
153
 
154
154
  it "creates a merchant account with the new parameters and doesn't require an id" do
155
155
  result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
156
156
 
157
- result.should be_success
158
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
159
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
157
+ expect(result).to be_success
158
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
159
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
160
160
  end
161
161
 
162
162
  it "allows an id to be passed" do
@@ -168,24 +168,24 @@ describe Braintree::MerchantAccount do
168
168
  ),
169
169
  )
170
170
 
171
- result.should be_success
172
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
173
- result.merchant_account.id.should == sub_merchant_account_id
174
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
171
+ expect(result).to be_success
172
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
173
+ expect(result.merchant_account.id).to eq(sub_merchant_account_id)
174
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
175
175
  end
176
176
 
177
177
  it "handles unsuccessful results" do
178
178
  result = Braintree::MerchantAccount.create({})
179
- result.should_not be_success
180
- result.errors.for(:merchant_account).on(:master_merchant_account_id).first.code.should == Braintree::ErrorCodes::MerchantAccount::MasterMerchantAccountIdIsRequired
179
+ expect(result).not_to be_success
180
+ expect(result.errors.for(:merchant_account).on(:master_merchant_account_id).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::MasterMerchantAccountIdIsRequired)
181
181
  end
182
182
 
183
183
  it "requires all fields" do
184
184
  result = Braintree::MerchantAccount.create(
185
185
  :master_merchant_account_id => "sandbox_master_merchant_account",
186
186
  )
187
- result.should_not be_success
188
- result.errors.for(:merchant_account).on(:tos_accepted).first.code.should == Braintree::ErrorCodes::MerchantAccount::TosAcceptedIsRequired
187
+ expect(result).not_to be_success
188
+ expect(result.errors.for(:merchant_account).on(:tos_accepted).first.code).to eq(Braintree::ErrorCodes::MerchantAccount::TosAcceptedIsRequired)
189
189
  end
190
190
 
191
191
  context "funding destination" do
@@ -194,7 +194,7 @@ describe Braintree::MerchantAccount do
194
194
  params[:funding][:destination] = ::Braintree::MerchantAccount::FundingDestination::Bank
195
195
  result = Braintree::MerchantAccount.create(params)
196
196
 
197
- result.should be_success
197
+ expect(result).to be_success
198
198
  end
199
199
 
200
200
  it "accepts an email" do
@@ -203,7 +203,7 @@ describe Braintree::MerchantAccount do
203
203
  params[:funding][:email] = "joebloggs@compuserve.com"
204
204
  result = Braintree::MerchantAccount.create(params)
205
205
 
206
- result.should be_success
206
+ expect(result).to be_success
207
207
  end
208
208
 
209
209
  it "accepts a mobile_phone" do
@@ -212,7 +212,7 @@ describe Braintree::MerchantAccount do
212
212
  params[:funding][:mobile_phone] = "3125882300"
213
213
  result = Braintree::MerchantAccount.create(params)
214
214
 
215
- result.should be_success
215
+ expect(result).to be_success
216
216
  end
217
217
  end
218
218
  end
@@ -221,15 +221,15 @@ describe Braintree::MerchantAccount do
221
221
  it "creates a merchant account with the new parameters and doesn't require an id" do
222
222
  merchant_account = Braintree::MerchantAccount.create!(VALID_APPLICATION_PARAMS)
223
223
 
224
- merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
225
- merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
224
+ expect(merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
225
+ expect(merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
226
226
  end
227
227
  end
228
228
 
229
229
  describe "create_for_currency" do
230
230
  it "creates a new merchant account for currency" do
231
231
  result = SpecHelper::create_merchant
232
- result.should be_success
232
+ expect(result).to be_success
233
233
 
234
234
  gateway = Braintree::Gateway.new(
235
235
  :access_token => result.credentials.access_token,
@@ -239,13 +239,13 @@ describe Braintree::MerchantAccount do
239
239
  result = gateway.merchant_account.create_for_currency(
240
240
  :currency => "JPY",
241
241
  )
242
- result.should be_success
243
- result.merchant_account.currency_iso_code.should == "JPY"
242
+ expect(result).to be_success
243
+ expect(result.merchant_account.currency_iso_code).to eq("JPY")
244
244
  end
245
245
 
246
246
  it "returns error if a merchant account already exists for that currency" do
247
247
  result = SpecHelper::create_merchant
248
- result.should be_success
248
+ expect(result).to be_success
249
249
 
250
250
  gateway = Braintree::Gateway.new(
251
251
  :access_token => result.credentials.access_token,
@@ -255,20 +255,20 @@ describe Braintree::MerchantAccount do
255
255
  result = gateway.merchant_account.create_for_currency(
256
256
  :currency => "USD",
257
257
  )
258
- result.should be_success
258
+ expect(result).to be_success
259
259
 
260
260
  result = gateway.merchant_account.create_for_currency(
261
261
  :currency => "USD",
262
262
  )
263
- result.should_not be_success
263
+ expect(result).not_to be_success
264
264
 
265
265
  errors = result.errors.for(:merchant).on(:currency)
266
- errors[0].code.should == Braintree::ErrorCodes::Merchant::MerchantAccountExistsForCurrency
266
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::MerchantAccountExistsForCurrency)
267
267
  end
268
268
 
269
269
  it "returns error if no currency is provided" do
270
270
  result = SpecHelper::create_merchant
271
- result.should be_success
271
+ expect(result).to be_success
272
272
 
273
273
  gateway = Braintree::Gateway.new(
274
274
  :access_token => result.credentials.access_token,
@@ -278,21 +278,21 @@ describe Braintree::MerchantAccount do
278
278
  result = gateway.merchant_account.create_for_currency(
279
279
  :currency => nil,
280
280
  )
281
- result.should_not be_success
281
+ expect(result).not_to be_success
282
282
 
283
283
  errors = result.errors.for(:merchant).on(:currency)
284
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsRequired
284
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsRequired)
285
285
 
286
286
  result = gateway.merchant_account.create_for_currency({})
287
- result.should_not be_success
287
+ expect(result).not_to be_success
288
288
 
289
289
  errors = result.errors.for(:merchant).on(:currency)
290
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsRequired
290
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsRequired)
291
291
  end
292
292
 
293
293
  it "returns error if a currency is not supported" do
294
294
  result = SpecHelper::create_merchant
295
- result.should be_success
295
+ expect(result).to be_success
296
296
 
297
297
  gateway = Braintree::Gateway.new(
298
298
  :access_token => result.credentials.access_token,
@@ -302,15 +302,15 @@ describe Braintree::MerchantAccount do
302
302
  result = gateway.merchant_account.create_for_currency(
303
303
  :currency => "FAKE_CURRENCY",
304
304
  )
305
- result.should_not be_success
305
+ expect(result).not_to be_success
306
306
 
307
307
  errors = result.errors.for(:merchant).on(:currency)
308
- errors[0].code.should == Braintree::ErrorCodes::Merchant::CurrencyIsInvalid
308
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrencyIsInvalid)
309
309
  end
310
310
 
311
311
  it "returns error if id is passed and already taken" do
312
312
  result = SpecHelper::create_merchant
313
- result.should be_success
313
+ expect(result).to be_success
314
314
 
315
315
  gateway = Braintree::Gateway.new(
316
316
  :access_token => result.credentials.access_token,
@@ -322,30 +322,30 @@ describe Braintree::MerchantAccount do
322
322
  :currency => "USD",
323
323
  :id => merchant.merchant_accounts.first.id,
324
324
  )
325
- result.should_not be_success
325
+ expect(result).not_to be_success
326
326
 
327
327
  errors = result.errors.for(:merchant).on(:id)
328
- errors[0].code.should == Braintree::ErrorCodes::Merchant::MerchantAccountExistsForId
328
+ expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::MerchantAccountExistsForId)
329
329
  end
330
330
  end
331
331
 
332
332
  describe "find" do
333
333
  it "finds the merchant account with the given token" do
334
334
  result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
335
- result.should be_success
336
- result.merchant_account.status.should == Braintree::MerchantAccount::Status::Pending
335
+ expect(result).to be_success
336
+ expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
337
337
 
338
338
  id = result.merchant_account.id
339
339
  merchant_account = Braintree::MerchantAccount.find(id)
340
340
 
341
- merchant_account.individual_details.first_name.should == VALID_APPLICATION_PARAMS[:individual][:first_name]
342
- merchant_account.individual_details.last_name.should == VALID_APPLICATION_PARAMS[:individual][:last_name]
341
+ expect(merchant_account.individual_details.first_name).to eq(VALID_APPLICATION_PARAMS[:individual][:first_name])
342
+ expect(merchant_account.individual_details.last_name).to eq(VALID_APPLICATION_PARAMS[:individual][:last_name])
343
343
  end
344
344
 
345
345
  it "retrieves the currency iso code for an existing master merchant account" do
346
346
  merchant_account = Braintree::MerchantAccount.find("sandbox_master_merchant_account")
347
347
 
348
- merchant_account.currency_iso_code.should == "USD"
348
+ expect(merchant_account.currency_iso_code).to eq("USD")
349
349
  end
350
350
 
351
351
  it "raises a NotFoundError exception if merchant account cannot be found" do
@@ -382,37 +382,37 @@ describe Braintree::MerchantAccount do
382
382
  params[:funding][:mobile_phone] = "1234567890"
383
383
  params[:funding][:destination] = Braintree::MerchantAccount::FundingDestination::MobilePhone
384
384
  result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", params)
385
- result.should be_success
386
- result.merchant_account.status.should == "active"
387
- result.merchant_account.id.should == "sandbox_sub_merchant_account"
388
- result.merchant_account.master_merchant_account.id.should == "sandbox_master_merchant_account"
389
- result.merchant_account.individual_details.first_name.should == "John"
390
- result.merchant_account.individual_details.last_name.should == "Doe"
391
- result.merchant_account.individual_details.email.should == "john.doe@example.com"
392
- result.merchant_account.individual_details.date_of_birth.should == "1970-01-01"
393
- result.merchant_account.individual_details.phone.should == "3125551234"
394
- result.merchant_account.individual_details.address_details.street_address.should == "123 Fake St"
395
- result.merchant_account.individual_details.address_details.locality.should == "Chicago"
396
- result.merchant_account.individual_details.address_details.region.should == "IL"
397
- result.merchant_account.individual_details.address_details.postal_code.should == "60622"
398
- result.merchant_account.business_details.dba_name.should == "James's Bloggs"
399
- result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc"
400
- result.merchant_account.business_details.tax_id.should == "423456789"
401
- result.merchant_account.business_details.address_details.street_address.should == "999 Fake St"
402
- result.merchant_account.business_details.address_details.locality.should == "Miami"
403
- result.merchant_account.business_details.address_details.region.should == "FL"
404
- result.merchant_account.business_details.address_details.postal_code.should == "99999"
405
- result.merchant_account.funding_details.account_number_last_4.should == "8798"
406
- result.merchant_account.funding_details.routing_number.should == "071000013"
407
- result.merchant_account.funding_details.email.should == "check@this.com"
408
- result.merchant_account.funding_details.mobile_phone.should == "1234567890"
409
- result.merchant_account.funding_details.destination.should == Braintree::MerchantAccount::FundingDestination::MobilePhone
410
- result.merchant_account.funding_details.descriptor.should == "Joes Bloggs MI"
385
+ expect(result).to be_success
386
+ expect(result.merchant_account.status).to eq("active")
387
+ expect(result.merchant_account.id).to eq("sandbox_sub_merchant_account")
388
+ expect(result.merchant_account.master_merchant_account.id).to eq("sandbox_master_merchant_account")
389
+ expect(result.merchant_account.individual_details.first_name).to eq("John")
390
+ expect(result.merchant_account.individual_details.last_name).to eq("Doe")
391
+ expect(result.merchant_account.individual_details.email).to eq("john.doe@example.com")
392
+ expect(result.merchant_account.individual_details.date_of_birth).to eq("1970-01-01")
393
+ expect(result.merchant_account.individual_details.phone).to eq("3125551234")
394
+ expect(result.merchant_account.individual_details.address_details.street_address).to eq("123 Fake St")
395
+ expect(result.merchant_account.individual_details.address_details.locality).to eq("Chicago")
396
+ expect(result.merchant_account.individual_details.address_details.region).to eq("IL")
397
+ expect(result.merchant_account.individual_details.address_details.postal_code).to eq("60622")
398
+ expect(result.merchant_account.business_details.dba_name).to eq("James's Bloggs")
399
+ expect(result.merchant_account.business_details.legal_name).to eq("James's Bloggs Inc")
400
+ expect(result.merchant_account.business_details.tax_id).to eq("423456789")
401
+ expect(result.merchant_account.business_details.address_details.street_address).to eq("999 Fake St")
402
+ expect(result.merchant_account.business_details.address_details.locality).to eq("Miami")
403
+ expect(result.merchant_account.business_details.address_details.region).to eq("FL")
404
+ expect(result.merchant_account.business_details.address_details.postal_code).to eq("99999")
405
+ expect(result.merchant_account.funding_details.account_number_last_4).to eq("8798")
406
+ expect(result.merchant_account.funding_details.routing_number).to eq("071000013")
407
+ expect(result.merchant_account.funding_details.email).to eq("check@this.com")
408
+ expect(result.merchant_account.funding_details.mobile_phone).to eq("1234567890")
409
+ expect(result.merchant_account.funding_details.destination).to eq(Braintree::MerchantAccount::FundingDestination::MobilePhone)
410
+ expect(result.merchant_account.funding_details.descriptor).to eq("Joes Bloggs MI")
411
411
  end
412
412
 
413
413
  it "does not require all fields" do
414
414
  result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", {:individual => {:first_name => "Jose"}})
415
- result.should be_success
415
+ expect(result).to be_success
416
416
  end
417
417
 
418
418
  it "handles validation errors for blank fields" do
@@ -445,17 +445,17 @@ describe Braintree::MerchantAccount do
445
445
  }
446
446
  )
447
447
 
448
- result.should_not be_success
449
- result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsRequired]
450
- result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsRequired]
451
- result.errors.for(:merchant_account).for(:individual).on(:date_of_birth).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::DateOfBirthIsRequired]
452
- result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsRequired]
453
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsRequired]
454
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsRequired]
455
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:locality).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::LocalityIsRequired]
456
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsRequired]
457
- result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsRequired]
458
- result.errors.for(:merchant_account).on(:base).should be_empty
448
+ expect(result).not_to be_success
449
+ expect(result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsRequired])
450
+ expect(result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsRequired])
451
+ expect(result.errors.for(:merchant_account).for(:individual).on(:date_of_birth).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::DateOfBirthIsRequired])
452
+ expect(result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsRequired])
453
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsRequired])
454
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsRequired])
455
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:locality).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::LocalityIsRequired])
456
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsRequired])
457
+ expect(result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsRequired])
458
+ expect(result.errors.for(:merchant_account).on(:base)).to be_empty
459
459
  end
460
460
 
461
461
  it "handles validation errors for invalid fields" do
@@ -494,30 +494,30 @@ describe Braintree::MerchantAccount do
494
494
  }
495
495
  )
496
496
 
497
- result.should_not be_success
498
- result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsInvalid]
499
- result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsInvalid]
500
- result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsInvalid]
501
- result.errors.for(:merchant_account).for(:individual).on(:phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::PhoneIsInvalid]
502
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsInvalid]
503
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsInvalid]
504
- result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsInvalid]
505
- result.errors.for(:merchant_account).for(:individual).on(:ssn).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Individual::SsnIsInvalid]
506
-
507
- result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsInvalid]
508
- result.errors.for(:merchant_account).for(:business).on(:dba_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::DbaNameIsInvalid]
509
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsInvalid]
510
- result.errors.for(:merchant_account).for(:business).for(:address).on(:street_address).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::StreetAddressIsInvalid]
511
- result.errors.for(:merchant_account).for(:business).for(:address).on(:postal_code).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::PostalCodeIsInvalid]
512
- result.errors.for(:merchant_account).for(:business).for(:address).on(:region).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::Address::RegionIsInvalid]
513
-
514
- result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsInvalid]
515
- result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsInvalid]
516
- result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsInvalid]
517
- result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsInvalid]
518
- result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsInvalid]
519
-
520
- result.errors.for(:merchant_account).on(:base).should be_empty
497
+ expect(result).not_to be_success
498
+ expect(result.errors.for(:merchant_account).for(:individual).on(:first_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::FirstNameIsInvalid])
499
+ expect(result.errors.for(:merchant_account).for(:individual).on(:last_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::LastNameIsInvalid])
500
+ expect(result.errors.for(:merchant_account).for(:individual).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::EmailIsInvalid])
501
+ expect(result.errors.for(:merchant_account).for(:individual).on(:phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::PhoneIsInvalid])
502
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::StreetAddressIsInvalid])
503
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::PostalCodeIsInvalid])
504
+ expect(result.errors.for(:merchant_account).for(:individual).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::Address::RegionIsInvalid])
505
+ expect(result.errors.for(:merchant_account).for(:individual).on(:ssn).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Individual::SsnIsInvalid])
506
+
507
+ expect(result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsInvalid])
508
+ expect(result.errors.for(:merchant_account).for(:business).on(:dba_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::DbaNameIsInvalid])
509
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsInvalid])
510
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:street_address).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::StreetAddressIsInvalid])
511
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:postal_code).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::PostalCodeIsInvalid])
512
+ expect(result.errors.for(:merchant_account).for(:business).for(:address).on(:region).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::Address::RegionIsInvalid])
513
+
514
+ expect(result.errors.for(:merchant_account).for(:funding).on(:destination).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::DestinationIsInvalid])
515
+ expect(result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsInvalid])
516
+ expect(result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsInvalid])
517
+ expect(result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsInvalid])
518
+ expect(result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsInvalid])
519
+
520
+ expect(result.errors.for(:merchant_account).on(:base)).to be_empty
521
521
  end
522
522
 
523
523
  it "handles validation errors for business fields" do
@@ -530,9 +530,9 @@ describe Braintree::MerchantAccount do
530
530
  }
531
531
  )
532
532
 
533
- result.should_not be_success
534
- result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsRequiredWithTaxId]
535
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdMustBeBlank]
533
+ expect(result).not_to be_success
534
+ expect(result.errors.for(:merchant_account).for(:business).on(:legal_name).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::LegalNameIsRequiredWithTaxId])
535
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdMustBeBlank])
536
536
 
537
537
  result = Braintree::MerchantAccount.update(
538
538
  "sandbox_sub_merchant_account", {
@@ -543,8 +543,8 @@ describe Braintree::MerchantAccount do
543
543
  }
544
544
  )
545
545
 
546
- result.should_not be_success
547
- result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsRequiredWithLegalName]
546
+ expect(result).not_to be_success
547
+ expect(result.errors.for(:merchant_account).for(:business).on(:tax_id).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Business::TaxIdIsRequiredWithLegalName])
548
548
  end
549
549
 
550
550
  it "handles validation errors for funding fields" do
@@ -558,9 +558,9 @@ describe Braintree::MerchantAccount do
558
558
  }
559
559
  )
560
560
 
561
- result.should_not be_success
562
- result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsRequired]
563
- result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsRequired]
561
+ expect(result).not_to be_success
562
+ expect(result.errors.for(:merchant_account).for(:funding).on(:routing_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::RoutingNumberIsRequired])
563
+ expect(result.errors.for(:merchant_account).for(:funding).on(:account_number).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::AccountNumberIsRequired])
564
564
 
565
565
  result = Braintree::MerchantAccount.update(
566
566
  "sandbox_sub_merchant_account", {
@@ -571,8 +571,8 @@ describe Braintree::MerchantAccount do
571
571
  }
572
572
  )
573
573
 
574
- result.should_not be_success
575
- result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsRequired]
574
+ expect(result).not_to be_success
575
+ expect(result.errors.for(:merchant_account).for(:funding).on(:email).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::EmailIsRequired])
576
576
 
577
577
  result = Braintree::MerchantAccount.update(
578
578
  "sandbox_sub_merchant_account", {
@@ -583,8 +583,8 @@ describe Braintree::MerchantAccount do
583
583
  }
584
584
  )
585
585
 
586
- result.should_not be_success
587
- result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code).should == [Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsRequired]
586
+ expect(result).not_to be_success
587
+ expect(result.errors.for(:merchant_account).for(:funding).on(:mobile_phone).map(&:code)).to eq([Braintree::ErrorCodes::MerchantAccount::Funding::MobilePhoneIsRequired])
588
588
  end
589
589
  end
590
590
 
@@ -596,8 +596,8 @@ describe Braintree::MerchantAccount do
596
596
  params[:individual][:first_name] = "John"
597
597
  params[:individual][:last_name] = "Doe"
598
598
  merchant_account = Braintree::MerchantAccount.update!("sandbox_sub_merchant_account", params)
599
- merchant_account.individual_details.first_name.should == "John"
600
- merchant_account.individual_details.last_name.should == "Doe"
599
+ expect(merchant_account.individual_details.first_name).to eq("John")
600
+ expect(merchant_account.individual_details.last_name).to eq("Doe")
601
601
  end
602
602
  end
603
603
  end