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
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "stringio"
|
2
2
|
|
3
3
|
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
4
4
|
|
@@ -22,26 +22,26 @@ describe Braintree::Configuration do
|
|
22
22
|
describe "initialize" do
|
23
23
|
it "accepts merchant credentials" do
|
24
24
|
config = Braintree::Configuration.new(
|
25
|
-
:merchant_id =>
|
26
|
-
:public_key =>
|
27
|
-
:private_key =>
|
25
|
+
:merchant_id => "merchant_id",
|
26
|
+
:public_key => "public_key",
|
27
|
+
:private_key => "private_key",
|
28
28
|
)
|
29
29
|
|
30
|
-
config.merchant_id.
|
31
|
-
config.public_key.
|
32
|
-
config.private_key.
|
30
|
+
expect(config.merchant_id).to eq("merchant_id")
|
31
|
+
expect(config.public_key).to eq("public_key")
|
32
|
+
expect(config.private_key).to eq("private_key")
|
33
33
|
end
|
34
34
|
|
35
35
|
it "accepts partner credentials" do
|
36
36
|
config = Braintree::Configuration.new(
|
37
|
-
:partner_id =>
|
38
|
-
:public_key =>
|
39
|
-
:private_key =>
|
37
|
+
:partner_id => "partner_id",
|
38
|
+
:public_key => "public_key",
|
39
|
+
:private_key => "private_key",
|
40
40
|
)
|
41
41
|
|
42
|
-
config.merchant_id.
|
43
|
-
config.public_key.
|
44
|
-
config.private_key.
|
42
|
+
expect(config.merchant_id).to eq("partner_id")
|
43
|
+
expect(config.public_key).to eq("public_key")
|
44
|
+
expect(config.private_key).to eq("private_key")
|
45
45
|
end
|
46
46
|
|
47
47
|
it "raises if combining client_id/secret with access_token" do
|
@@ -49,7 +49,7 @@ describe Braintree::Configuration do
|
|
49
49
|
Braintree::Configuration.new(
|
50
50
|
:client_id => "client_id$development$integration_client_id",
|
51
51
|
:client_secret => "client_secret$development$integration_client_secret",
|
52
|
-
:access_token => "access_token$development$integration_merchant_id$fb27c79dd"
|
52
|
+
:access_token => "access_token$development$integration_merchant_id$fb27c79dd",
|
53
53
|
)
|
54
54
|
end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
|
55
55
|
end
|
@@ -62,7 +62,7 @@ describe Braintree::Configuration do
|
|
62
62
|
:merchant_id => "merchant_id",
|
63
63
|
:public_key => "public_key",
|
64
64
|
:private_key => "private_key",
|
65
|
-
:environment => "development"
|
65
|
+
:environment => "development",
|
66
66
|
)
|
67
67
|
end.to raise_error(Braintree::ConfigurationError, /mixed credential types/)
|
68
68
|
end
|
@@ -82,7 +82,7 @@ describe Braintree::Configuration do
|
|
82
82
|
:access_token => "access_token$development$integration_merchant_id$fb27c79dd",
|
83
83
|
:environment => "sandbox",
|
84
84
|
)
|
85
|
-
$stderr.string.
|
85
|
+
expect($stderr.string).to eq("Braintree::Gateway should not be initialized with mixed environments: environment parameter and access_token do not match, environment from access_token is used.\n")
|
86
86
|
end
|
87
87
|
|
88
88
|
it "does not warn if both environment and access_token are provided and their environments match" do
|
@@ -90,36 +90,36 @@ describe Braintree::Configuration do
|
|
90
90
|
:access_token => "access_token$development$integration_merchant_id$fb27c79dd",
|
91
91
|
:environment => "development",
|
92
92
|
)
|
93
|
-
$stderr.string.
|
93
|
+
expect($stderr.string).to eq("")
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
97
|
it "accepts proxy params" do
|
98
98
|
config = Braintree::Configuration.new(
|
99
|
-
:proxy_address =>
|
99
|
+
:proxy_address => "localhost",
|
100
100
|
:proxy_port => 8080,
|
101
|
-
:proxy_user =>
|
102
|
-
:proxy_pass =>
|
101
|
+
:proxy_user => "user",
|
102
|
+
:proxy_pass => "test",
|
103
103
|
)
|
104
104
|
|
105
|
-
config.proxy_address.
|
106
|
-
config.proxy_port.
|
107
|
-
config.proxy_user.
|
108
|
-
config.proxy_pass.
|
105
|
+
expect(config.proxy_address).to eq("localhost")
|
106
|
+
expect(config.proxy_port).to eq(8080)
|
107
|
+
expect(config.proxy_user).to eq("user")
|
108
|
+
expect(config.proxy_pass).to eq("test")
|
109
109
|
end
|
110
110
|
|
111
111
|
it "accepts ssl version" do
|
112
112
|
config = Braintree::Configuration.new(
|
113
|
-
:ssl_version => :TLSv1_2
|
113
|
+
:ssl_version => :TLSv1_2,
|
114
114
|
)
|
115
115
|
|
116
|
-
config.ssl_version.
|
116
|
+
expect(config.ssl_version).to eq(:TLSv1_2)
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
120
|
describe "base_merchant_path" do
|
121
121
|
it "returns /merchants/{merchant_id}" do
|
122
|
-
Braintree::Configuration.instantiate.base_merchant_path.
|
122
|
+
expect(Braintree::Configuration.instantiate.base_merchant_path).to eq("/merchants/integration_merchant_id")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -127,17 +127,17 @@ describe Braintree::Configuration do
|
|
127
127
|
it "returns the expected url for the development env" do
|
128
128
|
Braintree::Configuration.environment = :development
|
129
129
|
port = Braintree::Configuration.instantiate.port
|
130
|
-
Braintree::Configuration.instantiate.base_merchant_url.
|
130
|
+
expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("http://localhost:#{port}/merchants/integration_merchant_id")
|
131
131
|
end
|
132
132
|
|
133
133
|
it "returns the expected url for the sandbox env" do
|
134
134
|
Braintree::Configuration.environment = :sandbox
|
135
|
-
Braintree::Configuration.instantiate.base_merchant_url.
|
135
|
+
expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.sandbox.braintreegateway.com:443/merchants/integration_merchant_id")
|
136
136
|
end
|
137
137
|
|
138
138
|
it "returns the expected url for the production env" do
|
139
139
|
Braintree::Configuration.environment = :production
|
140
|
-
Braintree::Configuration.instantiate.base_merchant_url.
|
140
|
+
expect(Braintree::Configuration.instantiate.base_merchant_url).to eq("https://api.braintreegateway.com:443/merchants/integration_merchant_id")
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -145,27 +145,27 @@ describe Braintree::Configuration do
|
|
145
145
|
it "sandbox" do
|
146
146
|
Braintree::Configuration.environment = :sandbox
|
147
147
|
ca_file = Braintree::Configuration.instantiate.ca_file
|
148
|
-
ca_file.
|
149
|
-
File.
|
148
|
+
expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
|
149
|
+
expect(File.exist?(ca_file)).to eq(true)
|
150
150
|
end
|
151
151
|
|
152
152
|
it "production" do
|
153
153
|
Braintree::Configuration.environment = :production
|
154
154
|
ca_file = Braintree::Configuration.instantiate.ca_file
|
155
|
-
ca_file.
|
156
|
-
File.
|
155
|
+
expect(ca_file).to match(/api_braintreegateway_com\.ca\.crt$/)
|
156
|
+
expect(File.exist?(ca_file)).to eq(true)
|
157
157
|
end
|
158
158
|
end
|
159
159
|
|
160
160
|
describe "logger" do
|
161
161
|
it "defaults to logging to stdout with log_level info" do
|
162
162
|
config = Braintree::Configuration.new
|
163
|
-
config.logger.level.
|
163
|
+
expect(config.logger.level).to eq(Logger::INFO)
|
164
164
|
end
|
165
165
|
|
166
166
|
it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
|
167
167
|
config = Braintree::Configuration.new :logger => nil
|
168
|
-
config.logger.
|
168
|
+
expect(config.logger).not_to eq(nil)
|
169
169
|
end
|
170
170
|
|
171
171
|
it "can set logger on gateway instance" do
|
@@ -215,17 +215,17 @@ describe Braintree::Configuration do
|
|
215
215
|
|
216
216
|
gateway = Braintree::Configuration.gateway
|
217
217
|
|
218
|
-
gateway.config.proxy_address.
|
219
|
-
gateway.config.proxy_port.
|
220
|
-
gateway.config.proxy_user.
|
221
|
-
gateway.config.proxy_pass.
|
218
|
+
expect(gateway.config.proxy_address).to eq("localhost")
|
219
|
+
expect(gateway.config.proxy_port).to eq(8080)
|
220
|
+
expect(gateway.config.proxy_user).to eq("user")
|
221
|
+
expect(gateway.config.proxy_pass).to eq("test")
|
222
222
|
end
|
223
223
|
|
224
224
|
it "sets the ssl version" do
|
225
225
|
Braintree::Configuration.ssl_version = :TLSv1_2
|
226
226
|
gateway = Braintree::Configuration.gateway
|
227
227
|
|
228
|
-
gateway.config.ssl_version.
|
228
|
+
expect(gateway.config.ssl_version).to eq(:TLSv1_2)
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -238,12 +238,12 @@ describe Braintree::Configuration do
|
|
238
238
|
|
239
239
|
it "allows the environment to be set with a string value" do
|
240
240
|
expect do
|
241
|
-
Braintree::Configuration.environment =
|
241
|
+
Braintree::Configuration.environment = "sandbox"
|
242
242
|
end.not_to raise_error
|
243
243
|
end
|
244
244
|
|
245
245
|
it "sets the environment as a symbol" do
|
246
|
-
Braintree::Configuration.environment =
|
246
|
+
Braintree::Configuration.environment = "sandbox"
|
247
247
|
expect(Braintree::Configuration.environment).to eq :sandbox
|
248
248
|
end
|
249
249
|
end
|
@@ -253,7 +253,7 @@ describe Braintree::Configuration do
|
|
253
253
|
begin
|
254
254
|
old_logger = Braintree::Configuration.logger
|
255
255
|
Braintree::Configuration.logger = nil
|
256
|
-
Braintree::Configuration.instantiate.logger.level.
|
256
|
+
expect(Braintree::Configuration.instantiate.logger.level).to eq(Logger::INFO)
|
257
257
|
ensure
|
258
258
|
Braintree::Configuration.logger = old_logger
|
259
259
|
end
|
@@ -261,7 +261,7 @@ describe Braintree::Configuration do
|
|
261
261
|
|
262
262
|
it "lazily initializes so that you can do Braintree::Configuration.logger.level = when configuring the client lib" do
|
263
263
|
Braintree::Configuration.logger = nil
|
264
|
-
Braintree::Configuration.logger.
|
264
|
+
expect(Braintree::Configuration.logger).not_to eq(nil)
|
265
265
|
end
|
266
266
|
end
|
267
267
|
|
@@ -316,25 +316,25 @@ describe Braintree::Configuration do
|
|
316
316
|
describe "self.port" do
|
317
317
|
it "is 443 for production" do
|
318
318
|
Braintree::Configuration.environment = :production
|
319
|
-
Braintree::Configuration.instantiate.port.
|
319
|
+
expect(Braintree::Configuration.instantiate.port).to eq(443)
|
320
320
|
end
|
321
321
|
|
322
322
|
it "is 443 for sandbox" do
|
323
323
|
Braintree::Configuration.environment = :sandbox
|
324
|
-
Braintree::Configuration.instantiate.port.
|
324
|
+
expect(Braintree::Configuration.instantiate.port).to eq(443)
|
325
325
|
end
|
326
326
|
|
327
327
|
it "is 3000 or GATEWAY_PORT environment variable for development" do
|
328
328
|
Braintree::Configuration.environment = :development
|
329
|
-
old_gateway_port = ENV[
|
329
|
+
old_gateway_port = ENV["GATEWAY_PORT"]
|
330
330
|
begin
|
331
|
-
ENV[
|
332
|
-
Braintree::Configuration.instantiate.port.
|
331
|
+
ENV["GATEWAY_PORT"] = nil
|
332
|
+
expect(Braintree::Configuration.instantiate.port).to eq(3000)
|
333
333
|
|
334
|
-
ENV[
|
335
|
-
Braintree::Configuration.instantiate.port.
|
334
|
+
ENV["GATEWAY_PORT"] = "1234"
|
335
|
+
expect(Braintree::Configuration.instantiate.port).to eq("1234")
|
336
336
|
ensure
|
337
|
-
ENV[
|
337
|
+
ENV["GATEWAY_PORT"] = old_gateway_port
|
338
338
|
end
|
339
339
|
end
|
340
340
|
end
|
@@ -342,32 +342,32 @@ describe Braintree::Configuration do
|
|
342
342
|
describe "self.protocol" do
|
343
343
|
it "is http for development" do
|
344
344
|
Braintree::Configuration.environment = :development
|
345
|
-
Braintree::Configuration.instantiate.protocol.
|
345
|
+
expect(Braintree::Configuration.instantiate.protocol).to eq("http")
|
346
346
|
end
|
347
347
|
|
348
348
|
it "is https for production" do
|
349
349
|
Braintree::Configuration.environment = :production
|
350
|
-
Braintree::Configuration.instantiate.protocol.
|
350
|
+
expect(Braintree::Configuration.instantiate.protocol).to eq("https")
|
351
351
|
end
|
352
352
|
|
353
353
|
it "is https for sandbox" do
|
354
354
|
Braintree::Configuration.environment = :sandbox
|
355
|
-
Braintree::Configuration.instantiate.protocol.
|
355
|
+
expect(Braintree::Configuration.instantiate.protocol).to eq("https")
|
356
356
|
end
|
357
357
|
end
|
358
358
|
|
359
359
|
describe "graphql_server" do
|
360
360
|
it "is localhost or GRAPHQL_HOST environment variable for development" do
|
361
361
|
Braintree::Configuration.environment = :development
|
362
|
-
old_gateway_url = ENV[
|
362
|
+
old_gateway_url = ENV["GRAPHQL_HOST"]
|
363
363
|
begin
|
364
|
-
ENV[
|
365
|
-
Braintree::Configuration.instantiate.graphql_server.
|
364
|
+
ENV["GRAPHQL_HOST"] = nil
|
365
|
+
expect(Braintree::Configuration.instantiate.graphql_server).to eq("graphql.bt.local")
|
366
366
|
|
367
|
-
ENV[
|
368
|
-
Braintree::Configuration.instantiate.graphql_server.
|
367
|
+
ENV["GRAPHQL_HOST"] = "gateway"
|
368
|
+
expect(Braintree::Configuration.instantiate.graphql_server).to eq("gateway")
|
369
369
|
ensure
|
370
|
-
ENV[
|
370
|
+
ENV["GRAPHQL_HOST"] = old_gateway_url
|
371
371
|
end
|
372
372
|
end
|
373
373
|
end
|
@@ -375,76 +375,76 @@ describe Braintree::Configuration do
|
|
375
375
|
describe "server" do
|
376
376
|
it "is localhost or GATEWAY_HOST environment variable for development" do
|
377
377
|
Braintree::Configuration.environment = :development
|
378
|
-
old_gateway_url = ENV[
|
378
|
+
old_gateway_url = ENV["GATEWAY_HOST"]
|
379
379
|
begin
|
380
|
-
ENV[
|
381
|
-
Braintree::Configuration.instantiate.server.
|
380
|
+
ENV["GATEWAY_HOST"] = nil
|
381
|
+
expect(Braintree::Configuration.instantiate.server).to eq("localhost")
|
382
382
|
|
383
|
-
ENV[
|
384
|
-
Braintree::Configuration.instantiate.server.
|
383
|
+
ENV["GATEWAY_HOST"] = "gateway"
|
384
|
+
expect(Braintree::Configuration.instantiate.server).to eq("gateway")
|
385
385
|
ensure
|
386
|
-
ENV[
|
386
|
+
ENV["GATEWAY_HOST"] = old_gateway_url
|
387
387
|
end
|
388
388
|
end
|
389
389
|
|
390
390
|
it "is api.braintreegateway.com for production" do
|
391
391
|
Braintree::Configuration.environment = :production
|
392
|
-
Braintree::Configuration.instantiate.server.
|
392
|
+
expect(Braintree::Configuration.instantiate.server).to eq("api.braintreegateway.com")
|
393
393
|
end
|
394
394
|
|
395
395
|
it "is api.sandbox.braintreegateway.com for sandbox" do
|
396
396
|
Braintree::Configuration.environment = :sandbox
|
397
|
-
Braintree::Configuration.instantiate.server.
|
397
|
+
expect(Braintree::Configuration.instantiate.server).to eq("api.sandbox.braintreegateway.com")
|
398
398
|
end
|
399
399
|
|
400
400
|
it "is qa.braintreegateway.com for qa" do
|
401
401
|
Braintree::Configuration.environment = :qa
|
402
|
-
Braintree::Configuration.instantiate.server.
|
402
|
+
expect(Braintree::Configuration.instantiate.server).to eq("gateway.qa2.braintreepayments.com")
|
403
403
|
end
|
404
404
|
|
405
405
|
it "can by changed by configuring the production endpoint" do
|
406
406
|
Braintree::Configuration.environment = :production
|
407
407
|
Braintree::Configuration.endpoint = "custom-endpoint"
|
408
|
-
Braintree::Configuration.instantiate.server.
|
408
|
+
expect(Braintree::Configuration.instantiate.server).to eq("custom-endpoint.braintreegateway.com")
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
412
412
|
describe "auth_url" do
|
413
413
|
it "is http://auth.venmo.dev for development" do
|
414
414
|
Braintree::Configuration.environment = :development
|
415
|
-
Braintree::Configuration.instantiate.auth_url.
|
415
|
+
expect(Braintree::Configuration.instantiate.auth_url).to eq("http://auth.venmo.dev:9292")
|
416
416
|
end
|
417
417
|
|
418
418
|
it "is https://auth.venmo.com for production" do
|
419
419
|
Braintree::Configuration.environment = :production
|
420
|
-
Braintree::Configuration.instantiate.auth_url.
|
420
|
+
expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.com")
|
421
421
|
end
|
422
422
|
|
423
423
|
it "is https://auth.sandbox.venmo.com for sandbox" do
|
424
424
|
Braintree::Configuration.environment = :sandbox
|
425
|
-
Braintree::Configuration.instantiate.auth_url.
|
425
|
+
expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.sandbox.braintreegateway.com")
|
426
426
|
end
|
427
427
|
|
428
428
|
it "is https://auth.qa.venmo.com for qa" do
|
429
429
|
Braintree::Configuration.environment = :qa
|
430
|
-
Braintree::Configuration.instantiate.auth_url.
|
430
|
+
expect(Braintree::Configuration.instantiate.auth_url).to eq("https://auth.venmo.qa2.braintreegateway.com")
|
431
431
|
end
|
432
432
|
end
|
433
433
|
|
434
434
|
describe "ssl?" do
|
435
435
|
it "returns false for development" do
|
436
436
|
Braintree::Configuration.environment = :development
|
437
|
-
Braintree::Configuration.instantiate.ssl
|
437
|
+
expect(Braintree::Configuration.instantiate.ssl?).to eq(false)
|
438
438
|
end
|
439
439
|
|
440
440
|
it "returns true for production" do
|
441
441
|
Braintree::Configuration.environment = :production
|
442
|
-
Braintree::Configuration.instantiate.ssl
|
442
|
+
expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
|
443
443
|
end
|
444
444
|
|
445
445
|
it "returns true for sandbox" do
|
446
446
|
Braintree::Configuration.environment = :sandbox
|
447
|
-
Braintree::Configuration.instantiate.ssl
|
447
|
+
expect(Braintree::Configuration.instantiate.ssl?).to eq(true)
|
448
448
|
end
|
449
449
|
end
|
450
450
|
|
@@ -455,20 +455,20 @@ describe Braintree::Configuration do
|
|
455
455
|
|
456
456
|
it "appends the default user_agent with the given value" do
|
457
457
|
Braintree::Configuration.custom_user_agent = "ActiveMerchant 1.2.3"
|
458
|
-
Braintree::Configuration.instantiate.user_agent.
|
458
|
+
expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String} (ActiveMerchant 1.2.3)")
|
459
459
|
end
|
460
460
|
|
461
461
|
it "does not append anything if there is no custom_user_agent" do
|
462
462
|
Braintree::Configuration.custom_user_agent = nil
|
463
|
-
Braintree::Configuration.instantiate.user_agent.
|
463
|
+
expect(Braintree::Configuration.instantiate.user_agent).to eq("Braintree Ruby Gem #{Braintree::Version::String}")
|
464
464
|
end
|
465
465
|
end
|
466
466
|
|
467
467
|
describe "inspect" do
|
468
468
|
it "masks the private_key" do
|
469
469
|
config = Braintree::Configuration.new(:private_key => "secret_key")
|
470
|
-
config.inspect.
|
471
|
-
config.inspect.
|
470
|
+
expect(config.inspect).to include('@private_key="[FILTERED]"')
|
471
|
+
expect(config.inspect).not_to include("secret_key")
|
472
472
|
end
|
473
473
|
end
|
474
474
|
|
@@ -476,7 +476,7 @@ describe Braintree::Configuration do
|
|
476
476
|
it "has a signature service initialized with the private key" do
|
477
477
|
config = Braintree::Configuration.new(:private_key => "secret_key")
|
478
478
|
|
479
|
-
config.signature_service.key.
|
479
|
+
expect(config.signature_service.key).to eq("secret_key")
|
480
480
|
end
|
481
481
|
end
|
482
482
|
end
|
@@ -6,9 +6,9 @@ describe Braintree::CredentialsParser do
|
|
6
6
|
parser = Braintree::CredentialsParser.new
|
7
7
|
parser.parse_client_credentials("client_id$development$integration_client_id", "client_secret$development$integration_client_secret")
|
8
8
|
|
9
|
-
parser.client_id.
|
10
|
-
parser.client_secret.
|
11
|
-
parser.environment.
|
9
|
+
expect(parser.client_id).to eq("client_id$development$integration_client_id")
|
10
|
+
expect(parser.client_secret).to eq("client_secret$development$integration_client_secret")
|
11
|
+
expect(parser.environment).to eq(:development)
|
12
12
|
end
|
13
13
|
|
14
14
|
it "raises error on inconsistent environment" do
|
@@ -57,9 +57,9 @@ describe Braintree::CredentialsParser do
|
|
57
57
|
parser = Braintree::CredentialsParser.new
|
58
58
|
parser.parse_access_token("access_token$development$integration_merchant_id$fb27c79dd")
|
59
59
|
|
60
|
-
parser.merchant_id.
|
61
|
-
parser.access_token.
|
62
|
-
parser.environment.
|
60
|
+
expect(parser.merchant_id).to eq("integration_merchant_id")
|
61
|
+
expect(parser.access_token).to eq("access_token$development$integration_merchant_id$fb27c79dd")
|
62
|
+
expect(parser.environment).to eq(:development)
|
63
63
|
end
|
64
64
|
|
65
65
|
it "raises error on nil access_token" do
|