braintree 4.14.0 → 4.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +22 -9
- data/lib/braintree/credit_card_gateway.rb +23 -11
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_gateway.rb +28 -11
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_codes.rb +4 -0
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +5 -5
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +23 -10
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- 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 +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +4 -0
- 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 +1 -1
- data/lib/braintree/transaction/address_details.rb +2 -1
- data/lib/braintree/transaction/credit_card_details.rb +4 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/local_payment_details.rb +2 -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 +16 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +37 -20
- data/lib/braintree/transaction_gateway.rb +44 -15
- data/lib/braintree/transaction_line_item.rb +13 -10
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +7 -6
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +3 -2
- data/lib/braintree/webhook_notification_gateway.rb +4 -4
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +18 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +3 -3
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +5 -1
- data/spec/integration/braintree/add_on_spec.rb +9 -9
- data/spec/integration/braintree/address_spec.rb +69 -69
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +8 -8
- data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
- data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
- data/spec/integration/braintree/credit_card_spec.rb +227 -228
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
- data/spec/integration/braintree/credit_card_verification_spec.rb +98 -53
- data/spec/integration/braintree/customer_search_spec.rb +20 -20
- data/spec/integration/braintree/customer_spec.rb +317 -317
- 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 +0 -1
- data/spec/integration/braintree/dispute_spec.rb +87 -87
- data/spec/integration/braintree/document_upload_spec.rb +17 -17
- data/spec/integration/braintree/error_codes_spec.rb +2 -2
- data/spec/integration/braintree/http_spec.rb +28 -28
- data/spec/integration/braintree/merchant_account_spec.rb +127 -127
- data/spec/integration/braintree/merchant_spec.rb +103 -103
- data/spec/integration/braintree/oauth_spec.rb +61 -61
- data/spec/integration/braintree/package_tracking_spec.rb +111 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
- data/spec/integration/braintree/payment_method_spec.rb +391 -391
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
- data/spec/integration/braintree/paypal_account_spec.rb +38 -38
- data/spec/integration/braintree/plan_spec.rb +15 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
- data/spec/integration/braintree/subscription_spec.rb +364 -364
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +19 -19
- data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
- data/spec/integration/braintree/transaction_search_spec.rb +225 -165
- data/spec/integration/braintree/transaction_spec.rb +1606 -1230
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
- data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
- data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
- data/spec/spec_helper.rb +9 -8
- data/spec/unit/braintree/address_spec.rb +8 -8
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +57 -57
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +31 -29
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +33 -28
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
- data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
- data/spec/unit/braintree/customer_spec.rb +41 -40
- data/spec/unit/braintree/digest_spec.rb +5 -5
- data/spec/unit/braintree/disbursement_spec.rb +11 -11
- data/spec/unit/braintree/dispute_search_spec.rb +2 -2
- data/spec/unit/braintree/dispute_spec.rb +56 -56
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +9 -9
- data/spec/unit/braintree/http_spec.rb +9 -9
- data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
- data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
- data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
- data/spec/unit/braintree/merchant_account_spec.rb +4 -4
- 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 +74 -0
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
- data/spec/unit/braintree/payment_method_spec.rb +19 -19
- data/spec/unit/braintree/paypal_account_spec.rb +4 -4
- data/spec/unit/braintree/resource_collection_spec.rb +7 -7
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
- 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 +17 -17
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +5 -5
- data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +41 -9
- data/spec/unit/braintree/transaction_search_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +101 -93
- 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 +27 -27
- data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
- data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +8 -8
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +17 -17
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +14 -2
@@ -9,42 +9,42 @@ describe Braintree::VisaCheckoutCard do
|
|
9
9
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutDiscover,
|
10
10
|
:customer_id => customer.id,
|
11
11
|
)
|
12
|
-
result.
|
12
|
+
expect(result).to be_success
|
13
13
|
|
14
14
|
visa_checkout_card = result.payment_method
|
15
|
-
visa_checkout_card.
|
16
|
-
visa_checkout_card.call_id.
|
17
|
-
visa_checkout_card.billing_address.
|
18
|
-
visa_checkout_card.bin.
|
19
|
-
visa_checkout_card.card_type.
|
20
|
-
visa_checkout_card.cardholder_name.
|
21
|
-
visa_checkout_card.commercial.
|
22
|
-
visa_checkout_card.country_of_issuance.
|
23
|
-
visa_checkout_card.created_at.
|
24
|
-
visa_checkout_card.customer_id.
|
25
|
-
visa_checkout_card.customer_location.
|
26
|
-
visa_checkout_card.debit.
|
27
|
-
visa_checkout_card.default
|
28
|
-
visa_checkout_card.durbin_regulated.
|
29
|
-
visa_checkout_card.expiration_date.
|
30
|
-
visa_checkout_card.expiration_month.
|
31
|
-
visa_checkout_card.expiration_year.
|
32
|
-
visa_checkout_card.expired
|
33
|
-
visa_checkout_card.healthcare.
|
34
|
-
visa_checkout_card.image_url.
|
35
|
-
visa_checkout_card.issuing_bank.
|
36
|
-
visa_checkout_card.last_4.
|
37
|
-
visa_checkout_card.payroll.
|
38
|
-
visa_checkout_card.prepaid.
|
39
|
-
visa_checkout_card.product_id.
|
40
|
-
visa_checkout_card.subscriptions.
|
41
|
-
visa_checkout_card.token.
|
42
|
-
visa_checkout_card.unique_number_identifier.
|
43
|
-
visa_checkout_card.updated_at.
|
15
|
+
expect(visa_checkout_card).to be_a(Braintree::VisaCheckoutCard)
|
16
|
+
expect(visa_checkout_card.call_id).to eq("abc123")
|
17
|
+
expect(visa_checkout_card.billing_address).not_to be_nil
|
18
|
+
expect(visa_checkout_card.bin).not_to be_nil
|
19
|
+
expect(visa_checkout_card.card_type).not_to be_nil
|
20
|
+
expect(visa_checkout_card.cardholder_name).not_to be_nil
|
21
|
+
expect(visa_checkout_card.commercial).not_to be_nil
|
22
|
+
expect(visa_checkout_card.country_of_issuance).not_to be_nil
|
23
|
+
expect(visa_checkout_card.created_at).not_to be_nil
|
24
|
+
expect(visa_checkout_card.customer_id).not_to be_nil
|
25
|
+
expect(visa_checkout_card.customer_location).not_to be_nil
|
26
|
+
expect(visa_checkout_card.debit).not_to be_nil
|
27
|
+
expect(visa_checkout_card.default?).not_to be_nil
|
28
|
+
expect(visa_checkout_card.durbin_regulated).not_to be_nil
|
29
|
+
expect(visa_checkout_card.expiration_date).not_to be_nil
|
30
|
+
expect(visa_checkout_card.expiration_month).not_to be_nil
|
31
|
+
expect(visa_checkout_card.expiration_year).not_to be_nil
|
32
|
+
expect(visa_checkout_card.expired?).not_to be_nil
|
33
|
+
expect(visa_checkout_card.healthcare).not_to be_nil
|
34
|
+
expect(visa_checkout_card.image_url).not_to be_nil
|
35
|
+
expect(visa_checkout_card.issuing_bank).not_to be_nil
|
36
|
+
expect(visa_checkout_card.last_4).not_to be_nil
|
37
|
+
expect(visa_checkout_card.payroll).not_to be_nil
|
38
|
+
expect(visa_checkout_card.prepaid).not_to be_nil
|
39
|
+
expect(visa_checkout_card.product_id).not_to be_nil
|
40
|
+
expect(visa_checkout_card.subscriptions).not_to be_nil
|
41
|
+
expect(visa_checkout_card.token).not_to be_nil
|
42
|
+
expect(visa_checkout_card.unique_number_identifier).not_to be_nil
|
43
|
+
expect(visa_checkout_card.updated_at).not_to be_nil
|
44
44
|
|
45
45
|
customer = Braintree::Customer.find(customer.id)
|
46
|
-
customer.visa_checkout_cards.size.
|
47
|
-
customer.visa_checkout_cards.first.
|
46
|
+
expect(customer.visa_checkout_cards.size).to eq(1)
|
47
|
+
expect(customer.visa_checkout_cards.first).to eq(visa_checkout_card)
|
48
48
|
end
|
49
49
|
|
50
50
|
it "can create with verification" do
|
@@ -55,8 +55,8 @@ describe Braintree::VisaCheckoutCard do
|
|
55
55
|
:customer_id => customer.id,
|
56
56
|
:options => {:verify_card => true},
|
57
57
|
)
|
58
|
-
result.
|
59
|
-
result.payment_method.verification.status.
|
58
|
+
expect(result).to be_success
|
59
|
+
expect(result.payment_method.verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
|
60
60
|
end
|
61
61
|
|
62
62
|
it "can search for transactions" do
|
@@ -64,14 +64,14 @@ describe Braintree::VisaCheckoutCard do
|
|
64
64
|
:payment_method_nonce => Braintree::Test::Nonce::VisaCheckoutDiscover,
|
65
65
|
:amount => "47.00",
|
66
66
|
)
|
67
|
-
transaction_create_result.
|
67
|
+
expect(transaction_create_result).to be_success
|
68
68
|
transaction_id = transaction_create_result.transaction.id
|
69
69
|
|
70
70
|
search_results = Braintree::Transaction.search do |search|
|
71
71
|
search.id.is transaction_id
|
72
72
|
search.payment_instrument_type.is Braintree::PaymentInstrumentType::VisaCheckoutCard
|
73
73
|
end
|
74
|
-
search_results.first.id.
|
74
|
+
expect(search_results.first.id).to eq(transaction_id)
|
75
75
|
end
|
76
76
|
|
77
77
|
it "can create transaction from nonce and vault" do
|
@@ -83,28 +83,28 @@ describe Braintree::VisaCheckoutCard do
|
|
83
83
|
:amount => "47.00",
|
84
84
|
:options => {:store_in_vault => true},
|
85
85
|
)
|
86
|
-
result.
|
86
|
+
expect(result).to be_success
|
87
87
|
|
88
88
|
visa_checkout_card_details = result.transaction.visa_checkout_card_details
|
89
|
-
visa_checkout_card_details.call_id.
|
90
|
-
visa_checkout_card_details.bin.
|
91
|
-
visa_checkout_card_details.card_type.
|
92
|
-
visa_checkout_card_details.cardholder_name.
|
93
|
-
visa_checkout_card_details.commercial.
|
94
|
-
visa_checkout_card_details.country_of_issuance.
|
95
|
-
visa_checkout_card_details.customer_location.
|
96
|
-
visa_checkout_card_details.debit.
|
97
|
-
visa_checkout_card_details.durbin_regulated.
|
98
|
-
visa_checkout_card_details.expiration_date.
|
99
|
-
visa_checkout_card_details.expiration_month.
|
100
|
-
visa_checkout_card_details.expiration_year.
|
101
|
-
visa_checkout_card_details.healthcare.
|
102
|
-
visa_checkout_card_details.image_url.
|
103
|
-
visa_checkout_card_details.issuing_bank.
|
104
|
-
visa_checkout_card_details.last_4.
|
105
|
-
visa_checkout_card_details.payroll.
|
106
|
-
visa_checkout_card_details.prepaid.
|
107
|
-
visa_checkout_card_details.product_id.
|
108
|
-
visa_checkout_card_details.token.
|
89
|
+
expect(visa_checkout_card_details.call_id).to eq("abc123")
|
90
|
+
expect(visa_checkout_card_details.bin).not_to be_nil
|
91
|
+
expect(visa_checkout_card_details.card_type).not_to be_nil
|
92
|
+
expect(visa_checkout_card_details.cardholder_name).not_to be_nil
|
93
|
+
expect(visa_checkout_card_details.commercial).not_to be_nil
|
94
|
+
expect(visa_checkout_card_details.country_of_issuance).not_to be_nil
|
95
|
+
expect(visa_checkout_card_details.customer_location).not_to be_nil
|
96
|
+
expect(visa_checkout_card_details.debit).not_to be_nil
|
97
|
+
expect(visa_checkout_card_details.durbin_regulated).not_to be_nil
|
98
|
+
expect(visa_checkout_card_details.expiration_date).not_to be_nil
|
99
|
+
expect(visa_checkout_card_details.expiration_month).not_to be_nil
|
100
|
+
expect(visa_checkout_card_details.expiration_year).not_to be_nil
|
101
|
+
expect(visa_checkout_card_details.healthcare).not_to be_nil
|
102
|
+
expect(visa_checkout_card_details.image_url).not_to be_nil
|
103
|
+
expect(visa_checkout_card_details.issuing_bank).not_to be_nil
|
104
|
+
expect(visa_checkout_card_details.last_4).not_to be_nil
|
105
|
+
expect(visa_checkout_card_details.payroll).not_to be_nil
|
106
|
+
expect(visa_checkout_card_details.prepaid).not_to be_nil
|
107
|
+
expect(visa_checkout_card_details.product_id).not_to be_nil
|
108
|
+
expect(visa_checkout_card_details.token).not_to be_nil
|
109
109
|
end
|
110
110
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -30,19 +30,20 @@ unless defined?(SPEC_HELPER_LOADED)
|
|
30
30
|
|
31
31
|
module SpecHelper
|
32
32
|
|
33
|
+
AdyenMerchantAccountId = "adyen_ma"
|
34
|
+
AibSwedenMaMerchantAccountId = "aib_swe_ma"
|
35
|
+
AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
|
36
|
+
CardProcessorBRLMerchantAccountId = "card_processor_brl"
|
33
37
|
DefaultMerchantAccountId = "sandbox_credit_card"
|
38
|
+
FakeAmexDirectMerchantAccountId = "fake_amex_direct_usd"
|
39
|
+
FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
|
40
|
+
FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
|
41
|
+
HiperBRLMerchantAccountId = "hiper_brl"
|
34
42
|
NonDefaultMerchantAccountId = "sandbox_credit_card_non_default"
|
35
43
|
NonDefaultSubMerchantAccountId = "sandbox_sub_merchant_account"
|
44
|
+
PinlessDebitMerchantAccountId = "pinless_debit"
|
36
45
|
ThreeDSecureMerchantAccountId = "three_d_secure_merchant_account"
|
37
|
-
FakeAmexDirectMerchantAccountId = "fake_amex_direct_usd"
|
38
|
-
FakeVenmoAccountMerchantAccountId = "fake_first_data_venmo_account"
|
39
46
|
UsBankMerchantAccountId = "us_bank_merchant_account"
|
40
|
-
AnotherUsBankMerchantAccountId = "another_us_bank_merchant_account"
|
41
|
-
AdyenMerchantAccountId = "adyen_ma"
|
42
|
-
HiperBRLMerchantAccountId = "hiper_brl"
|
43
|
-
CardProcessorBRLMerchantAccountId = "card_processor_brl"
|
44
|
-
FakeFirstDataMerchantAccountId = "fake_first_data_merchant_account"
|
45
|
-
AibSwedenMaMerchantAccountId = "aib_swe_ma"
|
46
47
|
|
47
48
|
TrialPlan = {
|
48
49
|
:description => "Plan for integration tests -- with trial",
|
@@ -6,29 +6,29 @@ describe Braintree::Address do
|
|
6
6
|
first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
|
7
7
|
second = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
|
8
8
|
|
9
|
-
first.
|
10
|
-
second.
|
9
|
+
expect(first).to eq(second)
|
10
|
+
expect(second).to eq(first)
|
11
11
|
end
|
12
12
|
|
13
13
|
it "returns false if given an address with a different id and the same customer_id" do
|
14
14
|
first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
|
15
15
|
second = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "not a1")
|
16
16
|
|
17
|
-
first.
|
18
|
-
second.
|
17
|
+
expect(first).not_to eq(second)
|
18
|
+
expect(second).not_to eq(first)
|
19
19
|
end
|
20
20
|
|
21
21
|
it "returns false if given an address with a different customer_id and the same id" do
|
22
22
|
first = Braintree::Address._new(:gateway, :customer_id => "c1", :id => "a1")
|
23
23
|
second = Braintree::Address._new(:gateway, :customer_id => "not c1", :id => "a1")
|
24
24
|
|
25
|
-
first.
|
26
|
-
second.
|
25
|
+
expect(first).not_to eq(second)
|
26
|
+
expect(second).not_to eq(first)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "returns false when not given an address" do
|
30
30
|
address = Braintree::Address._new(:gateway, :id => "a1")
|
31
|
-
address.
|
31
|
+
expect(address).not_to eq("not an address")
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -80,7 +80,7 @@ describe Braintree::Address do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "does not raise an error if address_id does not respond to strip" do
|
83
|
-
Braintree::Http.
|
83
|
+
allow(Braintree::Http).to receive(:new).and_return double.as_null_object
|
84
84
|
expect do
|
85
85
|
Braintree::Address.find("customer_id", 8675309)
|
86
86
|
end.to_not raise_error
|
@@ -8,11 +8,11 @@ describe Braintree::BaseModule do
|
|
8
8
|
klass = Class.new { include Braintree::BaseModule }
|
9
9
|
klass.return_object_or_raise(:obj) { result }
|
10
10
|
rescue Braintree::ValidationsFailed => ex
|
11
|
+
expect(ex).not_to eq(nil)
|
12
|
+
expect(ex.error_result).to eq(result)
|
13
|
+
expect(ex.inspect).to include(result.inspect)
|
14
|
+
expect(ex.to_s).to include(result.inspect)
|
11
15
|
end
|
12
|
-
ex.should_not == nil
|
13
|
-
ex.error_result.should == result
|
14
|
-
ex.inspect.should include(result.inspect)
|
15
|
-
ex.to_s.should include(result.inspect)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -7,8 +7,8 @@ module Braintree
|
|
7
7
|
it "delegates to ClientTokenGateway#generate" do
|
8
8
|
options = {:foo => :bar}
|
9
9
|
client_token_gateway = double(:client_token_gateway)
|
10
|
-
client_token_gateway.
|
11
|
-
ClientTokenGateway.
|
10
|
+
expect(client_token_gateway).to receive(:generate).with(options).once
|
11
|
+
allow(ClientTokenGateway).to receive(:new).and_return(client_token_gateway)
|
12
12
|
ClientToken.generate(options)
|
13
13
|
end
|
14
14
|
|
@@ -27,9 +27,9 @@ describe Braintree::Configuration do
|
|
27
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
|
@@ -39,9 +39,9 @@ describe Braintree::Configuration do
|
|
39
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
|
@@ -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,7 +90,7 @@ 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
|
|
@@ -102,10 +102,10 @@ describe Braintree::Configuration do
|
|
102
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
|
@@ -113,13 +113,13 @@ describe Braintree::Configuration do
|
|
113
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.exist?(ca_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.exist?(ca_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
|
|
@@ -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,12 +316,12 @@ 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
|
@@ -329,10 +329,10 @@ describe Braintree::Configuration do
|
|
329
329
|
old_gateway_port = ENV["GATEWAY_PORT"]
|
330
330
|
begin
|
331
331
|
ENV["GATEWAY_PORT"] = nil
|
332
|
-
Braintree::Configuration.instantiate.port.
|
332
|
+
expect(Braintree::Configuration.instantiate.port).to eq(3000)
|
333
333
|
|
334
334
|
ENV["GATEWAY_PORT"] = "1234"
|
335
|
-
Braintree::Configuration.instantiate.port.
|
335
|
+
expect(Braintree::Configuration.instantiate.port).to eq("1234")
|
336
336
|
ensure
|
337
337
|
ENV["GATEWAY_PORT"] = old_gateway_port
|
338
338
|
end
|
@@ -342,17 +342,17 @@ 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
|
|
@@ -362,10 +362,10 @@ describe Braintree::Configuration do
|
|
362
362
|
old_gateway_url = ENV["GRAPHQL_HOST"]
|
363
363
|
begin
|
364
364
|
ENV["GRAPHQL_HOST"] = nil
|
365
|
-
Braintree::Configuration.instantiate.graphql_server.
|
365
|
+
expect(Braintree::Configuration.instantiate.graphql_server).to eq("graphql.bt.local")
|
366
366
|
|
367
367
|
ENV["GRAPHQL_HOST"] = "gateway"
|
368
|
-
Braintree::Configuration.instantiate.graphql_server.
|
368
|
+
expect(Braintree::Configuration.instantiate.graphql_server).to eq("gateway")
|
369
369
|
ensure
|
370
370
|
ENV["GRAPHQL_HOST"] = old_gateway_url
|
371
371
|
end
|
@@ -378,10 +378,10 @@ describe Braintree::Configuration do
|
|
378
378
|
old_gateway_url = ENV["GATEWAY_HOST"]
|
379
379
|
begin
|
380
380
|
ENV["GATEWAY_HOST"] = nil
|
381
|
-
Braintree::Configuration.instantiate.server.
|
381
|
+
expect(Braintree::Configuration.instantiate.server).to eq("localhost")
|
382
382
|
|
383
383
|
ENV["GATEWAY_HOST"] = "gateway"
|
384
|
-
Braintree::Configuration.instantiate.server.
|
384
|
+
expect(Braintree::Configuration.instantiate.server).to eq("gateway")
|
385
385
|
ensure
|
386
386
|
ENV["GATEWAY_HOST"] = old_gateway_url
|
387
387
|
end
|
@@ -389,62 +389,62 @@ describe Braintree::Configuration do
|
|
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.qa.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
|