braintree 2.98.0 → 4.23.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/LICENSE +1 -1
- data/braintree.gemspec +7 -4
- data/lib/braintree/account_updater_daily_report.rb +4 -4
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +7 -27
- data/lib/braintree/address_gateway.rb +8 -7
- data/lib/braintree/advanced_search.rb +11 -12
- data/lib/braintree/apple_pay.rb +4 -4
- data/lib/braintree/apple_pay_card.rb +18 -4
- data/lib/braintree/apple_pay_options.rb +4 -4
- data/lib/braintree/authorization_adjustment.rb +4 -4
- data/lib/braintree/base_module.rb +11 -1
- data/lib/braintree/bin_data.rb +10 -3
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/client_token_gateway.rb +4 -3
- data/lib/braintree/configuration.rb +35 -35
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +2 -2
- data/lib/braintree/connected_merchant_status_transitioned.rb +2 -2
- data/lib/braintree/credit_card.rb +40 -86
- data/lib/braintree/credit_card_gateway.rb +58 -44
- data/lib/braintree/credit_card_verification.rb +39 -20
- data/lib/braintree/credit_card_verification_gateway.rb +35 -5
- data/lib/braintree/credit_card_verification_search.rb +2 -2
- data/lib/braintree/customer.rb +23 -88
- data/lib/braintree/customer_gateway.rb +17 -32
- data/lib/braintree/customer_search.rb +2 -2
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +7 -7
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/{transaction/coinbase_details.rb → dispute/paypal_message.rb} +5 -6
- data/lib/braintree/dispute/{history_event.rb → status_history.rb} +3 -1
- data/lib/braintree/dispute/transaction.rb +3 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +47 -6
- data/lib/braintree/dispute_gateway.rb +5 -10
- data/lib/braintree/dispute_search.rb +8 -4
- data/lib/braintree/document_upload.rb +3 -3
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +21 -0
- data/lib/braintree/error_codes.rb +217 -175
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +6 -5
- data/lib/braintree/exchange_rate.rb +13 -0
- data/lib/braintree/exchange_rate_quote.rb +24 -0
- data/lib/braintree/exchange_rate_quote_gateway.rb +35 -0
- data/lib/braintree/exchange_rate_quote_input.rb +21 -0
- data/lib/braintree/exchange_rate_quote_request.rb +18 -0
- data/lib/braintree/exchange_rate_quote_response.rb +18 -0
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/gateway.rb +6 -12
- data/lib/braintree/{android_pay_card.rb → google_pay_card.rb} +18 -5
- data/lib/braintree/granted_payment_instrument_update.rb +2 -2
- data/lib/braintree/graphql_client.rb +14 -8
- data/lib/braintree/http.rb +9 -10
- data/lib/braintree/local_payment_completed/blik_alias.rb +23 -0
- data/lib/braintree/local_payment_completed.rb +10 -5
- data/lib/braintree/local_payment_expired.rb +21 -0
- data/lib/braintree/local_payment_funded.rb +22 -0
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +4 -4
- data/lib/braintree/merchant_account.rb +3 -3
- data/lib/braintree/merchant_account_gateway.rb +10 -8
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +4 -4
- data/lib/braintree/oauth_credentials.rb +4 -4
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +14 -13
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +24 -0
- data/lib/braintree/payment_method_gateway.rb +52 -22
- data/lib/braintree/payment_method_nonce.rb +12 -7
- data/lib/braintree/payment_method_nonce_details.rb +40 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +14 -3
- data/lib/braintree/payment_method_parser.rb +4 -7
- data/lib/braintree/paypal_account.rb +3 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +22 -2
- data/lib/braintree/plan_gateway.rb +101 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +10 -5
- data/lib/braintree/revoked_payment_method_metadata.rb +2 -2
- data/lib/braintree/risk_data/liability_shift.rb +22 -0
- data/lib/braintree/risk_data.rb +10 -3
- data/lib/braintree/samsung_pay_card.rb +8 -6
- data/lib/braintree/sepa_direct_debit_account.rb +60 -0
- data/lib/braintree/sepa_direct_debit_account_gateway.rb +25 -0
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +28 -0
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +13 -13
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +5 -4
- data/lib/braintree/test/authentication_id.rb +21 -0
- data/lib/braintree/test/credit_card.rb +9 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +27 -20
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/test/venmo_sdk.rb +2 -0
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +23 -11
- data/lib/braintree/transaction/address_details.rb +14 -1
- data/lib/braintree/transaction/apple_pay_details.rb +13 -10
- data/lib/braintree/transaction/credit_card_details.rb +8 -1
- data/lib/braintree/transaction/customer_details.rb +3 -2
- data/lib/braintree/transaction/disbursement_details.rb +2 -1
- data/lib/braintree/transaction/{android_pay_details.rb → google_pay_details.rb} +6 -1
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/local_payment_details.rb +3 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/package_details.rb +19 -0
- data/lib/braintree/transaction/payment_receipt/card_present_data.rb +36 -0
- data/lib/braintree/transaction/payment_receipt/merchant_address.rb +19 -0
- data/lib/braintree/transaction/payment_receipt.rb +31 -0
- data/lib/braintree/transaction/paypal_details.rb +5 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +3 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +27 -0
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +3 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +2 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +119 -128
- data/lib/braintree/transaction_gateway.rb +138 -64
- data/lib/braintree/transaction_line_item.rb +14 -11
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +18 -0
- data/lib/braintree/transaction_search.rb +11 -7
- data/lib/braintree/unknown_payment_method.rb +2 -2
- data/lib/braintree/us_bank_account.rb +5 -5
- data/lib/braintree/us_bank_account_verification.rb +24 -16
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +25 -10
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +4 -4
- data/lib/braintree/venmo_profile_data.rb +25 -0
- data/lib/braintree/version.rb +2 -2
- data/lib/braintree/visa_checkout_card.rb +8 -8
- data/lib/braintree/webhook_notification.rb +55 -33
- data/lib/braintree/webhook_notification_gateway.rb +9 -9
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +569 -46
- data/lib/braintree/xml/generator.rb +6 -5
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +24 -37
- data/lib/braintree/xml/rexml.rb +6 -7
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +41 -24
- data/lib/ssl/api_braintreegateway_com.ca.crt +401 -168
- data/spec/integration/braintree/add_on_spec.rb +10 -10
- data/spec/integration/braintree/address_spec.rb +101 -178
- data/spec/integration/braintree/advanced_search_spec.rb +93 -93
- data/spec/integration/braintree/apple_pay_spec.rb +12 -12
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +279 -62
- data/spec/integration/braintree/client_api/spec_helper.rb +99 -73
- data/spec/integration/braintree/credit_card_spec.rb +522 -821
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/credit_card_verification_spec.rb +219 -30
- data/spec/integration/braintree/customer_search_spec.rb +28 -28
- data/spec/integration/braintree/customer_spec.rb +840 -757
- data/spec/integration/braintree/disbursement_spec.rb +2 -2
- data/spec/integration/braintree/discount_spec.rb +9 -9
- data/spec/integration/braintree/dispute_search_spec.rb +45 -9
- data/spec/integration/braintree/dispute_spec.rb +109 -82
- data/spec/integration/braintree/document_upload_spec.rb +29 -17
- data/spec/integration/braintree/error_codes_spec.rb +3 -3
- data/spec/integration/braintree/exchange_rate_quote_spec.rb +97 -0
- data/spec/integration/braintree/graphql_client_spec.rb +0 -2
- data/spec/integration/braintree/http_spec.rb +31 -33
- data/spec/integration/braintree/merchant_account_spec.rb +155 -156
- data/spec/integration/braintree/merchant_spec.rb +71 -192
- data/spec/integration/braintree/oauth_spec.rb +72 -72
- data/spec/integration/braintree/package_tracking_spec.rb +130 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +173 -78
- data/spec/integration/braintree/payment_method_spec.rb +953 -501
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +147 -234
- data/spec/integration/braintree/paypal_account_spec.rb +74 -72
- data/spec/integration/braintree/plan_spec.rb +96 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +75 -73
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +194 -0
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +18 -18
- data/spec/integration/braintree/subscription_spec.rb +507 -513
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +4 -4
- data/spec/integration/braintree/test_transaction_spec.rb +29 -29
- data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
- data/spec/integration/braintree/transaction_search_spec.rb +410 -217
- data/spec/integration/braintree/transaction_spec.rb +3252 -2102
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +42 -278
- data/spec/integration/braintree/us_bank_account_spec.rb +36 -36
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +25 -25
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +41 -41
- data/spec/integration/braintree/visa_checkout_card_spec.rb +62 -62
- data/spec/integration/spec_helper.rb +22 -7
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +15 -20
- data/spec/unit/braintree/address_spec.rb +9 -17
- data/spec/unit/braintree/apple_pay_card_spec.rb +110 -7
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +6 -6
- data/spec/unit/braintree/configuration_spec.rb +84 -84
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +91 -58
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +56 -0
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +10 -10
- data/spec/unit/braintree/credit_card_verification_spec.rb +40 -18
- data/spec/unit/braintree/customer_spec.rb +102 -57
- data/spec/unit/braintree/digest_spec.rb +5 -6
- data/spec/unit/braintree/disbursement_spec.rb +14 -14
- data/spec/unit/braintree/dispute_search_spec.rb +6 -2
- data/spec/unit/braintree/dispute_spec.rb +144 -66
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +41 -0
- data/spec/unit/braintree/error_result_spec.rb +11 -11
- data/spec/unit/braintree/errors_spec.rb +17 -17
- data/spec/unit/braintree/exchange_rate_quote_input_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_quote_request_spec.rb +82 -0
- data/spec/unit/braintree/exchange_rate_quote_response_spec.rb +52 -0
- data/spec/unit/braintree/exchange_rate_quote_spec.rb +42 -0
- data/spec/unit/braintree/exchange_rate_spec.rb +23 -0
- data/spec/unit/braintree/http_spec.rb +19 -17
- data/spec/unit/braintree/local_payment_completed_spec.rb +62 -8
- data/spec/unit/braintree/local_payment_expired_spec.rb +24 -0
- data/spec/unit/braintree/local_payment_funded_spec.rb +34 -0
- data/spec/unit/braintree/merchant_account_spec.rb +5 -5
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/package_tracking_spec.rb +77 -0
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +45 -0
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +51 -0
- data/spec/unit/braintree/payment_method_nonce_spec.rb +40 -0
- data/spec/unit/braintree/payment_method_spec.rb +20 -20
- data/spec/unit/braintree/paypal_account_spec.rb +16 -7
- data/spec/unit/braintree/resource_collection_spec.rb +34 -5
- data/spec/unit/braintree/risk_data/liability_shift.rb +26 -0
- data/spec/unit/braintree/risk_data_spec.rb +38 -8
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +29 -0
- data/spec/unit/braintree/sepa_debit_account_spec.rb +86 -0
- data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
- data/spec/unit/braintree/signature_service_spec.rb +2 -2
- data/spec/unit/braintree/subscription_search_spec.rb +18 -18
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +6 -6
- data/spec/unit/braintree/three_d_secure_info_spec.rb +37 -17
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +22 -6
- data/spec/unit/braintree/transaction/customer_details_spec.rb +3 -2
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +4 -4
- data/spec/unit/braintree/transaction/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +36 -0
- data/spec/unit/braintree/transaction/payment_receipt_spec.rb +73 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +63 -0
- data/spec/unit/braintree/transaction/sepa_direct_debit_account_details_spec.rb +33 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +150 -0
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +221 -124
- data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
- data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
- data/spec/unit/braintree/util_spec.rb +78 -44
- data/spec/unit/braintree/validation_error_collection_spec.rb +62 -62
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +43 -0
- data/spec/unit/braintree/webhook_notification_spec.rb +434 -197
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +27 -22
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +38 -38
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +91 -30
- data/lib/braintree/amex_express_checkout_card.rb +0 -38
- data/lib/braintree/coinbase_account.rb +0 -34
- data/lib/braintree/europe_bank_account.rb +0 -36
- data/lib/braintree/europe_bank_account_gateway.rb +0 -17
- data/lib/braintree/ideal_payment.rb +0 -61
- data/lib/braintree/ideal_payment_gateway.rb +0 -19
- data/lib/braintree/masterpass_card.rb +0 -81
- data/lib/braintree/settlement_batch.rb +0 -0
- data/lib/braintree/transaction/amex_express_checkout_details.rb +0 -21
- data/lib/braintree/transaction/ideal_payment_details.rb +0 -19
- data/lib/braintree/transaction/masterpass_card_details.rb +0 -47
- data/lib/braintree/transparent_redirect.rb +0 -40
- data/lib/braintree/transparent_redirect_gateway.rb +0 -105
- data/spec/hacks/tcp_socket.rb +0 -18
- data/spec/integration/braintree/coinbase_spec.rb +0 -34
- data/spec/integration/braintree/masterpass_card_spec.rb +0 -97
- data/spec/integration/braintree/transparent_redirect_spec.rb +0 -268
- data/spec/unit/braintree/transparent_redirect_spec.rb +0 -223
@@ -8,7 +8,7 @@ describe Braintree::Transaction, "search" do
|
|
8
8
|
search.billing_first_name.is "thisnameisnotreal"
|
9
9
|
end
|
10
10
|
|
11
|
-
collection.maximum_size.
|
11
|
+
expect(collection.maximum_size).to eq(0)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "can search on text fields" do
|
@@ -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
|
@@ -109,14 +109,14 @@ describe Braintree::Transaction, "search" do
|
|
109
109
|
search.id.is transaction.id
|
110
110
|
search.send(criterion).is value
|
111
111
|
end
|
112
|
-
collection.maximum_size.
|
113
|
-
collection.first.id.
|
112
|
+
expect(collection.maximum_size).to eq(1)
|
113
|
+
expect(collection.first.id).to eq(transaction.id)
|
114
114
|
|
115
115
|
collection = Braintree::Transaction.search do |search|
|
116
116
|
search.id.is transaction.id
|
117
117
|
search.send(criterion).is("invalid_attribute")
|
118
118
|
end
|
119
|
-
collection.
|
119
|
+
expect(collection).to be_empty
|
120
120
|
end
|
121
121
|
|
122
122
|
collection = Braintree::Transaction.search do |search|
|
@@ -126,27 +126,27 @@ describe Braintree::Transaction, "search" do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
collection.maximum_size.
|
130
|
-
collection.first.id.
|
129
|
+
expect(collection.maximum_size).to eq(1)
|
130
|
+
expect(collection.first.id).to eq(transaction.id)
|
131
131
|
end
|
132
132
|
|
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::
|
136
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
|
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 }.
|
143
|
+
expect(collection.any? { |t| t.id == transaction.id }).to eq(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::
|
149
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalBillingAgreement,
|
150
150
|
)
|
151
151
|
|
152
152
|
paypal_details = transaction.paypal_details
|
@@ -157,8 +157,44 @@ describe Braintree::Transaction, "search" do
|
|
157
157
|
search.paypal_payer_email.is paypal_details.payer_email
|
158
158
|
end
|
159
159
|
|
160
|
-
collection.maximum_size.
|
161
|
-
collection.first.id.
|
160
|
+
expect(collection.maximum_size).to eq(1)
|
161
|
+
expect(collection.first.id).to eq(transaction.id)
|
162
|
+
end
|
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
|
+
expect(collection.maximum_size).to eq(1)
|
174
|
+
expect(collection.first.id).to eq(transaction_id)
|
175
|
+
end
|
176
|
+
|
177
|
+
it "searches on reason_code" do
|
178
|
+
transaction_id = "ach_txn_ret1"
|
179
|
+
reason_code = "R01"
|
180
|
+
|
181
|
+
collection = Braintree::Transaction.search do |search|
|
182
|
+
search.reason_code.in reason_code
|
183
|
+
end
|
184
|
+
|
185
|
+
expect(collection.maximum_size).to eq(1)
|
186
|
+
expect(collection.first.id).to eq(transaction_id)
|
187
|
+
expect(collection.first.ach_return_responses.first[:reason_code]).to eq("R01")
|
188
|
+
end
|
189
|
+
|
190
|
+
it "searches on reason_codes" do
|
191
|
+
reason_code = "any_reason_code"
|
192
|
+
|
193
|
+
collection = Braintree::Transaction.search do |search|
|
194
|
+
search.reason_code.is reason_code
|
195
|
+
end
|
196
|
+
|
197
|
+
expect(collection.maximum_size).to eq(2)
|
162
198
|
end
|
163
199
|
|
164
200
|
context "multiple value fields" do
|
@@ -168,7 +204,7 @@ describe Braintree::Transaction, "search" do
|
|
168
204
|
:credit_card => {
|
169
205
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
170
206
|
:expiration_date => "05/12"
|
171
|
-
}
|
207
|
+
},
|
172
208
|
)
|
173
209
|
|
174
210
|
collection = Braintree::Transaction.search do |search|
|
@@ -176,21 +212,21 @@ describe Braintree::Transaction, "search" do
|
|
176
212
|
search.created_using.is Braintree::Transaction::CreatedUsing::FullInformation
|
177
213
|
end
|
178
214
|
|
179
|
-
collection.maximum_size.
|
215
|
+
expect(collection.maximum_size).to eq(1)
|
180
216
|
|
181
217
|
collection = Braintree::Transaction.search do |search|
|
182
218
|
search.id.is transaction.id
|
183
219
|
search.created_using.in Braintree::Transaction::CreatedUsing::FullInformation, Braintree::Transaction::CreatedUsing::Token
|
184
220
|
end
|
185
221
|
|
186
|
-
collection.maximum_size.
|
222
|
+
expect(collection.maximum_size).to eq(1)
|
187
223
|
|
188
224
|
collection = Braintree::Transaction.search do |search|
|
189
225
|
search.id.is transaction.id
|
190
226
|
search.created_using.is Braintree::Transaction::CreatedUsing::Token
|
191
227
|
end
|
192
228
|
|
193
|
-
collection.maximum_size.
|
229
|
+
expect(collection.maximum_size).to eq(0)
|
194
230
|
end
|
195
231
|
|
196
232
|
it "searches on credit_card_customer_location" do
|
@@ -199,7 +235,7 @@ describe Braintree::Transaction, "search" do
|
|
199
235
|
:credit_card => {
|
200
236
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
201
237
|
:expiration_date => "05/12"
|
202
|
-
}
|
238
|
+
},
|
203
239
|
)
|
204
240
|
|
205
241
|
collection = Braintree::Transaction.search do |search|
|
@@ -207,21 +243,21 @@ describe Braintree::Transaction, "search" do
|
|
207
243
|
search.credit_card_customer_location.is Braintree::CreditCard::CustomerLocation::US
|
208
244
|
end
|
209
245
|
|
210
|
-
collection.maximum_size.
|
246
|
+
expect(collection.maximum_size).to eq(1)
|
211
247
|
|
212
248
|
collection = Braintree::Transaction.search do |search|
|
213
249
|
search.id.is transaction.id
|
214
250
|
search.credit_card_customer_location.in Braintree::CreditCard::CustomerLocation::US, Braintree::CreditCard::CustomerLocation::International
|
215
251
|
end
|
216
252
|
|
217
|
-
collection.maximum_size.
|
253
|
+
expect(collection.maximum_size).to eq(1)
|
218
254
|
|
219
255
|
collection = Braintree::Transaction.search do |search|
|
220
256
|
search.id.is transaction.id
|
221
257
|
search.credit_card_customer_location.is Braintree::CreditCard::CustomerLocation::International
|
222
258
|
end
|
223
259
|
|
224
|
-
collection.maximum_size.
|
260
|
+
expect(collection.maximum_size).to eq(0)
|
225
261
|
end
|
226
262
|
|
227
263
|
it "searches on merchant_account_id" do
|
@@ -230,7 +266,7 @@ describe Braintree::Transaction, "search" do
|
|
230
266
|
:credit_card => {
|
231
267
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
232
268
|
:expiration_date => "05/12"
|
233
|
-
}
|
269
|
+
},
|
234
270
|
)
|
235
271
|
|
236
272
|
collection = Braintree::Transaction.search do |search|
|
@@ -238,21 +274,21 @@ describe Braintree::Transaction, "search" do
|
|
238
274
|
search.merchant_account_id.is transaction.merchant_account_id
|
239
275
|
end
|
240
276
|
|
241
|
-
collection.maximum_size.
|
277
|
+
expect(collection.maximum_size).to eq(1)
|
242
278
|
|
243
279
|
collection = Braintree::Transaction.search do |search|
|
244
280
|
search.id.is transaction.id
|
245
281
|
search.merchant_account_id.in transaction.merchant_account_id, "bogus_merchant_account_id"
|
246
282
|
end
|
247
283
|
|
248
|
-
collection.maximum_size.
|
284
|
+
expect(collection.maximum_size).to eq(1)
|
249
285
|
|
250
286
|
collection = Braintree::Transaction.search do |search|
|
251
287
|
search.id.is transaction.id
|
252
288
|
search.merchant_account_id.is "bogus_merchant_account_id"
|
253
289
|
end
|
254
290
|
|
255
|
-
collection.maximum_size.
|
291
|
+
expect(collection.maximum_size).to eq(0)
|
256
292
|
end
|
257
293
|
|
258
294
|
it "searches on credit_card_card_type" do
|
@@ -261,7 +297,7 @@ describe Braintree::Transaction, "search" do
|
|
261
297
|
:credit_card => {
|
262
298
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
263
299
|
:expiration_date => "05/12"
|
264
|
-
}
|
300
|
+
},
|
265
301
|
)
|
266
302
|
|
267
303
|
collection = Braintree::Transaction.search do |search|
|
@@ -269,28 +305,28 @@ describe Braintree::Transaction, "search" do
|
|
269
305
|
search.credit_card_card_type.is Braintree::CreditCard::CardType::Visa
|
270
306
|
end
|
271
307
|
|
272
|
-
collection.maximum_size.
|
308
|
+
expect(collection.maximum_size).to eq(1)
|
273
309
|
|
274
310
|
collection = Braintree::Transaction.search do |search|
|
275
311
|
search.id.is transaction.id
|
276
312
|
search.credit_card_card_type.is transaction.credit_card_details.card_type
|
277
313
|
end
|
278
314
|
|
279
|
-
collection.maximum_size.
|
315
|
+
expect(collection.maximum_size).to eq(1)
|
280
316
|
|
281
317
|
collection = Braintree::Transaction.search do |search|
|
282
318
|
search.id.is transaction.id
|
283
319
|
search.credit_card_card_type.in Braintree::CreditCard::CardType::Visa, Braintree::CreditCard::CardType::MasterCard
|
284
320
|
end
|
285
321
|
|
286
|
-
collection.maximum_size.
|
322
|
+
expect(collection.maximum_size).to eq(1)
|
287
323
|
|
288
324
|
collection = Braintree::Transaction.search do |search|
|
289
325
|
search.id.is transaction.id
|
290
326
|
search.credit_card_card_type.is Braintree::CreditCard::CardType::MasterCard
|
291
327
|
end
|
292
328
|
|
293
|
-
collection.maximum_size.
|
329
|
+
expect(collection.maximum_size).to eq(0)
|
294
330
|
end
|
295
331
|
|
296
332
|
it "searches for an Elo card" do
|
@@ -301,7 +337,7 @@ describe Braintree::Transaction, "search" do
|
|
301
337
|
:number => Braintree::Test::CreditCardNumbers::Elo,
|
302
338
|
:cvv => "737",
|
303
339
|
:expiration_date => "10/2020"
|
304
|
-
}
|
340
|
+
},
|
305
341
|
)
|
306
342
|
|
307
343
|
collection = Braintree::Transaction.search do |search|
|
@@ -309,7 +345,7 @@ describe Braintree::Transaction, "search" do
|
|
309
345
|
search.credit_card_card_type.is Braintree::CreditCard::CardType::Elo
|
310
346
|
end
|
311
347
|
|
312
|
-
collection.maximum_size.
|
348
|
+
expect(collection.maximum_size).to eq(1)
|
313
349
|
end
|
314
350
|
|
315
351
|
it "searches by payment instrument type CreditCardDetail" do
|
@@ -318,7 +354,7 @@ describe Braintree::Transaction, "search" do
|
|
318
354
|
:credit_card => {
|
319
355
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
320
356
|
:expiration_date => "05/12"
|
321
|
-
}
|
357
|
+
},
|
322
358
|
)
|
323
359
|
|
324
360
|
collection = Braintree::Transaction.search do |search|
|
@@ -326,14 +362,14 @@ describe Braintree::Transaction, "search" do
|
|
326
362
|
search.payment_instrument_type.in ["CreditCardDetail"]
|
327
363
|
end
|
328
364
|
|
329
|
-
collection.first.id.
|
330
|
-
collection.first.payment_instrument_type.
|
365
|
+
expect(collection.first.id).to eq(transaction.id)
|
366
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::CreditCard)
|
331
367
|
end
|
332
368
|
|
333
369
|
it "searches by payment instrument type PayPal" do
|
334
370
|
transaction = Braintree::Transaction.sale!(
|
335
371
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
336
|
-
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment
|
372
|
+
:payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
|
337
373
|
)
|
338
374
|
|
339
375
|
collection = Braintree::Transaction.search do |search|
|
@@ -341,14 +377,14 @@ describe Braintree::Transaction, "search" do
|
|
341
377
|
search.payment_instrument_type.in ["PayPalDetail"]
|
342
378
|
end
|
343
379
|
|
344
|
-
collection.first.id.
|
345
|
-
collection.first.payment_instrument_type.
|
380
|
+
expect(collection.first.id).to eq(transaction.id)
|
381
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::PayPalAccount)
|
346
382
|
end
|
347
383
|
|
348
384
|
it "searches by payment instrument type LocalPaymentDetail" do
|
349
385
|
transaction = Braintree::Transaction.sale!(
|
350
386
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
351
|
-
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment
|
387
|
+
:payment_method_nonce => Braintree::Test::Nonce::LocalPayment,
|
352
388
|
)
|
353
389
|
|
354
390
|
collection = Braintree::Transaction.search do |search|
|
@@ -356,14 +392,46 @@ describe Braintree::Transaction, "search" do
|
|
356
392
|
search.payment_instrument_type.in ["LocalPaymentDetail"]
|
357
393
|
end
|
358
394
|
|
359
|
-
collection.first.id.
|
360
|
-
collection.first.payment_instrument_type.
|
395
|
+
expect(collection.first.id).to eq(transaction.id)
|
396
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::LocalPayment)
|
397
|
+
end
|
398
|
+
|
399
|
+
it "searches by payment instrument type SepaDebitAccountDetail" do
|
400
|
+
transaction = Braintree::Transaction.sale!(
|
401
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
402
|
+
:payment_method_nonce => Braintree::Test::Nonce::SepaDirectDebit,
|
403
|
+
:options => {:submit_for_settlement => true},
|
404
|
+
)
|
405
|
+
|
406
|
+
collection = Braintree::Transaction.search do |search|
|
407
|
+
search.id.is transaction.id
|
408
|
+
search.payment_instrument_type.in ["SEPADebitAccountDetail"]
|
409
|
+
end
|
410
|
+
|
411
|
+
expect(collection.first.id).to eq(transaction.id)
|
412
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::SepaDirectDebitAccount)
|
413
|
+
end
|
414
|
+
|
415
|
+
it "searches by paypal_v2_order_id" do
|
416
|
+
transaction = Braintree::Transaction.sale!(
|
417
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
418
|
+
:payment_method_nonce => Braintree::Test::Nonce::SepaDirectDebit,
|
419
|
+
:options => {:submit_for_settlement => true},
|
420
|
+
)
|
421
|
+
|
422
|
+
collection = Braintree::Transaction.search do |search|
|
423
|
+
search.id.is transaction.id
|
424
|
+
search.sepa_debit_paypal_v2_order_id.is transaction.sepa_direct_debit_account_details.paypal_v2_order_id
|
425
|
+
end
|
426
|
+
|
427
|
+
expect(collection.first.id).to eq(transaction.id)
|
428
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::SepaDirectDebitAccount)
|
361
429
|
end
|
362
430
|
|
363
431
|
it "searches by payment instrument type ApplePay" do
|
364
432
|
transaction = Braintree::Transaction.sale!(
|
365
433
|
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
366
|
-
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa
|
434
|
+
:payment_method_nonce => Braintree::Test::Nonce::ApplePayVisa,
|
367
435
|
)
|
368
436
|
|
369
437
|
collection = Braintree::Transaction.search do |search|
|
@@ -371,8 +439,8 @@ describe Braintree::Transaction, "search" do
|
|
371
439
|
search.payment_instrument_type.in ["ApplePayDetail"]
|
372
440
|
end
|
373
441
|
|
374
|
-
collection.first.id.
|
375
|
-
collection.first.payment_instrument_type.
|
442
|
+
expect(collection.first.id).to eq(transaction.id)
|
443
|
+
expect(collection.first.payment_instrument_type).to eq(Braintree::PaymentInstrumentType::ApplePayCard)
|
376
444
|
end
|
377
445
|
|
378
446
|
it "searches on status" do
|
@@ -381,7 +449,7 @@ describe Braintree::Transaction, "search" do
|
|
381
449
|
:credit_card => {
|
382
450
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
383
451
|
:expiration_date => "05/12"
|
384
|
-
}
|
452
|
+
},
|
385
453
|
)
|
386
454
|
|
387
455
|
collection = Braintree::Transaction.search do |search|
|
@@ -389,21 +457,32 @@ describe Braintree::Transaction, "search" do
|
|
389
457
|
search.status.is Braintree::Transaction::Status::Authorized
|
390
458
|
end
|
391
459
|
|
392
|
-
collection.maximum_size.
|
460
|
+
expect(collection.maximum_size).to eq(1)
|
393
461
|
|
394
462
|
collection = Braintree::Transaction.search do |search|
|
395
463
|
search.id.is transaction.id
|
396
464
|
search.status.in Braintree::Transaction::Status::Authorized, Braintree::Transaction::Status::ProcessorDeclined
|
397
465
|
end
|
398
466
|
|
399
|
-
collection.maximum_size.
|
467
|
+
expect(collection.maximum_size).to eq(1)
|
400
468
|
|
401
469
|
collection = Braintree::Transaction.search do |search|
|
402
470
|
search.id.is transaction.id
|
403
471
|
search.status.is Braintree::Transaction::Status::ProcessorDeclined
|
404
472
|
end
|
405
473
|
|
406
|
-
collection.maximum_size.
|
474
|
+
expect(collection.maximum_size).to eq(0)
|
475
|
+
end
|
476
|
+
|
477
|
+
it "searches for settlement_confirmed transaction" do
|
478
|
+
transaction_id = "settlement_confirmed_txn"
|
479
|
+
|
480
|
+
collection = Braintree::Transaction.search do |search|
|
481
|
+
search.id.is transaction_id
|
482
|
+
end
|
483
|
+
|
484
|
+
expect(collection.maximum_size).to eq(1)
|
485
|
+
expect(collection.first.id).to eq(transaction_id)
|
407
486
|
end
|
408
487
|
|
409
488
|
it "finds expired authorizations by status" do
|
@@ -411,8 +490,8 @@ describe Braintree::Transaction, "search" do
|
|
411
490
|
search.status.in Braintree::Transaction::Status::AuthorizationExpired
|
412
491
|
end
|
413
492
|
|
414
|
-
collection.maximum_size.
|
415
|
-
collection.first.status.
|
493
|
+
expect(collection.maximum_size).to be > 0
|
494
|
+
expect(collection.first.status).to eq(Braintree::Transaction::Status::AuthorizationExpired)
|
416
495
|
end
|
417
496
|
|
418
497
|
it "searches on source" do
|
@@ -421,7 +500,7 @@ describe Braintree::Transaction, "search" do
|
|
421
500
|
:credit_card => {
|
422
501
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
423
502
|
:expiration_date => "05/12"
|
424
|
-
}
|
503
|
+
},
|
425
504
|
)
|
426
505
|
|
427
506
|
collection = Braintree::Transaction.search do |search|
|
@@ -429,21 +508,21 @@ describe Braintree::Transaction, "search" do
|
|
429
508
|
search.source.is Braintree::Transaction::Source::Api
|
430
509
|
end
|
431
510
|
|
432
|
-
collection.maximum_size.
|
511
|
+
expect(collection.maximum_size).to eq(1)
|
433
512
|
|
434
513
|
collection = Braintree::Transaction.search do |search|
|
435
514
|
search.id.is transaction.id
|
436
515
|
search.source.in Braintree::Transaction::Source::Api, Braintree::Transaction::Source::ControlPanel
|
437
516
|
end
|
438
517
|
|
439
|
-
collection.maximum_size.
|
518
|
+
expect(collection.maximum_size).to eq(1)
|
440
519
|
|
441
520
|
collection = Braintree::Transaction.search do |search|
|
442
521
|
search.id.is transaction.id
|
443
522
|
search.source.is Braintree::Transaction::Source::ControlPanel
|
444
523
|
end
|
445
524
|
|
446
|
-
collection.maximum_size.
|
525
|
+
expect(collection.maximum_size).to eq(0)
|
447
526
|
end
|
448
527
|
|
449
528
|
it "searches on type" do
|
@@ -454,7 +533,7 @@ describe Braintree::Transaction, "search" do
|
|
454
533
|
:cardholder_name => cardholder_name,
|
455
534
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
456
535
|
:expiration_date => "05/12"
|
457
|
-
}
|
536
|
+
},
|
458
537
|
)
|
459
538
|
|
460
539
|
transaction = Braintree::Transaction.sale!(
|
@@ -464,18 +543,18 @@ describe Braintree::Transaction, "search" do
|
|
464
543
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
465
544
|
:expiration_date => "05/12"
|
466
545
|
},
|
467
|
-
:options => {
|
546
|
+
:options => {:submit_for_settlement => true},
|
468
547
|
)
|
469
548
|
SpecHelper.settle_transaction transaction.id
|
470
549
|
|
471
|
-
refund_transaction =
|
550
|
+
refund_transaction = Braintree::Transaction.refund(transaction.id).transaction
|
472
551
|
|
473
552
|
collection = Braintree::Transaction.search do |search|
|
474
553
|
search.credit_card_cardholder_name.is cardholder_name
|
475
554
|
search.type.is Braintree::Transaction::Type::Credit
|
476
555
|
end
|
477
556
|
|
478
|
-
collection.maximum_size.
|
557
|
+
expect(collection.maximum_size).to eq(2)
|
479
558
|
|
480
559
|
collection = Braintree::Transaction.search do |search|
|
481
560
|
search.credit_card_cardholder_name.is cardholder_name
|
@@ -483,8 +562,8 @@ describe Braintree::Transaction, "search" do
|
|
483
562
|
search.refund.is true
|
484
563
|
end
|
485
564
|
|
486
|
-
collection.maximum_size.
|
487
|
-
collection.first.id.
|
565
|
+
expect(collection.maximum_size).to eq(1)
|
566
|
+
expect(collection.first.id).to eq(refund_transaction.id)
|
488
567
|
|
489
568
|
collection = Braintree::Transaction.search do |search|
|
490
569
|
search.credit_card_cardholder_name.is cardholder_name
|
@@ -492,20 +571,89 @@ describe Braintree::Transaction, "search" do
|
|
492
571
|
search.refund.is false
|
493
572
|
end
|
494
573
|
|
495
|
-
collection.maximum_size.
|
496
|
-
collection.first.id.
|
574
|
+
expect(collection.maximum_size).to eq(1)
|
575
|
+
expect(collection.first.id).to eq(credit_transaction.id)
|
576
|
+
end
|
577
|
+
|
578
|
+
it "searches on store_ids" do
|
579
|
+
transaction_id = "contact_visa_transaction"
|
580
|
+
store_ids = ["store-id"]
|
581
|
+
|
582
|
+
collection = Braintree::Transaction.search do |search|
|
583
|
+
search.id.is transaction_id
|
584
|
+
search.store_ids.in store_ids
|
585
|
+
end
|
586
|
+
|
587
|
+
expect(collection.maximum_size).to eq(1)
|
588
|
+
expect(collection.first.id).to eq(transaction_id)
|
589
|
+
end
|
590
|
+
|
591
|
+
it "searches on reason_codes for 2 items" do
|
592
|
+
reason_code = ["R01", "R02"]
|
593
|
+
|
594
|
+
collection = Braintree::Transaction.search do |search|
|
595
|
+
search.reason_code.in reason_code
|
596
|
+
end
|
597
|
+
|
598
|
+
expect(collection.maximum_size).to eq(2)
|
599
|
+
end
|
600
|
+
|
601
|
+
it "searches on a reason_code" do
|
602
|
+
reason_code = ["R01"]
|
603
|
+
transaction_id = "ach_txn_ret1"
|
604
|
+
|
605
|
+
collection = Braintree::Transaction.search do |search|
|
606
|
+
search.reason_code.in reason_code
|
607
|
+
end
|
608
|
+
|
609
|
+
expect(collection.maximum_size).to eq(1)
|
610
|
+
expect(collection.first.id).to eq(transaction_id)
|
611
|
+
end
|
612
|
+
|
613
|
+
xit "searches on debit_network" do
|
614
|
+
transaction = Braintree::Transaction.sale!(
|
615
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
616
|
+
:merchant_account_id => SpecHelper::PinlessDebitMerchantAccountId,
|
617
|
+
:currency_iso_code => "USD",
|
618
|
+
:payment_method_nonce => Braintree::Test::Nonce::TransactablePinlessDebitVisa,
|
619
|
+
:options => {
|
620
|
+
:submit_for_settlement => true
|
621
|
+
},
|
622
|
+
)
|
623
|
+
|
624
|
+
collection = Braintree::Transaction.search do |search|
|
625
|
+
search.id.is transaction.id
|
626
|
+
search.credit_card_card_type.is Braintree::CreditCard::CardType::Visa
|
627
|
+
end
|
628
|
+
|
629
|
+
expect(collection.maximum_size).to be > 0
|
630
|
+
|
631
|
+
collection = Braintree::Transaction.search do |search|
|
632
|
+
search.id.is transaction.id
|
633
|
+
search.debit_network.in Braintree::CreditCard::DebitNetwork::All
|
634
|
+
end
|
635
|
+
|
636
|
+
expect(collection.maximum_size).to be > 0
|
497
637
|
end
|
498
638
|
end
|
499
639
|
|
500
640
|
context "invalid search" do
|
501
641
|
it "raises an exception on invalid transaction type" do
|
502
642
|
expect do
|
503
|
-
|
643
|
+
Braintree::Transaction.search do |search|
|
504
644
|
search.customer_id.is "9171566"
|
505
645
|
search.type.is "settled"
|
506
646
|
end
|
507
647
|
end.to raise_error(ArgumentError)
|
508
648
|
end
|
649
|
+
|
650
|
+
it "raises an exception on invalid debit network" do
|
651
|
+
expect do
|
652
|
+
Braintree::Transaction.search do |search|
|
653
|
+
search.debit_network.is "invalid_network"
|
654
|
+
end
|
655
|
+
end.to raise_error(ArgumentError)
|
656
|
+
end
|
509
657
|
end
|
510
658
|
|
511
659
|
context "range fields" do
|
@@ -516,7 +664,7 @@ describe Braintree::Transaction, "search" do
|
|
516
664
|
:credit_card => {
|
517
665
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
518
666
|
:expiration_date => "05/12"
|
519
|
-
}
|
667
|
+
},
|
520
668
|
)
|
521
669
|
|
522
670
|
collection = Braintree::Transaction.search do |search|
|
@@ -524,31 +672,31 @@ describe Braintree::Transaction, "search" do
|
|
524
672
|
search.amount.between "500.00", "1500.00"
|
525
673
|
end
|
526
674
|
|
527
|
-
collection.maximum_size.
|
528
|
-
collection.first.id.
|
675
|
+
expect(collection.maximum_size).to eq(1)
|
676
|
+
expect(collection.first.id).to eq(transaction.id)
|
529
677
|
|
530
678
|
collection = Braintree::Transaction.search do |search|
|
531
679
|
search.id.is transaction.id
|
532
680
|
search.amount >= "500.00"
|
533
681
|
end
|
534
682
|
|
535
|
-
collection.maximum_size.
|
536
|
-
collection.first.id.
|
683
|
+
expect(collection.maximum_size).to eq(1)
|
684
|
+
expect(collection.first.id).to eq(transaction.id)
|
537
685
|
|
538
686
|
collection = Braintree::Transaction.search do |search|
|
539
687
|
search.id.is transaction.id
|
540
688
|
search.amount <= "1500.00"
|
541
689
|
end
|
542
690
|
|
543
|
-
collection.maximum_size.
|
544
|
-
collection.first.id.
|
691
|
+
expect(collection.maximum_size).to eq(1)
|
692
|
+
expect(collection.first.id).to eq(transaction.id)
|
545
693
|
|
546
694
|
collection = Braintree::Transaction.search do |search|
|
547
695
|
search.id.is transaction.id
|
548
696
|
search.amount.between "500.00", "900.00"
|
549
697
|
end
|
550
698
|
|
551
|
-
collection.maximum_size.
|
699
|
+
expect(collection.maximum_size).to eq(0)
|
552
700
|
end
|
553
701
|
|
554
702
|
it "can also take BigDecimal for amount" do
|
@@ -557,7 +705,7 @@ describe Braintree::Transaction, "search" do
|
|
557
705
|
:credit_card => {
|
558
706
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
559
707
|
:expiration_date => "05/12"
|
560
|
-
}
|
708
|
+
},
|
561
709
|
)
|
562
710
|
|
563
711
|
collection = Braintree::Transaction.search do |search|
|
@@ -565,7 +713,7 @@ describe Braintree::Transaction, "search" do
|
|
565
713
|
search.amount <= BigDecimal("1000.00")
|
566
714
|
end
|
567
715
|
|
568
|
-
collection.maximum_size.
|
716
|
+
expect(collection.maximum_size).to eq(1)
|
569
717
|
end
|
570
718
|
end
|
571
719
|
|
@@ -576,56 +724,56 @@ describe Braintree::Transaction, "search" do
|
|
576
724
|
:credit_card => {
|
577
725
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
578
726
|
:expiration_date => "05/12"
|
579
|
-
}
|
727
|
+
},
|
580
728
|
)
|
581
729
|
|
582
730
|
created_at = transaction.created_at
|
583
|
-
created_at.
|
731
|
+
expect(created_at).to be_utc
|
584
732
|
|
585
733
|
collection = Braintree::Transaction.search do |search|
|
586
734
|
search.id.is transaction.id
|
587
735
|
search.created_at.between(
|
588
736
|
created_at - 60,
|
589
|
-
created_at + 60
|
737
|
+
created_at + 60,
|
590
738
|
)
|
591
739
|
end
|
592
740
|
|
593
|
-
collection.maximum_size.
|
594
|
-
collection.first.id.
|
741
|
+
expect(collection.maximum_size).to eq(1)
|
742
|
+
expect(collection.first.id).to eq(transaction.id)
|
595
743
|
|
596
744
|
collection = Braintree::Transaction.search do |search|
|
597
745
|
search.id.is transaction.id
|
598
746
|
search.created_at >= created_at - 1
|
599
747
|
end
|
600
748
|
|
601
|
-
collection.maximum_size.
|
602
|
-
collection.first.id.
|
749
|
+
expect(collection.maximum_size).to eq(1)
|
750
|
+
expect(collection.first.id).to eq(transaction.id)
|
603
751
|
|
604
752
|
collection = Braintree::Transaction.search do |search|
|
605
753
|
search.id.is transaction.id
|
606
754
|
search.created_at <= created_at + 1
|
607
755
|
end
|
608
756
|
|
609
|
-
collection.maximum_size.
|
610
|
-
collection.first.id.
|
757
|
+
expect(collection.maximum_size).to eq(1)
|
758
|
+
expect(collection.first.id).to eq(transaction.id)
|
611
759
|
|
612
760
|
collection = Braintree::Transaction.search do |search|
|
613
761
|
search.id.is transaction.id
|
614
762
|
search.created_at.between(
|
615
763
|
created_at - 300,
|
616
|
-
created_at - 100
|
764
|
+
created_at - 100,
|
617
765
|
)
|
618
766
|
end
|
619
767
|
|
620
|
-
collection.maximum_size.
|
768
|
+
expect(collection.maximum_size).to eq(0)
|
621
769
|
|
622
770
|
collection = Braintree::Transaction.search do |search|
|
623
771
|
search.id.is transaction.id
|
624
772
|
search.created_at.is created_at
|
625
773
|
end
|
626
774
|
|
627
|
-
collection.maximum_size.
|
628
|
-
collection.first.id.
|
775
|
+
expect(collection.maximum_size).to eq(1)
|
776
|
+
expect(collection.first.id).to eq(transaction.id)
|
629
777
|
end
|
630
778
|
|
631
779
|
it "searches on created_at in local time" do
|
@@ -634,7 +782,7 @@ describe Braintree::Transaction, "search" do
|
|
634
782
|
:credit_card => {
|
635
783
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
636
784
|
:expiration_date => "05/12"
|
637
|
-
}
|
785
|
+
},
|
638
786
|
)
|
639
787
|
|
640
788
|
now = Time.now
|
@@ -643,38 +791,38 @@ describe Braintree::Transaction, "search" do
|
|
643
791
|
search.id.is transaction.id
|
644
792
|
search.created_at.between(
|
645
793
|
now - 60,
|
646
|
-
now + 60
|
794
|
+
now + 60,
|
647
795
|
)
|
648
796
|
end
|
649
797
|
|
650
|
-
collection.maximum_size.
|
651
|
-
collection.first.id.
|
798
|
+
expect(collection.maximum_size).to eq(1)
|
799
|
+
expect(collection.first.id).to eq(transaction.id)
|
652
800
|
|
653
801
|
collection = Braintree::Transaction.search do |search|
|
654
802
|
search.id.is transaction.id
|
655
803
|
search.created_at >= now - 60
|
656
804
|
end
|
657
805
|
|
658
|
-
collection.maximum_size.
|
659
|
-
collection.first.id.
|
806
|
+
expect(collection.maximum_size).to eq(1)
|
807
|
+
expect(collection.first.id).to eq(transaction.id)
|
660
808
|
|
661
809
|
collection = Braintree::Transaction.search do |search|
|
662
810
|
search.id.is transaction.id
|
663
811
|
search.created_at <= now + 60
|
664
812
|
end
|
665
813
|
|
666
|
-
collection.maximum_size.
|
667
|
-
collection.first.id.
|
814
|
+
expect(collection.maximum_size).to eq(1)
|
815
|
+
expect(collection.first.id).to eq(transaction.id)
|
668
816
|
|
669
817
|
collection = Braintree::Transaction.search do |search|
|
670
818
|
search.id.is transaction.id
|
671
819
|
search.created_at.between(
|
672
820
|
now - 300,
|
673
|
-
now - 100
|
821
|
+
now - 100,
|
674
822
|
)
|
675
823
|
end
|
676
824
|
|
677
|
-
collection.maximum_size.
|
825
|
+
expect(collection.maximum_size).to eq(0)
|
678
826
|
end
|
679
827
|
|
680
828
|
it "searches on created_at with dates" do
|
@@ -683,19 +831,37 @@ describe Braintree::Transaction, "search" do
|
|
683
831
|
:credit_card => {
|
684
832
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
685
833
|
:expiration_date => "05/12"
|
686
|
-
}
|
834
|
+
},
|
687
835
|
)
|
688
836
|
|
689
837
|
collection = Braintree::Transaction.search do |search|
|
690
838
|
search.id.is transaction.id
|
691
839
|
search.created_at.between(
|
692
840
|
Date.today - 1,
|
693
|
-
Date.today + 1
|
841
|
+
Date.today + 1,
|
694
842
|
)
|
695
843
|
end
|
696
844
|
|
697
|
-
collection.maximum_size.
|
698
|
-
collection.first.id.
|
845
|
+
expect(collection.maximum_size).to eq(1)
|
846
|
+
expect(collection.first.id).to eq(transaction.id)
|
847
|
+
end
|
848
|
+
end
|
849
|
+
|
850
|
+
context "ach return response created at" do
|
851
|
+
it "it finds records within date range of the custom field" do
|
852
|
+
date_search = Braintree::Transaction.search do |search|
|
853
|
+
search.ach_return_responses_created_at.between(DateTime.now - 1.0, DateTime.now + 1.0)
|
854
|
+
end
|
855
|
+
|
856
|
+
expect(date_search.maximum_size).to eq(2)
|
857
|
+
end
|
858
|
+
|
859
|
+
it "it does not find records not within date range of the custom field" do
|
860
|
+
neg_date_search = Braintree::Transaction.search do |search|
|
861
|
+
search.ach_return_responses_created_at.between(DateTime.now + 1.0, DateTime.now - 1.0)
|
862
|
+
end
|
863
|
+
|
864
|
+
expect(neg_date_search.maximum_size).to eq(0)
|
699
865
|
end
|
700
866
|
end
|
701
867
|
|
@@ -708,46 +874,46 @@ describe Braintree::Transaction, "search" do
|
|
708
874
|
search.id.is transaction_id
|
709
875
|
search.disbursement_date.between(
|
710
876
|
disbursement_time - 60,
|
711
|
-
disbursement_time + 60
|
877
|
+
disbursement_time + 60,
|
712
878
|
)
|
713
879
|
end
|
714
880
|
|
715
|
-
collection.maximum_size.
|
716
|
-
collection.first.id.
|
881
|
+
expect(collection.maximum_size).to eq(1)
|
882
|
+
expect(collection.first.id).to eq(transaction_id)
|
717
883
|
|
718
884
|
collection = Braintree::Transaction.search do |search|
|
719
885
|
search.id.is transaction_id
|
720
886
|
search.disbursement_date >= disbursement_time - 1
|
721
887
|
end
|
722
888
|
|
723
|
-
collection.maximum_size.
|
724
|
-
collection.first.id.
|
889
|
+
expect(collection.maximum_size).to eq(1)
|
890
|
+
expect(collection.first.id).to eq(transaction_id)
|
725
891
|
|
726
892
|
collection = Braintree::Transaction.search do |search|
|
727
893
|
search.id.is transaction_id
|
728
894
|
search.disbursement_date <= disbursement_time + 1
|
729
895
|
end
|
730
896
|
|
731
|
-
collection.maximum_size.
|
732
|
-
collection.first.id.
|
897
|
+
expect(collection.maximum_size).to eq(1)
|
898
|
+
expect(collection.first.id).to eq(transaction_id)
|
733
899
|
|
734
900
|
collection = Braintree::Transaction.search do |search|
|
735
901
|
search.id.is transaction_id
|
736
902
|
search.disbursement_date.between(
|
737
903
|
disbursement_time - 300,
|
738
|
-
disbursement_time - 100
|
904
|
+
disbursement_time - 100,
|
739
905
|
)
|
740
906
|
end
|
741
907
|
|
742
|
-
collection.maximum_size.
|
908
|
+
expect(collection.maximum_size).to eq(0)
|
743
909
|
|
744
910
|
collection = Braintree::Transaction.search do |search|
|
745
911
|
search.id.is transaction_id
|
746
912
|
search.disbursement_date.is disbursement_time
|
747
913
|
end
|
748
914
|
|
749
|
-
collection.maximum_size.
|
750
|
-
collection.first.id.
|
915
|
+
expect(collection.maximum_size).to eq(1)
|
916
|
+
expect(collection.first.id).to eq(transaction_id)
|
751
917
|
end
|
752
918
|
|
753
919
|
it "searches on disbursement_date in local time" do
|
@@ -758,38 +924,38 @@ describe Braintree::Transaction, "search" do
|
|
758
924
|
search.id.is transaction_id
|
759
925
|
search.disbursement_date.between(
|
760
926
|
now - 60,
|
761
|
-
now + 60
|
927
|
+
now + 60,
|
762
928
|
)
|
763
929
|
end
|
764
930
|
|
765
|
-
collection.maximum_size.
|
766
|
-
collection.first.id.
|
931
|
+
expect(collection.maximum_size).to eq(1)
|
932
|
+
expect(collection.first.id).to eq(transaction_id)
|
767
933
|
|
768
934
|
collection = Braintree::Transaction.search do |search|
|
769
935
|
search.id.is transaction_id
|
770
936
|
search.disbursement_date >= now - 60
|
771
937
|
end
|
772
938
|
|
773
|
-
collection.maximum_size.
|
774
|
-
collection.first.id.
|
939
|
+
expect(collection.maximum_size).to eq(1)
|
940
|
+
expect(collection.first.id).to eq(transaction_id)
|
775
941
|
|
776
942
|
collection = Braintree::Transaction.search do |search|
|
777
943
|
search.id.is transaction_id
|
778
944
|
search.disbursement_date <= now + 60
|
779
945
|
end
|
780
946
|
|
781
|
-
collection.maximum_size.
|
782
|
-
collection.first.id.
|
947
|
+
expect(collection.maximum_size).to eq(1)
|
948
|
+
expect(collection.first.id).to eq(transaction_id)
|
783
949
|
|
784
950
|
collection = Braintree::Transaction.search do |search|
|
785
951
|
search.id.is transaction_id
|
786
952
|
search.disbursement_date.between(
|
787
953
|
now - 300,
|
788
|
-
now - 100
|
954
|
+
now - 100,
|
789
955
|
)
|
790
956
|
end
|
791
957
|
|
792
|
-
collection.maximum_size.
|
958
|
+
expect(collection.maximum_size).to eq(0)
|
793
959
|
end
|
794
960
|
|
795
961
|
it "searches on disbursement_date with date ranges" do
|
@@ -800,12 +966,12 @@ describe Braintree::Transaction, "search" do
|
|
800
966
|
search.id.is transaction_id
|
801
967
|
search.disbursement_date.between(
|
802
968
|
disbursement_date - 1,
|
803
|
-
disbursement_date + 1
|
969
|
+
disbursement_date + 1,
|
804
970
|
)
|
805
971
|
end
|
806
972
|
|
807
|
-
collection.maximum_size.
|
808
|
-
collection.first.id.
|
973
|
+
expect(collection.maximum_size).to eq(1)
|
974
|
+
expect(collection.first.id).to eq(transaction_id)
|
809
975
|
end
|
810
976
|
end
|
811
977
|
|
@@ -816,7 +982,7 @@ describe Braintree::Transaction, "search" do
|
|
816
982
|
:credit_card => {
|
817
983
|
:number => Braintree::Test::CreditCardNumbers::Disputes::Chargeback,
|
818
984
|
:expiration_date => "03/18"
|
819
|
-
}
|
985
|
+
},
|
820
986
|
)
|
821
987
|
|
822
988
|
@disputed_date = @disputed_transaction.disputes.first.received_date
|
@@ -841,36 +1007,36 @@ describe Braintree::Transaction, "search" do
|
|
841
1007
|
search.id.is @disputed_transaction.id
|
842
1008
|
search.dispute_date.between(
|
843
1009
|
@disputed_time - 60,
|
844
|
-
@disputed_time + 60
|
1010
|
+
@disputed_time + 60,
|
845
1011
|
)
|
846
1012
|
end
|
847
1013
|
|
848
|
-
collection.maximum_size.
|
849
|
-
collection.first.id.
|
1014
|
+
expect(collection.maximum_size).to eq(1)
|
1015
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
850
1016
|
|
851
1017
|
collection = Braintree::Transaction.search do |search|
|
852
1018
|
search.id.is @disputed_transaction.id
|
853
1019
|
search.dispute_date >= @disputed_time - 1
|
854
1020
|
end
|
855
1021
|
|
856
|
-
collection.maximum_size.
|
857
|
-
collection.first.id.
|
1022
|
+
expect(collection.maximum_size).to eq(1)
|
1023
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
858
1024
|
|
859
1025
|
collection = Braintree::Transaction.search do |search|
|
860
1026
|
search.id.is @disputed_transaction.id
|
861
1027
|
search.dispute_date <= @disputed_time + 1
|
862
1028
|
end
|
863
1029
|
|
864
|
-
collection.maximum_size.
|
865
|
-
collection.first.id.
|
1030
|
+
expect(collection.maximum_size).to eq(1)
|
1031
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
866
1032
|
|
867
1033
|
collection = Braintree::Transaction.search do |search|
|
868
1034
|
search.id.is @disputed_transaction.id
|
869
1035
|
search.dispute_date.is @disputed_time
|
870
1036
|
end
|
871
1037
|
|
872
|
-
collection.maximum_size.
|
873
|
-
collection.first.id.
|
1038
|
+
expect(collection.maximum_size).to eq(1)
|
1039
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
874
1040
|
end
|
875
1041
|
|
876
1042
|
it "searches on dispute_date in local time" do
|
@@ -880,27 +1046,27 @@ describe Braintree::Transaction, "search" do
|
|
880
1046
|
search.id.is @disputed_transaction.id
|
881
1047
|
search.dispute_date.between(
|
882
1048
|
now - 60,
|
883
|
-
now + 60
|
1049
|
+
now + 60,
|
884
1050
|
)
|
885
1051
|
end
|
886
1052
|
|
887
|
-
collection.maximum_size.
|
888
|
-
collection.first.id.
|
1053
|
+
expect(collection.maximum_size).to eq(1)
|
1054
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
889
1055
|
|
890
1056
|
collection = Braintree::Transaction.search do |search|
|
891
1057
|
search.id.is @disputed_transaction.id
|
892
1058
|
search.dispute_date >= now - 60
|
893
1059
|
end
|
894
1060
|
|
895
|
-
collection.maximum_size.
|
896
|
-
collection.first.id.
|
1061
|
+
expect(collection.maximum_size).to eq(1)
|
1062
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
897
1063
|
|
898
1064
|
collection = Braintree::Transaction.search do |search|
|
899
1065
|
search.id.is @disputed_transaction.id
|
900
1066
|
search.dispute_date <= now + 60
|
901
1067
|
end
|
902
1068
|
|
903
|
-
collection.maximum_size.
|
1069
|
+
expect(collection.maximum_size).to eq(1)
|
904
1070
|
end
|
905
1071
|
|
906
1072
|
it "searches on dispute_date with date ranges" do
|
@@ -908,12 +1074,12 @@ describe Braintree::Transaction, "search" do
|
|
908
1074
|
search.id.is @disputed_transaction.id
|
909
1075
|
search.dispute_date.between(
|
910
1076
|
@disputed_date - 1,
|
911
|
-
@disputed_date + 1
|
1077
|
+
@disputed_date + 1,
|
912
1078
|
)
|
913
1079
|
end
|
914
1080
|
|
915
|
-
collection.maximum_size.
|
916
|
-
collection.first.id.
|
1081
|
+
expect(collection.maximum_size).to eq(1)
|
1082
|
+
expect(collection.first.id).to eq(@disputed_transaction.id)
|
917
1083
|
end
|
918
1084
|
end
|
919
1085
|
|
@@ -924,29 +1090,29 @@ describe Braintree::Transaction, "search" do
|
|
924
1090
|
:credit_card => {
|
925
1091
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
926
1092
|
:expiration_date => "05/12"
|
927
|
-
}
|
1093
|
+
},
|
928
1094
|
)
|
929
1095
|
|
930
1096
|
collection = Braintree::Transaction.search do |search|
|
931
1097
|
search.id.is transaction.id
|
932
1098
|
search.authorized_at.between(
|
933
1099
|
Date.today - 2,
|
934
|
-
Date.today - 1
|
1100
|
+
Date.today - 1,
|
935
1101
|
)
|
936
1102
|
end
|
937
1103
|
|
938
|
-
collection.maximum_size.
|
1104
|
+
expect(collection.maximum_size).to eq(0)
|
939
1105
|
|
940
1106
|
collection = Braintree::Transaction.search do |search|
|
941
1107
|
search.id.is transaction.id
|
942
1108
|
search.authorized_at.between(
|
943
1109
|
Date.today - 1,
|
944
|
-
Date.today + 1
|
1110
|
+
Date.today + 1,
|
945
1111
|
)
|
946
1112
|
end
|
947
1113
|
|
948
|
-
collection.maximum_size.
|
949
|
-
collection.first.id.
|
1114
|
+
expect(collection.maximum_size).to eq(1)
|
1115
|
+
expect(collection.first.id).to eq(transaction.id)
|
950
1116
|
end
|
951
1117
|
|
952
1118
|
it "finds transactions failed in a given range" do
|
@@ -955,50 +1121,50 @@ describe Braintree::Transaction, "search" do
|
|
955
1121
|
:credit_card => {
|
956
1122
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
957
1123
|
:expiration_date => "05/12"
|
958
|
-
}
|
1124
|
+
},
|
959
1125
|
).transaction
|
960
1126
|
|
961
1127
|
collection = Braintree::Transaction.search do |search|
|
962
1128
|
search.id.is transaction.id
|
963
1129
|
search.failed_at.between(
|
964
1130
|
Date.today - 2,
|
965
|
-
Date.today - 1
|
1131
|
+
Date.today - 1,
|
966
1132
|
)
|
967
1133
|
end
|
968
1134
|
|
969
|
-
collection.maximum_size.
|
1135
|
+
expect(collection.maximum_size).to eq(0)
|
970
1136
|
|
971
1137
|
collection = Braintree::Transaction.search do |search|
|
972
1138
|
search.id.is transaction.id
|
973
1139
|
search.failed_at.between(
|
974
1140
|
Date.today - 1,
|
975
|
-
Date.today + 1
|
1141
|
+
Date.today + 1,
|
976
1142
|
)
|
977
1143
|
end
|
978
1144
|
|
979
|
-
collection.maximum_size.
|
980
|
-
collection.first.id.
|
1145
|
+
expect(collection.maximum_size).to eq(1)
|
1146
|
+
expect(collection.first.id).to eq(transaction.id)
|
981
1147
|
end
|
982
1148
|
|
983
1149
|
it "finds expired authorizations in a given range" do
|
984
1150
|
collection = Braintree::Transaction.search do |search|
|
985
1151
|
search.authorization_expired_at.between(
|
986
1152
|
Date.today - 2,
|
987
|
-
Date.today - 1
|
1153
|
+
Date.today - 1,
|
988
1154
|
)
|
989
1155
|
end
|
990
1156
|
|
991
|
-
collection.maximum_size.
|
1157
|
+
expect(collection.maximum_size).to eq(0)
|
992
1158
|
|
993
1159
|
collection = Braintree::Transaction.search do |search|
|
994
1160
|
search.authorization_expired_at.between(
|
995
1161
|
Date.today - 1,
|
996
|
-
Date.today + 1
|
1162
|
+
Date.today + 1,
|
997
1163
|
)
|
998
1164
|
end
|
999
1165
|
|
1000
|
-
collection.maximum_size.
|
1001
|
-
collection.first.status.
|
1166
|
+
expect(collection.maximum_size).to be > 0
|
1167
|
+
expect(collection.first.status).to eq(Braintree::Transaction::Status::AuthorizationExpired)
|
1002
1168
|
end
|
1003
1169
|
|
1004
1170
|
it "finds transactions gateway_rejected in a given range" do
|
@@ -1017,29 +1183,29 @@ describe Braintree::Transaction, "search" do
|
|
1017
1183
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1018
1184
|
:expiration_date => "05/12",
|
1019
1185
|
:cvv => "200"
|
1020
|
-
}
|
1186
|
+
},
|
1021
1187
|
).transaction
|
1022
1188
|
|
1023
1189
|
collection = Braintree::Transaction.search do |search|
|
1024
1190
|
search.id.is transaction.id
|
1025
1191
|
search.gateway_rejected_at.between(
|
1026
1192
|
Date.today - 2,
|
1027
|
-
Date.today - 1
|
1193
|
+
Date.today - 1,
|
1028
1194
|
)
|
1029
1195
|
end
|
1030
1196
|
|
1031
|
-
collection.maximum_size.
|
1197
|
+
expect(collection.maximum_size).to eq(0)
|
1032
1198
|
|
1033
1199
|
collection = Braintree::Transaction.search do |search|
|
1034
1200
|
search.id.is transaction.id
|
1035
1201
|
search.gateway_rejected_at.between(
|
1036
1202
|
Date.today - 1,
|
1037
|
-
Date.today + 1
|
1203
|
+
Date.today + 1,
|
1038
1204
|
)
|
1039
1205
|
end
|
1040
1206
|
|
1041
|
-
collection.maximum_size.
|
1042
|
-
collection.first.id.
|
1207
|
+
expect(collection.maximum_size).to eq(1)
|
1208
|
+
expect(collection.first.id).to eq(transaction.id)
|
1043
1209
|
ensure
|
1044
1210
|
Braintree::Configuration.merchant_id = old_merchant
|
1045
1211
|
Braintree::Configuration.public_key = old_public_key
|
@@ -1053,29 +1219,29 @@ describe Braintree::Transaction, "search" do
|
|
1053
1219
|
:credit_card => {
|
1054
1220
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1055
1221
|
:expiration_date => "05/12"
|
1056
|
-
}
|
1222
|
+
},
|
1057
1223
|
).transaction
|
1058
1224
|
|
1059
1225
|
collection = Braintree::Transaction.search do |search|
|
1060
1226
|
search.id.is transaction.id
|
1061
1227
|
search.processor_declined_at.between(
|
1062
1228
|
Date.today - 2,
|
1063
|
-
Date.today - 1
|
1229
|
+
Date.today - 1,
|
1064
1230
|
)
|
1065
1231
|
end
|
1066
1232
|
|
1067
|
-
collection.maximum_size.
|
1233
|
+
expect(collection.maximum_size).to eq(0)
|
1068
1234
|
|
1069
1235
|
collection = Braintree::Transaction.search do |search|
|
1070
1236
|
search.id.is transaction.id
|
1071
1237
|
search.processor_declined_at.between(
|
1072
1238
|
Date.today - 1,
|
1073
|
-
Date.today + 1
|
1239
|
+
Date.today + 1,
|
1074
1240
|
)
|
1075
1241
|
end
|
1076
1242
|
|
1077
|
-
collection.maximum_size.
|
1078
|
-
collection.first.id.
|
1243
|
+
expect(collection.maximum_size).to eq(1)
|
1244
|
+
expect(collection.first.id).to eq(transaction.id)
|
1079
1245
|
end
|
1080
1246
|
|
1081
1247
|
it "finds transactions settled in a given range" do
|
@@ -1087,7 +1253,7 @@ describe Braintree::Transaction, "search" do
|
|
1087
1253
|
},
|
1088
1254
|
:options => {
|
1089
1255
|
:submit_for_settlement => true
|
1090
|
-
}
|
1256
|
+
},
|
1091
1257
|
).transaction
|
1092
1258
|
|
1093
1259
|
SpecHelper.settle_transaction transaction.id
|
@@ -1096,22 +1262,22 @@ describe Braintree::Transaction, "search" do
|
|
1096
1262
|
search.id.is transaction.id
|
1097
1263
|
search.settled_at.between(
|
1098
1264
|
Date.today - 2,
|
1099
|
-
Date.today - 1
|
1265
|
+
Date.today - 1,
|
1100
1266
|
)
|
1101
1267
|
end
|
1102
1268
|
|
1103
|
-
collection.maximum_size.
|
1269
|
+
expect(collection.maximum_size).to eq(0)
|
1104
1270
|
|
1105
1271
|
collection = Braintree::Transaction.search do |search|
|
1106
1272
|
search.id.is transaction.id
|
1107
1273
|
search.settled_at.between(
|
1108
1274
|
Date.today - 1,
|
1109
|
-
Date.today + 1
|
1275
|
+
Date.today + 1,
|
1110
1276
|
)
|
1111
1277
|
end
|
1112
1278
|
|
1113
|
-
collection.maximum_size.
|
1114
|
-
collection.first.id.
|
1279
|
+
expect(collection.maximum_size).to eq(1)
|
1280
|
+
expect(collection.first.id).to eq(transaction.id)
|
1115
1281
|
end
|
1116
1282
|
|
1117
1283
|
it "finds transactions submitted for settlement in a given range" do
|
@@ -1123,29 +1289,29 @@ describe Braintree::Transaction, "search" do
|
|
1123
1289
|
},
|
1124
1290
|
:options => {
|
1125
1291
|
:submit_for_settlement => true
|
1126
|
-
}
|
1292
|
+
},
|
1127
1293
|
).transaction
|
1128
1294
|
|
1129
1295
|
collection = Braintree::Transaction.search do |search|
|
1130
1296
|
search.id.is transaction.id
|
1131
1297
|
search.submitted_for_settlement_at.between(
|
1132
1298
|
Date.today - 2,
|
1133
|
-
Date.today - 1
|
1299
|
+
Date.today - 1,
|
1134
1300
|
)
|
1135
1301
|
end
|
1136
1302
|
|
1137
|
-
collection.maximum_size.
|
1303
|
+
expect(collection.maximum_size).to eq(0)
|
1138
1304
|
|
1139
1305
|
collection = Braintree::Transaction.search do |search|
|
1140
1306
|
search.id.is transaction.id
|
1141
1307
|
search.submitted_for_settlement_at.between(
|
1142
1308
|
Date.today - 1,
|
1143
|
-
Date.today + 1
|
1309
|
+
Date.today + 1,
|
1144
1310
|
)
|
1145
1311
|
end
|
1146
1312
|
|
1147
|
-
collection.maximum_size.
|
1148
|
-
collection.first.id.
|
1313
|
+
expect(collection.maximum_size).to eq(1)
|
1314
|
+
expect(collection.first.id).to eq(transaction.id)
|
1149
1315
|
end
|
1150
1316
|
|
1151
1317
|
it "finds transactions voided in a given range" do
|
@@ -1154,7 +1320,7 @@ describe Braintree::Transaction, "search" do
|
|
1154
1320
|
:credit_card => {
|
1155
1321
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1156
1322
|
:expiration_date => "05/12"
|
1157
|
-
}
|
1323
|
+
},
|
1158
1324
|
)
|
1159
1325
|
transaction = Braintree::Transaction.void(transaction.id).transaction
|
1160
1326
|
|
@@ -1162,22 +1328,22 @@ describe Braintree::Transaction, "search" do
|
|
1162
1328
|
search.id.is transaction.id
|
1163
1329
|
search.voided_at.between(
|
1164
1330
|
Date.today - 2,
|
1165
|
-
Date.today - 1
|
1331
|
+
Date.today - 1,
|
1166
1332
|
)
|
1167
1333
|
end
|
1168
1334
|
|
1169
|
-
collection.maximum_size.
|
1335
|
+
expect(collection.maximum_size).to eq(0)
|
1170
1336
|
|
1171
1337
|
collection = Braintree::Transaction.search do |search|
|
1172
1338
|
search.id.is transaction.id
|
1173
1339
|
search.voided_at.between(
|
1174
1340
|
Date.today - 1,
|
1175
|
-
Date.today + 1
|
1341
|
+
Date.today + 1,
|
1176
1342
|
)
|
1177
1343
|
end
|
1178
1344
|
|
1179
|
-
collection.maximum_size.
|
1180
|
-
collection.first.id.
|
1345
|
+
expect(collection.maximum_size).to eq(1)
|
1346
|
+
expect(collection.first.id).to eq(transaction.id)
|
1181
1347
|
end
|
1182
1348
|
end
|
1183
1349
|
|
@@ -1190,31 +1356,31 @@ describe Braintree::Transaction, "search" do
|
|
1190
1356
|
},
|
1191
1357
|
:options => {
|
1192
1358
|
:submit_for_settlement => true
|
1193
|
-
}
|
1359
|
+
},
|
1194
1360
|
)
|
1195
1361
|
|
1196
1362
|
collection = Braintree::Transaction.search do |search|
|
1197
1363
|
search.id.is transaction.id
|
1198
1364
|
search.authorized_at.between(
|
1199
1365
|
Date.today - 1,
|
1200
|
-
Date.today + 1
|
1366
|
+
Date.today + 1,
|
1201
1367
|
)
|
1202
1368
|
search.submitted_for_settlement_at.between(
|
1203
1369
|
Date.today - 1,
|
1204
|
-
Date.today + 1
|
1370
|
+
Date.today + 1,
|
1205
1371
|
)
|
1206
1372
|
end
|
1207
1373
|
|
1208
|
-
collection.maximum_size.
|
1374
|
+
expect(collection.maximum_size).to be > 0
|
1209
1375
|
end
|
1210
1376
|
end
|
1211
1377
|
|
1212
1378
|
it "returns multiple results" do
|
1213
1379
|
collection = Braintree::Transaction.search
|
1214
|
-
collection.maximum_size.
|
1380
|
+
expect(collection.maximum_size).to be > 100
|
1215
1381
|
|
1216
|
-
transaction_ids = collection.map {|t| t.id }.uniq.compact
|
1217
|
-
transaction_ids.size.
|
1382
|
+
transaction_ids = collection.map { |t| t.id }.uniq.compact
|
1383
|
+
expect(transaction_ids.size).to eq(collection.maximum_size)
|
1218
1384
|
end
|
1219
1385
|
|
1220
1386
|
context "text node operations" do
|
@@ -1225,7 +1391,7 @@ describe Braintree::Transaction, "search" do
|
|
1225
1391
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1226
1392
|
:expiration_date => "05/2012",
|
1227
1393
|
:cardholder_name => "Tom Smith"
|
1228
|
-
}
|
1394
|
+
},
|
1229
1395
|
)
|
1230
1396
|
end
|
1231
1397
|
|
@@ -1235,15 +1401,15 @@ describe Braintree::Transaction, "search" do
|
|
1235
1401
|
search.credit_card_cardholder_name.is "Tom Smith"
|
1236
1402
|
end
|
1237
1403
|
|
1238
|
-
collection.maximum_size.
|
1239
|
-
collection.first.id.
|
1404
|
+
expect(collection.maximum_size).to eq(1)
|
1405
|
+
expect(collection.first.id).to eq(@transaction.id)
|
1240
1406
|
|
1241
1407
|
collection = Braintree::Transaction.search do |search|
|
1242
1408
|
search.id.is @transaction.id
|
1243
1409
|
search.credit_card_cardholder_name.is "Invalid"
|
1244
1410
|
end
|
1245
1411
|
|
1246
|
-
collection.maximum_size.
|
1412
|
+
expect(collection.maximum_size).to eq(0)
|
1247
1413
|
end
|
1248
1414
|
|
1249
1415
|
it "is_not" do
|
@@ -1252,15 +1418,15 @@ describe Braintree::Transaction, "search" do
|
|
1252
1418
|
search.credit_card_cardholder_name.is_not "Anybody Else"
|
1253
1419
|
end
|
1254
1420
|
|
1255
|
-
collection.maximum_size.
|
1256
|
-
collection.first.id.
|
1421
|
+
expect(collection.maximum_size).to eq(1)
|
1422
|
+
expect(collection.first.id).to eq(@transaction.id)
|
1257
1423
|
|
1258
1424
|
collection = Braintree::Transaction.search do |search|
|
1259
1425
|
search.id.is @transaction.id
|
1260
1426
|
search.credit_card_cardholder_name.is_not "Tom Smith"
|
1261
1427
|
end
|
1262
1428
|
|
1263
|
-
collection.maximum_size.
|
1429
|
+
expect(collection.maximum_size).to eq(0)
|
1264
1430
|
end
|
1265
1431
|
|
1266
1432
|
it "ends_with" do
|
@@ -1269,15 +1435,15 @@ describe Braintree::Transaction, "search" do
|
|
1269
1435
|
search.credit_card_cardholder_name.ends_with "m Smith"
|
1270
1436
|
end
|
1271
1437
|
|
1272
|
-
collection.maximum_size.
|
1273
|
-
collection.first.id.
|
1438
|
+
expect(collection.maximum_size).to eq(1)
|
1439
|
+
expect(collection.first.id).to eq(@transaction.id)
|
1274
1440
|
|
1275
1441
|
collection = Braintree::Transaction.search do |search|
|
1276
1442
|
search.id.is @transaction.id
|
1277
1443
|
search.credit_card_cardholder_name.ends_with "Tom S"
|
1278
1444
|
end
|
1279
1445
|
|
1280
|
-
collection.maximum_size.
|
1446
|
+
expect(collection.maximum_size).to eq(0)
|
1281
1447
|
end
|
1282
1448
|
|
1283
1449
|
it "starts_with" do
|
@@ -1286,15 +1452,15 @@ describe Braintree::Transaction, "search" do
|
|
1286
1452
|
search.credit_card_cardholder_name.starts_with "Tom S"
|
1287
1453
|
end
|
1288
1454
|
|
1289
|
-
collection.maximum_size.
|
1290
|
-
collection.first.id.
|
1455
|
+
expect(collection.maximum_size).to eq(1)
|
1456
|
+
expect(collection.first.id).to eq(@transaction.id)
|
1291
1457
|
|
1292
1458
|
collection = Braintree::Transaction.search do |search|
|
1293
1459
|
search.id.is @transaction.id
|
1294
1460
|
search.credit_card_cardholder_name.starts_with "m Smith"
|
1295
1461
|
end
|
1296
1462
|
|
1297
|
-
collection.maximum_size.
|
1463
|
+
expect(collection.maximum_size).to eq(0)
|
1298
1464
|
end
|
1299
1465
|
|
1300
1466
|
it "contains" do
|
@@ -1303,26 +1469,53 @@ describe Braintree::Transaction, "search" do
|
|
1303
1469
|
search.credit_card_cardholder_name.contains "m Sm"
|
1304
1470
|
end
|
1305
1471
|
|
1306
|
-
collection.maximum_size.
|
1307
|
-
collection.first.id.
|
1472
|
+
expect(collection.maximum_size).to eq(1)
|
1473
|
+
expect(collection.first.id).to eq(@transaction.id)
|
1308
1474
|
|
1309
1475
|
collection = Braintree::Transaction.search do |search|
|
1310
1476
|
search.id.is @transaction.id
|
1311
1477
|
search.credit_card_cardholder_name.contains "Anybody Else"
|
1312
1478
|
end
|
1313
1479
|
|
1314
|
-
collection.maximum_size.
|
1480
|
+
expect(collection.maximum_size).to eq(0)
|
1315
1481
|
end
|
1316
1482
|
end
|
1317
1483
|
|
1318
1484
|
context "when the search times out" do
|
1319
|
-
it "raises a
|
1485
|
+
it "raises a UnexpectedError" do
|
1320
1486
|
expect {
|
1321
|
-
|
1322
|
-
search.amount.is
|
1487
|
+
Braintree::Transaction.search do |search|
|
1488
|
+
search.amount.is(-10)
|
1323
1489
|
end
|
1324
|
-
}.to raise_error(Braintree::
|
1490
|
+
}.to raise_error(Braintree::UnexpectedError)
|
1491
|
+
end
|
1492
|
+
end
|
1493
|
+
|
1494
|
+
it "searches by payment instrument type meta checkout" do
|
1495
|
+
meta_checkout_card_transaction = Braintree::Transaction.sale!(
|
1496
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1497
|
+
:options => {
|
1498
|
+
:submit_for_settlement => true
|
1499
|
+
},
|
1500
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutCard,
|
1501
|
+
)
|
1502
|
+
|
1503
|
+
meta_checkout_token_transaction = Braintree::Transaction.sale!(
|
1504
|
+
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
1505
|
+
:options => {
|
1506
|
+
:submit_for_settlement => true
|
1507
|
+
},
|
1508
|
+
:payment_method_nonce => Braintree::Test::Nonce::MetaCheckoutToken,
|
1509
|
+
)
|
1510
|
+
|
1511
|
+
collection = Braintree::Transaction.search do |search|
|
1512
|
+
search.payment_instrument_type.in ["MetaCheckout"]
|
1325
1513
|
end
|
1514
|
+
|
1515
|
+
collection.maximum_size.should == 2
|
1516
|
+
txn_ids = collection.map(&:id)
|
1517
|
+
expect(txn_ids).to include(meta_checkout_card_transaction.id)
|
1518
|
+
expect(txn_ids).to include(meta_checkout_token_transaction.id)
|
1326
1519
|
end
|
1327
1520
|
end
|
1328
1521
|
|
@@ -1336,7 +1529,7 @@ describe Braintree::Transaction, "search" do
|
|
1336
1529
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1337
1530
|
:expiration_date => "05/2012",
|
1338
1531
|
:cardholder_name => "#{cardholder_name} #{index}"
|
1339
|
-
}
|
1532
|
+
},
|
1340
1533
|
)
|
1341
1534
|
end
|
1342
1535
|
|
@@ -1353,7 +1546,7 @@ describe Braintree::Transaction, "search" do
|
|
1353
1546
|
:number => Braintree::Test::CreditCardNumbers::Visa,
|
1354
1547
|
:expiration_date => "05/2012",
|
1355
1548
|
:cardholder_name => new_cardholder_name,
|
1356
|
-
}
|
1549
|
+
},
|
1357
1550
|
)
|
1358
1551
|
|
1359
1552
|
transactions = collection.to_a
|