braintree 4.26.0 → 4.27.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.
@@ -142,90 +142,6 @@ describe Braintree::MerchantAccount do
142
142
  end
143
143
  end
144
144
 
145
- describe "create" do
146
- it "accepts the deprecated parameters" do
147
- result = Braintree::MerchantAccount.create(DEPRECATED_APPLICATION_PARAMS)
148
-
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
- end
153
-
154
- it "creates a merchant account with the new parameters and doesn't require an id" do
155
- result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
156
-
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
- end
161
-
162
- it "allows an id to be passed" do
163
- random_number = rand(10000)
164
- sub_merchant_account_id = "sub_merchant_account_id#{random_number}"
165
- result = Braintree::MerchantAccount.create(
166
- VALID_APPLICATION_PARAMS.merge(
167
- :id => sub_merchant_account_id,
168
- ),
169
- )
170
-
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
- end
176
-
177
- it "handles unsuccessful results" do
178
- result = Braintree::MerchantAccount.create({})
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
- end
182
-
183
- it "requires all fields" do
184
- result = Braintree::MerchantAccount.create(
185
- :master_merchant_account_id => "sandbox_master_merchant_account",
186
- )
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
- end
190
-
191
- context "funding destination" do
192
- it "accepts a bank" do
193
- params = VALID_APPLICATION_PARAMS.dup
194
- params[:funding][:destination] = ::Braintree::MerchantAccount::FundingDestination::Bank
195
- result = Braintree::MerchantAccount.create(params)
196
-
197
- expect(result).to be_success
198
- end
199
-
200
- it "accepts an email" do
201
- params = VALID_APPLICATION_PARAMS.dup
202
- params[:funding][:destination] = ::Braintree::MerchantAccount::FundingDestination::Email
203
- params[:funding][:email] = "joebloggs@compuserve.com"
204
- result = Braintree::MerchantAccount.create(params)
205
-
206
- expect(result).to be_success
207
- end
208
-
209
- it "accepts a mobile_phone" do
210
- params = VALID_APPLICATION_PARAMS.dup
211
- params[:funding][:destination] = ::Braintree::MerchantAccount::FundingDestination::MobilePhone
212
- params[:funding][:mobile_phone] = "3125882300"
213
- result = Braintree::MerchantAccount.create(params)
214
-
215
- expect(result).to be_success
216
- end
217
- end
218
- end
219
-
220
- describe "create!" do
221
- it "creates a merchant account with the new parameters and doesn't require an id" do
222
- merchant_account = Braintree::MerchantAccount.create!(VALID_APPLICATION_PARAMS)
223
-
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
- end
227
- end
228
-
229
145
  describe "create_for_currency" do
230
146
  it "creates a new merchant account for currency" do
231
147
  result = SpecHelper::create_merchant
@@ -330,18 +246,6 @@ describe Braintree::MerchantAccount do
330
246
  end
331
247
 
332
248
  describe "find" do
333
- it "finds the merchant account with the given token" do
334
- result = Braintree::MerchantAccount.create(VALID_APPLICATION_PARAMS)
335
- expect(result).to be_success
336
- expect(result.merchant_account.status).to eq(Braintree::MerchantAccount::Status::Pending)
337
-
338
- id = result.merchant_account.id
339
- merchant_account = Braintree::MerchantAccount.find(id)
340
-
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
- end
344
-
345
249
  it "retrieves the currency iso code for an existing master merchant account" do
346
250
  merchant_account = Braintree::MerchantAccount.find("sandbox_master_merchant_account")
347
251
 
@@ -354,250 +258,4 @@ describe Braintree::MerchantAccount do
354
258
  end.to raise_error(Braintree::NotFoundError, "Merchant account with id non-existant not found")
355
259
  end
356
260
  end
