braintree 4.38.0 → 4.40.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/address_gateway.rb +13 -3
- data/lib/braintree/credit_card_gateway.rb +1 -0
- data/lib/braintree/credit_card_verification_gateway.rb +1 -0
- data/lib/braintree/dispute_gateway.rb +7 -7
- data/lib/braintree/error_codes.rb +14 -0
- data/lib/braintree/payment_method_gateway.rb +1 -0
- data/lib/braintree/three_d_secure_pass_thru.rb +11 -0
- data/lib/braintree/transaction/local_payment_details.rb +2 -0
- data/lib/braintree/transaction/paypal_details.rb +2 -0
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +2 -0
- data/lib/braintree/transaction_gateway.rb +3 -0
- data/lib/braintree/util.rb +5 -0
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree.rb +1 -0
- data/spec/integration/braintree/advanced_search_spec.rb +4 -7
- data/spec/integration/braintree/braintree_gateway_spec.rb +1 -2
- data/spec/integration/braintree/credit_card_spec.rb +94 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +33 -0
- data/spec/integration/braintree/customer_spec.rb +153 -5
- data/spec/integration/braintree/http_spec.rb +1 -1
- data/spec/integration/braintree/payment_method_spec.rb +77 -7
- data/spec/integration/braintree/samsung_pay_card_spec.rb +1 -1
- data/spec/integration/braintree/transaction_search_spec.rb +18 -13
- data/spec/integration/braintree/transaction_spec.rb +116 -16
- data/spec/integration/braintree/transaction_transfer_type_spec.rb +71 -1
- data/spec/unit/braintree/address_spec.rb +32 -0
- data/spec/unit/braintree/credit_card_spec.rb +2 -0
- data/spec/unit/braintree/customer_spec.rb +2 -0
- data/spec/unit/braintree/dispute_spec.rb +38 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +3 -0
- metadata +3 -2
|
@@ -336,7 +336,7 @@ describe Braintree::Transaction do
|
|
|
336
336
|
|
|
337
337
|
describe "sca_exemption" do
|
|
338
338
|
context "with a valid request" do
|
|
339
|
-
|
|
339
|
+
it "succeeds with a valid sca_exemption request" do
|
|
340
340
|
requested_exemption = "low_value"
|
|
341
341
|
result = Braintree::Transaction.create(
|
|
342
342
|
:type => "sale",
|
|
@@ -1370,7 +1370,7 @@ describe Braintree::Transaction do
|
|
|
1370
1370
|
expect(result.transaction.gateway_rejection_reason).to eq(Braintree::Transaction::GatewayRejectionReason::TokenIssuance)
|
|
1371
1371
|
end
|
|
1372
1372
|
|
|
1373
|
-
|
|
1373
|
+
it "exposes the excessive_retry gateway rejection reason" do
|
|
1374
1374
|
with_duplicate_checking_merchant do
|
|
1375
1375
|
result = nil
|
|
1376
1376
|
counter = 0
|
|
@@ -1749,7 +1749,7 @@ describe Braintree::Transaction do
|
|
|
1749
1749
|
expect(result.transaction.descriptor.url).to eq("ebay.com")
|
|
1750
1750
|
end
|
|
1751
1751
|
|
|
1752
|
-
it "has validation errors
|
|
1752
|
+
it "has validation errors when the descriptor name is too long" do
|
|
1753
1753
|
result = Braintree::Transaction.sale(
|
|
1754
1754
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
1755
1755
|
:credit_card => {
|
|
@@ -1757,7 +1757,7 @@ describe Braintree::Transaction do
|
|
|
1757
1757
|
:expiration_date => "05/2009"
|
|
1758
1758
|
},
|
|
1759
1759
|
:descriptor => {
|
|
1760
|
-
:name => "badcompanyname12*
|
|
1760
|
+
:name => "badcompanyname12*badproductdescription",
|
|
1761
1761
|
:phone => "%bad4445555",
|
|
1762
1762
|
:url => "12345678901234"
|
|
1763
1763
|
},
|
|
@@ -2221,8 +2221,8 @@ describe Braintree::Transaction do
|
|
|
2221
2221
|
expect(apple_pay_details).not_to be_nil
|
|
2222
2222
|
expect(apple_pay_details.bin).not_to be_nil
|
|
2223
2223
|
expect(apple_pay_details.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
|
|
2224
|
-
expect(apple_pay_details.payment_instrument_name).to
|
|
2225
|
-
expect(apple_pay_details.source_description).to
|
|
2224
|
+
expect(apple_pay_details.payment_instrument_name).to match(/\AVisa \d{4}\z/)
|
|
2225
|
+
expect(apple_pay_details.source_description).to match(/\AVisa \d{4}\z/)
|
|
2226
2226
|
expect(apple_pay_details.expiration_month.to_i).to be > 0
|
|
2227
2227
|
expect(apple_pay_details.expiration_year.to_i).to be > 0
|
|
2228
2228
|
expect(apple_pay_details.cardholder_name).not_to be_nil
|
|
@@ -2250,8 +2250,8 @@ describe Braintree::Transaction do
|
|
|
2250
2250
|
expect(apple_pay_details).not_to be_nil
|
|
2251
2251
|
expect(apple_pay_details.bin).not_to be_nil
|
|
2252
2252
|
expect(apple_pay_details.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
|
|
2253
|
-
expect(apple_pay_details.payment_instrument_name).to
|
|
2254
|
-
expect(apple_pay_details.source_description).to
|
|
2253
|
+
expect(apple_pay_details.payment_instrument_name).to match(/\AVisa \d{4}\z/)
|
|
2254
|
+
expect(apple_pay_details.source_description).to match(/\AVisa \d{4}\z/)
|
|
2255
2255
|
expect(apple_pay_details.expiration_month.to_i).to be > 0
|
|
2256
2256
|
expect(apple_pay_details.expiration_year.to_i).to be > 0
|
|
2257
2257
|
expect(apple_pay_details.cardholder_name).not_to be_nil
|
|
@@ -2280,8 +2280,8 @@ describe Braintree::Transaction do
|
|
|
2280
2280
|
apple_pay_details = result.transaction.apple_pay_details
|
|
2281
2281
|
expect(apple_pay_details).not_to be_nil
|
|
2282
2282
|
expect(apple_pay_details.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
|
|
2283
|
-
expect(apple_pay_details.payment_instrument_name).to
|
|
2284
|
-
expect(apple_pay_details.source_description).to
|
|
2283
|
+
expect(apple_pay_details.payment_instrument_name).to match(/\AVisa \d{4}\z/)
|
|
2284
|
+
expect(apple_pay_details.source_description).to match(/\AVisa \d{4}\z/)
|
|
2285
2285
|
expect(apple_pay_details.expiration_month.to_i).to be > 0
|
|
2286
2286
|
expect(apple_pay_details.expiration_year.to_i).to be > 0
|
|
2287
2287
|
expect(apple_pay_details.cardholder_name).not_to be_nil
|
|
@@ -2905,6 +2905,106 @@ describe Braintree::Transaction do
|
|
|
2905
2905
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
|
2906
2906
|
end
|
|
2907
2907
|
|
|
2908
|
+
it "can create a transaction with a three_d_secure_pass_thru network specified" do
|
|
2909
|
+
result = Braintree::Transaction.create(
|
|
2910
|
+
:type => "sale",
|
|
2911
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2912
|
+
:credit_card => {
|
|
2913
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2914
|
+
:expiration_date => "05/2009",
|
|
2915
|
+
},
|
|
2916
|
+
:three_d_secure_pass_thru => {
|
|
2917
|
+
:eci_flag => "05",
|
|
2918
|
+
:cavv => "some_cavv",
|
|
2919
|
+
:xid => "some_xid",
|
|
2920
|
+
:three_d_secure_version => "2.2.0",
|
|
2921
|
+
:authentication_response => "Y",
|
|
2922
|
+
:directory_response => "Y",
|
|
2923
|
+
:cavv_algorithm => "2",
|
|
2924
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Visa,
|
|
2925
|
+
},
|
|
2926
|
+
)
|
|
2927
|
+
|
|
2928
|
+
expect(result.success?).to eq(true)
|
|
2929
|
+
expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
|
2930
|
+
end
|
|
2931
|
+
|
|
2932
|
+
it "returns an error for transaction with three_d_secure_pass_thru network when submit_for_settlement is false" do
|
|
2933
|
+
result = Braintree::Transaction.create(
|
|
2934
|
+
:type => "sale",
|
|
2935
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2936
|
+
:credit_card => {
|
|
2937
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2938
|
+
:expiration_date => "05/2009",
|
|
2939
|
+
},
|
|
2940
|
+
:three_d_secure_pass_thru => {
|
|
2941
|
+
:eci_flag => "05",
|
|
2942
|
+
:cavv => "some_cavv",
|
|
2943
|
+
:xid => "some_xid",
|
|
2944
|
+
:three_d_secure_version => "2.2.0",
|
|
2945
|
+
:authentication_response => "Y",
|
|
2946
|
+
:directory_response => "Y",
|
|
2947
|
+
:cavv_algorithm => "2",
|
|
2948
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Eftpos,
|
|
2949
|
+
},
|
|
2950
|
+
:options => {
|
|
2951
|
+
:submit_for_settlement => false,
|
|
2952
|
+
},
|
|
2953
|
+
)
|
|
2954
|
+
|
|
2955
|
+
expect(result.success?).to eq(false)
|
|
2956
|
+
expect(result.errors.for(:transaction).on(:base)[0].code).to eq(Braintree::ErrorCodes::Transaction::Options::SubmitForSettlementIsNotSupportedForNetwork)
|
|
2957
|
+
end
|
|
2958
|
+
|
|
2959
|
+
it "returns an error for transaction when the three_d_secure_pass_thru network does not support the presentment currency" do
|
|
2960
|
+
result = Braintree::Transaction.create(
|
|
2961
|
+
:type => "sale",
|
|
2962
|
+
:currency_iso_code => "USD",
|
|
2963
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2964
|
+
:credit_card => {
|
|
2965
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2966
|
+
:expiration_date => "05/2009",
|
|
2967
|
+
},
|
|
2968
|
+
:three_d_secure_pass_thru => {
|
|
2969
|
+
:eci_flag => "05",
|
|
2970
|
+
:cavv => "some_cavv",
|
|
2971
|
+
:xid => "some_xid",
|
|
2972
|
+
:three_d_secure_version => "2.2.0",
|
|
2973
|
+
:authentication_response => "Y",
|
|
2974
|
+
:directory_response => "Y",
|
|
2975
|
+
:cavv_algorithm => "2",
|
|
2976
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Eftpos,
|
|
2977
|
+
},
|
|
2978
|
+
)
|
|
2979
|
+
|
|
2980
|
+
expect(result.success?).to eq(false)
|
|
2981
|
+
expect(result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:network)[0].code).to eq(Braintree::ErrorCodes::Transaction::ThreeDSecureNetworkDoesNotSupportCurrency)
|
|
2982
|
+
end
|
|
2983
|
+
|
|
2984
|
+
it "returns an error for transaction when the three_d_secure_pass_thru network does not support the merchant account currency" do
|
|
2985
|
+
result = Braintree::Transaction.create(
|
|
2986
|
+
:type => "sale",
|
|
2987
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
2988
|
+
:credit_card => {
|
|
2989
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2990
|
+
:expiration_date => "05/2009",
|
|
2991
|
+
},
|
|
2992
|
+
:three_d_secure_pass_thru => {
|
|
2993
|
+
:eci_flag => "05",
|
|
2994
|
+
:cavv => "some_cavv",
|
|
2995
|
+
:xid => "some_xid",
|
|
2996
|
+
:three_d_secure_version => "2.2.0",
|
|
2997
|
+
:authentication_response => "Y",
|
|
2998
|
+
:directory_response => "Y",
|
|
2999
|
+
:cavv_algorithm => "2",
|
|
3000
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Eftpos,
|
|
3001
|
+
},
|
|
3002
|
+
)
|
|
3003
|
+
|
|
3004
|
+
expect(result.success?).to eq(false)
|
|
3005
|
+
expect(result.errors.for(:transaction).for(:three_d_secure_pass_thru).on(:network)[0].code).to eq(Braintree::ErrorCodes::Transaction::ThreeDSecureNetworkDoesNotSupportMerchantAccountCurrency)
|
|
3006
|
+
end
|
|
3007
|
+
|
|
2908
3008
|
it "returns an error for transaction with three_d_secure_pass_thru when processor settings do not support 3DS for card type" do
|
|
2909
3009
|
result = Braintree::Transaction.create(
|
|
2910
3010
|
:merchant_account_id => "heartland_ma",
|
|
@@ -5908,7 +6008,7 @@ describe Braintree::Transaction do
|
|
|
5908
6008
|
end
|
|
5909
6009
|
end
|
|
5910
6010
|
|
|
5911
|
-
|
|
6011
|
+
it "Amex Pay with Points" do
|
|
5912
6012
|
context "transaction creation" do
|
|
5913
6013
|
it "succeeds when submit_for_settlement is true" do
|
|
5914
6014
|
result = Braintree::Transaction.sale(
|
|
@@ -6055,7 +6155,7 @@ describe Braintree::Transaction do
|
|
|
6055
6155
|
end
|
|
6056
6156
|
|
|
6057
6157
|
context "Pinless debit transaction" do
|
|
6058
|
-
|
|
6158
|
+
it "successfully submits for settlement" do
|
|
6059
6159
|
# Flaky test
|
|
6060
6160
|
result = Braintree::Transaction.sale(
|
|
6061
6161
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
@@ -6367,7 +6467,7 @@ describe Braintree::Transaction do
|
|
|
6367
6467
|
expect(leg_errors).to eq([Braintree::ErrorCodes::Transaction::Industry::Leg::TravelFlight::FareAmountCannotBeNegative])
|
|
6368
6468
|
end
|
|
6369
6469
|
|
|
6370
|
-
|
|
6470
|
+
it "succeeds when level 2 data is provided" do
|
|
6371
6471
|
result = Braintree::Transaction.sale(
|
|
6372
6472
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
6373
6473
|
:merchant_account_id => SpecHelper::FakeAmexDirectMerchantAccountId,
|
|
@@ -6391,7 +6491,7 @@ describe Braintree::Transaction do
|
|
|
6391
6491
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::SubmittedForSettlement)
|
|
6392
6492
|
end
|
|
6393
6493
|
|
|
6394
|
-
|
|
6494
|
+
it "succeeds when level 3 data is provided" do
|
|
6395
6495
|
result = Braintree::Transaction.sale(
|
|
6396
6496
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
6397
6497
|
:merchant_account_id => SpecHelper::FakeAmexDirectMerchantAccountId,
|
|
@@ -6532,11 +6632,11 @@ describe Braintree::Transaction do
|
|
|
6532
6632
|
expect(result.errors.for(:transaction).on(:amount)[0].code).to eq(Braintree::ErrorCodes::Transaction::SettlementAmountIsTooLarge)
|
|
6533
6633
|
end
|
|
6534
6634
|
|
|
6535
|
-
it "returns an error response when the descriptor is
|
|
6635
|
+
it "returns an error response when the descriptor name is too long" do
|
|
6536
6636
|
result = Braintree::Transaction.update_details(transaction.id, {
|
|
6537
6637
|
:amount => Braintree::Test::TransactionAmounts::Authorize.to_f - 1,
|
|
6538
6638
|
:descriptor => {
|
|
6539
|
-
:name => "invalid descriptor name",
|
|
6639
|
+
:name => "invalid descriptor name that is way too long",
|
|
6540
6640
|
:phone => "invalid phone",
|
|
6541
6641
|
:url => "12345678901234"
|
|
6542
6642
|
},
|
|
@@ -16,6 +16,8 @@ describe Braintree::Transaction do
|
|
|
16
16
|
:transfer => {
|
|
17
17
|
:type => "wallet_transfer",
|
|
18
18
|
:receiver => {
|
|
19
|
+
:account_reference_number => "test123",
|
|
20
|
+
:account_reference_number_type => "SOCIAL_NETWORK_PROFILE_ID",
|
|
19
21
|
:first_name => "John",
|
|
20
22
|
:last_name => "Smith",
|
|
21
23
|
:middle_name => "D",
|
|
@@ -27,7 +29,8 @@ describe Braintree::Transaction do
|
|
|
27
29
|
}
|
|
28
30
|
},
|
|
29
31
|
:sender => {
|
|
30
|
-
:account_reference_number => "
|
|
32
|
+
:account_reference_number => "test@example.com",
|
|
33
|
+
:account_reference_number_type => "EMAIL_ADDRESS",
|
|
31
34
|
:date_of_birth => Date.new(2002, 1, 2),
|
|
32
35
|
:first_name => "Lisa",
|
|
33
36
|
:last_name => "Ray",
|
|
@@ -48,6 +51,73 @@ describe Braintree::Transaction do
|
|
|
48
51
|
expect(result.transaction.status).to eq(Braintree::Transaction::Status::Authorized)
|
|
49
52
|
end
|
|
50
53
|
|
|
54
|
+
it "should fail on transaction with invalid sender account reference number type" do
|
|
55
|
+
transaction_params = {
|
|
56
|
+
:type => "sale",
|
|
57
|
+
:amount => "100.00",
|
|
58
|
+
:merchant_account_id => "aft_first_data_wallet_transfer",
|
|
59
|
+
:credit_card => {
|
|
60
|
+
:number => "4111111111111111",
|
|
61
|
+
:expiration_date => "06/2026",
|
|
62
|
+
:cvv => "123"
|
|
63
|
+
},
|
|
64
|
+
:transfer => {
|
|
65
|
+
:type => "wallet_transfer",
|
|
66
|
+
:sender => {
|
|
67
|
+
:account_reference_number => "test@example.com",
|
|
68
|
+
:account_reference_number_type => "INVALID_ACCOUNT_REFERENCE_NUMBER_TYPE",
|
|
69
|
+
:date_of_birth => Date.new(2002, 1, 2),
|
|
70
|
+
:first_name => "Lisa",
|
|
71
|
+
:last_name => "Ray",
|
|
72
|
+
:middle_name => "D",
|
|
73
|
+
:address => {
|
|
74
|
+
:country_code_alpha2 => "US",
|
|
75
|
+
:locality => "LA",
|
|
76
|
+
:region => "CA",
|
|
77
|
+
:street_address => "12th Main"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
result = Braintree::Transaction.sale(transaction_params)
|
|
84
|
+
expect(result.success?).to eq(false)
|
|
85
|
+
expect(result.errors.for(:account_funding_transaction).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionTransferSenderAccountReferenceNumberTypeIsInvalid)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "should fail on transaction with invalid receiver account reference number type" do
|
|
89
|
+
transaction_params = {
|
|
90
|
+
:type => "sale",
|
|
91
|
+
:amount => "100.00",
|
|
92
|
+
:merchant_account_id => "aft_first_data_wallet_transfer",
|
|
93
|
+
:credit_card => {
|
|
94
|
+
:number => "4111111111111111",
|
|
95
|
+
:expiration_date => "06/2026",
|
|
96
|
+
:cvv => "123"
|
|
97
|
+
},
|
|
98
|
+
:transfer => {
|
|
99
|
+
:type => "wallet_transfer",
|
|
100
|
+
:receiver => {
|
|
101
|
+
:account_reference_number => "test@example.com",
|
|
102
|
+
:account_reference_number_type => "INVALID_ACCOUNT_REFERENCE_NUMBER_TYPE",
|
|
103
|
+
:first_name => "Lisa",
|
|
104
|
+
:last_name => "Ray",
|
|
105
|
+
:middle_name => "D",
|
|
106
|
+
:address => {
|
|
107
|
+
:country_code_alpha2 => "US",
|
|
108
|
+
:locality => "LA",
|
|
109
|
+
:region => "CA",
|
|
110
|
+
:street_address => "12th Main"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
result = Braintree::Transaction.sale(transaction_params)
|
|
117
|
+
expect(result.success?).to eq(false)
|
|
118
|
+
expect(result.errors.for(:account_funding_transaction).first.code).to eq(Braintree::ErrorCodes::Transaction::TransactionTransferReceiverAccountReferenceNumberTypeIsInvalid)
|
|
119
|
+
end
|
|
120
|
+
|
|
51
121
|
it "should fail on transaction with non brazil merchant" do
|
|
52
122
|
transaction_params = {
|
|
53
123
|
:type => "sale",
|
|
@@ -58,6 +58,20 @@ describe Braintree::Address do
|
|
|
58
58
|
Braintree::Address.update("customer_id", "address_id", :street_address => "456 E Main", :invalid_key => "foo")
|
|
59
59
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
|
60
60
|
end
|
|
61
|
+
|
|
62
|
+
it "raises an error if address_id contains invalid characters" do
|
|
63
|
+
expect do
|
|
64
|
+
Braintree::Address.update("customer_id", "../../foo", :street_address => "456 E Main")
|
|
65
|
+
end.to raise_error(ArgumentError, "address_id contains invalid characters")
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
describe "self.delete" do
|
|
70
|
+
it "raises an error if address_id contains invalid characters" do
|
|
71
|
+
expect do
|
|
72
|
+
Braintree::Address.delete("customer_id", "../../foo")
|
|
73
|
+
end.to raise_error(ArgumentError, "address_id contains invalid characters")
|
|
74
|
+
end
|
|
61
75
|
end
|
|
62
76
|
|
|
63
77
|
describe "self.find" do
|
|
@@ -85,6 +99,24 @@ describe Braintree::Address do
|
|
|
85
99
|
Braintree::Address.find("customer_id", 8675309)
|
|
86
100
|
end.to_not raise_error
|
|
87
101
|
end
|
|
102
|
+
|
|
103
|
+
it "raises an error if address_id contains invalid characters" do
|
|
104
|
+
expect do
|
|
105
|
+
Braintree::Address.find("customer_id", "../../foo")
|
|
106
|
+
end.to raise_error(ArgumentError, "address_id contains invalid characters")
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it "raises an error if address_id is a lone dot segment" do
|
|
110
|
+
expect do
|
|
111
|
+
Braintree::Address.find("customer_id", ".")
|
|
112
|
+
end.to raise_error(ArgumentError, "address_id contains invalid characters")
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
it "raises an error if address_id contains a dot" do
|
|
116
|
+
expect do
|
|
117
|
+
Braintree::Address.find("customer_id", "foo.bar")
|
|
118
|
+
end.to raise_error(ArgumentError, "address_id contains invalid characters")
|
|
119
|
+
end
|
|
88
120
|
end
|
|
89
121
|
|
|
90
122
|
describe "self.new" do
|
|
@@ -51,6 +51,7 @@ describe Braintree::CreditCard do
|
|
|
51
51
|
:directory_response,
|
|
52
52
|
:cavv_algorithm,
|
|
53
53
|
:ds_transaction_id,
|
|
54
|
+
:network,
|
|
54
55
|
]},
|
|
55
56
|
:customer_id,
|
|
56
57
|
])
|
|
@@ -100,6 +101,7 @@ describe Braintree::CreditCard do
|
|
|
100
101
|
:directory_response,
|
|
101
102
|
:cavv_algorithm,
|
|
102
103
|
:ds_transaction_id,
|
|
104
|
+
:network,
|
|
103
105
|
]},
|
|
104
106
|
])
|
|
105
107
|
end
|
|
@@ -164,6 +164,7 @@ describe Braintree::Customer do
|
|
|
164
164
|
:directory_response,
|
|
165
165
|
:cavv_algorithm,
|
|
166
166
|
:ds_transaction_id,
|
|
167
|
+
:network,
|
|
167
168
|
]},
|
|
168
169
|
]},
|
|
169
170
|
{:paypal_account => [
|
|
@@ -307,6 +308,7 @@ describe Braintree::Customer do
|
|
|
307
308
|
:directory_response,
|
|
308
309
|
:cavv_algorithm,
|
|
309
310
|
:ds_transaction_id,
|
|
311
|
+
:network,
|
|
310
312
|
]},
|
|
311
313
|
]},
|
|
312
314
|
{:tax_identifiers => [
|
|
@@ -278,6 +278,44 @@ describe Braintree::Dispute do
|
|
|
278
278
|
end
|
|
279
279
|
end
|
|
280
280
|
|
|
281
|
+
describe "path traversal" do
|
|
282
|
+
[
|
|
283
|
+
:accept,
|
|
284
|
+
:finalize,
|
|
285
|
+
:find,
|
|
286
|
+
].each do |method_name|
|
|
287
|
+
it "self.#{method_name} raises an exception if the dispute_id is a traversal segment" do
|
|
288
|
+
expect do
|
|
289
|
+
Braintree::Dispute.public_send(method_name, "../../foo")
|
|
290
|
+
end.to raise_error(ArgumentError, "dispute_id contains invalid characters")
|
|
291
|
+
end
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
it "self.add_file_evidence raises an exception if the dispute_id is a traversal segment" do
|
|
295
|
+
expect do
|
|
296
|
+
Braintree::Dispute.add_file_evidence("../../foo", "document_id")
|
|
297
|
+
end.to raise_error(ArgumentError, "dispute_id contains invalid characters")
|
|
298
|
+
end
|
|
299
|
+
|
|
300
|
+
it "self.add_text_evidence raises an exception if the dispute_id is a traversal segment" do
|
|
301
|
+
expect do
|
|
302
|
+
Braintree::Dispute.add_text_evidence("../../foo", "text evidence")
|
|
303
|
+
end.to raise_error(ArgumentError, "dispute_id contains invalid characters")
|
|
304
|
+
end
|
|
305
|
+
|
|
306
|
+
it "self.remove_evidence raises an exception if the dispute_id is a traversal segment" do
|
|
307
|
+
expect do
|
|
308
|
+
Braintree::Dispute.remove_evidence("../../foo", "evidence_id")
|
|
309
|
+
end.to raise_error(ArgumentError, "dispute_id contains invalid characters")
|
|
310
|
+
end
|
|
311
|
+
|
|
312
|
+
it "self.remove_evidence raises an exception if the evidence_id is a traversal segment" do
|
|
313
|
+
expect do
|
|
314
|
+
Braintree::Dispute.remove_evidence("dispute_id", "../../foo")
|
|
315
|
+
end.to raise_error(ArgumentError, "evidence_id contains invalid characters")
|
|
316
|
+
end
|
|
317
|
+
end
|
|
318
|
+
|
|
281
319
|
describe "initialize" do
|
|
282
320
|
it "converts string amount_dispute and amount_won" do
|
|
283
321
|
dispute = Braintree::Dispute._new(attributes)
|
|
@@ -128,6 +128,7 @@ describe Braintree::TransactionGateway do
|
|
|
128
128
|
:directory_response,
|
|
129
129
|
:cavv_algorithm,
|
|
130
130
|
:ds_transaction_id,
|
|
131
|
+
:network,
|
|
131
132
|
]
|
|
132
133
|
},
|
|
133
134
|
{
|
|
@@ -135,6 +136,7 @@ describe Braintree::TransactionGateway do
|
|
|
135
136
|
:type,
|
|
136
137
|
{:sender => [
|
|
137
138
|
:account_reference_number,
|
|
139
|
+
:account_reference_number_type,
|
|
138
140
|
:date_of_birth,
|
|
139
141
|
:first_name,
|
|
140
142
|
:last_name,
|
|
@@ -144,6 +146,7 @@ describe Braintree::TransactionGateway do
|
|
|
144
146
|
]},
|
|
145
147
|
{:receiver => [
|
|
146
148
|
:account_reference_number,
|
|
149
|
+
:account_reference_number_type,
|
|
147
150
|
:first_name,
|
|
148
151
|
:last_name,
|
|
149
152
|
:middle_name,
|
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: 4.
|
|
4
|
+
version: 4.40.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Braintree
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-05
|
|
11
|
+
date: 2026-08-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -195,6 +195,7 @@ files:
|
|
|
195
195
|
- lib/braintree/test_transaction.rb
|
|
196
196
|
- lib/braintree/testing_gateway.rb
|
|
197
197
|
- lib/braintree/three_d_secure_info.rb
|
|
198
|
+
- lib/braintree/three_d_secure_pass_thru.rb
|
|
198
199
|
- lib/braintree/transaction.rb
|
|
199
200
|
- lib/braintree/transaction/address_details.rb
|
|
200
201
|
- lib/braintree/transaction/apple_pay_details.rb
|