braintree 4.0.0 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +1 -0
- data/lib/braintree.rb +2 -0
- data/lib/braintree/apple_pay_card.rb +9 -0
- data/lib/braintree/credit_card_gateway.rb +11 -1
- data/lib/braintree/error_codes.rb +4 -2
- data/lib/braintree/google_pay_card.rb +9 -0
- data/lib/braintree/http.rb +1 -0
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/payment_method_gateway.rb +7 -2
- data/lib/braintree/payment_method_nonce.rb +6 -3
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +3 -3
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/webhook_notification.rb +8 -1
- data/lib/braintree/webhook_testing_gateway.rb +51 -2
- data/spec/integration/braintree/credit_card_spec.rb +89 -0
- data/spec/integration/braintree/customer_spec.rb +117 -0
- data/spec/integration/braintree/merchant_account_spec.rb +3 -3
- data/spec/integration/braintree/payment_method_nonce_spec.rb +2 -0
- data/spec/integration/braintree/payment_method_spec.rb +131 -0
- data/spec/integration/braintree/transaction_spec.rb +82 -2
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/braintree/credit_card_spec.rb +6 -6
- data/spec/unit/braintree/customer_spec.rb +8 -7
- data/spec/unit/braintree/http_spec.rb +2 -0
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -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 +50 -1
- metadata +22 -3
@@ -115,6 +115,46 @@ describe Braintree::Customer do
|
|
115
115
|
result.should be_success
|
116
116
|
end
|
117
117
|
|
118
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
119
|
+
with_fraud_protection_enterprise_merchant do
|
120
|
+
result = Braintree::Customer.create(
|
121
|
+
:credit_card => {
|
122
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
123
|
+
:expiration_date => "05/2010",
|
124
|
+
:cvv => "100",
|
125
|
+
:options => {
|
126
|
+
:skip_advanced_fraud_checking => false,
|
127
|
+
:verify_card => true,
|
128
|
+
},
|
129
|
+
},
|
130
|
+
)
|
131
|
+
|
132
|
+
expect(result).to be_success
|
133
|
+
verification = result.customer.credit_cards.first.verification
|
134
|
+
expect(verification.risk_data).not_to be_nil
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
139
|
+
with_fraud_protection_enterprise_merchant do
|
140
|
+
result = Braintree::Customer.create(
|
141
|
+
:credit_card => {
|
142
|
+
:number => Braintree::Test::CreditCardNumbers::MasterCard,
|
143
|
+
:expiration_date => "05/2010",
|
144
|
+
:cvv => "100",
|
145
|
+
:options => {
|
146
|
+
:skip_advanced_fraud_checking => true,
|
147
|
+
:verify_card => true,
|
148
|
+
},
|
149
|
+
},
|
150
|
+
)
|
151
|
+
|
152
|
+
expect(result).to be_success
|
153
|
+
verification = result.customer.credit_cards.first.verification
|
154
|
+
expect(verification.risk_data).to be_nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
118
158
|
it "supports creation with tax_identifiers" do
|
119
159
|
result = Braintree::Customer.create(
|
120
160
|
:tax_identifiers => [
|
@@ -981,6 +1021,15 @@ describe Braintree::Customer do
|
|
981
1021
|
apple_pay_card.token.should_not be_nil
|
982
1022
|
apple_pay_card.expiration_year.should_not be_nil
|
983
1023
|
apple_pay_card.payment_instrument_name.should == "AmEx 41002"
|
1024
|
+
apple_pay_card.commercial.should_not be_nil
|
1025
|
+
apple_pay_card.country_of_issuance.should_not be_nil
|
1026
|
+
apple_pay_card.debit.should_not be_nil
|
1027
|
+
apple_pay_card.durbin_regulated.should_not be_nil
|
1028
|
+
apple_pay_card.healthcare.should_not be_nil
|
1029
|
+
apple_pay_card.issuing_bank.should_not be_nil
|
1030
|
+
apple_pay_card.payroll.should_not be_nil
|
1031
|
+
apple_pay_card.prepaid.should_not be_nil
|
1032
|
+
apple_pay_card.product_id.should_not be_nil
|
984
1033
|
end
|
985
1034
|
|
986
1035
|
it "returns associated google pay proxy cards" do
|
@@ -997,6 +1046,15 @@ describe Braintree::Customer do
|
|
997
1046
|
google_pay_card.token.should_not be_nil
|
998
1047
|
google_pay_card.expiration_year.should_not be_nil
|
999
1048
|
google_pay_card.is_network_tokenized?.should == false
|
1049
|
+
google_pay_card.commercial.should_not be_nil
|
1050
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
1051
|
+
google_pay_card.debit.should_not be_nil
|
1052
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
1053
|
+
google_pay_card.healthcare.should_not be_nil
|
1054
|
+
google_pay_card.issuing_bank.should_not be_nil
|
1055
|
+
google_pay_card.payroll.should_not be_nil
|
1056
|
+
google_pay_card.prepaid.should_not be_nil
|
1057
|
+
google_pay_card.product_id.should_not be_nil
|
1000
1058
|
end
|
1001
1059
|
|
1002
1060
|
it "returns associated google pay network tokens" do
|
@@ -1013,6 +1071,15 @@ describe Braintree::Customer do
|
|
1013
1071
|
google_pay_card.token.should_not be_nil
|
1014
1072
|
google_pay_card.expiration_year.should_not be_nil
|
1015
1073
|
google_pay_card.is_network_tokenized?.should == true
|
1074
|
+
google_pay_card.commercial.should_not be_nil
|
1075
|
+
google_pay_card.country_of_issuance.should_not be_nil
|
1076
|
+
google_pay_card.debit.should_not be_nil
|
1077
|
+
google_pay_card.durbin_regulated.should_not be_nil
|
1078
|
+
google_pay_card.healthcare.should_not be_nil
|
1079
|
+
google_pay_card.issuing_bank.should_not be_nil
|
1080
|
+
google_pay_card.payroll.should_not be_nil
|
1081
|
+
google_pay_card.prepaid.should_not be_nil
|
1082
|
+
google_pay_card.product_id.should_not be_nil
|
1016
1083
|
end
|
1017
1084
|
|
1018
1085
|
it "returns associated venmo accounts" do
|
@@ -1345,6 +1412,56 @@ describe Braintree::Customer do
|
|
1345
1412
|
result.success?.should == true
|
1346
1413
|
end
|
1347
1414
|
|
1415
|
+
it "includes risk data when skip_advanced_fraud_checking is false" do
|
1416
|
+
with_fraud_protection_enterprise_merchant do
|
1417
|
+
customer = Braintree::Customer.create!(
|
1418
|
+
:first_name => "Joe",
|
1419
|
+
)
|
1420
|
+
|
1421
|
+
updated_result = Braintree::Customer.update(
|
1422
|
+
customer.id,
|
1423
|
+
:credit_card => {
|
1424
|
+
:cardholder_name => "New Joe Cardholder",
|
1425
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1426
|
+
:expiration_date => "12/2009",
|
1427
|
+
:options => {
|
1428
|
+
:skip_advanced_fraud_checking => false,
|
1429
|
+
:verify_card => true,
|
1430
|
+
},
|
1431
|
+
},
|
1432
|
+
)
|
1433
|
+
|
1434
|
+
expect(updated_result).to be_success
|
1435
|
+
verification = updated_result.customer.credit_cards.first.verification
|
1436
|
+
expect(verification.risk_data).not_to be_nil
|
1437
|
+
end
|
1438
|
+
end
|
1439
|
+
|
1440
|
+
it "does not include risk data when skip_advanced_fraud_checking is true" do
|
1441
|
+
with_fraud_protection_enterprise_merchant do
|
1442
|
+
customer = Braintree::Customer.create!(
|
1443
|
+
:first_name => "Joe",
|
1444
|
+
)
|
1445
|
+
|
1446
|
+
updated_result = Braintree::Customer.update(
|
1447
|
+
customer.id,
|
1448
|
+
:credit_card => {
|
1449
|
+
:cardholder_name => "New Joe Cardholder",
|
1450
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1451
|
+
:expiration_date => "12/2009",
|
1452
|
+
:options => {
|
1453
|
+
:skip_advanced_fraud_checking => true,
|
1454
|
+
:verify_card => true,
|
1455
|
+
},
|
1456
|
+
},
|
1457
|
+
)
|
1458
|
+
|
1459
|
+
expect(updated_result).to be_success
|
1460
|
+
verification = updated_result.customer.credit_cards.first.verification
|
1461
|
+
expect(verification.risk_data).to be_nil
|
1462
|
+
end
|
1463
|
+
end
|
1464
|
+
|
1348
1465
|
it "can update a tax_identifier" do
|
1349
1466
|
customer = Braintree::Customer.create!(
|
1350
1467
|
:tax_identifiers => [
|
@@ -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
|
|
@@ -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
|
{
|