357
-
358
- describe "update" do
359
- it "updates the Merchant Account info" do
360
- params = VALID_APPLICATION_PARAMS.clone
361
- params.delete(:tos_accepted)
362
- params.delete(:master_merchant_account_id)
363
- params[:individual][:first_name] = "John"
364
- params[:individual][:last_name] = "Doe"
365
- params[:individual][:email] = "john.doe@example.com"
366
- params[:individual][:date_of_birth] = "1970-01-01"
367
- params[:individual][:phone] = "3125551234"
368
- params[:individual][:address][:street_address] = "123 Fake St"
369
- params[:individual][:address][:locality] = "Chicago"
370
- params[:individual][:address][:region] = "IL"
371
- params[:individual][:address][:postal_code] = "60622"
372
- params[:business][:dba_name] = "James's Bloggs"
373
- params[:business][:legal_name] = "James's Bloggs Inc"
374
- params[:business][:tax_id] = "423456789"
375
- params[:business][:address][:street_address] = "999 Fake St"
376
- params[:business][:address][:locality] = "Miami"
377
- params[:business][:address][:region] = "FL"
378
- params[:business][:address][:postal_code] = "99999"
379
- params[:funding][:account_number] = "43759348798"
380
- params[:funding][:routing_number] = "071000013"
381
- params[:funding][:email] = "check@this.com"
382
- params[:funding][:mobile_phone] = "1234567890"
383
- params[:funding][:destination] = Braintree::MerchantAccount::FundingDestination::MobilePhone
384
- result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", params)
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
- end
412
-
413
- it "does not require all fields" do
414
- result = Braintree::MerchantAccount.update("sandbox_sub_merchant_account", {:individual => {:first_name => "Jose"}})
415
- expect(result).to be_success
416
- end
417
-
418
- it "handles validation errors for blank fields" do
419
- result = Braintree::MerchantAccount.update(
420
- "sandbox_sub_merchant_account", {
421
- :individual => {
422
- :first_name => "",
423
- :last_name => "",
424
- :email => "",
425
- :phone => "",
426
- :address => {
427
- :street_address => "",
428
- :postal_code => "",
429
- :locality => "",
430
- :region => "",
431
- },
432
- :date_of_birth => "",
433
- :ssn => "",
434
- },
435
- :business => {
436
- :legal_name => "",
437
- :dba_name => "",
438
- :tax_id => ""
439
- },
440
- :funding => {
441
- :destination => "",
442
- :routing_number => "",
443
- :account_number => ""
444
- },
445
- }
446
- )
447
-
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
- end
460
-
461
- it "handles validation errors for invalid fields" do
462
- result = Braintree::MerchantAccount.update(
463
- "sandbox_sub_merchant_account", {
464
- :individual => {
465
- :first_name => "<>",
466
- :last_name => "<>",
467
- :email => "bad",
468
- :phone => "999",
469
- :address => {
470
- :street_address => "nope",
471
- :postal_code => "1",
472
- :region => "QQ",
473
- },
474
- :date_of_birth => "hah",
475
- :ssn => "12345",
476
- },
477
- :business => {
478
- :legal_name => "``{}",
479
- :dba_name => "{}``",
480
- :tax_id => "bad",
481
- :address => {
482
- :street_address => "nope",
483
- :postal_code => "1",
484
- :region => "QQ",
485
- },
486
- },
487
- :funding => {
488
- :destination => "MY WALLET",
489
- :routing_number => "LEATHER",
490
- :account_number => "BACK POCKET",
491
- :email => "BILLFOLD",
492
- :mobile_phone => "TRIFOLD"
493
- },
494
- }
495
- )
496
-
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
- end
522
-
523
- it "handles validation errors for business fields" do
524
- result = Braintree::MerchantAccount.update(
525
- "sandbox_sub_merchant_account", {
526
- :business => {
527
- :legal_name => "",
528
- :tax_id => "111223333",
529
- },
530
- }
531
- )
532
-
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
-
537
- result = Braintree::MerchantAccount.update(
538
- "sandbox_sub_merchant_account", {
539
- :business => {
540
- :legal_name => "legal_name",
541
- :tax_id => "",
542
- },
543
- }
544
- )
545
-
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
- end
549
-
550
- it "handles validation errors for funding fields" do
551
- result = Braintree::MerchantAccount.update(
552
- "sandbox_sub_merchant_account", {
553
- :funding => {
554
- :destination => Braintree::MerchantAccount::FundingDestination::Bank,
555
- :routing_number => "",
556
- :account_number => ""
557
- },
558
- }
559
- )
560
-
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
-
565
- result = Braintree::MerchantAccount.update(
566
- "sandbox_sub_merchant_account", {
567
- :funding => {
568
- :destination => Braintree::MerchantAccount::FundingDestination::Email,
569
- :email => ""
570
- },
571
- }
572
- )
573
-
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
-
577
- result = Braintree::MerchantAccount.update(
578
- "sandbox_sub_merchant_account", {
579
- :funding => {
580
- :destination => Braintree::MerchantAccount::FundingDestination::MobilePhone,
581
- :mobile_phone => ""
582
- },
583
- }
584
- )
585
-
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
- end
589
- end
590
-
591
- describe "update!" do
592
- it "updates the Merchant Account info" do
593
- params = VALID_APPLICATION_PARAMS.clone
594
- params.delete(:tos_accepted)
595
- params.delete(:master_merchant_account_id)
596
- params[:individual][:first_name] = "John"
597
- params[:individual][:last_name] = "Doe"
598
- merchant_account = Braintree::MerchantAccount.update!("sandbox_sub_merchant_account", params)
599
- expect(merchant_account.individual_details.first_name).to eq("John")
600
- expect(merchant_account.individual_details.last_name).to eq("Doe")
601
- end
602
- end
603
261
  end
@@ -126,8 +126,8 @@ describe Braintree::PaymentMethod do
126
126
  expect(apple_pay_card.bin).not_to be_nil
127
127
  expect(apple_pay_card.token).to eq(token)
128
128
  expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
129
- expect(apple_pay_card.payment_instrument_name).to eq("Visa 8886")
130
- expect(apple_pay_card.source_description).to eq("Visa 8886")
129
+ expect(apple_pay_card.payment_instrument_name).to eq("Visa 2006")
130
+ expect(apple_pay_card.source_description).to eq("Visa 2006")
131
131
  expect(apple_pay_card.default).to eq(true)
132
132
  expect(apple_pay_card.image_url).to match(/apple_pay/)
