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
|
@@ -4,8 +4,7 @@ require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
|
|
4
4
|
|
|
5
5
|
describe Braintree::Customer do
|
|
6
6
|
describe "self.all" do
|
|
7
|
-
|
|
8
|
-
xit "gets more than a page of customers" do
|
|
7
|
+
it "gets more than a page of customers" do
|
|
9
8
|
customers = Braintree::Customer.all
|
|
10
9
|
expect(customers.maximum_size).to be > 100
|
|
11
10
|
|
|
@@ -1242,7 +1241,7 @@ describe Braintree::Customer do
|
|
|
1242
1241
|
expect(apple_pay_card.expiration_year).not_to be_nil
|
|
1243
1242
|
expect(apple_pay_card.healthcare).not_to be_nil
|
|
1244
1243
|
expect(apple_pay_card.issuing_bank).not_to be_nil
|
|
1245
|
-
expect(apple_pay_card.payment_instrument_name).to
|
|
1244
|
+
expect(apple_pay_card.payment_instrument_name).to match(/\AAmEx \d{4,5}\z/)
|
|
1246
1245
|
expect(apple_pay_card.payroll).not_to be_nil
|
|
1247
1246
|
expect(apple_pay_card.prepaid).not_to be_nil
|
|
1248
1247
|
expect(apple_pay_card.prepaid_reloadable).not_to be_nil
|
|
@@ -1326,7 +1325,7 @@ describe Braintree::Customer do
|
|
|
1326
1325
|
expect(venmo_account.username).not_to be_nil
|
|
1327
1326
|
end
|
|
1328
1327
|
|
|
1329
|
-
|
|
1328
|
+
it "returns associated us bank accounts" do
|
|
1330
1329
|
result = Braintree::Customer.create(
|
|
1331
1330
|
:payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
|
|
1332
1331
|
:credit_card => {
|
|
@@ -1693,7 +1692,8 @@ describe Braintree::Customer do
|
|
|
1693
1692
|
|
|
1694
1693
|
apple_pay_card = result.customer.payment_methods.find { |pm| pm.is_a?(Braintree::ApplePayCard) }
|
|
1695
1694
|
expect(apple_pay_card).not_to be_nil
|
|
1696
|
-
expect(apple_pay_card.
|
|
1695
|
+
expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
|
|
1696
|
+
expect(apple_pay_card.last_4).to match(/\A\d{4}\z/)
|
|
1697
1697
|
expect(apple_pay_card.cardholder_name).to eq("Updated Joe Cardholder")
|
|
1698
1698
|
|
|
1699
1699
|
verification = apple_pay_card.verification
|
|
@@ -2084,6 +2084,154 @@ describe Braintree::Customer do
|
|
|
2084
2084
|
expect(result).to be_success
|
|
2085
2085
|
end
|
|
2086
2086
|
|
|
2087
|
+
it "accepts a three_d_secure_pass_thru network specified on customer create" do
|
|
2088
|
+
result = Braintree::Customer.create(
|
|
2089
|
+
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
|
2090
|
+
:credit_card => {
|
|
2091
|
+
:three_d_secure_pass_thru => {
|
|
2092
|
+
:eci_flag => "05",
|
|
2093
|
+
:cavv => "some_cavv",
|
|
2094
|
+
:xid => "some_xid",
|
|
2095
|
+
:three_d_secure_version => "2.2.0",
|
|
2096
|
+
:authentication_response => "Y",
|
|
2097
|
+
:directory_response => "Y",
|
|
2098
|
+
:cavv_algorithm => "2",
|
|
2099
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2100
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Visa,
|
|
2101
|
+
},
|
|
2102
|
+
:options => {:verify_card => true},
|
|
2103
|
+
},
|
|
2104
|
+
)
|
|
2105
|
+
expect(result).to be_success
|
|
2106
|
+
end
|
|
2107
|
+
|
|
2108
|
+
it "rejects invalid network value in 3ds pass thru params on customer create" do
|
|
2109
|
+
result = Braintree::Customer.create(
|
|
2110
|
+
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
2111
|
+
:credit_card => {
|
|
2112
|
+
:three_d_secure_pass_thru => {
|
|
2113
|
+
:eci_flag => "05",
|
|
2114
|
+
:cavv => "some_cavv",
|
|
2115
|
+
:xid => "some_xid",
|
|
2116
|
+
:three_d_secure_version => "2.2.0",
|
|
2117
|
+
:authentication_response => "Y",
|
|
2118
|
+
:directory_response => "Y",
|
|
2119
|
+
:cavv_algorithm => "2",
|
|
2120
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2121
|
+
:network => "DISCOVER",
|
|
2122
|
+
},
|
|
2123
|
+
:options => {:verify_card => true},
|
|
2124
|
+
},
|
|
2125
|
+
)
|
|
2126
|
+
expect(result).not_to be_success
|
|
2127
|
+
error = result.errors.for(:verification).first
|
|
2128
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkIsInvalid)
|
|
2129
|
+
expect(error.message).to eq("Network is invalid. Supported networks are eftpos, Visa, and Mastercard.")
|
|
2130
|
+
end
|
|
2131
|
+
|
|
2132
|
+
it "rejects request where 3ds pass thru network does not match the payment instrument on customer create (VISA nonce, Mastercard network)" do
|
|
2133
|
+
result = Braintree::Customer.create(
|
|
2134
|
+
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
|
2135
|
+
:credit_card => {
|
|
2136
|
+
:three_d_secure_pass_thru => {
|
|
2137
|
+
:eci_flag => "05",
|
|
2138
|
+
:cavv => "some_cavv",
|
|
2139
|
+
:xid => "some_xid",
|
|
2140
|
+
:three_d_secure_version => "2.2.0",
|
|
2141
|
+
:authentication_response => "Y",
|
|
2142
|
+
:directory_response => "Y",
|
|
2143
|
+
:cavv_algorithm => "2",
|
|
2144
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2145
|
+
:network => Braintree::ThreeDSecurePassThru::Network::MasterCard,
|
|
2146
|
+
},
|
|
2147
|
+
:options => {:verify_card => true},
|
|
2148
|
+
},
|
|
2149
|
+
)
|
|
2150
|
+
expect(result).not_to be_success
|
|
2151
|
+
error = result.errors.for(:verification).first
|
|
2152
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkDoesNotMatchPaymentInstrument)
|
|
2153
|
+
expect(error.message).to eq("Network does not match the payment instrument.")
|
|
2154
|
+
end
|
|
2155
|
+
|
|
2156
|
+
it "accepts a three_d_secure_pass_thru network specified on customer update" do
|
|
2157
|
+
customer = Braintree::Customer.create!
|
|
2158
|
+
result = Braintree::Customer.update(
|
|
2159
|
+
customer.id,
|
|
2160
|
+
:credit_card => {
|
|
2161
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2162
|
+
:expiration_date => "05/2009",
|
|
2163
|
+
:three_d_secure_pass_thru => {
|
|
2164
|
+
:eci_flag => "05",
|
|
2165
|
+
:cavv => "some_cavv",
|
|
2166
|
+
:xid => "some_xid",
|
|
2167
|
+
:three_d_secure_version => "2.2.0",
|
|
2168
|
+
:authentication_response => "Y",
|
|
2169
|
+
:directory_response => "Y",
|
|
2170
|
+
:cavv_algorithm => "2",
|
|
2171
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2172
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Visa,
|
|
2173
|
+
},
|
|
2174
|
+
:options => {:verify_card => true}
|
|
2175
|
+
},
|
|
2176
|
+
)
|
|
2177
|
+
|
|
2178
|
+
expect(result).to be_success
|
|
2179
|
+
end
|
|
2180
|
+
|
|
2181
|
+
it "rejects invalid network value in 3ds pass thru params on customer update" do
|
|
2182
|
+
customer = Braintree::Customer.create!
|
|
2183
|
+
result = Braintree::Customer.update(
|
|
2184
|
+
customer.id,
|
|
2185
|
+
:credit_card => {
|
|
2186
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2187
|
+
:expiration_date => "05/2009",
|
|
2188
|
+
:three_d_secure_pass_thru => {
|
|
2189
|
+
:eci_flag => "05",
|
|
2190
|
+
:cavv => "some_cavv",
|
|
2191
|
+
:xid => "some_xid",
|
|
2192
|
+
:three_d_secure_version => "2.2.0",
|
|
2193
|
+
:authentication_response => "Y",
|
|
2194
|
+
:directory_response => "Y",
|
|
2195
|
+
:cavv_algorithm => "2",
|
|
2196
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2197
|
+
:network => "DISCOVER",
|
|
2198
|
+
},
|
|
2199
|
+
:options => {:verify_card => true}
|
|
2200
|
+
},
|
|
2201
|
+
)
|
|
2202
|
+
expect(result).not_to be_success
|
|
2203
|
+
error = result.errors.for(:verification).first
|
|
2204
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkIsInvalid)
|
|
2205
|
+
expect(error.message).to eq("Network is invalid. Supported networks are eftpos, Visa, and Mastercard.")
|
|
2206
|
+
end
|
|
2207
|
+
|
|
2208
|
+
it "rejects request where 3ds pass thru network does not match the payment instrument on customer update (VISA card, Mastercard network)" do
|
|
2209
|
+
customer = Braintree::Customer.create!
|
|
2210
|
+
result = Braintree::Customer.update(
|
|
2211
|
+
customer.id,
|
|
2212
|
+
:credit_card => {
|
|
2213
|
+
:number => Braintree::Test::CreditCardNumbers::Visa,
|
|
2214
|
+
:expiration_date => "05/2009",
|
|
2215
|
+
:three_d_secure_pass_thru => {
|
|
2216
|
+
:eci_flag => "05",
|
|
2217
|
+
:cavv => "some_cavv",
|
|
2218
|
+
:xid => "some_xid",
|
|
2219
|
+
:three_d_secure_version => "2.2.0",
|
|
2220
|
+
:authentication_response => "Y",
|
|
2221
|
+
:directory_response => "Y",
|
|
2222
|
+
:cavv_algorithm => "2",
|
|
2223
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
2224
|
+
:network => Braintree::ThreeDSecurePassThru::Network::MasterCard,
|
|
2225
|
+
},
|
|
2226
|
+
:options => {:verify_card => true}
|
|
2227
|
+
},
|
|
2228
|
+
)
|
|
2229
|
+
expect(result).not_to be_success
|
|
2230
|
+
error = result.errors.for(:verification).first
|
|
2231
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkDoesNotMatchPaymentInstrument)
|
|
2232
|
+
expect(error.message).to eq("Network does not match the payment instrument.")
|
|
2233
|
+
end
|
|
2234
|
+
|
|
2087
2235
|
it "returns 3DS info on cc verification" do
|
|
2088
2236
|
result = Braintree::Customer.create(
|
|
2089
2237
|
:payment_method_nonce => Braintree::Test::Nonce::ThreeDSecureVisaFullAuthentication,
|
|
@@ -97,7 +97,7 @@ describe Braintree::Http do
|
|
|
97
97
|
end
|
|
98
98
|
|
|
99
99
|
describe "ssl_version" do
|
|
100
|
-
|
|
100
|
+
it "causes failed requests to sandbox with incompatible SSL version" do
|
|
101
101
|
begin
|
|
102
102
|
original_env = Braintree::Configuration.environment
|
|
103
103
|
Braintree::Configuration.environment = :sandbox
|
|
@@ -92,8 +92,8 @@ describe Braintree::PaymentMethod do
|
|
|
92
92
|
expect(apple_pay_card.bin).not_to be_nil
|
|
93
93
|
expect(apple_pay_card.token).to eq(token)
|
|
94
94
|
expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::AmEx)
|
|
95
|
-
expect(apple_pay_card.payment_instrument_name).to
|
|
96
|
-
expect(apple_pay_card.source_description).to
|
|
95
|
+
expect(apple_pay_card.payment_instrument_name).to match(/\AAmEx \d{4,5}\z/)
|
|
96
|
+
expect(apple_pay_card.source_description).to match(/\AAmEx \d{4,5}\z/)
|
|
97
97
|
expect(apple_pay_card.default).to eq(true)
|
|
98
98
|
expect(apple_pay_card.image_url).to match(/apple_pay/)
|
|
99
99
|
expect(apple_pay_card.expiration_month.to_i).to be > 0
|
|
@@ -127,8 +127,8 @@ describe Braintree::PaymentMethod do
|
|
|
127
127
|
expect(apple_pay_card.bin).not_to be_nil
|
|
128
128
|
expect(apple_pay_card.token).to eq(token)
|
|
129
129
|
expect(apple_pay_card.card_type).to eq(Braintree::ApplePayCard::CardType::Visa)
|
|
130
|
-
expect(apple_pay_card.payment_instrument_name).to
|
|
131
|
-
expect(apple_pay_card.source_description).to
|
|
130
|
+
expect(apple_pay_card.payment_instrument_name).to match(/\AVisa \d{4}\z/)
|
|
131
|
+
expect(apple_pay_card.source_description).to match(/\AVisa \d{4}\z/)
|
|
132
132
|
expect(apple_pay_card.default).to eq(true)
|
|
133
133
|
expect(apple_pay_card.image_url).to match(/apple_pay/)
|
|
134
134
|
expect(apple_pay_card.expiration_month.to_i).to be > 0
|
|
@@ -382,6 +382,76 @@ describe Braintree::PaymentMethod do
|
|
|
382
382
|
expect(result).to be_success
|
|
383
383
|
end
|
|
384
384
|
|
|
385
|
+
it "accepts a three_d_secure_pass_thru network specified in the request" do
|
|
386
|
+
customer = Braintree::Customer.create!
|
|
387
|
+
result = Braintree::PaymentMethod.create(
|
|
388
|
+
:customer_id => customer.id,
|
|
389
|
+
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
|
390
|
+
:three_d_secure_pass_thru => {
|
|
391
|
+
:eci_flag => "05",
|
|
392
|
+
:cavv => "some_cavv",
|
|
393
|
+
:xid => "some_xid",
|
|
394
|
+
:three_d_secure_version => "2.2.0",
|
|
395
|
+
:authentication_response => "Y",
|
|
396
|
+
:directory_response => "Y",
|
|
397
|
+
:cavv_algorithm => "2",
|
|
398
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
399
|
+
:network => Braintree::ThreeDSecurePassThru::Network::Visa,
|
|
400
|
+
},
|
|
401
|
+
:options => {:verify_card => true},
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
expect(result).to be_success
|
|
405
|
+
end
|
|
406
|
+
|
|
407
|
+
it "rejects invalid network value in 3ds pass thru params" do
|
|
408
|
+
customer = Braintree::Customer.create!
|
|
409
|
+
result = Braintree::PaymentMethod.create(
|
|
410
|
+
:customer_id => customer.id,
|
|
411
|
+
:payment_method_nonce => Braintree::Test::Nonce::Transactable,
|
|
412
|
+
:three_d_secure_pass_thru => {
|
|
413
|
+
:eci_flag => "05",
|
|
414
|
+
:cavv => "some_cavv",
|
|
415
|
+
:xid => "some_xid",
|
|
416
|
+
:three_d_secure_version => "2.2.0",
|
|
417
|
+
:authentication_response => "Y",
|
|
418
|
+
:directory_response => "Y",
|
|
419
|
+
:cavv_algorithm => "2",
|
|
420
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
421
|
+
:network => "DISCOVER",
|
|
422
|
+
},
|
|
423
|
+
:options => {:verify_card => true},
|
|
424
|
+
)
|
|
425
|
+
expect(result).not_to be_success
|
|
426
|
+
error = result.errors.for(:verification).first
|
|
427
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkIsInvalid)
|
|
428
|
+
expect(error.message).to eq("Network is invalid. Supported networks are eftpos, Visa, and Mastercard.")
|
|
429
|
+
end
|
|
430
|
+
|
|
431
|
+
it "rejects request where 3ds pass thru network does not match the payment instrument (VISA nonce, Mastercard network)" do
|
|
432
|
+
customer = Braintree::Customer.create!
|
|
433
|
+
result = Braintree::PaymentMethod.create(
|
|
434
|
+
:customer_id => customer.id,
|
|
435
|
+
:payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
|
|
436
|
+
:three_d_secure_pass_thru => {
|
|
437
|
+
:eci_flag => "05",
|
|
438
|
+
:cavv => "some_cavv",
|
|
439
|
+
:xid => "some_xid",
|
|
440
|
+
:three_d_secure_version => "2.2.0",
|
|
441
|
+
:authentication_response => "Y",
|
|
442
|
+
:directory_response => "Y",
|
|
443
|
+
:cavv_algorithm => "2",
|
|
444
|
+
:ds_transaction_id => "some_ds_transaction_id",
|
|
445
|
+
:network => Braintree::ThreeDSecurePassThru::Network::MasterCard,
|
|
446
|
+
},
|
|
447
|
+
:options => {:verify_card => true},
|
|
448
|
+
)
|
|
449
|
+
expect(result).not_to be_success
|
|
450
|
+
error = result.errors.for(:verification).first
|
|
451
|
+
expect(error.code).to eq(Braintree::ErrorCodes::Verification::ThreeDSecurePassThru::NetworkDoesNotMatchPaymentInstrument)
|
|
452
|
+
expect(error.message).to eq("Network does not match the payment instrument.")
|
|
453
|
+
end
|
|
454
|
+
|
|
385
455
|
it "returns 3DS info on cc verification" do
|
|
386
456
|
customer = Braintree::Customer.create.customer
|
|
387
457
|
result = Braintree::PaymentMethod.create(
|
|
@@ -813,7 +883,7 @@ describe Braintree::PaymentMethod do
|
|
|
813
883
|
expect(update_result.payment_method.verification.credit_card[:account_type]).to eq("credit")
|
|
814
884
|
end
|
|
815
885
|
|
|
816
|
-
|
|
886
|
+
it "updates the credit card with account_type debit" do
|
|
817
887
|
customer = Braintree::Customer.create!
|
|
818
888
|
credit_card = Braintree::CreditCard.create!(
|
|
819
889
|
:cardholder_name => "Original Holder",
|
|
@@ -1404,7 +1474,7 @@ describe Braintree::PaymentMethod do
|
|
|
1404
1474
|
expect(apple_pay_card.image_url).to match(/apple_pay/)
|
|
1405
1475
|
expect(apple_pay_card.expiration_month.to_i).to be > 0
|
|
1406
1476
|
expect(apple_pay_card.expiration_year.to_i).to be > 0
|
|
1407
|
-
expect(apple_pay_card.source_description).to
|
|
1477
|
+
expect(apple_pay_card.source_description).to match(/\AAmEx \d{4,5}\z/)
|
|
1408
1478
|
expect(apple_pay_card.customer_id).to eq(customer.id)
|
|
1409
1479
|
end
|
|
1410
1480
|
|
|
@@ -1427,7 +1497,7 @@ describe Braintree::PaymentMethod do
|
|
|
1427
1497
|
expect(apple_pay_card.image_url).to match(/apple_pay/)
|
|
1428
1498
|
expect(apple_pay_card.expiration_month.to_i).to be > 0
|
|
1429
1499
|
expect(apple_pay_card.expiration_year.to_i).to be > 0
|
|
1430
|
-
expect(apple_pay_card.source_description).to
|
|
1500
|
+
expect(apple_pay_card.source_description).to match(/\AVisa \d{4}\z/)
|
|
1431
1501
|
expect(apple_pay_card.customer_id).to eq(customer.id)
|
|
1432
1502
|
expect(apple_pay_card.is_device_token).to eq(false)
|
|
1433
1503
|
apple_pay_card.merchant_token_identifier == "DNITHE302308980427388297"
|
|
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/client_api/spec_helper")
|
|
|
3
3
|
|
|
4
4
|
# NEXT_MAJOR_VERSION remove these tests
|
|
5
5
|
# SamsungPayCard has been deprecated
|
|
6
|
-
|
|
6
|
+
describe Braintree::SamsungPayCard do
|
|
7
7
|
it "can create from payment method nonce" do
|
|
8
8
|
customer = Braintree::Customer.create!
|
|
9
9
|
|
|
@@ -11,8 +11,7 @@ describe Braintree::Transaction, "search" do
|
|
|
11
11
|
expect(collection.maximum_size).to eq(0)
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
xit "can search on text fields" do
|
|
14
|
+
it "can search on text fields" do
|
|
16
15
|
first_name = "Tim_#{rand(10**10)}"
|
|
17
16
|
token = "creditcard_#{rand(10**10)}"
|
|
18
17
|
customer_id = "customer_#{rand(10**10)}"
|
|
@@ -132,8 +131,7 @@ describe Braintree::Transaction, "search" do
|
|
|
132
131
|
expect(collection.first.id).to eq(transaction.id)
|
|
133
132
|
end
|
|
134
133
|
|
|
135
|
-
|
|
136
|
-
xit "searches on users" do
|
|
134
|
+
it "searches on users" do
|
|
137
135
|
transaction = Braintree::Transaction.sale!(
|
|
138
136
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
139
137
|
:payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
|
|
@@ -177,14 +175,15 @@ describe Braintree::Transaction, "search" do
|
|
|
177
175
|
expect(collection.first.id).to eq(transaction_id)
|
|
178
176
|
end
|
|
179
177
|
|
|
180
|
-
it "searches on reason_codes for
|
|
178
|
+
it "searches on reason_codes for 2 items" do
|
|
181
179
|
reason_code = ["R01", "R02"]
|
|
182
180
|
|
|
183
181
|
collection = Braintree::Transaction.search do |search|
|
|
182
|
+
search.ids.in ["ach_txn_ret1", "ach_txn_ret2"]
|
|
184
183
|
search.reason_code.in reason_code
|
|
185
184
|
end
|
|
186
185
|
|
|
187
|
-
expect(collection.maximum_size).to eq(
|
|
186
|
+
expect(collection.maximum_size).to eq(2)
|
|
188
187
|
end
|
|
189
188
|
|
|
190
189
|
it "searches on reason_code" do
|
|
@@ -192,6 +191,7 @@ describe Braintree::Transaction, "search" do
|
|
|
192
191
|
reason_code = "R01"
|
|
193
192
|
|
|
194
193
|
collection = Braintree::Transaction.search do |search|
|
|
194
|
+
search.ids.in [transaction_id]
|
|
195
195
|
search.reason_code.in reason_code
|
|
196
196
|
end
|
|
197
197
|
item = collection.find { |t| t.id == transaction_id }
|
|
@@ -204,6 +204,7 @@ describe Braintree::Transaction, "search" do
|
|
|
204
204
|
reason_code = "RJCT"
|
|
205
205
|
|
|
206
206
|
collection = Braintree::Transaction.search do |search|
|
|
207
|
+
search.ids.in [transaction_id]
|
|
207
208
|
search.reason_code.in reason_code
|
|
208
209
|
end
|
|
209
210
|
item = collection.find { |t| t.id == transaction_id }
|
|
@@ -217,10 +218,11 @@ describe Braintree::Transaction, "search" do
|
|
|
217
218
|
reason_code = "any_reason_code"
|
|
218
219
|
|
|
219
220
|
collection = Braintree::Transaction.search do |search|
|
|
221
|
+
search.ids.in ["ach_txn_ret1", "ach_txn_ret2", "ach_txn_ret3", "ach_txn_ret4"]
|
|
220
222
|
search.reason_code.is reason_code
|
|
221
223
|
end
|
|
222
224
|
|
|
223
|
-
expect(collection.maximum_size).to eq(
|
|
225
|
+
expect(collection.maximum_size).to eq(4)
|
|
224
226
|
end
|
|
225
227
|
|
|
226
228
|
context "multiple value fields" do
|
|
@@ -512,6 +514,7 @@ describe Braintree::Transaction, "search" do
|
|
|
512
514
|
end
|
|
513
515
|
|
|
514
516
|
it "finds expired authorizations by status" do
|
|
517
|
+
skip "pending search fix"
|
|
515
518
|
collection = Braintree::Transaction.search do |search|
|
|
516
519
|
search.status.in Braintree::Transaction::Status::AuthorizationExpired
|
|
517
520
|
end
|
|
@@ -614,7 +617,7 @@ describe Braintree::Transaction, "search" do
|
|
|
614
617
|
expect(collection.first.id).to eq(transaction_id)
|
|
615
618
|
end
|
|
616
619
|
|
|
617
|
-
|
|
620
|
+
it "searches on debit_network" do
|
|
618
621
|
transaction = Braintree::Transaction.sale!(
|
|
619
622
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
|
620
623
|
:merchant_account_id => SpecHelper::PinlessDebitMerchantAccountId,
|
|
@@ -854,6 +857,7 @@ describe Braintree::Transaction, "search" do
|
|
|
854
857
|
context "ach return response created at" do
|
|
855
858
|
it "it finds records within date range of the custom field" do
|
|
856
859
|
date_search = Braintree::Transaction.search do |search|
|
|
860
|
+
search.ids.in ["ach_txn_ret1", "ach_txn_ret2", "ach_txn_ret3", "ach_txn_ret4"]
|
|
857
861
|
search.ach_return_responses_created_at.between(DateTime.now - 1.0, DateTime.now + 1.0)
|
|
858
862
|
end
|
|
859
863
|
|
|
@@ -862,6 +866,7 @@ describe Braintree::Transaction, "search" do
|
|
|
862
866
|
|
|
863
867
|
it "it does not find records not within date range of the custom field" do
|
|
864
868
|
neg_date_search = Braintree::Transaction.search do |search|
|
|
869
|
+
search.ids.in ["ach_txn_ret1", "ach_txn_ret2", "ach_txn_ret3", "ach_txn_ret4"]
|
|
865
870
|
search.ach_return_responses_created_at.between(DateTime.now + 1.0, DateTime.now - 1.0)
|
|
866
871
|
end
|
|
867
872
|
|
|
@@ -1006,7 +1011,7 @@ describe Braintree::Transaction, "search" do
|
|
|
1006
1011
|
}
|
|
1007
1012
|
end
|
|
1008
1013
|
|
|
1009
|
-
|
|
1014
|
+
it "searches on dispute_date in UTC" do
|
|
1010
1015
|
collection = Braintree::Transaction.search do |search|
|
|
1011
1016
|
search.id.is @disputed_transaction.id
|
|
1012
1017
|
search.dispute_date.between(
|
|
@@ -1043,7 +1048,7 @@ describe Braintree::Transaction, "search" do
|
|
|
1043
1048
|
expect(collection.first.id).to eq(@disputed_transaction.id)
|
|
1044
1049
|
end
|
|
1045
1050
|
|
|
1046
|
-
|
|
1051
|
+
it "searches on dispute_date in local time" do
|
|
1047
1052
|
now = @disputed_time.localtime("-06:00")
|
|
1048
1053
|
|
|
1049
1054
|
collection = Braintree::Transaction.search do |search|
|
|
@@ -1073,7 +1078,7 @@ describe Braintree::Transaction, "search" do
|
|
|
1073
1078
|
expect(collection.maximum_size).to eq(1)
|
|
1074
1079
|
end
|
|
1075
1080
|
|
|
1076
|
-
|
|
1081
|
+
it "searches on dispute_date with date ranges" do
|
|
1077
1082
|
collection = Braintree::Transaction.search do |search|
|
|
1078
1083
|
search.id.is @disputed_transaction.id
|
|
1079
1084
|
search.dispute_date.between(
|
|
@@ -1151,6 +1156,7 @@ describe Braintree::Transaction, "search" do
|
|
|
1151
1156
|
end
|
|
1152
1157
|
|
|
1153
1158
|
it "finds expired authorizations in a given range" do
|
|
1159
|
+
skip "pending search fix"
|
|
1154
1160
|
collection = Braintree::Transaction.search do |search|
|
|
1155
1161
|
search.authorization_expired_at.between(
|
|
1156
1162
|
Date.today - 2,
|
|
@@ -1379,8 +1385,7 @@ describe Braintree::Transaction, "search" do
|
|
|
1379
1385
|
end
|
|
1380
1386
|
end
|
|
1381
1387
|
|
|
1382
|
-
|
|
1383
|
-
xit "returns multiple results" do
|
|
1388
|
+
it "returns multiple results" do
|
|
1384
1389
|
collection = Braintree::Transaction.search
|
|
1385
1390
|
expect(collection.maximum_size).to be > 100
|
|
1386
1391
|
|