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
@@ -10,39 +10,35 @@ describe Braintree::PaymentMethod do
|
|
10
10
|
Braintree::Configuration.private_key = "integration2_private_key"
|
11
11
|
end
|
12
12
|
|
13
|
-
context "plaid verified nonce" do
|
14
|
-
let(:nonce) {
|
13
|
+
context "non plaid verified nonce" do
|
14
|
+
let(:nonce) { generate_non_plaid_us_bank_account_nonce }
|
15
15
|
|
16
|
-
it "succeeds" do
|
16
|
+
it "succeeds and does not verify when no method provided" do
|
17
17
|
customer = Braintree::Customer.create.customer
|
18
18
|
result = Braintree::PaymentMethod.create(
|
19
19
|
:payment_method_nonce => nonce,
|
20
20
|
:customer_id => customer.id,
|
21
21
|
:options => {
|
22
22
|
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
23
|
-
}
|
23
|
+
},
|
24
24
|
)
|
25
25
|
|
26
|
-
result.
|
26
|
+
expect(result).to be_success
|
27
27
|
us_bank_account = result.payment_method
|
28
|
-
us_bank_account.
|
29
|
-
us_bank_account.routing_number.
|
30
|
-
us_bank_account.last_4.
|
31
|
-
us_bank_account.account_type.
|
32
|
-
us_bank_account.account_holder_name.
|
33
|
-
us_bank_account.bank_name.
|
34
|
-
us_bank_account.default.
|
35
|
-
us_bank_account.ach_mandate.text.
|
36
|
-
us_bank_account.ach_mandate.accepted_at.
|
37
|
-
|
38
|
-
us_bank_account.verifications.count.
|
39
|
-
us_bank_account.
|
40
|
-
|
41
|
-
us_bank_account.
|
42
|
-
us_bank_account.verifications.first.verification_determined_at.should be_a Time
|
43
|
-
us_bank_account.verified.should == true
|
44
|
-
|
45
|
-
Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
|
28
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
29
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
30
|
+
expect(us_bank_account.last_4).to eq("0000")
|
31
|
+
expect(us_bank_account.account_type).to eq("checking")
|
32
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
33
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
34
|
+
expect(us_bank_account.default).to eq(true)
|
35
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
36
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
37
|
+
|
38
|
+
expect(us_bank_account.verifications.count).to eq(0)
|
39
|
+
expect(us_bank_account.verified).to eq(false)
|
40
|
+
|
41
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
46
42
|
end
|
47
43
|
|
48
44
|
[
|
@@ -57,107 +53,102 @@ describe Braintree::PaymentMethod do
|
|
57
53
|
:options => {
|
58
54
|
:us_bank_account_verification_method => method,
|
59
55
|
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
60
|
-
}
|
56
|
+
},
|
61
57
|
)
|
62
58
|
|
63
|
-
result.
|
59
|
+
expect(result).to be_success
|
64
60
|
us_bank_account = result.payment_method
|
65
|
-
us_bank_account.
|
66
|
-
us_bank_account.routing_number.
|
67
|
-
us_bank_account.last_4.
|
68
|
-
us_bank_account.account_type.
|
69
|
-
us_bank_account.account_holder_name.
|
70
|
-
us_bank_account.bank_name.
|
71
|
-
us_bank_account.default.
|
72
|
-
us_bank_account.ach_mandate.text.
|
73
|
-
us_bank_account.ach_mandate.accepted_at.
|
74
|
-
|
75
|
-
|
76
|
-
us_bank_account.verifications.
|
77
|
-
|
78
|
-
us_bank_account.verifications.
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
us_bank_account.verifications.each do |verification|
|
84
|
-
verification.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
85
|
-
verification.id.should_not be_empty
|
86
|
-
verification.verification_determined_at.should be_a Time
|
87
|
-
end
|
88
|
-
|
89
|
-
Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
|
61
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
62
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
63
|
+
expect(us_bank_account.last_4).to eq("0000")
|
64
|
+
expect(us_bank_account.account_type).to eq("checking")
|
65
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
66
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
67
|
+
expect(us_bank_account.default).to eq(true)
|
68
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
69
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
70
|
+
|
71
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
72
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
73
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(method)
|
74
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
75
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
76
|
+
expect(us_bank_account.verified).to eq(true)
|
77
|
+
|
78
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
90
79
|
end
|
91
80
|
end
|
92
|
-
end
|
93
81
|
|
94
|
-
|
95
|
-
let(:nonce) { generate_non_plaid_us_bank_account_nonce }
|
96
|
-
|
97
|
-
it "succeeds and does not verify when no method provided" do
|
82
|
+
it "succeeds and verifies with verification_add_ons for NetworkCheck with fake nonce" do
|
98
83
|
customer = Braintree::Customer.create.customer
|
99
84
|
result = Braintree::PaymentMethod.create(
|
100
|
-
:payment_method_nonce =>
|
85
|
+
:payment_method_nonce => Braintree::Test::Nonce::UsBankAccount,
|
101
86
|
:customer_id => customer.id,
|
102
87
|
:options => {
|
88
|
+
:us_bank_account_verification_method => Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck,
|
89
|
+
:verification_add_ons => Braintree::UsBankAccountVerification::VerificationAddOns::CustomerVerification,
|
103
90
|
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
104
|
-
}
|
91
|
+
},
|
105
92
|
)
|
106
93
|
|
107
|
-
result.
|
94
|
+
expect(result).to be_success
|
108
95
|
us_bank_account = result.payment_method
|
109
|
-
us_bank_account.
|
110
|
-
us_bank_account.routing_number.
|
111
|
-
us_bank_account.last_4.
|
112
|
-
us_bank_account.account_type.
|
113
|
-
us_bank_account.account_holder_name.
|
114
|
-
us_bank_account.bank_name.
|
115
|
-
us_bank_account.default.
|
116
|
-
us_bank_account.ach_mandate.text.
|
117
|
-
us_bank_account.ach_mandate.accepted_at.
|
118
|
-
|
119
|
-
us_bank_account.verifications.count.
|
120
|
-
us_bank_account.
|
121
|
-
|
122
|
-
|
96
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
97
|
+
expect(us_bank_account.routing_number).to eq("123456789")
|
98
|
+
expect(us_bank_account.last_4).to eq("0000")
|
99
|
+
expect(us_bank_account.account_type).to eq("checking")
|
100
|
+
expect(us_bank_account.account_holder_name).to eq("Dan Schulman")
|
101
|
+
expect(us_bank_account.bank_name).to match(/Wells Fargo/)
|
102
|
+
expect(us_bank_account.default).to eq(true)
|
103
|
+
expect(us_bank_account.ach_mandate.text).to eq("example mandate text")
|
104
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
105
|
+
|
106
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
107
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
108
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck)
|
109
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
110
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
111
|
+
expect(us_bank_account.verifications.first.processor_response_code).to eq("1000")
|
112
|
+
expect(us_bank_account.verified).to eq(true)
|
113
|
+
|
114
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
123
115
|
end
|
124
116
|
|
125
|
-
|
126
|
-
Braintree::
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
:
|
133
|
-
:
|
134
|
-
|
135
|
-
|
136
|
-
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
137
|
-
}
|
138
|
-
)
|
117
|
+
it "returns additional processor response for failed NetworkCheck" do
|
118
|
+
customer = Braintree::Customer.create.customer
|
119
|
+
invalid_nonce = generate_non_plaid_us_bank_account_nonce("1000000005")
|
120
|
+
result = Braintree::PaymentMethod.create(
|
121
|
+
:payment_method_nonce => invalid_nonce,
|
122
|
+
:customer_id => customer.id,
|
123
|
+
:options => {
|
124
|
+
:us_bank_account_verification_method => Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck,
|
125
|
+
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
126
|
+
},
|
127
|
+
)
|
139
128
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
129
|
+
expect(result).to be_success
|
130
|
+
us_bank_account = result.payment_method
|
131
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
132
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
133
|
+
expect(us_bank_account.last_4).to eq("0005")
|
134
|
+
expect(us_bank_account.account_type).to eq("checking")
|
135
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
136
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
137
|
+
expect(us_bank_account.default).to eq(true)
|
138
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
139
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
140
|
+
|
141
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
142
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::ProcessorDeclined)
|
143
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(Braintree::UsBankAccountVerification::VerificationMethod::NetworkCheck)
|
144
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
145
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
146
|
+
expect(us_bank_account.verifications.first.processor_response_code).to eq("2061")
|
147
|
+
expect(us_bank_account.verifications.first.additional_processor_response).to eq("Invalid routing number")
|
148
|
+
|
149
|
+
expect(us_bank_account.verified).to eq(false)
|
150
|
+
|
151
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
161
152
|
end
|
162
153
|
end
|
163
154
|
|
@@ -165,102 +156,24 @@ describe Braintree::PaymentMethod do
|
|
165
156
|
customer = Braintree::Customer.create.customer
|
166
157
|
result = Braintree::PaymentMethod.create(
|
167
158
|
:payment_method_nonce => generate_invalid_us_bank_account_nonce,
|
168
|
-
:customer_id => customer.id
|
159
|
+
:customer_id => customer.id,
|
169
160
|
)
|
170
161
|
|
171
|
-
result.
|
172
|
-
result.errors.for(:payment_method).on(:payment_method_nonce)[0].code.
|
162
|
+
expect(result).not_to be_success
|
163
|
+
expect(result.errors.for(:payment_method).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown)
|
173
164
|
end
|
174
165
|
end
|
175
166
|
|
176
167
|
context "exempt merchant" do
|
177
|
-
context "plaid verified nonce" do
|
178
|
-
before do
|
179
|
-
Braintree::Configuration.merchant_id = "integration_merchant_id"
|
180
|
-
Braintree::Configuration.public_key = "integration_public_key"
|
181
|
-
Braintree::Configuration.private_key = "integration_private_key"
|
182
|
-
end
|
183
|
-
|
184
|
-
let(:nonce) { generate_valid_plaid_us_bank_account_nonce }
|
185
|
-
|
186
|
-
it "succeeds and verifies via independent check" do
|
187
|
-
customer = Braintree::Customer.create.customer
|
188
|
-
result = Braintree::PaymentMethod.create(
|
189
|
-
:payment_method_nonce => nonce,
|
190
|
-
:customer_id => customer.id,
|
191
|
-
:options => {
|
192
|
-
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
193
|
-
}
|
194
|
-
)
|
195
|
-
|
196
|
-
result.should be_success
|
197
|
-
us_bank_account = result.payment_method
|
198
|
-
us_bank_account.should be_a(Braintree::UsBankAccount)
|
199
|
-
us_bank_account.routing_number.should == "011000015"
|
200
|
-
us_bank_account.last_4.should == "0000"
|
201
|
-
us_bank_account.account_type.should == "checking"
|
202
|
-
us_bank_account.account_holder_name.should == "PayPal, Inc."
|
203
|
-
us_bank_account.bank_name.should == "FEDERAL RESERVE BANK"
|
204
|
-
us_bank_account.default.should == true
|
205
|
-
us_bank_account.ach_mandate.text.should == "cl mandate text"
|
206
|
-
us_bank_account.ach_mandate.accepted_at.should be_a Time
|
207
|
-
|
208
|
-
us_bank_account.verifications.count.should == 1
|
209
|
-
us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
210
|
-
us_bank_account.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
|
211
|
-
us_bank_account.verifications.first.id.should_not be_empty
|
212
|
-
us_bank_account.verifications.first.verification_determined_at.should be_a Time
|
213
|
-
us_bank_account.verified.should == true
|
214
|
-
|
215
|
-
Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
context "non plaid verified nonce" do
|
220
|
-
let(:nonce) { generate_non_plaid_us_bank_account_nonce }
|
221
|
-
|
222
|
-
it "succeeds and verifies via independent check" do
|
223
|
-
customer = Braintree::Customer.create.customer
|
224
|
-
result = Braintree::PaymentMethod.create(
|
225
|
-
:payment_method_nonce => nonce,
|
226
|
-
:customer_id => customer.id,
|
227
|
-
:options => {
|
228
|
-
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
229
|
-
}
|
230
|
-
)
|
231
|
-
|
232
|
-
result.should be_success
|
233
|
-
us_bank_account = result.payment_method
|
234
|
-
us_bank_account.should be_a(Braintree::UsBankAccount)
|
235
|
-
us_bank_account.routing_number.should == "021000021"
|
236
|
-
us_bank_account.last_4.should == "0000"
|
237
|
-
us_bank_account.account_type.should == "checking"
|
238
|
-
us_bank_account.account_holder_name.should == "John Doe"
|
239
|
-
us_bank_account.bank_name.should =~ /CHASE/
|
240
|
-
us_bank_account.default.should == true
|
241
|
-
us_bank_account.ach_mandate.text.should == "cl mandate text"
|
242
|
-
us_bank_account.ach_mandate.accepted_at.should be_a Time
|
243
|
-
|
244
|
-
us_bank_account.verifications.count.should == 1
|
245
|
-
us_bank_account.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
246
|
-
us_bank_account.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
|
247
|
-
us_bank_account.verifications.first.id.should_not be_empty
|
248
|
-
us_bank_account.verifications.first.verification_determined_at.should be_a Time
|
249
|
-
us_bank_account.verified.should == true
|
250
|
-
|
251
|
-
Braintree::PaymentMethod.find(us_bank_account.token).should be_a(Braintree::UsBankAccount)
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
168
|
it "fails with invalid nonce" do
|
256
169
|
customer = Braintree::Customer.create.customer
|
257
170
|
result = Braintree::PaymentMethod.create(
|
258
171
|
:payment_method_nonce => generate_invalid_us_bank_account_nonce,
|
259
|
-
:customer_id => customer.id
|
172
|
+
:customer_id => customer.id,
|
260
173
|
)
|
261
174
|
|
262
|
-
result.
|
263
|
-
result.errors.for(:payment_method).on(:payment_method_nonce)[0].code.
|
175
|
+
expect(result).not_to be_success
|
176
|
+
expect(result.errors.for(:payment_method).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::PaymentMethod::PaymentMethodNonceUnknown)
|
264
177
|
end
|
265
178
|
end
|
266
179
|
end
|
@@ -276,7 +189,7 @@ describe Braintree::PaymentMethod do
|
|
276
189
|
context "unverified token" do
|
277
190
|
let(:payment_method) do
|
278
191
|
customer = Braintree::Customer.create.customer
|
279
|
-
|
192
|
+
Braintree::PaymentMethod.create(
|
280
193
|
:payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
|
281
194
|
:customer_id => customer.id,
|
282
195
|
:options => {
|
@@ -298,27 +211,27 @@ describe Braintree::PaymentMethod do
|
|
298
211
|
},
|
299
212
|
)
|
300
213
|
|
301
|
-
result.
|
214
|
+
expect(result).to be_success
|
302
215
|
|
303
216
|
us_bank_account = result.payment_method
|
304
|
-
us_bank_account.
|
305
|
-
us_bank_account.routing_number.
|
306
|
-
us_bank_account.last_4.
|
307
|
-
us_bank_account.account_type.
|
308
|
-
us_bank_account.account_holder_name.
|
309
|
-
us_bank_account.bank_name.
|
310
|
-
us_bank_account.default.
|
311
|
-
us_bank_account.ach_mandate.text.
|
312
|
-
us_bank_account.ach_mandate.accepted_at.
|
313
|
-
|
314
|
-
us_bank_account.verifications.count.
|
315
|
-
us_bank_account.verifications.first.status.
|
316
|
-
us_bank_account.verifications.first.verification_method.
|
317
|
-
us_bank_account.verifications.first.id.
|
318
|
-
us_bank_account.verifications.first.verification_determined_at.
|
319
|
-
us_bank_account.verified.
|
320
|
-
|
321
|
-
Braintree::PaymentMethod.find(us_bank_account.token).
|
217
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
218
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
219
|
+
expect(us_bank_account.last_4).to eq("0000")
|
220
|
+
expect(us_bank_account.account_type).to eq("checking")
|
221
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
222
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
223
|
+
expect(us_bank_account.default).to eq(true)
|
224
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
225
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
226
|
+
|
227
|
+
expect(us_bank_account.verifications.count).to eq(1)
|
228
|
+
expect(us_bank_account.verifications.first.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
229
|
+
expect(us_bank_account.verifications.first.verification_method).to eq(method)
|
230
|
+
expect(us_bank_account.verifications.first.id).not_to be_empty
|
231
|
+
expect(us_bank_account.verifications.first.verification_determined_at).to be_a Time
|
232
|
+
expect(us_bank_account.verified).to eq(true)
|
233
|
+
|
234
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
322
235
|
end
|
323
236
|
end
|
324
237
|
|
@@ -331,8 +244,8 @@ describe Braintree::PaymentMethod do
|
|
331
244
|
},
|
332
245
|
)
|
333
246
|
|
334
|
-
result.
|
335
|
-
result.errors.for(:options).first.code.
|
247
|
+
expect(result).not_to be_success
|
248
|
+
expect(result.errors.for(:options).first.code).to eq(Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid)
|
336
249
|
end
|
337
250
|
end
|
338
251
|
end
|
@@ -347,12 +260,12 @@ describe Braintree::PaymentMethod do
|
|
347
260
|
context "unverified token" do
|
348
261
|
let(:payment_method) do
|
349
262
|
customer = Braintree::Customer.create.customer
|
350
|
-
|
263
|
+
Braintree::PaymentMethod.create(
|
351
264
|
:payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
|
352
265
|
:customer_id => customer.id,
|
353
266
|
:options => {
|
354
267
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
355
|
-
}
|
268
|
+
},
|
356
269
|
).payment_method
|
357
270
|
end
|
358
271
|
|
@@ -369,29 +282,29 @@ describe Braintree::PaymentMethod do
|
|
369
282
|
},
|
370
283
|
)
|
371
284
|
|
372
|
-
result.
|
285
|
+
expect(result).to be_success
|
373
286
|
|
374
287
|
us_bank_account = result.payment_method
|
375
|
-
us_bank_account.
|
376
|
-
us_bank_account.routing_number.
|
377
|
-
us_bank_account.last_4.
|
378
|
-
us_bank_account.account_type.
|
379
|
-
us_bank_account.account_holder_name.
|
380
|
-
us_bank_account.bank_name.
|
381
|
-
us_bank_account.default.
|
382
|
-
us_bank_account.ach_mandate.text.
|
383
|
-
us_bank_account.ach_mandate.accepted_at.
|
384
|
-
|
385
|
-
us_bank_account.verifications.count.
|
288
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
289
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
290
|
+
expect(us_bank_account.last_4).to eq("0000")
|
291
|
+
expect(us_bank_account.account_type).to eq("checking")
|
292
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
293
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
294
|
+
expect(us_bank_account.default).to eq(true)
|
295
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
296
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
297
|
+
|
298
|
+
expect(us_bank_account.verifications.count).to eq(2)
|
386
299
|
verification = us_bank_account.verifications.find do |verification|
|
387
300
|
verification.verification_method == method
|
388
301
|
end
|
389
|
-
verification.status.
|
390
|
-
verification.id.
|
391
|
-
verification.verification_determined_at.
|
392
|
-
us_bank_account.verified.
|
302
|
+
expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
303
|
+
expect(verification.id).not_to be_empty
|
304
|
+
expect(verification.verification_determined_at).to be_a Time
|
305
|
+
expect(us_bank_account.verified).to eq(true)
|
393
306
|
|
394
|
-
Braintree::PaymentMethod.find(us_bank_account.token).
|
307
|
+
expect(Braintree::PaymentMethod.find(us_bank_account.token)).to be_a(Braintree::UsBankAccount)
|
395
308
|
end
|
396
309
|
end
|
397
310
|
|
@@ -403,8 +316,8 @@ describe Braintree::PaymentMethod do
|
|
403
316
|
},
|
404
317
|
)
|
405
318
|
|
406
|
-
result.
|
407
|
-
result.errors.for(:options).first.code.
|
319
|
+
expect(result).not_to be_success
|
320
|
+
expect(result.errors.for(:options).first.code).to eq(Braintree::ErrorCodes::PaymentMethod::Options::UsBankAccountVerificationMethodIsInvalid)
|
408
321
|
end
|
409
322
|
end
|
410
323
|
end
|