braintree 3.2.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +6 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +10 -6
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +10 -7
- data/lib/braintree/payment_method_nonce.rb +7 -4
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +24 -5
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +282 -165
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +28 -35
- data/spec/integration/braintree/payment_method_spec.rb +269 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +574 -360
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +20 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +9 -9
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +16 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -8,7 +8,7 @@ describe Braintree::Test::TransactionAmounts do
|
|
8
8
|
:credit_card => {
|
9
9
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
10
10
|
:expiration_date => "12/2012"
|
11
|
-
}
|
11
|
+
},
|
12
12
|
)
|
13
13
|
transaction.status.should == Braintree::Transaction::Status::Authorized
|
14
14
|
end
|
@@ -21,7 +21,7 @@ describe Braintree::Test::TransactionAmounts do
|
|
21
21
|
:credit_card => {
|
22
22
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
23
23
|
:expiration_date => "12/2012"
|
24
|
-
}
|
24
|
+
},
|
25
25
|
)
|
26
26
|
result.transaction.status.should == Braintree::Transaction::Status::ProcessorDeclined
|
27
27
|
end
|
@@ -9,7 +9,7 @@ describe Braintree::TestTransaction do
|
|
9
9
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
10
10
|
:options => {
|
11
11
|
:submit_for_settlement => true
|
12
|
-
}
|
12
|
+
},
|
13
13
|
)
|
14
14
|
sale_result.success?.should == true
|
15
15
|
sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -25,7 +25,7 @@ describe Braintree::TestTransaction do
|
|
25
25
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
26
26
|
:options => {
|
27
27
|
:submit_for_settlement => true
|
28
|
-
}
|
28
|
+
},
|
29
29
|
)
|
30
30
|
sale_result.success?.should == true
|
31
31
|
sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -41,7 +41,7 @@ describe Braintree::TestTransaction do
|
|
41
41
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
42
42
|
:options => {
|
43
43
|
:submit_for_settlement => true
|
44
|
-
}
|
44
|
+
},
|
45
45
|
)
|
46
46
|
sale_result.success?.should == true
|
47
47
|
sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -57,7 +57,7 @@ describe Braintree::TestTransaction do
|
|
57
57
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
58
58
|
:options => {
|
59
59
|
:submit_for_settlement => true
|
60
|
-
}
|
60
|
+
},
|
61
61
|
)
|
62
62
|
sale_result.success?.should == true
|
63
63
|
sale_result.transaction.status.should == Braintree::Transaction::Status::SubmittedForSettlement
|
@@ -70,7 +70,7 @@ describe Braintree::TestTransaction do
|
|
70
70
|
it "returns a validation error when invalid transition is specified" do
|
71
71
|
sale_result = Braintree::Transaction.sale(
|
72
72
|
:amount => "100",
|
73
|
-
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa
|
73
|
+
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
74
74
|
)
|
75
75
|
sale_result.success?.should == true
|
76
76
|
|
@@ -97,10 +97,10 @@ describe Braintree::TestTransaction do
|
|
97
97
|
in_prod do
|
98
98
|
config = Braintree::Configuration.new(
|
99
99
|
:environment => (original_env == :production ? :development : original_env),
|
100
|
-
:merchant_id =>
|
101
|
-
:public_key =>
|
102
|
-
:private_key =>
|
103
|
-
:logger => Logger.new(StringIO.new)
|
100
|
+
:merchant_id => "integration_merchant_id",
|
101
|
+
:public_key => "integration_public_key",
|
102
|
+
:private_key => "integration_private_key",
|
103
|
+
:logger => Logger.new(StringIO.new),
|
104
104
|
)
|
105
105
|
|
106
106
|
gateway = Braintree::Gateway.new(config)
|
@@ -110,7 +110,7 @@ describe Braintree::TestTransaction do
|
|
110
110
|
|
111
111
|
sale_result = transaction_gateway.sale(
|
112
112
|
:amount => "100",
|
113
|
-
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa
|
113
|
+
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutVisa,
|
114
114
|
)
|
115
115
|
testing_gateway.settle(sale_result.transaction.id)
|
116
116
|
end
|
@@ -60,7 +60,7 @@ describe Braintree::Transaction, "search" do
|
|
60
60
|
:postal_code => "54321",
|
61
61
|
:region => "MA",
|
62
62
|
:street_address => "456 Road"
|
63
|
-
}
|
63
|
+
},
|
64
64
|
)
|
65
65
|
|
66
66
|
SpecHelper.settle_transaction transaction.id
|
@@ -133,20 +133,20 @@ describe Braintree::Transaction, "search" do
|
|
133
133
|
it "searches on users" do
|
134
134
|
transaction = Braintree::Transaction.sale!(
|
135
135
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
136
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
136
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
137
137
|
)
|
138
138
|
|
139
139
|
collection = Braintree::Transaction.search do |search|
|
140
140
|
search.user.is "integration_user_public_id"
|
141
141
|
end
|
142
142
|
|
143
|
-
collection.any?{ |t| t.id == transaction.id }.should == true
|
143
|
+
collection.any? { |t| t.id == transaction.id }.should == true
|
144
144
|
end
|
145
145
|
|
146
146
|
it "searches on paypal transactions" do
|
147
147
|
transaction = Braintree::Transaction.sale!(
|
148
148
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
149
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
149
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
150
150
|
)
|
151
151
|
|
152
152
|
paypal_details = transaction.paypal_details
|
@@ -161,6 +161,19 @@ describe Braintree::Transaction, "search" do
|
|
161
161
|
collection.first.id.should == transaction.id
|
162
162
|
end
|
163
163
|
|
164
|
+
it "searches on store_id" do
|
165
|
+
transaction_id = "contact_visa_transaction"
|
166
|
+
store_id = "store-id"
|
167
|
+
|
168
|
+
collection = Braintree::Transaction.search do |search|
|
169
|
+
search.id.is transaction_id
|
170
|
+
search.store_ids.in store_id
|
171
|
+
end
|
172
|
+
|
173
|
+
collection.maximum_size.should == 1
|
174
|
+
collection.first.id.should == transaction_id
|
175
|
+
end
|
176
|
+
|
164
177
|
context "multiple value fields" do
|
165
178
|
it "searches on created_using" do
|
166
179
|
transaction = Braintree::Transaction.sale!(
|
@@ -168,7 +181,7 @@ describe Braintree::Transaction, "search" do
|
|
168
181
|
:credit_card => {
|
169
182
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
170
183
|
:expiration_date => "05/12"
|
171
|
-
}
|
184
|
+
},
|
172
185
|
)
|
173
186
|
|
174
187
|
collection = Braintree::Transaction.search do |search|
|
@@ -199,7 +212,7 @@ describe Braintree::Transaction, "search" do
|
|
199
212
|
:credit_card => {
|
200
213
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
201
214
|
:expiration_date => "05/12"
|
202
|
-
}
|
215
|
+
},
|
203
216
|
)
|
204
217
|
|
205
218
|
collection = Braintree::Transaction.search do |search|
|
@@ -230,7 +243,7 @@ describe Braintree::Transaction, "search" do
|
|
230
243
|
:credit_card => {
|
231
244
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
232
245
|
:expiration_date => "05/12"
|
233
|
-
}
|
246
|
+
},
|
234
247
|
)
|
235
248
|
|
236
249
|
collection = Braintree::Transaction.search do |search|
|
@@ -261,7 +274,7 @@ describe Braintree::Transaction, "search" do
|
|
261
274
|
:credit_card => {
|
262
275
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
263
276
|
:expiration_date => "05/12"
|
264
|
-
}
|
277
|
+
},
|
265
278
|
)
|
266
279
|
|
267
280
|
collection = Braintree::Transaction.search do |search|
|
@@ -301,7 +314,7 @@ describe Braintree::Transaction, "search" do
|
|
301
314
|
:number => Braintree::Test::CreditCardNumbers::Elo,
|
302
315
|
:cvv => "737",
|
303
316
|
:expiration_date => "10/2020"
|
304
|
-
}
|
317
|
+
},
|
305
318
|
)
|
306
319
|
|
307
320
|
collection = Braintree::Transaction.search do |search|
|
@@ -318,7 +331,7 @@ describe Braintree::Transaction, "search" do
|
|
318
331
|
:credit_card => {
|
319
332
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
320
333
|
:expiration_date => "05/12"
|
321
|
-
}
|
334
|
+
},
|
322
335
|
)
|
323
336
|
|
324
337
|
collection = Braintree::Transaction.search do |search|
|
@@ -333,7 +346,7 @@ describe Braintree::Transaction, "search" do
|
|
333
346
|
it "searches by payment instrument type PayPal" do
|
334
347
|
transaction = Braintree::Transaction.sale!(
|
335
348
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
336
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
349
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
337
350
|
)
|
338
351
|
|
339
352
|
collection = Braintree::Transaction.search do |search|
|
@@ -348,7 +361,7 @@ describe Braintree::Transaction, "search" do
|
|
348
361
|
it "searches by payment instrument type LocalPaymentDetail" do
|
349
362
|
transaction = Braintree::Transaction.sale!(
|
350
363
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
351
|
-
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment
|
364
|
+
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment,
|
352
365
|
)
|
353
366
|
|
354
367
|
collection = Braintree::Transaction.search do |search|
|
@@ -363,7 +376,7 @@ describe Braintree::Transaction, "search" do
|
|
363
376
|
it "searches by payment instrument type ApplePay" do
|
364
377
|
transaction = Braintree::Transaction.sale!(
|
365
378
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
366
|
-
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa
|
379
|
+
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa,
|
367
380
|
)
|
368
381
|
|
369
382
|
collection = Braintree::Transaction.search do |search|
|
@@ -381,7 +394,7 @@ describe Braintree::Transaction, "search" do
|
|
381
394
|
:credit_card => {
|
382
395
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
383
396
|
:expiration_date => "05/12"
|
384
|
-
}
|
397
|
+
},
|
385
398
|
)
|
386
399
|
|
387
400
|
collection = Braintree::Transaction.search do |search|
|
@@ -421,7 +434,7 @@ describe Braintree::Transaction, "search" do
|
|
421
434
|
:credit_card => {
|
422
435
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
423
436
|
:expiration_date => "05/12"
|
424
|
-
}
|
437
|
+
},
|
425
438
|
)
|
426
439
|
|
427
440
|
collection = Braintree::Transaction.search do |search|
|
@@ -454,7 +467,7 @@ describe Braintree::Transaction, "search" do
|
|
454
467
|
:cardholder_name => cardholder_name,
|
455
468
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
456
469
|
:expiration_date => "05/12"
|
457
|
-
}
|
470
|
+
},
|
458
471
|
)
|
459
472
|
|
460
473
|
transaction = Braintree::Transaction.sale!(
|
@@ -464,7 +477,7 @@ describe Braintree::Transaction, "search" do
|
|
464
477
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
465
478
|
:expiration_date => "05/12"
|
466
479
|
},
|
467
|
-
:options => {
|
480
|
+
:options => {:submit_for_settlement => true},
|
468
481
|
)
|
469
482
|
SpecHelper.settle_transaction transaction.id
|
470
483
|
|
@@ -495,6 +508,19 @@ describe Braintree::Transaction, "search" do
|
|
495
508
|
collection.maximum_size.should == 1
|
496
509
|
collection.first.id.should == credit_transaction.id
|
497
510
|
end
|
511
|
+
|
512
|
+
it "searches on store_ids" do
|
513
|
+
transaction_id = "contact_visa_transaction"
|
514
|
+
store_ids = ["store-id"]
|
515
|
+
|
516
|
+
collection = Braintree::Transaction.search do |search|
|
517
|
+
search.id.is transaction_id
|
518
|
+
search.store_ids.in store_ids
|
519
|
+
end
|
520
|
+
|
521
|
+
collection.maximum_size.should == 1
|
522
|
+
collection.first.id.should == transaction_id
|
523
|
+
end
|
498
524
|
end
|
499
525
|
|
500
526
|
context "invalid search" do
|
@@ -516,7 +542,7 @@ describe Braintree::Transaction, "search" do
|
|
516
542
|
:credit_card => {
|
517
543
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
518
544
|
:expiration_date => "05/12"
|
519
|
-
}
|
545
|
+
},
|
520
546
|
)
|
521
547
|
|
522
548
|
collection = Braintree::Transaction.search do |search|
|
@@ -557,7 +583,7 @@ describe Braintree::Transaction, "search" do
|
|
557
583
|
:credit_card => {
|
558
584
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
559
585
|
:expiration_date => "05/12"
|
560
|
-
}
|
586
|
+
},
|
561
587
|
)
|
562
588
|
|
563
589
|
collection = Braintree::Transaction.search do |search|
|
@@ -576,7 +602,7 @@ describe Braintree::Transaction, "search" do
|
|
576
602
|
:credit_card => {
|
577
603
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
578
604
|
:expiration_date => "05/12"
|
579
|
-
}
|
605
|
+
},
|
580
606
|
)
|
581
607
|
|
582
608
|
created_at = transaction.created_at
|
@@ -586,7 +612,7 @@ describe Braintree::Transaction, "search" do
|
|
586
612
|
search.id.is transaction.id
|
587
613
|
search.created_at.between(
|
588
614
|
created_at - 60,
|
589
|
-
created_at + 60
|
615
|
+
created_at + 60,
|
590
616
|
)
|
591
617
|
end
|
592
618
|
|
@@ -613,7 +639,7 @@ describe Braintree::Transaction, "search" do
|
|
613
639
|
search.id.is transaction.id
|
614
640
|
search.created_at.between(
|
615
641
|
created_at - 300,
|
616
|
-
created_at - 100
|
642
|
+
created_at - 100,
|
617
643
|
)
|
618
644
|
end
|
619
645
|
|
@@ -634,7 +660,7 @@ describe Braintree::Transaction, "search" do
|
|
634
660
|
:credit_card => {
|
635
661
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
636
662
|
:expiration_date => "05/12"
|
637
|
-
}
|
663
|
+
},
|
638
664
|
)
|
639
665
|
|
640
666
|
now = Time.now
|
@@ -643,7 +669,7 @@ describe Braintree::Transaction, "search" do
|
|
643
669
|
search.id.is transaction.id
|
644
670
|
search.created_at.between(
|
645
671
|
now - 60,
|
646
|
-
now + 60
|
672
|
+
now + 60,
|
647
673
|
)
|
648
674
|
end
|
649
675
|
|
@@ -670,7 +696,7 @@ describe Braintree::Transaction, "search" do
|
|
670
696
|
search.id.is transaction.id
|
671
697
|
search.created_at.between(
|
672
698
|
now - 300,
|
673
|
-
now - 100
|
699
|
+
now - 100,
|
674
700
|
)
|
675
701
|
end
|
676
702
|
|
@@ -683,14 +709,14 @@ describe Braintree::Transaction, "search" do
|
|
683
709
|
:credit_card => {
|
684
710
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
685
711
|
:expiration_date => "05/12"
|
686
|
-
}
|
712
|
+
},
|
687
713
|
)
|
688
714
|
|
689
715
|
collection = Braintree::Transaction.search do |search|
|
690
716
|
search.id.is transaction.id
|
691
717
|
search.created_at.between(
|
692
718
|
Date.today - 1,
|
693
|
-
Date.today + 1
|
719
|
+
Date.today + 1,
|
694
720
|
)
|
695
721
|
end
|
696
722
|
|
@@ -708,7 +734,7 @@ describe Braintree::Transaction, "search" do
|
|
708
734
|
search.id.is transaction_id
|
709
735
|
search.disbursement_date.between(
|
710
736
|
disbursement_time - 60,
|
711
|
-
disbursement_time + 60
|
737
|
+
disbursement_time + 60,
|
712
738
|
)
|
713
739
|
end
|
714
740
|
|
@@ -735,7 +761,7 @@ describe Braintree::Transaction, "search" do
|
|
735
761
|
search.id.is transaction_id
|
736
762
|
search.disbursement_date.between(
|
737
763
|
disbursement_time - 300,
|
738
|
-
disbursement_time - 100
|
764
|
+
disbursement_time - 100,
|
739
765
|
)
|
740
766
|
end
|
741
767
|
|
@@ -758,7 +784,7 @@ describe Braintree::Transaction, "search" do
|
|
758
784
|
search.id.is transaction_id
|
759
785
|
search.disbursement_date.between(
|
760
786
|
now - 60,
|
761
|
-
now + 60
|
787
|
+
now + 60,
|
762
788
|
)
|
763
789
|
end
|
764
790
|
|
@@ -785,7 +811,7 @@ describe Braintree::Transaction, "search" do
|
|
785
811
|
search.id.is transaction_id
|
786
812
|
search.disbursement_date.between(
|
787
813
|
now - 300,
|
788
|
-
now - 100
|
814
|
+
now - 100,
|
789
815
|
)
|
790
816
|
end
|
791
817
|
|
@@ -800,7 +826,7 @@ describe Braintree::Transaction, "search" do
|
|
800
826
|
search.id.is transaction_id
|
801
827
|
search.disbursement_date.between(
|
802
828
|
disbursement_date - 1,
|
803
|
-
disbursement_date + 1
|
829
|
+
disbursement_date + 1,
|
804
830
|
)
|
805
831
|
end
|
806
832
|
|
@@ -816,7 +842,7 @@ describe Braintree::Transaction, "search" do
|
|
816
842
|
:credit_card => {
|
817
843
|
:number => Braintree::Test::CreditCardNumbers::Disputes::Chargeback,
|
818
844
|
:expiration_date => "03/18"
|
819
|
-
}
|
845
|
+
},
|
820
846
|
)
|
821
847
|
|
822
848
|
@disputed_date = @disputed_transaction.disputes.first.received_date
|
@@ -841,7 +867,7 @@ describe Braintree::Transaction, "search" do
|
|
841
867
|
search.id.is @disputed_transaction.id
|
842
868
|
search.dispute_date.between(
|
843
869
|
@disputed_time - 60,
|
844
|
-
@disputed_time + 60
|
870
|
+
@disputed_time + 60,
|
845
871
|
)
|
846
872
|
end
|
847
873
|
|
@@ -880,7 +906,7 @@ describe Braintree::Transaction, "search" do
|
|
880
906
|
search.id.is @disputed_transaction.id
|
881
907
|
search.dispute_date.between(
|
882
908
|
now - 60,
|
883
|
-
now + 60
|
909
|
+
now + 60,
|
884
910
|
)
|
885
911
|
end
|
886
912
|
|
@@ -908,7 +934,7 @@ describe Braintree::Transaction, "search" do
|
|
908
934
|
search.id.is @disputed_transaction.id
|
909
935
|
search.dispute_date.between(
|
910
936
|
@disputed_date - 1,
|
911
|
-
@disputed_date + 1
|
937
|
+
@disputed_date + 1,
|
912
938
|
)
|
913
939
|
end
|
914
940
|
|
@@ -924,14 +950,14 @@ describe Braintree::Transaction, "search" do
|
|
924
950
|
:credit_card => {
|
925
951
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
926
952
|
:expiration_date => "05/12"
|
927
|
-
}
|
953
|
+
},
|
928
954
|
)
|
929
955
|
|
930
956
|
collection = Braintree::Transaction.search do |search|
|
931
957
|
search.id.is transaction.id
|
932
958
|
search.authorized_at.between(
|
933
959
|
Date.today - 2,
|
934
|
-
Date.today - 1
|
960
|
+
Date.today - 1,
|
935
961
|
)
|
936
962
|
end
|
937
963
|
|
@@ -941,7 +967,7 @@ describe Braintree::Transaction, "search" do
|
|
941
967
|
search.id.is transaction.id
|
942
968
|
search.authorized_at.between(
|
943
969
|
Date.today - 1,
|
944
|
-
Date.today + 1
|
970
|
+
Date.today + 1,
|
945
971
|
)
|
946
972
|
end
|
947
973
|
|
@@ -955,14 +981,14 @@ describe Braintree::Transaction, "search" do
|
|
955
981
|
:credit_card => {
|
956
982
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
957
983
|
:expiration_date => "05/12"
|
958
|
-
}
|
984
|
+
},
|
959
985
|
).transaction
|
960
986
|
|
961
987
|
collection = Braintree::Transaction.search do |search|
|
962
988
|
search.id.is transaction.id
|
963
989
|
search.failed_at.between(
|
964
990
|
Date.today - 2,
|
965
|
-
Date.today - 1
|
991
|
+
Date.today - 1,
|
966
992
|
)
|
967
993
|
end
|
968
994
|
|
@@ -972,7 +998,7 @@ describe Braintree::Transaction, "search" do
|
|
972
998
|
search.id.is transaction.id
|
973
999
|
search.failed_at.between(
|
974
1000
|
Date.today - 1,
|
975
|
-
Date.today + 1
|
1001
|
+
Date.today + 1,
|
976
1002
|
)
|
977
1003
|
end
|
978
1004
|
|
@@ -984,7 +1010,7 @@ describe Braintree::Transaction, "search" do
|
|
984
1010
|
collection = Braintree::Transaction.search do |search|
|
985
1011
|
search.authorization_expired_at.between(
|
986
1012
|
Date.today - 2,
|
987
|
-
Date.today - 1
|
1013
|
+
Date.today - 1,
|
988
1014
|
)
|
989
1015
|
end
|
990
1016
|
|
@@ -993,7 +1019,7 @@ describe Braintree::Transaction, "search" do
|
|
993
1019
|
collection = Braintree::Transaction.search do |search|
|
994
1020
|
search.authorization_expired_at.between(
|
995
1021
|
Date.today - 1,
|
996
|
-
Date.today + 1
|
1022
|
+
Date.today + 1,
|
997
1023
|
)
|
998
1024
|
end
|
999
1025
|
|
@@ -1017,14 +1043,14 @@ describe Braintree::Transaction, "search" do
|
|
1017
1043
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1018
1044
|
:expiration_date => "05/12",
|
1019
1045
|
:cvv => "200"
|
1020
|
-
}
|
1046
|
+
},
|
1021
1047
|
).transaction
|
1022
1048
|
|
1023
1049
|
collection = Braintree::Transaction.search do |search|
|
1024
1050
|
search.id.is transaction.id
|
1025
1051
|
search.gateway_rejected_at.between(
|
1026
1052
|
Date.today - 2,
|
1027
|
-
Date.today - 1
|
1053
|
+
Date.today - 1,
|
1028
1054
|
)
|
1029
1055
|
end
|
1030
1056
|
|
@@ -1034,7 +1060,7 @@ describe Braintree::Transaction, "search" do
|
|
1034
1060
|
search.id.is transaction.id
|
1035
1061
|
search.gateway_rejected_at.between(
|
1036
1062
|
Date.today - 1,
|
1037
|
-
Date.today + 1
|
1063
|
+
Date.today + 1,
|
1038
1064
|
)
|
1039
1065
|
end
|
1040
1066
|
|
@@ -1053,14 +1079,14 @@ describe Braintree::Transaction, "search" do
|
|
1053
1079
|
:credit_card => {
|
1054
1080
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1055
1081
|
:expiration_date => "05/12"
|
1056
|
-
}
|
1082
|
+
},
|
1057
1083
|
).transaction
|
1058
1084
|
|
1059
1085
|
collection = Braintree::Transaction.search do |search|
|
1060
1086
|
search.id.is transaction.id
|
1061
1087
|
search.processor_declined_at.between(
|
1062
1088
|
Date.today - 2,
|
1063
|
-
Date.today - 1
|
1089
|
+
Date.today - 1,
|
1064
1090
|
)
|
1065
1091
|
end
|
1066
1092
|
|
@@ -1070,7 +1096,7 @@ describe Braintree::Transaction, "search" do
|
|
1070
1096
|
search.id.is transaction.id
|
1071
1097
|
search.processor_declined_at.between(
|
1072
1098
|
Date.today - 1,
|
1073
|
-
Date.today + 1
|
1099
|
+
Date.today + 1,
|
1074
1100
|
)
|
1075
1101
|
end
|
1076
1102
|
|
@@ -1087,7 +1113,7 @@ describe Braintree::Transaction, "search" do
|
|
1087
1113
|
},
|
1088
1114
|
:options => {
|
1089
1115
|
:submit_for_settlement => true
|
1090
|
-
}
|
1116
|
+
},
|
1091
1117
|
).transaction
|
1092
1118
|
|
1093
1119
|
SpecHelper.settle_transaction transaction.id
|
@@ -1096,7 +1122,7 @@ describe Braintree::Transaction, "search" do
|
|
1096
1122
|
search.id.is transaction.id
|
1097
1123
|
search.settled_at.between(
|
1098
1124
|
Date.today - 2,
|
1099
|
-
Date.today - 1
|
1125
|
+
Date.today - 1,
|
1100
1126
|
)
|
1101
1127
|
end
|
1102
1128
|
|
@@ -1106,7 +1132,7 @@ describe Braintree::Transaction, "search" do
|
|
1106
1132
|
search.id.is transaction.id
|
1107
1133
|
search.settled_at.between(
|
1108
1134
|
Date.today - 1,
|
1109
|
-
Date.today + 1
|
1135
|
+
Date.today + 1,
|
1110
1136
|
)
|
1111
1137
|
end
|
1112
1138
|
|
@@ -1123,14 +1149,14 @@ describe Braintree::Transaction, "search" do
|
|
1123
1149
|
},
|
1124
1150
|
:options => {
|
1125
1151
|
:submit_for_settlement => true
|
1126
|
-
}
|
1152
|
+
},
|
1127
1153
|
).transaction
|
1128
1154
|
|
1129
1155
|
collection = Braintree::Transaction.search do |search|
|
1130
1156
|
search.id.is transaction.id
|
1131
1157
|
search.submitted_for_settlement_at.between(
|
1132
1158
|
Date.today - 2,
|
1133
|
-
Date.today - 1
|
1159
|
+
Date.today - 1,
|
1134
1160
|
)
|
1135
1161
|
end
|
1136
1162
|
|
@@ -1140,7 +1166,7 @@ describe Braintree::Transaction, "search" do
|
|
1140
1166
|
search.id.is transaction.id
|
1141
1167
|
search.submitted_for_settlement_at.between(
|
1142
1168
|
Date.today - 1,
|
1143
|
-
Date.today + 1
|
1169
|
+
Date.today + 1,
|
1144
1170
|
)
|
1145
1171
|
end
|
1146
1172
|
|
@@ -1154,7 +1180,7 @@ describe Braintree::Transaction, "search" do
|
|
1154
1180
|
:credit_card => {
|
1155
1181
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1156
1182
|
:expiration_date => "05/12"
|
1157
|
-
}
|
1183
|
+
},
|
1158
1184
|
)
|
1159
1185
|
transaction = Braintree::Transaction.void(transaction.id).transaction
|
1160
1186
|
|
@@ -1162,7 +1188,7 @@ describe Braintree::Transaction, "search" do
|
|
1162
1188
|
search.id.is transaction.id
|
1163
1189
|
search.voided_at.between(
|
1164
1190
|
Date.today - 2,
|
1165
|
-
Date.today - 1
|
1191
|
+
Date.today - 1,
|
1166
1192
|
)
|
1167
1193
|
end
|
1168
1194
|
|
@@ -1172,7 +1198,7 @@ describe Braintree::Transaction, "search" do
|
|
1172
1198
|
search.id.is transaction.id
|
1173
1199
|
search.voided_at.between(
|
1174
1200
|
Date.today - 1,
|
1175
|
-
Date.today + 1
|
1201
|
+
Date.today + 1,
|
1176
1202
|
)
|
1177
1203
|
end
|
1178
1204
|
|
@@ -1190,18 +1216,18 @@ describe Braintree::Transaction, "search" do
|
|
1190
1216
|
},
|
1191
1217
|
:options => {
|
1192
1218
|
:submit_for_settlement => true
|
1193
|
-
}
|
1219
|
+
},
|
1194
1220
|
)
|
1195
1221
|
|
1196
1222
|
collection = Braintree::Transaction.search do |search|
|
1197
1223
|
search.id.is transaction.id
|
1198
1224
|
search.authorized_at.between(
|
1199
1225
|
Date.today - 1,
|
1200
|
-
Date.today + 1
|
1226
|
+
Date.today + 1,
|
1201
1227
|
)
|
1202
1228
|
search.submitted_for_settlement_at.between(
|
1203
1229
|
Date.today - 1,
|
1204
|
-
Date.today + 1
|
1230
|
+
Date.today + 1,
|
1205
1231
|
)
|
1206
1232
|
end
|
1207
1233
|
|
@@ -1213,7 +1239,7 @@ describe Braintree::Transaction, "search" do
|
|
1213
1239
|
collection = Braintree::Transaction.search
|
1214
1240
|
collection.maximum_size.should > 100
|
1215
1241
|
|
1216
|
-
transaction_ids = collection.map {|t| t.id }.uniq.compact
|
1242
|
+
transaction_ids = collection.map { |t| t.id }.uniq.compact
|
1217
1243
|
transaction_ids.size.should == collection.maximum_size
|
1218
1244
|
end
|
1219
1245
|
|
@@ -1225,7 +1251,7 @@ describe Braintree::Transaction, "search" do
|
|
1225
1251
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1226
1252
|
:expiration_date => "05/2012",
|
1227
1253
|
:cardholder_name => "Tom Smith"
|
1228
|
-
}
|
1254
|
+
},
|
1229
1255
|
)
|
1230
1256
|
end
|
1231
1257
|
|
@@ -1319,7 +1345,7 @@ describe Braintree::Transaction, "search" do
|
|
1319
1345
|
it "raises a UnexpectedError" do
|
1320
1346
|
expect {
|
1321
1347
|
collection = Braintree::Transaction.search do |search|
|
1322
|
-
search.amount.is
|
1348
|
+
search.amount.is(-10)
|
1323
1349
|
end
|
1324
1350
|
}.to raise_error(Braintree::UnexpectedError)
|
1325
1351
|
end
|
@@ -1336,7 +1362,7 @@ describe Braintree::Transaction, "search" do
|
|
1336
1362
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1337
1363
|
:expiration_date => "05/2012",
|
1338
1364
|
:cardholder_name => "#{cardholder_name} #{index}"
|
1339
|
-
}
|
1365
|
+
},
|
1340
1366
|
)
|
1341
1367
|
end
|
1342
1368
|
|
@@ -1353,7 +1379,7 @@ describe Braintree::Transaction, "search" do
|
|
1353
1379
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1354
1380
|
:expiration_date => "05/2012",
|
1355
1381
|
:cardholder_name => new_cardholder_name,
|
1356
|
-
}
|
1382
|
+
},
|
1357
1383
|
)
|
1358
1384
|
|
1359
1385
|
transactions = collection.to_a
|