133
133
  expect(apple_pay_card.expiration_month.to_i).to be > 0
@@ -1228,7 +1228,7 @@ describe Braintree::PaymentMethod do
1228
1228
  expect(apple_pay_card.image_url).to match(/apple_pay/)
1229
1229
  expect(apple_pay_card.expiration_month.to_i).to be > 0
1230
1230
  expect(apple_pay_card.expiration_year.to_i).to be > 0
1231
- expect(apple_pay_card.source_description).to eq("Visa 8886")
1231
+ expect(apple_pay_card.source_description).to eq("Visa 2006")
1232
1232
  expect(apple_pay_card.customer_id).to eq(customer.id)
1233
1233
  apple_pay_card.merchant_token_identifier == "DNITHE302308980427388297"
1234
1234
  apple_pay_card.source_card_last4 == "2006"
@@ -0,0 +1,119 @@
1
+ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
2
+ require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
3
+
4
+ describe Braintree::Transaction do
5
+
6
+ describe "self.sale" do
7
+
8
+ it "should create a transaction with sub merchant and payment facilitator for a payfac merchant" do
9
+ transaction_params = {
10
+ :type => "sale",
11
+ :amount => "100.00",
12
+ :merchant_account_id => SpecHelper::CardProcessorBRLPayFacMerchantAccountId,
13
+ :credit_card => {
14
+ :number => "4111111111111111",
15
+ :expiration_date => "06/2026",
16
+ :cvv => "123",
17
+ },
18
+ :descriptor => {
19
+ :name => "companynme12*product12",
20
+ :phone => "1232344444",
21
+ :url => "example.com",
22
+ },
23
+ :billing => {
24
+ :first_name => "Bob James",
25
+ :country_code_alpha2 => "CA",
26
+ :extended_address => "",
27
+ :locality => "Trois-Rivires",
28
+ :region => "QC",
29
+ :postal_code => "G8Y 156",
30
+ :street_address => "2346 Boul Lane",
31
+ },
32
+ :payment_facilitator => {
33
+ :payment_facilitator_id => "98765432109",
34
+ :sub_merchant => {
35
+ :reference_number => "123456789012345",
36
+ :tax_id => "99112233445577",
37
+ :legal_name => "Fooda",
38
+ :address => {
39
+ :street_address => "10880 Ibitinga",
40
+ :locality => "Araraquara",
41
+ :region => "SP",
42
+ :country_code_alpha2 => "BR",
43
+ :postal_code => "13525000",
44
+ :international_phone => {
45
+ :country_code => "55",
46
+ :national_number => "9876543210",
47
+ },
48
+ },
49
+ },
50
+ },
51
+ :options => {
52
+ :store_in_vault_on_success => true,
53
+ },
54
+ }
55
+
56
+ result = Braintree::Transaction.sale(transaction_params)
57
+ expect(result.success?).to eq(true)
58
+ expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
59
+ end
60
+
61
+ it "should fail on transaction with payment facilitator and non brazil merchant" do
62
+ transaction_params = {
63
+ :type => "sale",
64
+ :amount => "100.00",
65
+ :credit_card => {
66
+ :number => "4111111111111111",
67
+ :expiration_date => "06/2026",
68
+ :cvv => "123",
69
+ },
70
+ :descriptor => {
71
+ :name => "companynme12*product12",
72
+ :phone => "1232344444",
73
+ :url => "example.com",
74
+ },
75
+ :billing => {
76
+ :first_name => "Bob James",
77
+ :country_code_alpha2 => "CA",
78
+ :extended_address => "",
79
+ :locality => "Trois-Rivires",
80
+ :region => "QC",
81
+ :postal_code => "G8Y 156",
82
+ :street_address => "2346 Boul Lane",
83
+ },
84
+ :payment_facilitator => {
85
+ :payment_facilitator_id => "98765432109",
86
+ :sub_merchant => {
87
+ :reference_number => "123456789012345",
88
+ :tax_id => "99112233445577",
89
+ :legal_name => "Fooda",
90
+ :address => {
91
+ :street_address => "10880 Ibitinga",
92
+ :locality => "Araraquara",
93
+ :region => "SP",
94
+ :country_code_alpha2 => "BR",
95
+ :postal_code => "13525000",
96
+ :international_phone => {
97
+ :country_code => "55",
98
+ :national_number => "9876543210",
99
+ },
100
+ },
101
+ },
102
+ },
103
+ :options => {
104
+ :store_in_vault_on_success => true,
105
+ },
106
+ }
107
+
108
+ ezp_gateway = Braintree::Gateway.new(
109
+ :environment => :development,
110
+ :merchant_id => "pp_credit_ezp_merchant",
111
+ :public_key => "pp_credit_ezp_merchant_public_key",
112
+ :private_key => "pp_credit_ezp_merchant_private_key",
113
+ )
114
+
115
+ result = ezp_gateway.transaction.sale(transaction_params)
116
+ expect(result.errors.for(:transaction).first.code).to eq(Braintree::ErrorCodes::PaymentFacilitator::PaymentFacilitatorNotApplicable)
117
+ end
118
+ end
119
+ end