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
@@ -6,50 +6,50 @@ describe Braintree::MerchantGateway do
|
|
6
6
|
gateway = Braintree::Gateway.new(
|
7
7
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
8
8
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
9
|
-
:logger => Logger.new("/dev/null")
|
9
|
+
:logger => Logger.new("/dev/null"),
|
10
10
|
)
|
11
11
|
|
12
12
|
result = gateway.merchant.create(
|
13
13
|
:email => "name@email.com",
|
14
|
-
:country_code_alpha3 => "
|
15
|
-
:payment_methods => ["credit_card", "paypal"]
|
14
|
+
:country_code_alpha3 => "GBR",
|
15
|
+
:payment_methods => ["credit_card", "paypal"],
|
16
16
|
)
|
17
17
|
|
18
|
-
result.
|
18
|
+
expect(result).to be_success
|
19
19
|
|
20
20
|
merchant = result.merchant
|
21
|
-
merchant.id.
|
22
|
-
merchant.email.
|
23
|
-
merchant.company_name.
|
24
|
-
merchant.country_code_alpha3.
|
25
|
-
merchant.country_code_alpha2.
|
26
|
-
merchant.country_code_numeric.
|
27
|
-
merchant.country_name.
|
21
|
+
expect(merchant.id).not_to be_nil
|
22
|
+
expect(merchant.email).to eq("name@email.com")
|
23
|
+
expect(merchant.company_name).to eq("name@email.com")
|
24
|
+
expect(merchant.country_code_alpha3).to eq("GBR")
|
25
|
+
expect(merchant.country_code_alpha2).to eq("GB")
|
26
|
+
expect(merchant.country_code_numeric).to eq("826")
|
27
|
+
expect(merchant.country_name).to eq("United Kingdom")
|
28
28
|
|
29
29
|
credentials = result.credentials
|
30
|
-
credentials.access_token.
|
31
|
-
credentials.refresh_token.
|
32
|
-
credentials.expires_at.
|
33
|
-
credentials.token_type.
|
30
|
+
expect(credentials.access_token).not_to be_nil
|
31
|
+
expect(credentials.refresh_token).not_to be_nil
|
32
|
+
expect(credentials.expires_at).not_to be_nil
|
33
|
+
expect(credentials.token_type).to eq("bearer")
|
34
34
|
end
|
35
35
|
|
36
36
|
it "gives an error when using invalid payment_methods" do
|
37
37
|
gateway = Braintree::Gateway.new(
|
38
38
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
39
39
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
40
|
-
:logger => Logger.new("/dev/null")
|
40
|
+
:logger => Logger.new("/dev/null"),
|
41
41
|
)
|
42
42
|
|
43
43
|
result = gateway.merchant.create(
|
44
44
|
:email => "name@email.com",
|
45
|
-
:country_code_alpha3 => "
|
46
|
-
:payment_methods => ["fake_money"]
|
45
|
+
:country_code_alpha3 => "GBR",
|
46
|
+
:payment_methods => ["fake_money"],
|
47
47
|
)
|
48
48
|
|
49
|
-
result.
|
49
|
+
expect(result).not_to be_success
|
50
50
|
errors = result.errors.for(:merchant).on(:payment_methods)
|
51
51
|
|
52
|
-
errors[0].code.
|
52
|
+
expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::PaymentMethodsAreInvalid)
|
53
53
|
end
|
54
54
|
|
55
55
|
context "credentials" do
|
@@ -70,223 +70,116 @@ describe Braintree::MerchantGateway do
|
|
70
70
|
)
|
71
71
|
result = gateway.merchant.create(
|
72
72
|
:email => "name@email.com",
|
73
|
-
:country_code_alpha3 => "
|
74
|
-
:payment_methods => ["credit_card", "paypal"]
|
73
|
+
:country_code_alpha3 => "GBR",
|
74
|
+
:payment_methods => ["credit_card", "paypal"],
|
75
75
|
)
|
76
76
|
|
77
|
-
result.
|
77
|
+
expect(result).to be_success
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
context "multiple currencies" do
|
82
82
|
before(:each) do
|
83
83
|
@gateway = Braintree::Gateway.new(
|
84
|
-
:client_id => "client_id$
|
85
|
-
:client_secret => "client_secret$
|
86
|
-
:logger => Logger.new("/dev/null")
|
84
|
+
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
85
|
+
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
86
|
+
:logger => Logger.new("/dev/null"),
|
87
87
|
)
|
88
88
|
end
|
89
89
|
|
90
|
-
it "creates a US multi currency merchant for paypal and credit_card" do
|
91
|
-
result = @gateway.merchant.create(
|
92
|
-
:email => "name@email.com",
|
93
|
-
:country_code_alpha3 => "USA",
|
94
|
-
:payment_methods => ["credit_card", "paypal"],
|
95
|
-
:currencies => ["GBP", "USD"]
|
96
|
-
)
|
97
|
-
|
98
|
-
merchant = result.merchant
|
99
|
-
merchant.id.should_not be_nil
|
100
|
-
merchant.email.should == "name@email.com"
|
101
|
-
merchant.company_name.should == "name@email.com"
|
102
|
-
merchant.country_code_alpha3.should == "USA"
|
103
|
-
merchant.country_code_alpha2.should == "US"
|
104
|
-
merchant.country_code_numeric.should == "840"
|
105
|
-
merchant.country_name.should == "United States of America"
|
106
|
-
|
107
|
-
credentials = result.credentials
|
108
|
-
credentials.access_token.should_not be_nil
|
109
|
-
credentials.refresh_token.should_not be_nil
|
110
|
-
credentials.expires_at.should_not be_nil
|
111
|
-
credentials.token_type.should == "bearer"
|
112
|
-
|
113
|
-
merchant_accounts = merchant.merchant_accounts
|
114
|
-
merchant_accounts.count.should == 2
|
115
|
-
|
116
|
-
merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
|
117
|
-
merchant_account.default.should == true
|
118
|
-
merchant_account.currency_iso_code.should == "USD"
|
119
|
-
|
120
|
-
merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
|
121
|
-
merchant_account.default.should == false
|
122
|
-
merchant_account.currency_iso_code.should == "GBP"
|
123
|
-
end
|
124
|
-
|
125
90
|
it "creates an EU multi currency merchant for paypal and credit_card" do
|
126
91
|
result = @gateway.merchant.create(
|
127
92
|
:email => "name@email.com",
|
128
93
|
:country_code_alpha3 => "GBR",
|
129
94
|
:payment_methods => ["credit_card", "paypal"],
|
130
|
-
:currencies => ["GBP", "USD"]
|
95
|
+
:currencies => ["GBP", "USD"],
|
131
96
|
)
|
132
97
|
|
133
98
|
merchant = result.merchant
|
134
|
-
merchant.id.
|
135
|
-
merchant.email.
|
136
|
-
merchant.company_name.
|
137
|
-
merchant.country_code_alpha3.
|
138
|
-
merchant.country_code_alpha2.
|
139
|
-
merchant.country_code_numeric.
|
140
|
-
merchant.country_name.
|
99
|
+
expect(merchant.id).not_to be_nil
|
100
|
+
expect(merchant.email).to eq("name@email.com")
|
101
|
+
expect(merchant.company_name).to eq("name@email.com")
|
102
|
+
expect(merchant.country_code_alpha3).to eq("GBR")
|
103
|
+
expect(merchant.country_code_alpha2).to eq("GB")
|
104
|
+
expect(merchant.country_code_numeric).to eq("826")
|
105
|
+
expect(merchant.country_name).to eq("United Kingdom")
|
141
106
|
|
142
107
|
credentials = result.credentials
|
143
|
-
credentials.access_token.
|
144
|
-
credentials.refresh_token.
|
145
|
-
credentials.expires_at.
|
146
|
-
credentials.token_type.
|
108
|
+
expect(credentials.access_token).not_to be_nil
|
109
|
+
expect(credentials.refresh_token).not_to be_nil
|
110
|
+
expect(credentials.expires_at).not_to be_nil
|
111
|
+
expect(credentials.token_type).to eq("bearer")
|
147
112
|
|
148
113
|
merchant_accounts = merchant.merchant_accounts
|
149
|
-
merchant_accounts.count.
|
114
|
+
expect(merchant_accounts.count).to eq(2)
|
150
115
|
|
151
116
|
merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
|
152
|
-
merchant_account.default.
|
153
|
-
merchant_account.currency_iso_code.
|
117
|
+
expect(merchant_account.default).to eq(true)
|
118
|
+
expect(merchant_account.currency_iso_code).to eq("GBP")
|
154
119
|
|
155
120
|
merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
|
156
|
-
merchant_account.default.
|
157
|
-
merchant_account.currency_iso_code.
|
121
|
+
expect(merchant_account.default).to eq(false)
|
122
|
+
expect(merchant_account.currency_iso_code).to eq("USD")
|
158
123
|
end
|
159
124
|
|
160
125
|
|
161
126
|
it "creates a paypal-only merchant that accepts multiple currencies" do
|
162
127
|
result = @gateway.merchant.create(
|
163
128
|
:email => "name@email.com",
|
164
|
-
:country_code_alpha3 => "
|
129
|
+
:country_code_alpha3 => "GBR",
|
165
130
|
:payment_methods => ["paypal"],
|
166
131
|
:currencies => ["GBP", "USD"],
|
167
132
|
:paypal_account => {
|
168
133
|
:client_id => "paypal_client_id",
|
169
134
|
:client_secret => "paypal_client_secret",
|
170
|
-
}
|
135
|
+
},
|
171
136
|
)
|
172
137
|
|
173
|
-
result.
|
138
|
+
expect(result).to be_success
|
174
139
|
|
175
140
|
merchant = result.merchant
|
176
|
-
merchant.id.
|
177
|
-
merchant.email.
|
178
|
-
merchant.company_name.
|
179
|
-
merchant.country_code_alpha3.
|
180
|
-
merchant.country_code_alpha2.
|
181
|
-
merchant.country_code_numeric.
|
182
|
-
merchant.country_name.
|
141
|
+
expect(merchant.id).not_to be_nil
|
142
|
+
expect(merchant.email).to eq("name@email.com")
|
143
|
+
expect(merchant.company_name).to eq("name@email.com")
|
144
|
+
expect(merchant.country_code_alpha3).to eq("GBR")
|
145
|
+
expect(merchant.country_code_alpha2).to eq("GB")
|
146
|
+
expect(merchant.country_code_numeric).to eq("826")
|
147
|
+
expect(merchant.country_name).to eq("United Kingdom")
|
183
148
|
|
184
149
|
credentials = result.credentials
|
185
|
-
credentials.access_token.
|
186
|
-
credentials.refresh_token.
|
187
|
-
credentials.expires_at.
|
188
|
-
credentials.token_type.
|
150
|
+
expect(credentials.access_token).not_to be_nil
|
151
|
+
expect(credentials.refresh_token).not_to be_nil
|
152
|
+
expect(credentials.expires_at).not_to be_nil
|
153
|
+
expect(credentials.token_type).to eq("bearer")
|
189
154
|
|
190
155
|
merchant_accounts = merchant.merchant_accounts
|
191
|
-
merchant_accounts.count.
|
156
|
+
expect(merchant_accounts.count).to eq(2)
|
192
157
|
|
193
158
|
merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
|
194
|
-
merchant_account.default.
|
195
|
-
merchant_account.currency_iso_code.
|
159
|
+
expect(merchant_account.default).to eq(false)
|
160
|
+
expect(merchant_account.currency_iso_code).to eq("USD")
|
196
161
|
|
197
162
|
merchant_account = merchant_accounts.detect { |ma| ma.id == "GBP" }
|
198
|
-
merchant_account.default.
|
199
|
-
merchant_account.currency_iso_code.
|
200
|
-
end
|
201
|
-
|
202
|
-
it "allows creation of non-US merchant if onboarding application is internal" do
|
203
|
-
result = @gateway.merchant.create(
|
204
|
-
:email => "name@email.com",
|
205
|
-
:country_code_alpha3 => "JPN",
|
206
|
-
:payment_methods => ["paypal"],
|
207
|
-
:paypal_account => {
|
208
|
-
:client_id => "paypal_client_id",
|
209
|
-
:client_secret => "paypal_client_secret",
|
210
|
-
}
|
211
|
-
)
|
212
|
-
|
213
|
-
result.should be_success
|
214
|
-
|
215
|
-
merchant = result.merchant
|
216
|
-
merchant.id.should_not be_nil
|
217
|
-
merchant.email.should == "name@email.com"
|
218
|
-
merchant.company_name.should == "name@email.com"
|
219
|
-
merchant.country_code_alpha3.should == "JPN"
|
220
|
-
merchant.country_code_alpha2.should == "JP"
|
221
|
-
merchant.country_code_numeric.should == "392"
|
222
|
-
merchant.country_name.should == "Japan"
|
223
|
-
|
224
|
-
credentials = result.credentials
|
225
|
-
credentials.access_token.should_not be_nil
|
226
|
-
credentials.refresh_token.should_not be_nil
|
227
|
-
credentials.expires_at.should_not be_nil
|
228
|
-
credentials.token_type.should == "bearer"
|
229
|
-
|
230
|
-
merchant_accounts = merchant.merchant_accounts
|
231
|
-
merchant_accounts.count.should == 1
|
232
|
-
|
233
|
-
merchant_account = merchant_accounts.detect { |ma| ma.id == "JPY" }
|
234
|
-
merchant_account.default.should == true
|
235
|
-
merchant_account.currency_iso_code.should == "JPY"
|
236
|
-
end
|
237
|
-
|
238
|
-
it "defaults to USD for non-US merchant if onboarding application is internal and country currency not supported" do
|
239
|
-
result = @gateway.merchant.create(
|
240
|
-
:email => "name@email.com",
|
241
|
-
:country_code_alpha3 => "YEM",
|
242
|
-
:payment_methods => ["paypal"],
|
243
|
-
:paypal_account => {
|
244
|
-
:client_id => "paypal_client_id",
|
245
|
-
:client_secret => "paypal_client_secret",
|
246
|
-
}
|
247
|
-
)
|
248
|
-
|
249
|
-
result.should be_success
|
250
|
-
|
251
|
-
merchant = result.merchant
|
252
|
-
merchant.id.should_not be_nil
|
253
|
-
merchant.email.should == "name@email.com"
|
254
|
-
merchant.company_name.should == "name@email.com"
|
255
|
-
merchant.country_code_alpha3.should == "YEM"
|
256
|
-
merchant.country_code_alpha2.should == "YE"
|
257
|
-
merchant.country_code_numeric.should == "887"
|
258
|
-
merchant.country_name.should == "Yemen"
|
259
|
-
|
260
|
-
credentials = result.credentials
|
261
|
-
credentials.access_token.should_not be_nil
|
262
|
-
credentials.refresh_token.should_not be_nil
|
263
|
-
credentials.expires_at.should_not be_nil
|
264
|
-
credentials.token_type.should == "bearer"
|
265
|
-
|
266
|
-
merchant_accounts = merchant.merchant_accounts
|
267
|
-
merchant_accounts.count.should == 1
|
268
|
-
|
269
|
-
merchant_account = merchant_accounts.detect { |ma| ma.id == "USD" }
|
270
|
-
merchant_account.default.should == true
|
271
|
-
merchant_account.currency_iso_code.should == "USD"
|
163
|
+
expect(merchant_account.default).to eq(true)
|
164
|
+
expect(merchant_account.currency_iso_code).to eq("GBP")
|
272
165
|
end
|
273
166
|
|
274
167
|
it "returns error if invalid currency is passed" do
|
275
168
|
result = @gateway.merchant.create(
|
276
169
|
:email => "name@email.com",
|
277
|
-
:country_code_alpha3 => "
|
170
|
+
:country_code_alpha3 => "GBR",
|
278
171
|
:payment_methods => ["paypal"],
|
279
172
|
:currencies => ["FAKE", "GBP"],
|
280
173
|
:paypal_account => {
|
281
174
|
:client_id => "paypal_client_id",
|
282
175
|
:client_secret => "paypal_client_secret",
|
283
|
-
}
|
176
|
+
},
|
284
177
|
)
|
285
178
|
|
286
|
-
result.
|
179
|
+
expect(result).not_to be_success
|
287
180
|
errors = result.errors.for(:merchant).on(:currencies)
|
288
181
|
|
289
|
-
errors[0].code.
|
182
|
+
expect(errors[0].code).to eq(Braintree::ErrorCodes::Merchant::CurrenciesAreInvalid)
|
290
183
|
end
|
291
184
|
end
|
292
185
|
end
|
@@ -304,30 +197,16 @@ describe Braintree::MerchantGateway do
|
|
304
197
|
|
305
198
|
it "succeeds" do
|
306
199
|
result = Braintree::Merchant.provision_raw_apple_pay
|
307
|
-
result.
|
308
|
-
result.supported_networks.
|
200
|
+
expect(result).to be_success
|
201
|
+
expect(result.supported_networks).to eq(["visa", "mastercard", "amex", "discover", "maestro", "elo"])
|
309
202
|
end
|
310
203
|
|
311
204
|
it "is repeatable" do
|
312
205
|
result = Braintree::Merchant.provision_raw_apple_pay
|
313
|
-
result.
|
314
|
-
result = Braintree::Merchant.provision_raw_apple_pay
|
315
|
-
result.should be_success
|
316
|
-
result.supported_networks.should == ["visa", "mastercard", "amex", "discover"]
|
317
|
-
end
|
318
|
-
end
|
319
|
-
|
320
|
-
context "merchant has no processor connection supporting apple pay" do
|
321
|
-
before do
|
322
|
-
Braintree::Configuration.merchant_id = "forward_payment_method_merchant_id"
|
323
|
-
Braintree::Configuration.public_key = "forward_payment_method_public_key"
|
324
|
-
Braintree::Configuration.private_key = "forward_payment_method_private_key"
|
325
|
-
end
|
326
|
-
|
327
|
-
it "returns a validation error" do
|
206
|
+
expect(result).to be_success
|
328
207
|
result = Braintree::Merchant.provision_raw_apple_pay
|
329
|
-
result.
|
330
|
-
result.
|
208
|
+
expect(result).to be_success
|
209
|
+
expect(result.supported_networks).to eq(["visa", "mastercard", "amex", "discover", "maestro", "elo"])
|
331
210
|
end
|
332
211
|
end
|
333
212
|
|
@@ -5,7 +5,7 @@ describe "OAuth" do
|
|
5
5
|
@gateway = Braintree::Gateway.new(
|
6
6
|
:client_id => "client_id$#{Braintree::Configuration.environment}$integration_client_id",
|
7
7
|
:client_secret => "client_secret$#{Braintree::Configuration.environment}$integration_client_secret",
|
8
|
-
:logger => Logger.new("/dev/null")
|
8
|
+
:logger => Logger.new("/dev/null"),
|
9
9
|
)
|
10
10
|
end
|
11
11
|
|
@@ -18,38 +18,38 @@ describe "OAuth" do
|
|
18
18
|
|
19
19
|
result = @gateway.oauth.create_token_from_code(
|
20
20
|
:code => code,
|
21
|
-
:scope => "read_write"
|
21
|
+
:scope => "read_write",
|
22
22
|
)
|
23
23
|
|
24
|
-
result.
|
24
|
+
expect(result).to be_success
|
25
25
|
credentials = result.credentials
|
26
|
-
credentials.access_token.
|
27
|
-
credentials.refresh_token.
|
28
|
-
credentials.expires_at.
|
29
|
-
credentials.token_type.
|
26
|
+
expect(credentials.access_token).not_to be_nil
|
27
|
+
expect(credentials.refresh_token).not_to be_nil
|
28
|
+
expect(credentials.expires_at).not_to be_nil
|
29
|
+
expect(credentials.token_type).to eq("bearer")
|
30
30
|
end
|
31
31
|
|
32
32
|
it "returns validation errors for bad params" do
|
33
33
|
result = @gateway.oauth.create_token_from_code(
|
34
34
|
:code => "bad_code",
|
35
|
-
:scope => "read_write"
|
35
|
+
:scope => "read_write",
|
36
36
|
)
|
37
37
|
|
38
|
-
result.
|
39
|
-
|
40
|
-
result.message.
|
38
|
+
expect(result).not_to be_success
|
39
|
+
expect(result.errors.for(:credentials).on(:code)[0].code).to eq(Braintree::ErrorCodes::OAuth::InvalidGrant)
|
40
|
+
expect(result.message).to match(/Invalid grant: code not found/)
|
41
41
|
end
|
42
42
|
|
43
43
|
it "raises with a helpful error if client_id and client_secret are not set" do
|
44
44
|
gateway = Braintree::Gateway.new(
|
45
45
|
:access_token => "access_token$development$integration_merchant_id$fb27c79dd",
|
46
|
-
:logger => Logger.new("/dev/null")
|
46
|
+
:logger => Logger.new("/dev/null"),
|
47
47
|
)
|
48
48
|
|
49
49
|
expect do
|
50
50
|
gateway.oauth.create_token_from_code(
|
51
51
|
:code => "some code",
|
52
|
-
:scope => "read_write"
|
52
|
+
:scope => "read_write",
|
53
53
|
)
|
54
54
|
end.to raise_error(Braintree::ConfigurationError, /client_id and client_secret are required/);
|
55
55
|
end
|
@@ -63,20 +63,20 @@ describe "OAuth" do
|
|
63
63
|
})
|
64
64
|
refresh_token = @gateway.oauth.create_token_from_code(
|
65
65
|
:code => code,
|
66
|
-
:scope => "read_write"
|
66
|
+
:scope => "read_write",
|
67
67
|
).credentials.refresh_token
|
68
68
|
|
69
69
|
result = @gateway.oauth.create_token_from_refresh_token(
|
70
70
|
:refresh_token => refresh_token,
|
71
|
-
:scope => "read_write"
|
71
|
+
:scope => "read_write",
|
72
72
|
)
|
73
73
|
|
74
|
-
result.
|
74
|
+
expect(result).to be_success
|
75
75
|
credentials = result.credentials
|
76
|
-
credentials.access_token.
|
77
|
-
credentials.refresh_token.
|
78
|
-
credentials.expires_at.
|
79
|
-
credentials.token_type.
|
76
|
+
expect(credentials.access_token).not_to be_nil
|
77
|
+
expect(credentials.refresh_token).not_to be_nil
|
78
|
+
expect(credentials.expires_at).not_to be_nil
|
79
|
+
expect(credentials.token_type).to eq("bearer")
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
@@ -88,15 +88,15 @@ describe "OAuth" do
|
|
88
88
|
})
|
89
89
|
access_token = @gateway.oauth.create_token_from_code(
|
90
90
|
:code => code,
|
91
|
-
:scope => "read_write"
|
91
|
+
:scope => "read_write",
|
92
92
|
).credentials.access_token
|
93
93
|
|
94
94
|
result = @gateway.oauth.revoke_access_token(access_token)
|
95
|
-
result.
|
95
|
+
expect(result).to be_success
|
96
96
|
|
97
97
|
gateway = Braintree::Gateway.new(
|
98
98
|
:access_token => access_token,
|
99
|
-
:logger => Logger.new("/dev/null")
|
99
|
+
:logger => Logger.new("/dev/null"),
|
100
100
|
)
|
101
101
|
|
102
102
|
expect do
|
@@ -146,53 +146,53 @@ describe "OAuth" do
|
|
146
146
|
:currency => "USD",
|
147
147
|
:website => "http://example.com"
|
148
148
|
},
|
149
|
-
:payment_methods => ["credit_card", "paypal"]
|
149
|
+
:payment_methods => ["credit_card", "paypal"],
|
150
150
|
)
|
151
151
|
|
152
152
|
uri = URI.parse(url)
|
153
|
-
uri.host.
|
154
|
-
uri.path.
|
153
|
+
expect(uri.host).to eq(Braintree::Configuration.instantiate.server)
|
154
|
+
expect(uri.path).to eq("/oauth/connect")
|
155
155
|
|
156
156
|
query = CGI.parse(uri.query)
|
157
|
-
query["merchant_id"].
|
158
|
-
query["client_id"].
|
159
|
-
query["redirect_uri"].
|
160
|
-
query["scope"].
|
161
|
-
query["state"].
|
162
|
-
query["landing_page"].
|
163
|
-
query["login_only"].
|
164
|
-
|
165
|
-
query["user[country]"].
|
166
|
-
query["business[name]"].
|
167
|
-
|
168
|
-
query["user[email]"].
|
169
|
-
query["user[first_name]"].
|
170
|
-
query["user[last_name]"].
|
171
|
-
query["user[phone]"].
|
172
|
-
query["user[dob_year]"].
|
173
|
-
query["user[dob_month]"].
|
174
|
-
query["user[dob_day]"].
|
175
|
-
query["user[street_address]"].
|
176
|
-
query["user[locality]"].
|
177
|
-
query["user[region]"].
|
178
|
-
query["user[postal_code]"].
|
179
|
-
|
180
|
-
query["business[name]"].
|
181
|
-
query["business[registered_as]"].
|
182
|
-
query["business[industry]"].
|
183
|
-
query["business[description]"].
|
184
|
-
query["business[street_address]"].
|
185
|
-
query["business[locality]"].
|
186
|
-
query["business[region]"].
|
187
|
-
query["business[postal_code]"].
|
188
|
-
query["business[country]"].
|
189
|
-
query["business[annual_volume_amount]"].
|
190
|
-
query["business[average_transaction_amount]"].
|
191
|
-
query["business[maximum_transaction_amount]"].
|
192
|
-
query["business[ship_physical_goods]"].
|
193
|
-
query["business[fulfillment_completed_in]"].
|
194
|
-
query["business[currency]"].
|
195
|
-
query["business[website]"].
|
157
|
+
expect(query["merchant_id"]).to eq(["integration_merchant_id"])
|
158
|
+
expect(query["client_id"]).to eq(["client_id$#{Braintree::Configuration.environment}$integration_client_id"])
|
159
|
+
expect(query["redirect_uri"]).to eq(["http://bar.example.com"])
|
160
|
+
expect(query["scope"]).to eq(["read_write"])
|
161
|
+
expect(query["state"]).to eq(["baz_state"])
|
162
|
+
expect(query["landing_page"]).to eq(["signup"])
|
163
|
+
expect(query["login_only"]).to eq(["false"])
|
164
|
+
|
165
|
+
expect(query["user[country]"]).to eq(["USA"])
|
166
|
+
expect(query["business[name]"]).to eq(["14 Ladders"])
|
167
|
+
|
168
|
+
expect(query["user[email]"]).to eq(["foo@example.com"])
|
169
|
+
expect(query["user[first_name]"]).to eq(["Bob"])
|
170
|
+
expect(query["user[last_name]"]).to eq(["Jones"])
|
171
|
+
expect(query["user[phone]"]).to eq(["555-555-5555"])
|
172
|
+
expect(query["user[dob_year]"]).to eq(["1970"])
|
173
|
+
expect(query["user[dob_month]"]).to eq(["01"])
|
174
|
+
expect(query["user[dob_day]"]).to eq(["01"])
|
175
|
+
expect(query["user[street_address]"]).to eq(["222 W Merchandise Mart"])
|
176
|
+
expect(query["user[locality]"]).to eq(["Chicago"])
|
177
|
+
expect(query["user[region]"]).to eq(["IL"])
|
178
|
+
expect(query["user[postal_code]"]).to eq(["60606"])
|
179
|
+
|
180
|
+
expect(query["business[name]"]).to eq(["14 Ladders"])
|
181
|
+
expect(query["business[registered_as]"]).to eq(["14.0 Ladders"])
|
182
|
+
expect(query["business[industry]"]).to eq(["Ladders"])
|
183
|
+
expect(query["business[description]"]).to eq(["We sell the best ladders"])
|
184
|
+
expect(query["business[street_address]"]).to eq(["111 N Canal"])
|
185
|
+
expect(query["business[locality]"]).to eq(["Chicago"])
|
186
|
+
expect(query["business[region]"]).to eq(["IL"])
|
187
|
+
expect(query["business[postal_code]"]).to eq(["60606"])
|
188
|
+
expect(query["business[country]"]).to eq(["USA"])
|
189
|
+
expect(query["business[annual_volume_amount]"]).to eq(["1000000"])
|
190
|
+
expect(query["business[average_transaction_amount]"]).to eq(["100"])
|
191
|
+
expect(query["business[maximum_transaction_amount]"]).to eq(["10000"])
|
192
|
+
expect(query["business[ship_physical_goods]"]).to eq(["true"])
|
193
|
+
expect(query["business[fulfillment_completed_in]"]).to eq(["7"])
|
194
|
+
expect(query["business[currency]"]).to eq(["USD"])
|
195
|
+
expect(query["business[website]"]).to eq(["http://example.com"])
|
196
196
|
end
|
197
197
|
|
198
198
|
it "builds the query string with multiple payment_methods" do
|
@@ -201,17 +201,17 @@ describe "OAuth" do
|
|
201
201
|
:redirect_uri => "http://bar.example.com",
|
202
202
|
:scope => "read_write",
|
203
203
|
:state => "baz_state",
|
204
|
-
:payment_methods => ["credit_card", "paypal"]
|
204
|
+
:payment_methods => ["credit_card", "paypal"],
|
205
205
|
)
|
206
206
|
|
207
207
|
uri = URI.parse(url)
|
208
|
-
uri.host.
|
209
|
-
uri.path.
|
208
|
+
expect(uri.host).to eq(Braintree::Configuration.instantiate.server)
|
209
|
+
expect(uri.path).to eq("/oauth/connect")
|
210
210
|
|
211
211
|
query = CGI.parse(CGI.unescape(uri.query))
|
212
|
-
query["payment_methods[]"].length.
|
213
|
-
query["payment_methods[]"].
|
214
|
-
query["payment_methods[]"].
|
212
|
+
expect(query["payment_methods[]"].length).to eq(2)
|
213
|
+
expect(query["payment_methods[]"]).to include("paypal")
|
214
|
+
expect(query["payment_methods[]"]).to include("credit_card")
|
215
215
|
end
|
216
216
|
|
217
217
|
it "doesn't mutate the options" do
|
@@ -219,7 +219,7 @@ describe "OAuth" do
|
|
219
219
|
|
220
220
|
@gateway.oauth.connect_url(params)
|
221
221
|
|
222
|
-
params.
|
222
|
+
expect(params).to eq({:payment_methods => ["credit_card"]})
|
223
223
|
end
|
224
224
|
end
|
225
225
|
end
|