braintree 3.4.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +2 -2
- data/lib/braintree.rb +4 -0
- data/lib/braintree/address.rb +1 -0
- data/lib/braintree/apple_pay_card.rb +9 -0
- data/lib/braintree/credit_card_gateway.rb +11 -1
- data/lib/braintree/customer.rb +4 -2
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/dispute.rb +14 -0
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_search.rb +1 -0
- data/lib/braintree/error_codes.rb +4 -6
- data/lib/braintree/google_pay_card.rb +9 -0
- data/lib/braintree/payment_method_gateway.rb +7 -4
- data/lib/braintree/payment_method_nonce.rb +7 -4
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +3 -3
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/webhook_notification.rb +2 -1
- data/lib/braintree/webhook_testing_gateway.rb +20 -0
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +12 -2
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/address_spec.rb +4 -0
- data/spec/integration/braintree/credit_card_spec.rb +89 -0
- data/spec/integration/braintree/customer_spec.rb +144 -0
- data/spec/integration/braintree/dispute_search_spec.rb +25 -0
- data/spec/integration/braintree/merchant_account_spec.rb +3 -3
- data/spec/integration/braintree/payment_method_nonce_spec.rb +16 -23
- data/spec/integration/braintree/payment_method_spec.rb +131 -0
- data/spec/integration/braintree/transaction_spec.rb +82 -2
- data/spec/spec_helper.rb +2 -0
- data/spec/unit/braintree/credit_card_spec.rb +6 -6
- data/spec/unit/braintree/customer_spec.rb +17 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +26 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +4 -0
- data/spec/unit/braintree/transaction_spec.rb +3 -3
- data/spec/unit/braintree/webhook_notification_spec.rb +16 -0
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- metadata +15 -7
@@ -78,6 +78,31 @@ describe Braintree::Dispute, "search" do
|
|
78
78
|
dispute = collection.disputes.first
|
79
79
|
end
|
80
80
|
|
81
|
+
it "correctly returns chargeback protected disputes" do
|
82
|
+
collection = Braintree::Dispute.search do |search|
|
83
|
+
search.case_number.is "CASE-CHARGEBACK-PROTECTED"
|
84
|
+
end
|
85
|
+
|
86
|
+
expect(collection.disputes.count).to eq(1)
|
87
|
+
dispute = collection.disputes.first
|
88
|
+
|
89
|
+
expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
|
90
|
+
expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
|
91
|
+
end
|
92
|
+
|
93
|
+
it "correctly returns disputes by chargeback protection level flag" do
|
94
|
+
collection = Braintree::Dispute.search do |search|
|
95
|
+
search.chargeback_protection_level.in [
|
96
|
+
Braintree::Dispute::ChargebackProtectionLevel::Effortless
|
97
|
+
]
|
98
|
+
end
|
99
|
+
expect(collection.disputes.count).to eq(1)
|
100
|
+
dispute = collection.disputes.first
|
101
|
+
|
102
|
+
expect(dispute.chargeback_protection_level).to eq(Braintree::Dispute::ChargebackProtectionLevel::Effortless)
|
103
|
+
expect(dispute.reason).to eq(Braintree::Dispute::Reason::Fraud)
|
104
|
+
end
|
105
|
+
|
81
106
|
it "correctly returns disputes by effective_date range" do
|
82
107
|
effective_date = transaction.disputes.first.status_history.first.effective_date
|
83
108
|
|
@@ -41,7 +41,7 @@ VALID_APPLICATION_PARAMS = {
|
|
41
41
|
:business => {
|
42
42
|
:legal_name => "Joe's Bloggs",
|
43
43
|
:dba_name => "Joe's Junkyard",
|
44
|
-
:tax_id => "
|
44
|
+
:tax_id => "423456789",
|
45
45
|
:address => {
|
46
46
|
:street_address => "456 Fake St",
|
47
47
|
:postal_code => "48104",
|
@@ -371,7 +371,7 @@ describe Braintree::MerchantAccount do
|
|
371
371
|
params[:individual][:address][:postal_code] = "60622"
|
372
372
|
params[:business][:dba_name] = "James's Bloggs"
|
373
373
|
params[:business][:legal_name] = "James's Bloggs Inc"
|
374
|
-
params[:business][:tax_id] = "
|
374
|
+
params[:business][:tax_id] = "423456789"
|
375
375
|
params[:business][:address][:street_address] = "999 Fake St"
|
376
376
|
params[:business][:address][:locality] = "Miami"
|
377
377
|
params[:business][:address][:region] = "FL"
|
@@ -397,7 +397,7 @@ describe Braintree::MerchantAccount do
|
|
397
397
|
result.merchant_account.individual_details.address_details.postal_code.should == "60622"
|
398
398
|
result.merchant_account.business_details.dba_name.should == "James's Bloggs"
|
399
399
|
result.merchant_account.business_details.legal_name.should == "James's Bloggs Inc"
|
400
|
-
result.merchant_account.business_details.tax_id.should == "
|
400
|
+
result.merchant_account.business_details.tax_id.should == "423456789"
|
401
401
|
result.merchant_account.business_details.address_details.street_address.should == "999 Fake St"
|
402
402
|
result.merchant_account.business_details.address_details.locality.should == "Miami"
|
403
403
|
result.merchant_account.business_details.address_details.region.should == "FL"
|
@@ -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
|
@@ -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.
|
83
|
-
nonce.details.
|
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.
|
91
|
-
nonce.details.
|
92
|
-
nonce.details.
|
93
|
-
nonce.details.
|
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
|
@@ -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
|
127
|
+
nonce.details.bin.should == "401288"
|
135
128
|
end
|
136
129
|
|
137
130
|
it "returns bin_data with commercial set to Yes" do
|
@@ -99,6 +99,15 @@ describe Braintree::PaymentMethod do
|
|
99
99
|
apple_pay_card.expiration_month.to_i.should > 0
|
100
100
|
apple_pay_card.expiration_year.to_i.should > 0
|
101
101
|
apple_pay_card.customer_id.should == customer.id
|
102
|
+
apple_pay_card.commercial.should_not be_nil
|
103
|
+
apple_pay_card.country_of_issuance.should_not be_nil
|
104
|
+
apple_pay_card.debit.should_not be_nil
|
105
|
+
apple_pay_card.durbin_regulated.should_not be_nil
|
106
|
+
apple_pay_card.healthcare.should_not be_nil
|
107
|
+
apple_pay_card.issuing_bank.should_not be_nil
|
108
|
+
apple_pay_card.payroll.should_not be_nil
|
109
|
+
apple_pay_card.prepaid.should_not be_nil
|
110
|
+
apple_pay_card.product_id.should_not be_nil
|
102
111
|
end
|
103
112
|
|
104
113
|
it "creates a payment method from a fake google pay proxy card nonce" do
|
@@ -127,6 +136,15 @@ describe Braintree::PaymentMethod do
|
|
127
136
|
google_pay_card.google_transaction_id.should == "google_transaction_id"
|
128
137
|
google_pay_card.source_description.should == "Discover 1111"
|
129
138
|
google_pay_card.customer_id.should == customer.id
|
139
|
+
google_pay_card.commercial.should_not be_nil
|
140
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
141
|
+
google_pay_card.debit.should_not be_nil
|
142
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
143
|
+
google_pay_card.healthcare.should_not be_nil
|
144
|
+
google_pay_card.issuing_bank.should_not be_nil
|
145
|
+
google_pay_card.payroll.should_not be_nil
|
146
|
+
google_pay_card.prepaid.should_not be_nil
|
147
|
+
google_pay_card.product_id.should_not be_nil
|
130
148
|
end
|
131
149
|
|
132
150
|
it "creates a payment method from a google pay network token nonce" do
|
@@ -155,6 +173,15 @@ describe Braintree::PaymentMethod do
|
|
155
173
|
google_pay_card.google_transaction_id.should == "google_transaction_id"
|
156
174
|
google_pay_card.source_description.should == "MasterCard 4444"
|
157
175
|
google_pay_card.customer_id.should == customer.id
|
176
|
+
google_pay_card.commercial.should_not be_nil
|
177
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
178
|
+
google_pay_card.debit.should_not be_nil
|
179
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
180
|
+
google_pay_card.healthcare.should_not be_nil
|
181
|
+
google_pay_card.issuing_bank.should_not be_nil
|
182
|
+
google_pay_card.payroll.should_not be_nil
|
183
|
+
google_pay_card.prepaid.should_not be_nil
|
184
|
+
google_pay_card.product_id.should_not be_nil
|
158
185
|
end
|
159
186
|
|
160
187
|
it "creates a payment method from venmo account nonce" do
|
@@ -527,6 +554,58 @@ describe Braintree::PaymentMethod do
|
|
527
554
|
found_credit_card.billing_address.street_address.should == "456 Xyz Way"
|
528
555
|
end
|
529
556
|
|
557
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
558
|
+
with_fraud_protection_enterprise_merchant do
|
559
|
+
customer = Braintree::Customer.create!
|
560
|
+
|
561
|
+
nonce = nonce_for_new_payment_method(
|
562
|
+
:credit_card => {
|
563
|
+
:cvv => "123",
|
564
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
565
|
+
:expiration_date => "05/2009",
|
566
|
+
},
|
567
|
+
)
|
568
|
+
result = Braintree::PaymentMethod.create(
|
569
|
+
:payment_method_nonce => nonce,
|
570
|
+
:customer_id => customer.id,
|
571
|
+
:options => {
|
572
|
+
:verify_card => true,
|
573
|
+
:skip_advanced_fraud_checking => false,
|
574
|
+
},
|
575
|
+
)
|
576
|
+
|
577
|
+
expect(result).to be_success
|
578
|
+
verification = result.payment_method.verification
|
579
|
+
expect(verification.risk_data).not_to be_nil
|
580
|
+
end
|
581
|
+
end
|
582
|
+
|
583
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
584
|
+
with_fraud_protection_enterprise_merchant do
|
585
|
+
customer = Braintree::Customer.create!
|
586
|
+
|
587
|
+
nonce = nonce_for_new_payment_method(
|
588
|
+
:credit_card => {
|
589
|
+
:cvv => "123",
|
590
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
591
|
+
:expiration_date => "05/2009",
|
592
|
+
},
|
593
|
+
)
|
594
|
+
result = Braintree::PaymentMethod.create(
|
595
|
+
:payment_method_nonce => nonce,
|
596
|
+
:customer_id => customer.id,
|
597
|
+
:options => {
|
598
|
+
:verify_card => true,
|
599
|
+
:skip_advanced_fraud_checking => true,
|
600
|
+
},
|
601
|
+
)
|
602
|
+
|
603
|
+
expect(result).to be_success
|
604
|
+
verification = result.payment_method.verification
|
605
|
+
expect(verification.risk_data).to be_nil
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
530
609
|
context "account_type" do
|
531
610
|
it "verifies card with account_type debit" do
|
532
611
|
nonce = nonce_for_new_payment_method(
|
@@ -1368,6 +1447,58 @@ describe Braintree::PaymentMethod do
|
|
1368
1447
|
updated_credit_card.expiration_date.should == "06/2013"
|
1369
1448
|
end
|
1370
1449
|
|
1450
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
1451
|
+
with_fraud_protection_enterprise_merchant do
|
1452
|
+
customer = Braintree::Customer.create!
|
1453
|
+
credit_card = Braintree::CreditCard.create!(
|
1454
|
+
:customer_id => customer.id,
|
1455
|
+
:cvv => "123",
|
1456
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1457
|
+
:expiration_date => "05/2012",
|
1458
|
+
)
|
1459
|
+
update_result = Braintree::PaymentMethod.update(
|
1460
|
+
credit_card.token,
|
1461
|
+
:cvv => "456",
|
1462
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
1463
|
+
:expiration_date => "06/2013",
|
1464
|
+
:options => {
|
1465
|
+
:verify_card => true,
|
1466
|
+
:skip_advanced_fraud_checking => false
|
1467
|
+
},
|
1468
|
+
)
|
1469
|
+
|
1470
|
+
expect(update_result).to be_success
|
1471
|
+
verification = update_result.payment_method.verification
|
1472
|
+
expect(verification.risk_data).not_to be_nil
|
1473
|
+
end
|
1474
|
+
end
|
1475
|
+
|
1476
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
1477
|
+
with_fraud_protection_enterprise_merchant do
|
1478
|
+
customer = Braintree::Customer.create!
|
1479
|
+
credit_card = Braintree::CreditCard.create!(
|
1480
|
+
:customer_id => customer.id,
|
1481
|
+
:cvv => "123",
|
1482
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1483
|
+
:expiration_date => "05/2012",
|
1484
|
+
)
|
1485
|
+
update_result = Braintree::PaymentMethod.update(
|
1486
|
+
credit_card.token,
|
1487
|
+
:cvv => "456",
|
1488
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
1489
|
+
:expiration_date => "06/2013",
|
1490
|
+
:options => {
|
1491
|
+
:verify_card => true,
|
1492
|
+
:skip_advanced_fraud_checking => true
|
1493
|
+
},
|
1494
|
+
)
|
1495
|
+
|
1496
|
+
expect(update_result).to be_success
|
1497
|
+
verification = update_result.payment_method.verification
|
1498
|
+
expect(verification.risk_data).to be_nil
|
1499
|
+
end
|
1500
|
+
end
|
1501
|
+
|
1371
1502
|
context "verification_currency_iso_code" do
|
1372
1503
|
it "validates verification_currency_iso_code and updates the credit card " do
|
1373
1504
|
customer = Braintree::Customer.create!
|
@@ -999,6 +999,34 @@ describe Braintree::Transaction do
|
|
999
999
|
result.transaction.credit_card_details.expiration_date.should == "05/2011"
|
1000
1000
|
end
|
1001
1001
|
|
1002
|
+
it "accepts exchange_rate_quote_id" do
|
1003
|
+
result = Braintree::Transaction.create(
|
1004
|
+
:type => "sale",
|
1005
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1006
|
+
:credit_card => {
|
1007
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1008
|
+
:expiration_date => "05/2009"
|
1009
|
+
},
|
1010
|
+
:exchange_rate_quote_id => "dummyExchangeRateQuoteId-Brainree-Ruby",
|
1011
|
+
)
|
1012
|
+
result.success?.should == true
|
1013
|
+
result.transaction.credit_card_details.expiration_date.should == "05/2009"
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
it "returns an error if provided invalid exchange_rate_quote_id" do
|
1017
|
+
result = Braintree::Transaction.create(
|
1018
|
+
:type => "sale",
|
1019
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1020
|
+
:credit_card => {
|
1021
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1022
|
+
:expiration_date => "05/2009"
|
1023
|
+
},
|
1024
|
+
:exchange_rate_quote_id => "a" * 4010,
|
1025
|
+
)
|
1026
|
+
result.success?.should == false
|
1027
|
+
result.errors.for(:transaction).on(:exchange_rate_quote_id)[0].code.should == Braintree::ErrorCodes::Transaction::ExchangeRateQuoteIdTooLong
|
1028
|
+
end
|
1029
|
+
|
1002
1030
|
it "returns some error if customer_id is invalid" do
|
1003
1031
|
result = Braintree::Transaction.create(
|
1004
1032
|
:type => "sale",
|
@@ -4386,7 +4414,7 @@ describe Braintree::Transaction do
|
|
4386
4414
|
:amount => "10.00",
|
4387
4415
|
)
|
4388
4416
|
result.success?.should == true
|
4389
|
-
result.transaction.network_transaction_id.
|
4417
|
+
result.transaction.network_transaction_id.should_not be_nil
|
4390
4418
|
end
|
4391
4419
|
|
4392
4420
|
it "accepts blank previous_network_transaction_id" do
|
@@ -4403,7 +4431,7 @@ describe Braintree::Transaction do
|
|
4403
4431
|
:amount => "10.00",
|
4404
4432
|
)
|
4405
4433
|
result.success?.should == true
|
4406
|
-
result.transaction.network_transaction_id.
|
4434
|
+
result.transaction.network_transaction_id.should_not be_nil
|
4407
4435
|
end
|
4408
4436
|
end
|
4409
4437
|
end
|
@@ -5058,6 +5086,22 @@ describe Braintree::Transaction do
|
|
5058
5086
|
result.errors.for(:transaction).on(:currency_iso_code)[0].code.should == Braintree::ErrorCodes::Transaction::CurrencyCodeNotSupportedByMerchantAccount
|
5059
5087
|
end
|
5060
5088
|
|
5089
|
+
it "validates tax_amount for Aib domestic sweden transaction and returns error" do
|
5090
|
+
params = {
|
5091
|
+
:transaction => {
|
5092
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
5093
|
+
:merchant_account_id => SpecHelper::AibSwedenMaMerchantAccountId,
|
5094
|
+
:credit_card => {
|
5095
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
5096
|
+
:expiration_date => "05/2030"
|
5097
|
+
}
|
5098
|
+
}
|
5099
|
+
}
|
5100
|
+
result = Braintree::Transaction.sale(params[:transaction])
|
5101
|
+
result.success?.should == false
|
5102
|
+
result.errors.for(:transaction).on(:tax_amount)[0].code.should == Braintree::ErrorCodes::Transaction::TaxAmountIsRequiredForAibSwedish
|
5103
|
+
end
|
5104
|
+
|
5061
5105
|
it "skips advanced fraud checking if transaction[options][skip_advanced_fraud_checking] is set to true" do
|
5062
5106
|
with_advanced_fraud_kount_integration_merchant do
|
5063
5107
|
result = Braintree::Transaction.sale(
|
@@ -6984,6 +7028,42 @@ describe Braintree::Transaction do
|
|
6984
7028
|
end
|
6985
7029
|
end
|
6986
7030
|
|
7031
|
+
describe "Manual Key Entry" do
|
7032
|
+
context "with correct encrypted payment reader card details" do
|
7033
|
+
it "returns a success response" do
|
7034
|
+
result = Braintree::Transaction.sale(
|
7035
|
+
:amount => "10.00",
|
7036
|
+
:credit_card => {
|
7037
|
+
:payment_reader_card_details => {
|
7038
|
+
:encrypted_card_data => "8F34DFB312DC79C24FD5320622F3E11682D79E6B0C0FD881",
|
7039
|
+
:key_serial_number => "FFFFFF02000572A00005",
|
7040
|
+
},
|
7041
|
+
},
|
7042
|
+
)
|
7043
|
+
|
7044
|
+
expect(result).to be_success
|
7045
|
+
end
|
7046
|
+
end
|
7047
|
+
|
7048
|
+
context "with invalid encrypted payment reader card details" do
|
7049
|
+
it "returns a failure response" do
|
7050
|
+
result = Braintree::Transaction.sale(
|
7051
|
+
:amount => "10.00",
|
7052
|
+
:credit_card => {
|
7053
|
+
:payment_reader_card_details => {
|
7054
|
+
:encrypted_card_data => "invalid",
|
7055
|
+
:key_serial_number => "invalid",
|
7056
|
+
},
|
7057
|
+
},
|
7058
|
+
)
|
7059
|
+
|
7060
|
+
expect(result).not_to be_success
|
7061
|
+
expect(result.errors.for(:transaction).first.code)
|
7062
|
+
.to eq(Braintree::ErrorCodes::Transaction::PaymentInstrumentNotSupportedByMerchantAccount)
|
7063
|
+
end
|
7064
|
+
end
|
7065
|
+
end
|
7066
|
+
|
6987
7067
|
describe "Adjust Authorization" do
|
6988
7068
|
let(:first_data_master_transaction_params) do
|
6989
7069
|
{
|
data/spec/spec_helper.rb
CHANGED
@@ -3,6 +3,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
3
3
|
project_root = File.expand_path(File.dirname(__FILE__) + "/..")
|
4
4
|
require "rubygems"
|
5
5
|
require "bundler/setup"
|
6
|
+
require "libxml"
|
6
7
|
require "rspec"
|
7
8
|
require "pry"
|
8
9
|
|
@@ -41,6 +42,7 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
41
42
|
HiperBRLMerchantAccountId = "hiper_brl"
|
42
43
|
CardProcessorBRLMerchantAccountId = "card_processor_brl"
|
43
44
|
FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
|
45
|
+
AibSwedenMaMerchantAccountId = "aib_swe_ma"
|
44
46
|
|
45
47
|
TrialPlan = {
|
46
48
|
:description => "Plan for integration tests -- with trial",
|
@@ -11,7 +11,7 @@ describe Braintree::CreditCard do
|
|
11
11
|
|
12
12
|
describe "self.create_signature" do
|
13
13
|
it "should be what we expect" do
|
14
|
-
Braintree::CreditCardGateway._create_signature.
|
14
|
+
expect(Braintree::CreditCardGateway._create_signature).to match([
|
15
15
|
:billing_address_id,
|
16
16
|
:cardholder_name,
|
17
17
|
:cvv,
|
@@ -24,7 +24,7 @@ describe Braintree::CreditCard do
|
|
24
24
|
:device_data,
|
25
25
|
:payment_method_nonce,
|
26
26
|
{:external_vault=>[:network_transaction_id]},
|
27
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
|
27
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
28
28
|
{:billing_address => [
|
29
29
|
:company,
|
30
30
|
:country_code_alpha2,
|
@@ -51,13 +51,13 @@ describe Braintree::CreditCard do
|
|
51
51
|
:ds_transaction_id,
|
52
52
|
]},
|
53
53
|
:customer_id,
|
54
|
-
]
|
54
|
+
])
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "self.update_signature" do
|
59
59
|
it "should be what we expect" do
|
60
|
-
Braintree::CreditCardGateway._update_signature.
|
60
|
+
expect(Braintree::CreditCardGateway._update_signature).to match([
|
61
61
|
:billing_address_id,
|
62
62
|
:cardholder_name,
|
63
63
|
:cvv,
|
@@ -70,7 +70,7 @@ describe Braintree::CreditCard do
|
|
70
70
|
:device_data,
|
71
71
|
:payment_method_nonce,
|
72
72
|
{:external_vault=>[:network_transaction_id]},
|
73
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code]},
|
73
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
74
74
|
{:billing_address => [
|
75
75
|
:company,
|
76
76
|
:country_code_alpha2,
|
@@ -97,7 +97,7 @@ describe Braintree::CreditCard do
|
|
97
97
|
:cavv_algorithm,
|
98
98
|
:ds_transaction_id,
|
99
99
|
]},
|
100
|
-
]
|
100
|
+
])
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|