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
@@ -4,28 +4,28 @@ describe Braintree::CreditCard do
|
|
4
4
|
describe "self.create" do
|
5
5
|
it "raises an exception if attributes contain an invalid key" do
|
6
6
|
expect do
|
7
|
-
Braintree::CreditCard.create(:invalid_key =>
|
7
|
+
Braintree::CreditCard.create(:invalid_key => "val")
|
8
8
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
12
|
describe "self.create_signature" do
|
13
13
|
it "should be what we expect" do
|
14
|
-
Braintree::CreditCardGateway._create_signature.
|
14
|
+
expect(Braintree::CreditCardGateway._create_signature).to match([
|
15
15
|
:billing_address_id,
|
16
16
|
:cardholder_name,
|
17
17
|
:cvv,
|
18
|
-
:device_session_id,
|
19
18
|
:expiration_date,
|
20
19
|
:expiration_month,
|
21
20
|
:expiration_year,
|
22
21
|
:number,
|
23
22
|
:token,
|
24
|
-
:venmo_sdk_payment_method_code,
|
23
|
+
:venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
|
25
24
|
:device_data,
|
26
|
-
:fraud_merchant_id,
|
27
25
|
:payment_method_nonce,
|
28
|
-
{:
|
26
|
+
{:external_vault=>[:network_transaction_id]},
|
27
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
|
28
|
+
:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
|
29
29
|
{:billing_address => [
|
30
30
|
:company,
|
31
31
|
:country_code_alpha2,
|
@@ -34,34 +34,46 @@ describe Braintree::CreditCard do
|
|
34
34
|
:country_name,
|
35
35
|
:extended_address,
|
36
36
|
:first_name,
|
37
|
+
{:international_phone=>[:country_code, :national_number]},
|
37
38
|
:last_name,
|
38
39
|
:locality,
|
40
|
+
:phone_number,
|
39
41
|
:postal_code,
|
40
42
|
:region,
|
41
43
|
:street_address
|
42
44
|
]},
|
43
|
-
:
|
44
|
-
|
45
|
+
{:three_d_secure_pass_thru => [
|
46
|
+
:eci_flag,
|
47
|
+
:cavv,
|
48
|
+
:xid,
|
49
|
+
:three_d_secure_version,
|
50
|
+
:authentication_response,
|
51
|
+
:directory_response,
|
52
|
+
:cavv_algorithm,
|
53
|
+
:ds_transaction_id,
|
54
|
+
]},
|
55
|
+
:customer_id,
|
56
|
+
])
|
45
57
|
end
|
46
58
|
end
|
47
59
|
|
48
60
|
describe "self.update_signature" do
|
49
61
|
it "should be what we expect" do
|
50
|
-
Braintree::CreditCardGateway._update_signature.
|
62
|
+
expect(Braintree::CreditCardGateway._update_signature).to match([
|
51
63
|
:billing_address_id,
|
52
64
|
:cardholder_name,
|
53
65
|
:cvv,
|
54
|
-
:device_session_id,
|
55
66
|
:expiration_date,
|
56
67
|
:expiration_month,
|
57
68
|
:expiration_year,
|
58
69
|
:number,
|
59
70
|
:token,
|
60
|
-
:venmo_sdk_payment_method_code,
|
71
|
+
:venmo_sdk_payment_method_code, # NEXT_MAJOR_VERSION Remove this attribute
|
61
72
|
:device_data,
|
62
|
-
:fraud_merchant_id,
|
63
73
|
:payment_method_nonce,
|
64
|
-
{:
|
74
|
+
{:external_vault=>[:network_transaction_id]},
|
75
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, # NEXT_MAJOR_VERSION Remove this attribute
|
76
|
+
:fail_on_duplicate_payment_method, :fail_on_duplicate_payment_method_for_customer, :verification_account_type, :verification_currency_iso_code])},
|
65
77
|
{:billing_address => [
|
66
78
|
:company,
|
67
79
|
:country_code_alpha2,
|
@@ -70,29 +82,26 @@ describe Braintree::CreditCard do
|
|
70
82
|
:country_name,
|
71
83
|
:extended_address,
|
72
84
|
:first_name,
|
85
|
+
{:international_phone=>[:country_code, :national_number]},
|
73
86
|
:last_name,
|
74
87
|
:locality,
|
88
|
+
:phone_number,
|
75
89
|
:postal_code,
|
76
90
|
:region,
|
77
91
|
:street_address,
|
78
92
|
{:options => [:update_existing]}
|
79
|
-
]}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
describe "self.create_credit_card_url" do
|
93
|
-
it "returns the url" do
|
94
|
-
config = Braintree::Configuration.instantiate
|
95
|
-
Braintree::CreditCard.create_credit_card_url.should == "http#{config.ssl? ? 's' : ''}://#{config.server}:#{config.port}/merchants/integration_merchant_id/payment_methods/all/create_via_transparent_redirect_request"
|
93
|
+
]},
|
94
|
+
{:three_d_secure_pass_thru => [
|
95
|
+
:eci_flag,
|
96
|
+
:cavv,
|
97
|
+
:xid,
|
98
|
+
:three_d_secure_version,
|
99
|
+
:authentication_response,
|
100
|
+
:directory_response,
|
101
|
+
:cavv_algorithm,
|
102
|
+
:ds_transaction_id,
|
103
|
+
]},
|
104
|
+
])
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
@@ -101,31 +110,31 @@ describe Braintree::CreditCard do
|
|
101
110
|
first = Braintree::CreditCard._new(:gateway, :token => 123)
|
102
111
|
second = Braintree::CreditCard._new(:gateway, :token => 123)
|
103
112
|
|
104
|
-
first.
|
105
|
-
second.
|
113
|
+
expect(first).to eq(second)
|
114
|
+
expect(second).to eq(first)
|
106
115
|
end
|
107
116
|
|
108
117
|
it "returns false if given a credit card with a different token" do
|
109
118
|
first = Braintree::CreditCard._new(:gateway, :token => 123)
|
110
119
|
second = Braintree::CreditCard._new(:gateway, :token => 124)
|
111
120
|
|
112
|
-
first.
|
113
|
-
second.
|
121
|
+
expect(first).not_to eq(second)
|
122
|
+
expect(second).not_to eq(first)
|
114
123
|
end
|
115
124
|
|
116
125
|
it "returns false if not given a credit card" do
|
117
126
|
credit_card = Braintree::CreditCard._new(:gateway, :token => 123)
|
118
|
-
credit_card.
|
127
|
+
expect(credit_card).not_to eq("not a credit card")
|
119
128
|
end
|
120
129
|
end
|
121
130
|
|
122
131
|
describe "default?" do
|
123
132
|
it "is true if the credit card is the default credit card for the customer" do
|
124
|
-
Braintree::CreditCard._new(:gateway, :default => true).default
|
133
|
+
expect(Braintree::CreditCard._new(:gateway, :default => true).default?).to eq(true)
|
125
134
|
end
|
126
135
|
|
127
136
|
it "is false if the credit card is not the default credit card for the customer" do
|
128
|
-
Braintree::CreditCard._new(:gateway, :default => false).default
|
137
|
+
expect(Braintree::CreditCard._new(:gateway, :default => false).default?).to eq(false)
|
129
138
|
end
|
130
139
|
end
|
131
140
|
|
@@ -149,7 +158,7 @@ describe Braintree::CreditCard do
|
|
149
158
|
end
|
150
159
|
|
151
160
|
it "does not raise an error if address_id does not respond to strip" do
|
152
|
-
Braintree::Http.
|
161
|
+
allow(Braintree::Http).to receive(:new).and_return double.as_null_object
|
153
162
|
expect do
|
154
163
|
Braintree::CreditCard.find(8675309)
|
155
164
|
end.to_not raise_error
|
@@ -159,7 +168,7 @@ describe Braintree::CreditCard do
|
|
159
168
|
describe "inspect" do
|
160
169
|
it "includes the token first" do
|
161
170
|
output = Braintree::CreditCard._new(:gateway, :token => "cc123").inspect
|
162
|
-
output.
|
171
|
+
expect(output).to include("#<Braintree::CreditCard token: \"cc123\",")
|
163
172
|
end
|
164
173
|
|
165
174
|
it "includes all customer attributes" do
|
@@ -174,20 +183,22 @@ describe Braintree::CreditCard do
|
|
174
183
|
:expiration_year => "2020",
|
175
184
|
:last_4 => "1111",
|
176
185
|
:token => "tok1",
|
177
|
-
:updated_at => Time.now
|
186
|
+
:updated_at => Time.now,
|
187
|
+
:is_network_tokenized => false,
|
178
188
|
)
|
179
189
|
output = credit_card.inspect
|
180
|
-
output.
|
181
|
-
output.
|
182
|
-
output.
|
183
|
-
|
184
|
-
output.
|
185
|
-
output.
|
186
|
-
output.
|
187
|
-
output.
|
188
|
-
output.
|
189
|
-
output.
|
190
|
-
output.
|
190
|
+
expect(output).to include(%q(bin: "411111"))
|
191
|
+
expect(output).to include(%q(card_type: "Visa"))
|
192
|
+
expect(output).to include(%q(cardholder_name: "John Miller"))
|
193
|
+
|
194
|
+
expect(output).to include(%q(customer_id: "cid1"))
|
195
|
+
expect(output).to include(%q(expiration_month: "01"))
|
196
|
+
expect(output).to include(%q(expiration_year: "2020"))
|
197
|
+
expect(output).to include(%q(last_4: "1111"))
|
198
|
+
expect(output).to include(%q(token: "tok1"))
|
199
|
+
expect(output).to include(%Q(updated_at: #{credit_card.updated_at.inspect}))
|
200
|
+
expect(output).to include(%Q(created_at: #{credit_card.created_at.inspect}))
|
201
|
+
expect(output).to include(%q(is_network_tokenized?: false))
|
191
202
|
end
|
192
203
|
end
|
193
204
|
|
@@ -196,16 +207,38 @@ describe Braintree::CreditCard do
|
|
196
207
|
credit_card = Braintree::CreditCard._new(
|
197
208
|
:gateway,
|
198
209
|
:bin => "510510",
|
199
|
-
:last_4 => "5100"
|
210
|
+
:last_4 => "5100",
|
211
|
+
)
|
212
|
+
expect(credit_card.masked_number).to eq("510510******5100")
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
describe "is_network_tokenized?" do
|
217
|
+
it "returns true" do
|
218
|
+
credit_card = Braintree::CreditCard._new(
|
219
|
+
:gateway,
|
220
|
+
:bin => "510510",
|
221
|
+
:last_4 => "5100",
|
222
|
+
:is_network_tokenized => true,
|
223
|
+
)
|
224
|
+
expect(credit_card.is_network_tokenized?).to eq(true)
|
225
|
+
end
|
226
|
+
|
227
|
+
it "returns false" do
|
228
|
+
credit_card = Braintree::CreditCard._new(
|
229
|
+
:gateway,
|
230
|
+
:bin => "510510",
|
231
|
+
:last_4 => "5100",
|
232
|
+
:is_network_tokenized => false,
|
200
233
|
)
|
201
|
-
credit_card.
|
234
|
+
expect(credit_card.is_network_tokenized?).to eq(false)
|
202
235
|
end
|
203
236
|
end
|
204
237
|
|
205
238
|
describe "self.update" do
|
206
239
|
it "raises an exception if attributes contain an invalid key" do
|
207
240
|
expect do
|
208
|
-
Braintree::CreditCard.
|
241
|
+
Braintree::CreditCard.update(:gateway, :invalid_key => "val")
|
209
242
|
end.to raise_error(ArgumentError, "invalid keys: invalid_key")
|
210
243
|
end
|
211
244
|
end
|
@@ -221,15 +254,15 @@ describe Braintree::CreditCard do
|
|
221
254
|
describe "self._new" do
|
222
255
|
describe "initializing verification" do
|
223
256
|
it "picks the youngest verification" do
|
224
|
-
verification1 = {
|
225
|
-
verification2 = {
|
257
|
+
verification1 = {:created_at => Time.now, :id => 123}
|
258
|
+
verification2 = {:created_at => Time.now - 3600, :id => 456}
|
226
259
|
credit_card = Braintree::CreditCard._new(Braintree::Configuration.gateway, {:verifications => [verification1, verification2]})
|
227
|
-
credit_card.verification.id.
|
260
|
+
expect(credit_card.verification.id).to eq(123)
|
228
261
|
end
|
229
262
|
|
230
263
|
it "picks nil if verifications are empty" do
|
231
264
|
credit_card = Braintree::CreditCard._new(Braintree::Configuration.gateway, {})
|
232
|
-
credit_card.verification.
|
265
|
+
expect(credit_card.verification).to be_nil
|
233
266
|
end
|
234
267
|
end
|
235
268
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::CreditCardVerificationGateway do
|
4
|
+
describe "Credit Card Verification Gateway" do
|
5
|
+
let(:gateway) do
|
6
|
+
config = Braintree::Configuration.new(
|
7
|
+
:merchant_id => "merchant_id",
|
8
|
+
:public_key => "public_key",
|
9
|
+
:private_key => "private_key",
|
10
|
+
)
|
11
|
+
Braintree::Gateway.new(config)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "creates a credit card verification gateway" do
|
15
|
+
result = Braintree::CreditCardVerificationGateway.new(gateway)
|
16
|
+
|
17
|
+
expect(result.inspect).to include("merchant_id")
|
18
|
+
expect(result.inspect).to include("public_key")
|
19
|
+
expect(result.inspect).to include("private_key")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "creates a credit card verification gateway signature" do
|
23
|
+
result = Braintree::CreditCardVerificationGateway._create_signature
|
24
|
+
expect(result.inspect).to include("credit_card")
|
25
|
+
expect(result.inspect).to include("billing_address")
|
26
|
+
expect(result.inspect).to include("cardholder_name")
|
27
|
+
expect(result.inspect).to include("cvv")
|
28
|
+
expect(result.inspect).to include("expiration_date")
|
29
|
+
expect(result.inspect).to include("expiration_month")
|
30
|
+
expect(result.inspect).to include("expiration_year")
|
31
|
+
expect(result.inspect).to include("number")
|
32
|
+
expect(result.inspect).to include("external_vault")
|
33
|
+
expect(result.inspect).to include("previous_network_transaction_id")
|
34
|
+
expect(result.inspect).to include("status")
|
35
|
+
expect(result.inspect).to include("intended_transaction_source")
|
36
|
+
expect(result.inspect).to include("options")
|
37
|
+
expect(result.inspect).to include("account_type")
|
38
|
+
expect(result.inspect).to include("amount")
|
39
|
+
expect(result.inspect).to include("merchant_account_id")
|
40
|
+
expect(result.inspect).to include("payment_method_nonce")
|
41
|
+
expect(result.inspect).to include("risk_data")
|
42
|
+
expect(result.inspect).to include("customer_browser")
|
43
|
+
expect(result.inspect).to include("customer_ip")
|
44
|
+
expect(result.inspect).to include("three_d_secure_authentication_id")
|
45
|
+
expect(result.inspect).to include("three_d_secure_pass_thru")
|
46
|
+
expect(result.inspect).to include("authentication_response")
|
47
|
+
expect(result.inspect).to include("cavv")
|
48
|
+
expect(result.inspect).to include("cavv_algorithm")
|
49
|
+
expect(result.inspect).to include("directory_response")
|
50
|
+
expect(result.inspect).to include("ds_transaction_id")
|
51
|
+
expect(result.inspect).to include("eci_flag")
|
52
|
+
expect(result.inspect).to include("three_d_secure_version")
|
53
|
+
expect(result.inspect).to include("xid")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -7,11 +7,11 @@ module Braintree
|
|
7
7
|
it "allows All card types" do
|
8
8
|
search = CreditCardVerificationSearch.new
|
9
9
|
|
10
|
-
|
10
|
+
expect do
|
11
11
|
search.credit_card_card_type.in(
|
12
|
-
*Braintree::CreditCard::CardType::All
|
12
|
+
*Braintree::CreditCard::CardType::All,
|
13
13
|
)
|
14
|
-
end.
|
14
|
+
end.not_to raise_error
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -20,7 +20,7 @@ module Braintree
|
|
20
20
|
search = CreditCardVerificationSearch.new
|
21
21
|
search.id.is "v_id"
|
22
22
|
|
23
|
-
search.to_hash.
|
23
|
+
expect(search.to_hash).to eq({:id => {:is => "v_id"}})
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -29,7 +29,7 @@ module Braintree
|
|
29
29
|
search = CreditCardVerificationSearch.new
|
30
30
|
search.ids.in("id1","id2")
|
31
31
|
|
32
|
-
search.to_hash.
|
32
|
+
expect(search.to_hash).to eq({:ids => ["id1", "id2"]})
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -38,7 +38,7 @@ module Braintree
|
|
38
38
|
search = CreditCardVerificationSearch.new
|
39
39
|
search.credit_card_cardholder_name.is "v_cardholder_name"
|
40
40
|
|
41
|
-
search.to_hash.
|
41
|
+
expect(search.to_hash).to eq({:credit_card_cardholder_name => {:is => "v_cardholder_name"}})
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -47,7 +47,7 @@ module Braintree
|
|
47
47
|
search = CreditCardVerificationSearch.new
|
48
48
|
search.credit_card_expiration_date.is_not "v_credit_card_expiration_date"
|
49
49
|
|
50
|
-
search.to_hash.
|
50
|
+
expect(search.to_hash).to eq({:credit_card_expiration_date => {:is_not => "v_credit_card_expiration_date"}})
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
@@ -57,7 +57,7 @@ module Braintree
|
|
57
57
|
|
58
58
|
search.credit_card_number.starts_with "v_credit_card_bin"
|
59
59
|
|
60
|
-
search.to_hash.
|
60
|
+
expect(search.to_hash).to eq({:credit_card_number => {:starts_with => "v_credit_card_bin"}})
|
61
61
|
end
|
62
62
|
|
63
63
|
it "ends with" do
|
@@ -65,14 +65,14 @@ module Braintree
|
|
65
65
|
|
66
66
|
search.credit_card_number.ends_with "v_credit_card_last_4"
|
67
67
|
|
68
|
-
search.to_hash.
|
68
|
+
expect(search.to_hash).to eq({:credit_card_number => {:ends_with => "v_credit_card_last_4"}})
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
context "created_at" do
|
73
73
|
it "is a range node" do
|
74
74
|
search = CreditCardVerificationSearch.new
|
75
|
-
search.created_at.
|
75
|
+
expect(search.created_at).to be_kind_of(Braintree::AdvancedSearch::RangeNode)
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -6,6 +6,8 @@ describe Braintree::CreditCardVerification do
|
|
6
6
|
verification = Braintree::CreditCardVerification._new(
|
7
7
|
:status => "verified",
|
8
8
|
:amount => "12.45",
|
9
|
+
:ani_first_name_response_code => "I",
|
10
|
+
:ani_last_name_response_code => "I",
|
9
11
|
:currency_iso_code => "USD",
|
10
12
|
:avs_error_response_code => "I",
|
11
13
|
:avs_postal_code_response_code => "I",
|
@@ -17,8 +19,7 @@ describe Braintree::CreditCardVerification do
|
|
17
19
|
:network_response_code => "05",
|
18
20
|
:network_response_text => "Do not Honor",
|
19
21
|
)
|
20
|
-
|
21
|
-
verification.inspect.should == %(#<Braintree::CreditCardVerification status: "verified", processor_response_code: "2000", processor_response_text: "Do Not Honor", amount: "12.45", currency_iso_code: "USD", cvv_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", network_response_code: "05", network_response_text: "Do not Honor", merchant_account_id: "some_id", gateway_rejection_reason: nil, id: nil, credit_card: nil, billing: nil, created_at: nil>)
|
22
|
+
expect(verification.inspect).to eq(%(#<Braintree::CreditCardVerification amount: "12.45", ani_first_name_response_code: "I", ani_last_name_response_code: "I", avs_error_response_code: "I", avs_postal_code_response_code: "I", avs_street_address_response_code: "I", billing: nil, created_at: nil, credit_card: nil, currency_iso_code: "USD", cvv_response_code: "I", gateway_rejection_reason: nil, id: nil, merchant_account_id: "some_id", network_response_code: "05", network_response_text: "Do not Honor", processor_response_code: "2000", processor_response_text: "Do Not Honor", status: "verified">))
|
22
23
|
end
|
23
24
|
|
24
25
|
it "has a status" do
|
@@ -30,16 +31,33 @@ describe Braintree::CreditCardVerification do
|
|
30
31
|
:cvv_response_code => "I",
|
31
32
|
:processor_response_code => "2000",
|
32
33
|
:processor_response_text => "Do Not Honor",
|
33
|
-
:merchant_account_id => "some_id"
|
34
|
+
:merchant_account_id => "some_id",
|
34
35
|
)
|
35
36
|
|
36
|
-
verification.status.
|
37
|
+
expect(verification.status).to eq(Braintree::CreditCardVerification::Status::Verified)
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
41
|
+
it "accepts ani name reponse codes" do
|
42
|
+
verification = Braintree::CreditCardVerification._new(
|
43
|
+
:ani_first_name_response_code => "M",
|
44
|
+
:ani_last_name_response_code => "M",
|
45
|
+
)
|
46
|
+
|
47
|
+
expect(verification.ani_first_name_response_code).to eq("M")
|
48
|
+
expect(verification.ani_last_name_response_code).to eq("M")
|
49
|
+
end
|
50
|
+
|
40
51
|
it "accepts amount as either a String or BigDecimal" do
|
41
|
-
Braintree::CreditCardVerification._new(:amount => "12.34").amount.
|
42
|
-
Braintree::CreditCardVerification._new(:amount => BigDecimal("12.34")).amount.
|
52
|
+
expect(Braintree::CreditCardVerification._new(:amount => "12.34").amount).to eq(BigDecimal("12.34"))
|
53
|
+
expect(Braintree::CreditCardVerification._new(:amount => BigDecimal("12.34")).amount).to eq(BigDecimal("12.34"))
|
54
|
+
end
|
55
|
+
|
56
|
+
it "accepts network_transaction_id" do
|
57
|
+
verification = Braintree::CreditCardVerification._new(
|
58
|
+
:network_transaction_id => "123456789012345",
|
59
|
+
)
|
60
|
+
expect(verification.network_transaction_id).to eq "123456789012345"
|
43
61
|
end
|
44
62
|
|
45
63
|
describe "self.create" do
|
@@ -81,27 +99,27 @@ describe Braintree::CreditCardVerification do
|
|
81
99
|
first = Braintree::CreditCardVerification._new(:id => 123)
|
82
100
|
second = Braintree::CreditCardVerification._new(:id => 123)
|
83
101
|
|
84
|
-
first.
|
85
|
-
second.
|
102
|
+
expect(first).to eq(second)
|
103
|
+
expect(second).to eq(first)
|
86
104
|
end
|
87
105
|
|
88
106
|
it "returns false for verifications with different ids" do
|
89
107
|
first = Braintree::CreditCardVerification._new(:id => 123)
|
90
108
|
second = Braintree::CreditCardVerification._new(:id => 124)
|
91
109
|
|
92
|
-
first.
|
93
|
-
second.
|
110
|
+
expect(first).not_to eq(second)
|
111
|
+
expect(second).not_to eq(first)
|
94
112
|
end
|
95
113
|
|
96
114
|
it "returns false when comparing to nil" do
|
97
|
-
Braintree::CreditCardVerification._new({}).
|
115
|
+
expect(Braintree::CreditCardVerification._new({})).not_to eq(nil)
|
98
116
|
end
|
99
117
|
|
100
118
|
it "returns false when comparing to non-verifications" do
|
101
119
|
same_id_different_object = Object.new
|
102
120
|
def same_id_different_object.id; 123; end
|
103
121
|
verification = Braintree::CreditCardVerification._new(:id => 123)
|
104
|
-
verification.
|
122
|
+
expect(verification).not_to eq(same_id_different_object)
|
105
123
|
end
|
106
124
|
end
|
107
125
|
|
@@ -110,19 +128,23 @@ describe Braintree::CreditCardVerification do
|
|
110
128
|
verification = Braintree::CreditCardVerification._new(:risk_data => {
|
111
129
|
:id => "123",
|
112
130
|
:decision => "WOO YOU WON $1000 dollars",
|
131
|
+
:decision_reasons => ["reason"],
|
113
132
|
:device_data_captured => true,
|
114
|
-
:fraud_service_provider => "
|
133
|
+
:fraud_service_provider => "paypal_fraud_protection",
|
134
|
+
:transaction_risk_score => "12",
|
115
135
|
})
|
116
136
|
|
117
|
-
verification.risk_data.id.
|
118
|
-
verification.risk_data.decision.
|
119
|
-
verification.risk_data.
|
120
|
-
verification.risk_data.
|
137
|
+
expect(verification.risk_data.id).to eq("123")
|
138
|
+
expect(verification.risk_data.decision).to eq("WOO YOU WON $1000 dollars")
|
139
|
+
expect(verification.risk_data.decision_reasons).to eq(["reason"])
|
140
|
+
expect(verification.risk_data.device_data_captured).to eq(true)
|
141
|
+
expect(verification.risk_data.fraud_service_provider).to eq("paypal_fraud_protection")
|
142
|
+
expect(verification.risk_data.transaction_risk_score).to eq("12")
|
121
143
|
end
|
122
144
|
|
123
145
|
it "handles a nil risk_data" do
|
124
146
|
verification = Braintree::CreditCardVerification._new(:risk_data => nil)
|
125
|
-
verification.risk_data.
|
147
|
+
expect(verification.risk_data).to be_nil
|
126
148
|
end
|
127
149
|
end
|
128
150
|
|