braintree 2.96.0 → 2.97.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/lib/braintree/credit_card_gateway.rb +1 -1
- data/lib/braintree/error_codes.rb +24 -0
- data/lib/braintree/test/nonce.rb +1 -1
- data/lib/braintree/transaction.rb +11 -0
- data/lib/braintree/transaction/local_payment_details.rb +7 -0
- data/lib/braintree/transaction_gateway.rb +10 -2
- data/lib/braintree/version.rb +1 -1
- data/spec/integration/braintree/credit_card_spec.rb +107 -0
- data/spec/integration/braintree/customer_spec.rb +131 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +11 -0
- data/spec/integration/braintree/transaction_spec.rb +254 -114
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/braintree/credit_card_spec.rb +2 -2
- data/spec/unit/braintree/customer_spec.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b9796b601bd0eb88d43af1f1f4649dbef92b3f13b64e2ba1530ce2fe184b3817
|
|
4
|
+
data.tar.gz: baf2344bb18263a50a0e6106918239a5c61f3879e003e8cb8a5f771e949f6089
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 295157174583b40728788a3ff63530e90bec65095500ce23666a582a8c61ddd1d036f906ff5b40f1d3419b656f3bd7830cd877aad65c89b5eb1ded0ce77fe404
|
|
7
|
+
data.tar.gz: 18895f9963e28778251ecf5850dc039d54c5b7bc85fa8f1c548c7f9990ae1e6cc5d5394e56b8bbbdeb491c71387311dc285ed997011ed6572fc65d1cd5cf0b58
|
|
@@ -108,7 +108,7 @@ module Braintree
|
|
|
108
108
|
|
|
109
109
|
def self._signature(type) # :nodoc:
|
|
110
110
|
billing_address_params = AddressGateway._shared_signature
|
|
111
|
-
options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method]
|
|
111
|
+
options = [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]
|
|
112
112
|
signature = [
|
|
113
113
|
:billing_address_id, :cardholder_name, :cvv, :device_session_id, :expiration_date,
|
|
114
114
|
:expiration_month, :expiration_year, :number, :token, :venmo_sdk_payment_method_code,
|
|
@@ -24,6 +24,7 @@ module Braintree
|
|
|
24
24
|
PostalCodeInvalidCharacters = "81813"
|
|
25
25
|
PostalCodeIsInvalid = "91826"
|
|
26
26
|
PostalCodeIsRequired = "81808"
|
|
27
|
+
PostalCodeIsRequiredForCardBrandAndProcessor = "81828"
|
|
27
28
|
PostalCodeIsTooLong = "81809"
|
|
28
29
|
RegionIsInvalid = "91825"
|
|
29
30
|
RegionIsTooLong = "81810"
|
|
@@ -407,6 +408,10 @@ module Braintree
|
|
|
407
408
|
ThreeDSecureCavvIsRequired = "915116"
|
|
408
409
|
ThreeDSecureXidIsRequired = "915115"
|
|
409
410
|
ThreeDSecureEciFlagIsInvalid = "915114"
|
|
411
|
+
ThreeDSecureThreeDSecureVersionIsInvalid = "915119"
|
|
412
|
+
ThreeDSecureAuthenticationResponseIsInvalid = "915120"
|
|
413
|
+
ThreeDSecureDirectoryResponseIsInvalid = "915121"
|
|
414
|
+
ThreeDSecureCavvAlgorithmIsInvalid = "915122"
|
|
410
415
|
ThreeDSecureMerchantAccountDoesNotSupportCardType = "915131"
|
|
411
416
|
TypeIsInvalid = "91523"
|
|
412
417
|
TypeIsRequired = "91524"
|
|
@@ -439,6 +444,16 @@ module Braintree
|
|
|
439
444
|
CheckOutDateIsInvalid = "93405"
|
|
440
445
|
CheckOutDateMustFollowCheckInDate = "93406"
|
|
441
446
|
UnknownDataField = "93407"
|
|
447
|
+
RoomRateMustBeGreaterThanZero = "93433"
|
|
448
|
+
RoomRateFormatIsInvalid = "93434"
|
|
449
|
+
RoomRateIsTooLarge = "93435"
|
|
450
|
+
RoomTaxMustBeGreaterThanZero = "93436"
|
|
451
|
+
RoomTaxFormatIsInvalid = "93437"
|
|
452
|
+
RoomTaxIsTooLarge = "93438"
|
|
453
|
+
NoShowIndicatorIsInvalid = "93439"
|
|
454
|
+
AdvancedDepositIndicatorIsInvalid = "93440"
|
|
455
|
+
FireSafetyIndicatorIsInvalid = "93441"
|
|
456
|
+
PropertyPhoneIsInvalid = "93442"
|
|
442
457
|
end
|
|
443
458
|
|
|
444
459
|
module TravelCruise
|
|
@@ -496,6 +511,15 @@ module Braintree
|
|
|
496
511
|
TicketNumberIsTooLong = "96320"
|
|
497
512
|
end
|
|
498
513
|
end
|
|
514
|
+
|
|
515
|
+
module AdditionalCharge
|
|
516
|
+
KindIsInvalid = "96601"
|
|
517
|
+
KindMustBeUnique = "96602"
|
|
518
|
+
AmountMustBeGreaterThanZero = "96603"
|
|
519
|
+
AmountFormatIsInvalid = "96604"
|
|
520
|
+
AmountIsTooLarge = "96605"
|
|
521
|
+
AmountIsRequired = "96606"
|
|
522
|
+
end
|
|
499
523
|
end
|
|
500
524
|
|
|
501
525
|
module ExternalVault
|
data/lib/braintree/test/nonce.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Braintree
|
|
|
6
6
|
PayPalOneTimePayment = "fake-paypal-one-time-nonce"
|
|
7
7
|
PayPalFuturePayment = "fake-paypal-future-nonce"
|
|
8
8
|
PayPalBillingAgreement = "fake-paypal-billing-agreement-nonce"
|
|
9
|
-
LocalPayment = "fake-local-payment-nonce"
|
|
9
|
+
LocalPayment = "fake-local-payment-method-nonce"
|
|
10
10
|
ApplePayVisa = "fake-apple-pay-visa-nonce"
|
|
11
11
|
ApplePayMasterCard = "fake-apple-pay-mastercard-nonce"
|
|
12
12
|
ApplePayAmEx = "fake-apple-pay-amex-nonce"
|
|
@@ -64,6 +64,17 @@ module Braintree
|
|
|
64
64
|
All = constants.map { |c| const_get(c) }
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
module AdditionalCharge
|
|
68
|
+
Restaurant = "restaurant"
|
|
69
|
+
GiftShop = "gift_shop"
|
|
70
|
+
MiniBar = "mini_bar"
|
|
71
|
+
Telephone = "telephone"
|
|
72
|
+
Laundry = "laundry"
|
|
73
|
+
Other = "other"
|
|
74
|
+
|
|
75
|
+
All = constants.map { |c| const_get(c) }
|
|
76
|
+
end
|
|
77
|
+
|
|
67
78
|
module Type # :nodoc:
|
|
68
79
|
Credit = "credit" # :nodoc:
|
|
69
80
|
Sale = "sale" # :nodoc:
|
|
@@ -3,11 +3,18 @@ module Braintree
|
|
|
3
3
|
class LocalPaymentDetails
|
|
4
4
|
include BaseModule
|
|
5
5
|
|
|
6
|
+
attr_reader :capture_id
|
|
6
7
|
attr_reader :custom_field
|
|
8
|
+
attr_reader :debug_id
|
|
7
9
|
attr_reader :description
|
|
8
10
|
attr_reader :funding_source
|
|
9
11
|
attr_reader :payer_id
|
|
10
12
|
attr_reader :payment_id
|
|
13
|
+
attr_reader :refund_from_transaction_fee_amount
|
|
14
|
+
attr_reader :refund_from_transaction_fee_currency_iso_code
|
|
15
|
+
attr_reader :refund_id
|
|
16
|
+
attr_reader :transaction_fee_amount
|
|
17
|
+
attr_reader :transaction_fee_currency_iso_code
|
|
11
18
|
|
|
12
19
|
def initialize(attributes)
|
|
13
20
|
set_instance_variables_from_hash attributes unless attributes.nil?
|
|
@@ -205,6 +205,11 @@ module Braintree
|
|
|
205
205
|
:eci_flag,
|
|
206
206
|
:cavv,
|
|
207
207
|
:xid,
|
|
208
|
+
:three_d_secure_version,
|
|
209
|
+
:authentication_response,
|
|
210
|
+
:directory_response,
|
|
211
|
+
:cavv_algorithm,
|
|
212
|
+
:ds_transaction_id,
|
|
208
213
|
]
|
|
209
214
|
},
|
|
210
215
|
{:options => [
|
|
@@ -237,13 +242,16 @@ module Braintree
|
|
|
237
242
|
{:industry => [
|
|
238
243
|
:industry_type,
|
|
239
244
|
{:data => [
|
|
240
|
-
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate,
|
|
245
|
+
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
|
241
246
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
|
242
|
-
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket,
|
|
247
|
+
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone,
|
|
243
248
|
{:legs => [
|
|
244
249
|
:conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
|
|
245
250
|
:arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
|
|
246
251
|
]},
|
|
252
|
+
{:additional_charges => [
|
|
253
|
+
:kind, :amount,
|
|
254
|
+
]},
|
|
247
255
|
]},
|
|
248
256
|
]},
|
|
249
257
|
{:apple_pay_card => [:number, :cardholder_name, :cryptogram, :expiration_month, :expiration_year, :eci_indicator]},
|
data/lib/braintree/version.rb
CHANGED
|
@@ -550,6 +550,75 @@ describe Braintree::CreditCard do
|
|
|
550
550
|
credit_card.card_type.should == Braintree::CreditCard::CardType::Elo
|
|
551
551
|
end
|
|
552
552
|
end
|
|
553
|
+
|
|
554
|
+
context "verification_account_type" do
|
|
555
|
+
it "verifies card with account_type debit" do
|
|
556
|
+
customer = Braintree::Customer.create!
|
|
557
|
+
result = Braintree::CreditCard.create(
|
|
558
|
+
:customer_id => customer.id,
|
|
559
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
560
|
+
:expiration_month => "11",
|
|
561
|
+
:expiration_year => "2099",
|
|
562
|
+
:options => {
|
|
563
|
+
:verify_card => true,
|
|
564
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
565
|
+
:verification_account_type => "debit",
|
|
566
|
+
}
|
|
567
|
+
)
|
|
568
|
+
|
|
569
|
+
expect(result).to be_success
|
|
570
|
+
end
|
|
571
|
+
|
|
572
|
+
it "verifies card with account_type credit" do
|
|
573
|
+
customer = Braintree::Customer.create!
|
|
574
|
+
result = Braintree::CreditCard.create(
|
|
575
|
+
:customer_id => customer.id,
|
|
576
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
577
|
+
:expiration_month => "11",
|
|
578
|
+
:expiration_year => "2099",
|
|
579
|
+
:options => {
|
|
580
|
+
:verify_card => true,
|
|
581
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
582
|
+
:verification_account_type => "credit",
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
expect(result).to be_success
|
|
587
|
+
end
|
|
588
|
+
|
|
589
|
+
it "errors with invalid account_type" do
|
|
590
|
+
customer = Braintree::Customer.create!
|
|
591
|
+
result = Braintree::CreditCard.create(
|
|
592
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
593
|
+
:expiration_month => "11",
|
|
594
|
+
:expiration_year => "2099",
|
|
595
|
+
:options => {
|
|
596
|
+
:verify_card => true,
|
|
597
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
598
|
+
:verification_account_type => "ach",
|
|
599
|
+
}
|
|
600
|
+
)
|
|
601
|
+
|
|
602
|
+
expect(result).to_not be_success
|
|
603
|
+
expect(result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq Braintree::ErrorCodes::CreditCard::VerificationAccountTypeIsInvalid
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
it "errors when account_type not supported by merchant" do
|
|
607
|
+
customer = Braintree::Customer.create!
|
|
608
|
+
result = Braintree::CreditCard.create(
|
|
609
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
610
|
+
:expiration_month => "11",
|
|
611
|
+
:expiration_year => "2099",
|
|
612
|
+
:options => {
|
|
613
|
+
:verify_card => true,
|
|
614
|
+
:verification_account_type => "credit",
|
|
615
|
+
}
|
|
616
|
+
)
|
|
617
|
+
|
|
618
|
+
expect(result).to_not be_success
|
|
619
|
+
expect(result.errors.for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq Braintree::ErrorCodes::CreditCard::VerificationAccountTypeNotSupported
|
|
620
|
+
end
|
|
621
|
+
end
|
|
553
622
|
end
|
|
554
623
|
|
|
555
624
|
describe "self.create!" do
|
|
@@ -937,6 +1006,44 @@ describe Braintree::CreditCard do
|
|
|
937
1006
|
Braintree::CreditCard.find(card1.token).should_not be_default
|
|
938
1007
|
Braintree::CreditCard.find(card2.token).should be_default
|
|
939
1008
|
end
|
|
1009
|
+
|
|
1010
|
+
context "verification_account_type" do
|
|
1011
|
+
it "updates the credit card with account_type credit" do
|
|
1012
|
+
customer = Braintree::Customer.create!
|
|
1013
|
+
card = Braintree::CreditCard.create(
|
|
1014
|
+
:customer_id => customer.id,
|
|
1015
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
1016
|
+
:expiration_date => "06/2013",
|
|
1017
|
+
).credit_card
|
|
1018
|
+
update_result = Braintree::CreditCard.update(
|
|
1019
|
+
card.token,
|
|
1020
|
+
:options => {
|
|
1021
|
+
:verify_card => true,
|
|
1022
|
+
:verification_account_type => "credit",
|
|
1023
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
1024
|
+
},
|
|
1025
|
+
)
|
|
1026
|
+
expect(update_result).to be_success
|
|
1027
|
+
end
|
|
1028
|
+
|
|
1029
|
+
it "updates the credit card with account_type debit" do
|
|
1030
|
+
customer = Braintree::Customer.create!
|
|
1031
|
+
card = Braintree::CreditCard.create(
|
|
1032
|
+
:customer_id => customer.id,
|
|
1033
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
1034
|
+
:expiration_date => "06/2013",
|
|
1035
|
+
).credit_card
|
|
1036
|
+
update_result = Braintree::CreditCard.update(
|
|
1037
|
+
card.token,
|
|
1038
|
+
:options => {
|
|
1039
|
+
:verify_card => true,
|
|
1040
|
+
:verification_account_type => "debit",
|
|
1041
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
1042
|
+
},
|
|
1043
|
+
)
|
|
1044
|
+
expect(update_result).to be_success
|
|
1045
|
+
end
|
|
1046
|
+
end
|
|
940
1047
|
end
|
|
941
1048
|
|
|
942
1049
|
describe "self.update!" do
|
|
@@ -496,6 +496,97 @@ describe Braintree::Customer do
|
|
|
496
496
|
|
|
497
497
|
result.success?.should == true
|
|
498
498
|
end
|
|
499
|
+
|
|
500
|
+
context "verification_account_type" do
|
|
501
|
+
it "verifies card with account_type debit" do
|
|
502
|
+
nonce = nonce_for_new_payment_method(
|
|
503
|
+
:credit_card => {
|
|
504
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
505
|
+
:expiration_month => "11",
|
|
506
|
+
:expiration_year => "2099",
|
|
507
|
+
}
|
|
508
|
+
)
|
|
509
|
+
result = Braintree::Customer.create(
|
|
510
|
+
:payment_method_nonce => nonce,
|
|
511
|
+
:credit_card => {
|
|
512
|
+
:options => {
|
|
513
|
+
:verify_card => true,
|
|
514
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
515
|
+
:verification_account_type => "debit",
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
)
|
|
519
|
+
|
|
520
|
+
expect(result).to be_success
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
it "verifies card with account_type credit" do
|
|
524
|
+
nonce = nonce_for_new_payment_method(
|
|
525
|
+
:credit_card => {
|
|
526
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
527
|
+
:expiration_month => "11",
|
|
528
|
+
:expiration_year => "2099",
|
|
529
|
+
}
|
|
530
|
+
)
|
|
531
|
+
result = Braintree::Customer.create(
|
|
532
|
+
:payment_method_nonce => nonce,
|
|
533
|
+
:credit_card => {
|
|
534
|
+
:options => {
|
|
535
|
+
:verify_card => true,
|
|
536
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
537
|
+
:verification_account_type => "credit",
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
|
|
542
|
+
expect(result).to be_success
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
it "errors with invalid account_type" do
|
|
546
|
+
nonce = nonce_for_new_payment_method(
|
|
547
|
+
:credit_card => {
|
|
548
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
549
|
+
:expiration_month => "11",
|
|
550
|
+
:expiration_year => "2099",
|
|
551
|
+
}
|
|
552
|
+
)
|
|
553
|
+
result = Braintree::Customer.create(
|
|
554
|
+
:payment_method_nonce => nonce,
|
|
555
|
+
:credit_card => {
|
|
556
|
+
:options => {
|
|
557
|
+
:verify_card => true,
|
|
558
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
559
|
+
:verification_account_type => "ach",
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
)
|
|
563
|
+
|
|
564
|
+
expect(result).to_not be_success
|
|
565
|
+
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq Braintree::ErrorCodes::CreditCard::VerificationAccountTypeIsInvalid
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
it "errors when account_type not supported by merchant" do
|
|
569
|
+
nonce = nonce_for_new_payment_method(
|
|
570
|
+
:credit_card => {
|
|
571
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
572
|
+
:expiration_month => "11",
|
|
573
|
+
:expiration_year => "2099",
|
|
574
|
+
}
|
|
575
|
+
)
|
|
576
|
+
result = Braintree::Customer.create(
|
|
577
|
+
:payment_method_nonce => nonce,
|
|
578
|
+
:credit_card => {
|
|
579
|
+
:options => {
|
|
580
|
+
:verify_card => true,
|
|
581
|
+
:verification_account_type => "credit",
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
)
|
|
585
|
+
|
|
586
|
+
expect(result).to_not be_success
|
|
587
|
+
expect(result.errors.for(:customer).for(:credit_card).for(:options).on(:verification_account_type)[0].code).to eq Braintree::ErrorCodes::CreditCard::VerificationAccountTypeNotSupported
|
|
588
|
+
end
|
|
589
|
+
end
|
|
499
590
|
end
|
|
500
591
|
|
|
501
592
|
describe "self.create!" do
|
|
@@ -1251,6 +1342,46 @@ describe Braintree::Customer do
|
|
|
1251
1342
|
result.success?.should == false
|
|
1252
1343
|
result.errors.for(:customer).on(:email)[0].message.should == "Email is an invalid format."
|
|
1253
1344
|
end
|
|
1345
|
+
|
|
1346
|
+
context "verification_account_type" do
|
|
1347
|
+
it "updates the credit card with account_type credit" do
|
|
1348
|
+
customer = Braintree::Customer.create!
|
|
1349
|
+
update_result = Braintree::Customer.update(
|
|
1350
|
+
customer.id,
|
|
1351
|
+
:credit_card => {
|
|
1352
|
+
:cardholder_name => "New Holder",
|
|
1353
|
+
:cvv => "456",
|
|
1354
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
1355
|
+
:expiration_date => "06/2013",
|
|
1356
|
+
:options => {
|
|
1357
|
+
:verify_card => true,
|
|
1358
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
1359
|
+
:verification_account_type => "credit",
|
|
1360
|
+
},
|
|
1361
|
+
}
|
|
1362
|
+
)
|
|
1363
|
+
expect(update_result).to be_success
|
|
1364
|
+
end
|
|
1365
|
+
|
|
1366
|
+
it "updates the credit card with account_type debit" do
|
|
1367
|
+
customer = Braintree::Customer.create!
|
|
1368
|
+
update_result = Braintree::Customer.update(
|
|
1369
|
+
customer.id,
|
|
1370
|
+
:credit_card => {
|
|
1371
|
+
:cardholder_name => "New Holder",
|
|
1372
|
+
:cvv => "456",
|
|
1373
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
1374
|
+
:expiration_date => "06/2013",
|
|
1375
|
+
:options => {
|
|
1376
|
+
:verify_card => true,
|
|
1377
|
+
:verification_merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
1378
|
+
:verification_account_type => "debit",
|
|
1379
|
+
},
|
|
1380
|
+
}
|
|
1381
|
+
)
|
|
1382
|
+
expect(update_result).to be_success
|
|
1383
|
+
end
|
|
1384
|
+
end
|
|
1254
1385
|
end
|
|
1255
1386
|
|
|
1256
1387
|
describe "self.update!" do
|
|
@@ -83,6 +83,17 @@ describe Braintree::PaymentMethodNonce do
|
|
|
83
83
|
nonce.details.fetch(:card_type).should == "Visa"
|
|
84
84
|
end
|
|
85
85
|
|
|
86
|
+
it "return paypal details if details exist" do
|
|
87
|
+
result = Braintree::PaymentMethodNonce.find("fake-google-pay-paypal-nonce")
|
|
88
|
+
|
|
89
|
+
nonce = result.payment_method_nonce
|
|
90
|
+
|
|
91
|
+
nonce.details.fetch(:payer_info).fetch(:first_name).should_not be_nil
|
|
92
|
+
nonce.details.fetch(:payer_info).fetch(:last_name).should_not be_nil
|
|
93
|
+
nonce.details.fetch(:payer_info).fetch(:email).should_not be_nil
|
|
94
|
+
nonce.details.fetch(:payer_info).fetch(:payer_id).should_not be_nil
|
|
95
|
+
end
|
|
96
|
+
|
|
86
97
|
it "return venmo details if details exist" do
|
|
87
98
|
result = Braintree::PaymentMethodNonce.find("fake-venmo-account-nonce")
|
|
88
99
|
|
|
@@ -162,7 +162,7 @@ describe Braintree::Transaction do
|
|
|
162
162
|
it "accepts valid industry data" do
|
|
163
163
|
result = Braintree::Transaction.create(
|
|
164
164
|
:type => "sale",
|
|
165
|
-
:amount =>
|
|
165
|
+
:amount => 1000_00,
|
|
166
166
|
:credit_card => {
|
|
167
167
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
|
168
168
|
:expiration_date => "05/2009"
|
|
@@ -172,8 +172,23 @@ describe Braintree::Transaction do
|
|
|
172
172
|
:data => {
|
|
173
173
|
:folio_number => "ABCDEFG",
|
|
174
174
|
:check_in_date => "2014-06-01",
|
|
175
|
-
:check_out_date => "2014-06-
|
|
176
|
-
:room_rate =>
|
|
175
|
+
:check_out_date => "2014-06-05",
|
|
176
|
+
:room_rate => 170_00,
|
|
177
|
+
:room_tax => 30_00,
|
|
178
|
+
:no_show => false,
|
|
179
|
+
:advanced_deposit => false,
|
|
180
|
+
:fire_safe => true,
|
|
181
|
+
:property_phone => "1112223345",
|
|
182
|
+
:additional_charges => [
|
|
183
|
+
{
|
|
184
|
+
:kind => Braintree::Transaction::AdditionalCharge::Telephone,
|
|
185
|
+
:amount => 50_00,
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
:kind => Braintree::Transaction::AdditionalCharge::Other,
|
|
189
|
+
:amount => 150_00,
|
|
190
|
+
},
|
|
191
|
+
],
|
|
177
192
|
}
|
|
178
193
|
}
|
|
179
194
|
)
|
|
@@ -183,7 +198,7 @@ describe Braintree::Transaction do
|
|
|
183
198
|
it "returns errors if validations on industry lodging data fails" do
|
|
184
199
|
result = Braintree::Transaction.create(
|
|
185
200
|
:type => "sale",
|
|
186
|
-
:amount =>
|
|
201
|
+
:amount => 500_00,
|
|
187
202
|
:credit_card => {
|
|
188
203
|
:number => Braintree::Test::CreditCardNumbers::CardTypeIndicators::Prepaid,
|
|
189
204
|
:expiration_date => "05/2009"
|
|
@@ -195,13 +210,22 @@ describe Braintree::Transaction do
|
|
|
195
210
|
:check_in_date => "2014-06-30",
|
|
196
211
|
:check_out_date => "2014-06-01",
|
|
197
212
|
:room_rate => "asdfasdf",
|
|
213
|
+
:additional_charges => [
|
|
214
|
+
{
|
|
215
|
+
:kind => "unknown",
|
|
216
|
+
:amount => 20_00,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
198
219
|
}
|
|
199
220
|
}
|
|
200
221
|
)
|
|
201
222
|
result.success?.should be(false)
|
|
202
223
|
invalid_folio = Braintree::ErrorCodes::Transaction::Industry::Lodging::FolioNumberIsInvalid
|
|
203
224
|
check_out_date_must_follow_check_in_date = Braintree::ErrorCodes::Transaction::Industry::Lodging::CheckOutDateMustFollowCheckInDate
|
|
204
|
-
|
|
225
|
+
room_rate_format_is_invalid = Braintree::ErrorCodes::Transaction::Industry::Lodging::RoomRateFormatIsInvalid
|
|
226
|
+
invalid_additional_charge_kind = Braintree::ErrorCodes::Transaction::Industry::AdditionalCharge::KindIsInvalid
|
|
227
|
+
result.errors.for(:transaction).for(:industry).map { |e| e.code }.sort.should include *[invalid_folio, check_out_date_must_follow_check_in_date, room_rate_format_is_invalid]
|
|
228
|
+
result.errors.for(:transaction).for(:industry).for(:additional_charges).for(:index_0).on(:kind).map { |e| e.code }.sort.should include *[invalid_additional_charge_kind]
|
|
205
229
|
end
|
|
206
230
|
end
|
|
207
231
|
|
|
@@ -1148,9 +1172,9 @@ describe Braintree::Transaction do
|
|
|
1148
1172
|
result = Braintree::Transaction.sale(
|
|
1149
1173
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1150
1174
|
:credit_card => {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1175
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1176
|
+
:expiration_date => "05/2009"
|
|
1177
|
+
},
|
|
1154
1178
|
:tax_amount => 'abcd'
|
|
1155
1179
|
)
|
|
1156
1180
|
result.success?.should == false
|
|
@@ -1161,9 +1185,9 @@ describe Braintree::Transaction do
|
|
|
1161
1185
|
result = Braintree::Transaction.sale(
|
|
1162
1186
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1163
1187
|
:credit_card => {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1188
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1189
|
+
:expiration_date => "05/2009"
|
|
1190
|
+
},
|
|
1167
1191
|
:purchase_order_number => 'a' * 18
|
|
1168
1192
|
)
|
|
1169
1193
|
result.success?.should == false
|
|
@@ -1174,9 +1198,9 @@ describe Braintree::Transaction do
|
|
|
1174
1198
|
result = Braintree::Transaction.sale(
|
|
1175
1199
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1176
1200
|
:credit_card => {
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1201
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
1202
|
+
:expiration_date => "05/2009"
|
|
1203
|
+
},
|
|
1180
1204
|
:purchase_order_number => "\303\237\303\245\342\210\202"
|
|
1181
1205
|
)
|
|
1182
1206
|
result.success?.should == false
|
|
@@ -2113,6 +2137,11 @@ describe Braintree::Transaction do
|
|
|
2113
2137
|
:eci_flag => "02",
|
|
2114
2138
|
:cavv => "some_cavv",
|
|
2115
2139
|
:xid => "some_xid",
|
|
2140
|
+
:three_d_secure_version => "1.0.2",
|
|
2141
|
+
:authentication_response => "Y",
|
|
2142
|
+
:directory_response => "Y",
|
|
2143
|
+
:cavv_algorithm => "2",
|
|
2144
|
+
:ds_transaction_id => "some_ds_id",
|
|
2116
2145
|
}
|
|
2117
2146
|
)
|
|
2118
2147
|
|
|
@@ -2133,6 +2162,11 @@ describe Braintree::Transaction do
|
|
|
2133
2162
|
:eci_flag => "02",
|
|
2134
2163
|
:cavv => "some_cavv",
|
|
2135
2164
|
:xid => "some_xid",
|
|
2165
|
+
:three_d_secure_version => "1.0.2",
|
|
2166
|
+
:authentication_response => "Y",
|
|
2167
|
+
:directory_response => "Y",
|
|
2168
|
+
:cavv_algorithm => "2",
|
|
2169
|
+
:ds_transaction_id => "some_ds_id",
|
|
2136
2170
|
}
|
|
2137
2171
|
)
|
|
2138
2172
|
result.success?.should == false
|
|
@@ -2169,6 +2203,11 @@ describe Braintree::Transaction do
|
|
|
2169
2203
|
:eci_flag => "05",
|
|
2170
2204
|
:cavv => "",
|
|
2171
2205
|
:xid => "",
|
|
2206
|
+
:three_d_secure_version => "1.0.2",
|
|
2207
|
+
:authentication_response => "Y",
|
|
2208
|
+
:directory_response => "Y",
|
|
2209
|
+
:cavv_algorithm => "2",
|
|
2210
|
+
:ds_transaction_id => "some_ds_id",
|
|
2172
2211
|
}
|
|
2173
2212
|
)
|
|
2174
2213
|
result.success?.should == false
|
|
@@ -2187,13 +2226,111 @@ describe Braintree::Transaction do
|
|
|
2187
2226
|
:eci_flag => "bad_eci_flag",
|
|
2188
2227
|
:cavv => "some_cavv",
|
|
2189
2228
|
:xid => "some_xid",
|
|
2229
|
+
:three_d_secure_version => "1.0.2",
|
|
2230
|
+
:authentication_response => "Y",
|
|
2231
|
+
:directory_response => "Y",
|
|
2232
|
+
:cavv_algorithm => "2",
|
|
2233
|
+
:ds_transaction_id => "some_ds_id",
|
|
2190
2234
|
}
|
|
2191
2235
|
)
|
|
2192
2236
|
result.success?.should == false
|
|
2193
2237
|
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:eci_flag)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureEciFlagIsInvalid
|
|
2194
2238
|
end
|
|
2195
2239
|
|
|
2240
|
+
it "returns an error for transaction when the three_d_secure_pass_thru three_d_secure_version is invalid" do
|
|
2241
|
+
result = Braintree::Transaction.create(
|
|
2242
|
+
:type => "sale",
|
|
2243
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2244
|
+
:credit_card => {
|
|
2245
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2246
|
+
:expiration_date => "12/12",
|
|
2247
|
+
},
|
|
2248
|
+
:three_d_secure_pass_thru => {
|
|
2249
|
+
:eci_flag => "02",
|
|
2250
|
+
:cavv => "some_cavv",
|
|
2251
|
+
:xid => "some_xid",
|
|
2252
|
+
:three_d_secure_version => "invalid",
|
|
2253
|
+
:authentication_response => "Y",
|
|
2254
|
+
:directory_response => "Y",
|
|
2255
|
+
:cavv_algorithm => "2",
|
|
2256
|
+
:ds_transaction_id => "some_ds_id",
|
|
2257
|
+
}
|
|
2258
|
+
)
|
|
2259
|
+
result.success?.should == false
|
|
2260
|
+
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:three_d_secure_version)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureThreeDSecureVersionIsInvalid
|
|
2261
|
+
end
|
|
2196
2262
|
|
|
2263
|
+
it "returns an error for transaction when the three_d_secure_pass_thru authentication_response is invalid" do
|
|
2264
|
+
result = Braintree::Transaction.create(
|
|
2265
|
+
:type => "sale",
|
|
2266
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2267
|
+
:merchant_account_id => SpecHelper:: AdyenMerchantAccountId,
|
|
2268
|
+
:credit_card => {
|
|
2269
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2270
|
+
:expiration_date => "12/12",
|
|
2271
|
+
},
|
|
2272
|
+
:three_d_secure_pass_thru => {
|
|
2273
|
+
:eci_flag => "02",
|
|
2274
|
+
:cavv => "some_cavv",
|
|
2275
|
+
:xid => "some_xid",
|
|
2276
|
+
:three_d_secure_version => "1.0.2",
|
|
2277
|
+
:authentication_response => "asdf",
|
|
2278
|
+
:directory_response => "Y",
|
|
2279
|
+
:cavv_algorithm => "2",
|
|
2280
|
+
:ds_transaction_id => "some_ds_id",
|
|
2281
|
+
}
|
|
2282
|
+
)
|
|
2283
|
+
result.success?.should == false
|
|
2284
|
+
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:authentication_response)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureAuthenticationResponseIsInvalid
|
|
2285
|
+
end
|
|
2286
|
+
|
|
2287
|
+
it "returns an error for transaction when the three_d_secure_pass_thru directory_response is invalid" do
|
|
2288
|
+
result = Braintree::Transaction.create(
|
|
2289
|
+
:type => "sale",
|
|
2290
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2291
|
+
:merchant_account_id => SpecHelper:: AdyenMerchantAccountId,
|
|
2292
|
+
:credit_card => {
|
|
2293
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2294
|
+
:expiration_date => "12/12",
|
|
2295
|
+
},
|
|
2296
|
+
:three_d_secure_pass_thru => {
|
|
2297
|
+
:eci_flag => "02",
|
|
2298
|
+
:cavv => "some_cavv",
|
|
2299
|
+
:xid => "some_xid",
|
|
2300
|
+
:three_d_secure_version => "1.0.2",
|
|
2301
|
+
:authentication_response => "Y",
|
|
2302
|
+
:directory_response => "abc",
|
|
2303
|
+
:cavv_algorithm => "2",
|
|
2304
|
+
:ds_transaction_id => "some_ds_id",
|
|
2305
|
+
}
|
|
2306
|
+
)
|
|
2307
|
+
result.success?.should == false
|
|
2308
|
+
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:directory_response)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureDirectoryResponseIsInvalid
|
|
2309
|
+
end
|
|
2310
|
+
|
|
2311
|
+
it "returns an error for transaction when the three_d_secure_pass_thru cavv_algorithm is invalid" do
|
|
2312
|
+
result = Braintree::Transaction.create(
|
|
2313
|
+
:type => "sale",
|
|
2314
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2315
|
+
:merchant_account_id => SpecHelper:: AdyenMerchantAccountId,
|
|
2316
|
+
:credit_card => {
|
|
2317
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2318
|
+
:expiration_date => "12/12",
|
|
2319
|
+
},
|
|
2320
|
+
:three_d_secure_pass_thru => {
|
|
2321
|
+
:eci_flag => "02",
|
|
2322
|
+
:cavv => "some_cavv",
|
|
2323
|
+
:xid => "some_xid",
|
|
2324
|
+
:three_d_secure_version => "1.0.2",
|
|
2325
|
+
:authentication_response => "Y",
|
|
2326
|
+
:directory_response => "Y",
|
|
2327
|
+
:cavv_algorithm => "bad_alg",
|
|
2328
|
+
:ds_transaction_id => "some_ds_id",
|
|
2329
|
+
}
|
|
2330
|
+
)
|
|
2331
|
+
result.success?.should == false
|
|
2332
|
+
result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:cavv_algorithm)[0].code.should == Braintree::ErrorCodes::Transaction::ThreeDSecureCavvAlgorithmIsInvalid
|
|
2333
|
+
end
|
|
2197
2334
|
end
|
|
2198
2335
|
|
|
2199
2336
|
context "paypal" do
|
|
@@ -2275,6 +2412,9 @@ describe Braintree::Transaction do
|
|
|
2275
2412
|
result.transaction.local_payment_details.should_not be_nil
|
|
2276
2413
|
result.transaction.local_payment_details.funding_source.should_not be_nil
|
|
2277
2414
|
result.transaction.local_payment_details.payment_id.should_not be_nil
|
|
2415
|
+
result.transaction.local_payment_details.capture_id.should_not be_nil
|
|
2416
|
+
result.transaction.local_payment_details.transaction_fee_amount.should_not be_nil
|
|
2417
|
+
result.transaction.local_payment_details.transaction_fee_currency_iso_code.should_not be_nil
|
|
2278
2418
|
end
|
|
2279
2419
|
end
|
|
2280
2420
|
|
|
@@ -3941,118 +4081,118 @@ describe Braintree::Transaction do
|
|
|
3941
4081
|
|
|
3942
4082
|
context "account_type" do
|
|
3943
4083
|
it "creates a Hiper transaction with account type credit" do
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
4084
|
+
result = Braintree::Transaction.create(
|
|
4085
|
+
:type => "sale",
|
|
4086
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
4087
|
+
:credit_card => {
|
|
4088
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
4089
|
+
:expiration_date => "05/2009"
|
|
4090
|
+
},
|
|
4091
|
+
:amount => "10.00",
|
|
4092
|
+
:options => {
|
|
3947
4093
|
:credit_card => {
|
|
3948
|
-
:
|
|
3949
|
-
:expiration_date => "05/2009"
|
|
3950
|
-
},
|
|
3951
|
-
:amount => "10.00",
|
|
3952
|
-
:options => {
|
|
3953
|
-
:credit_card => {
|
|
3954
|
-
:account_type => "credit",
|
|
3955
|
-
}
|
|
4094
|
+
:account_type => "credit",
|
|
3956
4095
|
}
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
4096
|
+
}
|
|
4097
|
+
)
|
|
4098
|
+
result.success?.should == true
|
|
4099
|
+
result.transaction.credit_card_details.account_type.should == "credit"
|
|
4100
|
+
end
|
|
3961
4101
|
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
4102
|
+
it "creates a Hipercard transaction with account_type credit" do
|
|
4103
|
+
result = Braintree::Transaction.create(
|
|
4104
|
+
:type => "sale",
|
|
4105
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
4106
|
+
:credit_card => {
|
|
4107
|
+
:number => Braintree::Test::CreditCardNumbers::Hipercard,
|
|
4108
|
+
:expiration_date => "05/2009"
|
|
4109
|
+
},
|
|
4110
|
+
:amount => "10.00",
|
|
4111
|
+
:options => {
|
|
3966
4112
|
:credit_card => {
|
|
3967
|
-
:
|
|
3968
|
-
:expiration_date => "05/2009"
|
|
3969
|
-
},
|
|
3970
|
-
:amount => "10.00",
|
|
3971
|
-
:options => {
|
|
3972
|
-
:credit_card => {
|
|
3973
|
-
:account_type => "credit",
|
|
3974
|
-
}
|
|
4113
|
+
:account_type => "credit",
|
|
3975
4114
|
}
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4115
|
+
}
|
|
4116
|
+
)
|
|
4117
|
+
result.success?.should == true
|
|
4118
|
+
result.transaction.credit_card_details.account_type.should == "credit"
|
|
4119
|
+
end
|
|
3980
4120
|
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
4121
|
+
it "creates a Hiper transaction with account_type debit" do
|
|
4122
|
+
result = Braintree::Transaction.create(
|
|
4123
|
+
:type => "sale",
|
|
4124
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
4125
|
+
:credit_card => {
|
|
4126
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
4127
|
+
:expiration_date => "05/2009"
|
|
4128
|
+
},
|
|
4129
|
+
:amount => "10.00",
|
|
4130
|
+
:options => {
|
|
3985
4131
|
:credit_card => {
|
|
3986
|
-
:
|
|
3987
|
-
:expiration_date => "05/2009"
|
|
4132
|
+
:account_type => "debit",
|
|
3988
4133
|
},
|
|
3989
|
-
:
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
}
|
|
3996
|
-
)
|
|
3997
|
-
result.success?.should == true
|
|
3998
|
-
result.transaction.credit_card_details.account_type.should == "debit"
|
|
3999
|
-
end
|
|
4134
|
+
:submit_for_settlement => true,
|
|
4135
|
+
}
|
|
4136
|
+
)
|
|
4137
|
+
result.success?.should == true
|
|
4138
|
+
result.transaction.credit_card_details.account_type.should == "debit"
|
|
4139
|
+
end
|
|
4000
4140
|
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4141
|
+
it "does not allow auths with account_type debit" do
|
|
4142
|
+
result = Braintree::Transaction.create(
|
|
4143
|
+
:type => "sale",
|
|
4144
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
4145
|
+
:credit_card => {
|
|
4146
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
4147
|
+
:expiration_date => "05/2009"
|
|
4148
|
+
},
|
|
4149
|
+
:amount => "10.00",
|
|
4150
|
+
:options => {
|
|
4005
4151
|
:credit_card => {
|
|
4006
|
-
:
|
|
4007
|
-
:expiration_date => "05/2009"
|
|
4152
|
+
:account_type => "debit",
|
|
4008
4153
|
},
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
}
|
|
4015
|
-
)
|
|
4016
|
-
result.success?.should == false
|
|
4017
|
-
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeDebitDoesNotSupportAuths
|
|
4018
|
-
end
|
|
4154
|
+
}
|
|
4155
|
+
)
|
|
4156
|
+
result.success?.should == false
|
|
4157
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeDebitDoesNotSupportAuths
|
|
4158
|
+
end
|
|
4019
4159
|
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4160
|
+
it "does not allow invalid account_type" do
|
|
4161
|
+
result = Braintree::Transaction.create(
|
|
4162
|
+
:type => "sale",
|
|
4163
|
+
:merchant_account_id => SpecHelper::HiperBRLMerchantAccountId,
|
|
4164
|
+
:credit_card => {
|
|
4165
|
+
:number => Braintree::Test::CreditCardNumbers::Hiper,
|
|
4166
|
+
:expiration_date => "05/2009"
|
|
4167
|
+
},
|
|
4168
|
+
:amount => "10.00",
|
|
4169
|
+
:options => {
|
|
4024
4170
|
:credit_card => {
|
|
4025
|
-
:
|
|
4026
|
-
:expiration_date => "05/2009"
|
|
4171
|
+
:account_type => "ach",
|
|
4027
4172
|
},
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
}
|
|
4034
|
-
)
|
|
4035
|
-
result.success?.should == false
|
|
4036
|
-
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeIsInvalid
|
|
4037
|
-
end
|
|
4173
|
+
}
|
|
4174
|
+
)
|
|
4175
|
+
result.success?.should == false
|
|
4176
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeIsInvalid
|
|
4177
|
+
end
|
|
4038
4178
|
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4179
|
+
it "does not allow account_type not supported by merchant" do
|
|
4180
|
+
result = Braintree::Transaction.create(
|
|
4181
|
+
:type => "sale",
|
|
4182
|
+
:credit_card => {
|
|
4183
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
4184
|
+
:expiration_date => "05/2009"
|
|
4185
|
+
},
|
|
4186
|
+
:amount => "10.00",
|
|
4187
|
+
:options => {
|
|
4042
4188
|
:credit_card => {
|
|
4043
|
-
:
|
|
4044
|
-
:expiration_date => "05/2009"
|
|
4189
|
+
:account_type => "credit",
|
|
4045
4190
|
},
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
}
|
|
4052
|
-
)
|
|
4053
|
-
result.success?.should == false
|
|
4054
|
-
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeNotSupported
|
|
4055
|
-
end
|
|
4191
|
+
}
|
|
4192
|
+
)
|
|
4193
|
+
result.success?.should == false
|
|
4194
|
+
result.errors.for(:transaction).for(:options).for(:credit_card).on(:account_type)[0].code.should == Braintree::ErrorCodes::Transaction::Options::CreditCard::AccountTypeNotSupported
|
|
4195
|
+
end
|
|
4056
4196
|
end
|
|
4057
4197
|
end
|
|
4058
4198
|
|
|
@@ -4843,11 +4983,11 @@ describe Braintree::Transaction do
|
|
|
4843
4983
|
)
|
|
4844
4984
|
|
|
4845
4985
|
options = {
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4986
|
+
:descriptor => {
|
|
4987
|
+
:name => '123*123456789012345678',
|
|
4988
|
+
:phone => '3334445555',
|
|
4989
|
+
:url => "ebay.com"
|
|
4990
|
+
}
|
|
4851
4991
|
}
|
|
4852
4992
|
|
|
4853
4993
|
result = Braintree::Transaction.submit_for_settlement(transaction.id, nil, options)
|
data/spec/spec_helper.rb
CHANGED
|
@@ -25,7 +25,7 @@ describe Braintree::CreditCard do
|
|
|
25
25
|
:device_data,
|
|
26
26
|
:fraud_merchant_id,
|
|
27
27
|
:payment_method_nonce,
|
|
28
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method]},
|
|
28
|
+
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
|
29
29
|
{:billing_address => [
|
|
30
30
|
:company,
|
|
31
31
|
:country_code_alpha2,
|
|
@@ -61,7 +61,7 @@ describe Braintree::CreditCard do
|
|
|
61
61
|
:device_data,
|
|
62
62
|
:fraud_merchant_id,
|
|
63
63
|
:payment_method_nonce,
|
|
64
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method]},
|
|
64
|
+
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
|
65
65
|
{:billing_address => [
|
|
66
66
|
:company,
|
|
67
67
|
:country_code_alpha2,
|
|
@@ -101,7 +101,7 @@ describe Braintree::Customer do
|
|
|
101
101
|
:device_data,
|
|
102
102
|
:fraud_merchant_id,
|
|
103
103
|
:payment_method_nonce,
|
|
104
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method]},
|
|
104
|
+
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
|
105
105
|
{:billing_address => [
|
|
106
106
|
:company,
|
|
107
107
|
:country_code_alpha2,
|
|
@@ -186,6 +186,7 @@ describe Braintree::Customer do
|
|
|
186
186
|
:verification_amount,
|
|
187
187
|
:venmo_sdk_session,
|
|
188
188
|
:fail_on_duplicate_payment_method,
|
|
189
|
+
:verification_account_type,
|
|
189
190
|
:update_existing_token
|
|
190
191
|
]},
|
|
191
192
|
{:billing_address => [
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: braintree
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.97.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Braintree
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-06-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -318,7 +318,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
318
318
|
- !ruby/object:Gem::Version
|
|
319
319
|
version: '0'
|
|
320
320
|
requirements: []
|
|
321
|
-
rubygems_version: 3.0.
|
|
321
|
+
rubygems_version: 3.0.4
|
|
322
322
|
signing_key:
|
|
323
323
|
specification_version: 4
|
|
324
324
|
summary: Braintree Gateway Ruby Client Library
|