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,123 +10,6 @@ describe Braintree::Transaction do
|
|
10
10
|
Braintree::Configuration.private_key = "integration2_private_key"
|
11
11
|
end
|
12
12
|
|
13
|
-
context "plaid-verified" do
|
14
|
-
let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
|
15
|
-
|
16
|
-
context "nonce" do
|
17
|
-
it "sale succeeds" do
|
18
|
-
result = Braintree::Transaction.create(
|
19
|
-
:type => "sale",
|
20
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
21
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
22
|
-
:payment_method_nonce => plaid_nonce,
|
23
|
-
:options => {
|
24
|
-
:submit_for_settlement => true,
|
25
|
-
}
|
26
|
-
)
|
27
|
-
result.success?.should == true
|
28
|
-
result.transaction.id.should =~ /^\w{6,}$/
|
29
|
-
result.transaction.type.should == "sale"
|
30
|
-
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
|
31
|
-
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
32
|
-
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
33
|
-
result.transaction.us_bank_account_details.routing_number.should == "011000015"
|
34
|
-
result.transaction.us_bank_account_details.last_4.should == "0000"
|
35
|
-
result.transaction.us_bank_account_details.account_type.should == "checking"
|
36
|
-
result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
37
|
-
result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
38
|
-
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
39
|
-
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context "token" do
|
44
|
-
it "payment_method#create then sale succeeds" do
|
45
|
-
payment_method = Braintree::PaymentMethod.create(
|
46
|
-
:payment_method_nonce => plaid_nonce,
|
47
|
-
:customer_id => Braintree::Customer.create.customer.id,
|
48
|
-
:options => {
|
49
|
-
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
50
|
-
}
|
51
|
-
).payment_method
|
52
|
-
|
53
|
-
payment_method.verifications.count.should == 1
|
54
|
-
payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
55
|
-
payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
|
56
|
-
payment_method.verifications.first.id.should_not be_empty
|
57
|
-
payment_method.verifications.first.verification_determined_at.should be_a Time
|
58
|
-
payment_method.verified.should == true
|
59
|
-
|
60
|
-
result = Braintree::Transaction.create(
|
61
|
-
:type => "sale",
|
62
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
63
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
64
|
-
:payment_method_token => payment_method.token,
|
65
|
-
:options => {
|
66
|
-
:submit_for_settlement => true,
|
67
|
-
}
|
68
|
-
)
|
69
|
-
|
70
|
-
result.success?.should == true
|
71
|
-
|
72
|
-
transaction = result.transaction
|
73
|
-
|
74
|
-
transaction.id.should =~ /^\w{6,}$/
|
75
|
-
transaction.type.should == "sale"
|
76
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
77
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
78
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
79
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
80
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
81
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
82
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
83
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
84
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
85
|
-
end
|
86
|
-
|
87
|
-
it "transaction#create store_in_vault then sale succeeds" do
|
88
|
-
result = Braintree::Transaction.create(
|
89
|
-
:type => "sale",
|
90
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
91
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
92
|
-
:payment_method_nonce => plaid_nonce,
|
93
|
-
:options => {
|
94
|
-
:submit_for_settlement => true,
|
95
|
-
:store_in_vault => true,
|
96
|
-
}
|
97
|
-
)
|
98
|
-
|
99
|
-
result.success?.should == true
|
100
|
-
|
101
|
-
result = Braintree::Transaction.create(
|
102
|
-
:type => "sale",
|
103
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
104
|
-
:merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
105
|
-
:payment_method_token => result.transaction.us_bank_account_details.token,
|
106
|
-
:options => {
|
107
|
-
:submit_for_settlement => true,
|
108
|
-
}
|
109
|
-
)
|
110
|
-
|
111
|
-
result.success?.should == true
|
112
|
-
|
113
|
-
transaction = result.transaction
|
114
|
-
|
115
|
-
transaction.id.should =~ /^\w{6,}$/
|
116
|
-
transaction.type.should == "sale"
|
117
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
118
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
119
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
120
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
121
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
122
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
123
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
124
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
125
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
13
|
context "not plaid-verified" do
|
131
14
|
let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
|
132
15
|
let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
|
@@ -140,10 +23,10 @@ describe Braintree::Transaction do
|
|
140
23
|
:payment_method_nonce => non_plaid_nonce,
|
141
24
|
:options => {
|
142
25
|
:submit_for_settlement => true,
|
143
|
-
}
|
26
|
+
},
|
144
27
|
)
|
145
|
-
result.success
|
146
|
-
result.errors.for(:transaction).on(:payment_method_nonce)[0].code.
|
28
|
+
expect(result.success?).to eq(false)
|
29
|
+
expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::UsBankAccountNonceMustBePlaidVerified)
|
147
30
|
end
|
148
31
|
|
149
32
|
it "sale fails for invalid nonce" do
|
@@ -154,10 +37,10 @@ describe Braintree::Transaction do
|
|
154
37
|
:payment_method_nonce => invalid_nonce,
|
155
38
|
:options => {
|
156
39
|
:submit_for_settlement => true,
|
157
|
-
}
|
40
|
+
},
|
158
41
|
)
|
159
|
-
result.success
|
160
|
-
result.errors.for(:transaction).on(:payment_method_nonce)[0].code.
|
42
|
+
expect(result.success?).to eq(false)
|
43
|
+
expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown)
|
161
44
|
end
|
162
45
|
end
|
163
46
|
|
@@ -169,16 +52,16 @@ describe Braintree::Transaction do
|
|
169
52
|
:options => {
|
170
53
|
:us_bank_account_verification_method => "independent_check",
|
171
54
|
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
172
|
-
}
|
55
|
+
},
|
173
56
|
)
|
174
57
|
payment_method = result.payment_method
|
175
58
|
|
176
|
-
payment_method.verifications.count.
|
59
|
+
expect(payment_method.verifications.count).to eq(1)
|
177
60
|
payment_method.verifications.first.status == Braintree::UsBankAccountVerification::Status::Verified
|
178
61
|
payment_method.verifications.first.verification_method == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
|
179
|
-
payment_method.verifications.first.id.
|
180
|
-
payment_method.verifications.first.verification_determined_at.
|
181
|
-
payment_method.verified.
|
62
|
+
expect(payment_method.verifications.first.id).not_to be_empty
|
63
|
+
expect(payment_method.verifications.first.verification_determined_at).to be_a Time
|
64
|
+
expect(payment_method.verified).to eq(true)
|
182
65
|
|
183
66
|
result = Braintree::Transaction.create(
|
184
67
|
:type => "sale",
|
@@ -187,10 +70,10 @@ describe Braintree::Transaction do
|
|
187
70
|
:payment_method_token => payment_method.token,
|
188
71
|
:options => {
|
189
72
|
:submit_for_settlement => true,
|
190
|
-
}
|
73
|
+
},
|
191
74
|
)
|
192
75
|
|
193
|
-
result.success
|
76
|
+
expect(result.success?).to eq(true)
|
194
77
|
end
|
195
78
|
|
196
79
|
it "sale fails for unverified token" do
|
@@ -199,11 +82,11 @@ describe Braintree::Transaction do
|
|
199
82
|
:customer_id => Braintree::Customer.create.customer.id,
|
200
83
|
:options => {
|
201
84
|
:verification_merchant_account_id => SpecHelper::AnotherUsBankMerchantAccountId,
|
202
|
-
}
|
85
|
+
},
|
203
86
|
).payment_method
|
204
87
|
|
205
|
-
payment_method.verifications.count.
|
206
|
-
payment_method.verified.
|
88
|
+
expect(payment_method.verifications.count).to eq(0)
|
89
|
+
expect(payment_method.verified).to eq(false)
|
207
90
|
|
208
91
|
result = Braintree::Transaction.create(
|
209
92
|
:type => "sale",
|
@@ -212,11 +95,11 @@ describe Braintree::Transaction do
|
|
212
95
|
:payment_method_token => payment_method.token,
|
213
96
|
:options => {
|
214
97
|
:submit_for_settlement => true,
|
215
|
-
}
|
98
|
+
},
|
216
99
|
)
|
217
100
|
|
218
|
-
result.success
|
219
|
-
result.errors.for(:transaction)[0].code.
|
101
|
+
expect(result.success?).to eq(false)
|
102
|
+
expect(result.errors.for(:transaction)[0].code).to eq(Braintree::ErrorCodes::Transaction::UsBankAccountNotVerified)
|
220
103
|
end
|
221
104
|
end
|
222
105
|
end
|
@@ -229,125 +112,6 @@ describe Braintree::Transaction do
|
|
229
112
|
Braintree::Configuration.private_key = "integration_private_key"
|
230
113
|
end
|
231
114
|
|
232
|
-
context "plaid-verified" do
|
233
|
-
let(:plaid_nonce) { generate_valid_plaid_us_bank_account_nonce }
|
234
|
-
|
235
|
-
context "nonce" do
|
236
|
-
it "sale succeeds" do
|
237
|
-
result = Braintree::Transaction.create(
|
238
|
-
:type => "sale",
|
239
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
240
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
241
|
-
:payment_method_nonce => plaid_nonce,
|
242
|
-
:options => {
|
243
|
-
:submit_for_settlement => true,
|
244
|
-
}
|
245
|
-
)
|
246
|
-
result.success?.should == true
|
247
|
-
result.transaction.id.should =~ /^\w{6,}$/
|
248
|
-
result.transaction.type.should == "sale"
|
249
|
-
result.transaction.payment_instrument_type.should == Braintree::PaymentInstrumentType::UsBankAccount
|
250
|
-
result.transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
251
|
-
result.transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
252
|
-
result.transaction.us_bank_account_details.routing_number.should == "011000015"
|
253
|
-
result.transaction.us_bank_account_details.last_4.should == "0000"
|
254
|
-
result.transaction.us_bank_account_details.account_type.should == "checking"
|
255
|
-
result.transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
256
|
-
result.transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
257
|
-
result.transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
258
|
-
result.transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
context "token" do
|
263
|
-
it "payment_method#create then sale succeeds" do
|
264
|
-
result = Braintree::PaymentMethod.create(
|
265
|
-
:payment_method_nonce => plaid_nonce,
|
266
|
-
:customer_id => Braintree::Customer.create.customer.id,
|
267
|
-
:options => {
|
268
|
-
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
269
|
-
}
|
270
|
-
)
|
271
|
-
|
272
|
-
payment_method = result.payment_method
|
273
|
-
|
274
|
-
payment_method.verifications.count.should == 1
|
275
|
-
payment_method.verifications.first.status.should == Braintree::UsBankAccountVerification::Status::Verified
|
276
|
-
payment_method.verifications.first.verification_method.should == Braintree::UsBankAccountVerification::VerificationMethod::TokenizedCheck
|
277
|
-
payment_method.verifications.first.id.should_not be_empty
|
278
|
-
payment_method.verifications.first.verification_determined_at.should be_a Time
|
279
|
-
payment_method.verified.should == true
|
280
|
-
|
281
|
-
result = Braintree::Transaction.create(
|
282
|
-
:type => "sale",
|
283
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
284
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
285
|
-
:payment_method_token => payment_method.token,
|
286
|
-
:options => {
|
287
|
-
:submit_for_settlement => true,
|
288
|
-
}
|
289
|
-
)
|
290
|
-
|
291
|
-
result.success?.should == true
|
292
|
-
|
293
|
-
transaction = result.transaction
|
294
|
-
|
295
|
-
transaction.id.should =~ /^\w{6,}$/
|
296
|
-
transaction.type.should == "sale"
|
297
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
298
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
299
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
300
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
301
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
302
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
303
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
304
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
305
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
306
|
-
end
|
307
|
-
|
308
|
-
it "transaction#create store_in_vault then sale succeeds" do
|
309
|
-
result = Braintree::Transaction.create(
|
310
|
-
:type => "sale",
|
311
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
312
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
313
|
-
:payment_method_nonce => plaid_nonce,
|
314
|
-
:options => {
|
315
|
-
:submit_for_settlement => true,
|
316
|
-
:store_in_vault => true,
|
317
|
-
}
|
318
|
-
)
|
319
|
-
|
320
|
-
result.success?.should == true
|
321
|
-
|
322
|
-
result = Braintree::Transaction.create(
|
323
|
-
:type => "sale",
|
324
|
-
:amount => Braintree::Test::TransactionAmounts::Authorize,
|
325
|
-
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
326
|
-
:payment_method_token => result.transaction.us_bank_account_details.token,
|
327
|
-
:options => {
|
328
|
-
:submit_for_settlement => true,
|
329
|
-
}
|
330
|
-
)
|
331
|
-
|
332
|
-
result.success?.should == true
|
333
|
-
|
334
|
-
transaction = result.transaction
|
335
|
-
|
336
|
-
transaction.id.should =~ /^\w{6,}$/
|
337
|
-
transaction.type.should == "sale"
|
338
|
-
transaction.amount.should == BigDecimal(Braintree::Test::TransactionAmounts::Authorize)
|
339
|
-
transaction.status.should == Braintree::Transaction::Status::SettlementPending
|
340
|
-
transaction.us_bank_account_details.routing_number.should == "011000015"
|
341
|
-
transaction.us_bank_account_details.last_4.should == "0000"
|
342
|
-
transaction.us_bank_account_details.account_type.should == "checking"
|
343
|
-
transaction.us_bank_account_details.account_holder_name.should == "PayPal, Inc."
|
344
|
-
transaction.us_bank_account_details.bank_name.should == "FEDERAL RESERVE BANK"
|
345
|
-
transaction.us_bank_account_details.ach_mandate.text.should == "cl mandate text"
|
346
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.should be_a Time
|
347
|
-
end
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
351
115
|
context "not plaid-verified" do
|
352
116
|
let(:non_plaid_nonce) { generate_non_plaid_us_bank_account_nonce }
|
353
117
|
let(:invalid_nonce) { generate_invalid_us_bank_account_nonce }
|
@@ -361,23 +125,23 @@ describe Braintree::Transaction do
|
|
361
125
|
:payment_method_nonce => non_plaid_nonce,
|
362
126
|
:options => {
|
363
127
|
:submit_for_settlement => true,
|
364
|
-
}
|
128
|
+
},
|
365
129
|
)
|
366
|
-
result.success
|
130
|
+
expect(result.success?).to eq(true)
|
367
131
|
|
368
132
|
transaction = result.transaction
|
369
133
|
|
370
|
-
transaction.id.
|
371
|
-
transaction.type.
|
372
|
-
transaction.amount.
|
373
|
-
transaction.status.
|
374
|
-
transaction.us_bank_account_details.routing_number.
|
375
|
-
transaction.us_bank_account_details.last_4.
|
376
|
-
transaction.us_bank_account_details.account_type.
|
377
|
-
transaction.us_bank_account_details.account_holder_name.
|
378
|
-
transaction.us_bank_account_details.bank_name.
|
379
|
-
transaction.us_bank_account_details.ach_mandate.text.
|
380
|
-
transaction.us_bank_account_details.ach_mandate.accepted_at.
|
134
|
+
expect(transaction.id).to match(/^\w{6,}$/)
|
135
|
+
expect(transaction.type).to eq("sale")
|
136
|
+
expect(transaction.amount).to eq(BigDecimal(Braintree::Test::TransactionAmounts::Authorize))
|
137
|
+
expect(transaction.status).to eq(Braintree::Transaction::Status::SettlementPending)
|
138
|
+
expect(transaction.us_bank_account_details.routing_number).to eq("021000021")
|
139
|
+
expect(transaction.us_bank_account_details.last_4).to eq("0000")
|
140
|
+
expect(transaction.us_bank_account_details.account_type).to eq("checking")
|
141
|
+
expect(transaction.us_bank_account_details.account_holder_name).to eq("John Doe")
|
142
|
+
expect(transaction.us_bank_account_details.bank_name).to match(/CHASE/)
|
143
|
+
expect(transaction.us_bank_account_details.ach_mandate.text).to eq("cl mandate text")
|
144
|
+
expect(transaction.us_bank_account_details.ach_mandate.accepted_at).to be_a Time
|
381
145
|
end
|
382
146
|
|
383
147
|
it "sale fails for invalid nonce" do
|
@@ -388,10 +152,10 @@ describe Braintree::Transaction do
|
|
388
152
|
:payment_method_nonce => invalid_nonce,
|
389
153
|
:options => {
|
390
154
|
:submit_for_settlement => true,
|
391
|
-
}
|
155
|
+
},
|
392
156
|
)
|
393
|
-
result.success
|
394
|
-
result.errors.for(:transaction).on(:payment_method_nonce)[0].code.
|
157
|
+
expect(result.success?).to eq(false)
|
158
|
+
expect(result.errors.for(:transaction).on(:payment_method_nonce)[0].code).to eq(Braintree::ErrorCodes::Transaction::PaymentMethodNonceUnknown)
|
395
159
|
end
|
396
160
|
end
|
397
161
|
|
@@ -402,16 +166,16 @@ describe Braintree::Transaction do
|
|
402
166
|
:customer_id => Braintree::Customer.create.customer.id,
|
403
167
|
:options => {
|
404
168
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
405
|
-
}
|
169
|
+
},
|
406
170
|
)
|
407
171
|
payment_method = result.payment_method
|
408
172
|
|
409
|
-
payment_method.verifications.count.
|
173
|
+
expect(payment_method.verifications.count).to eq(1)
|
410
174
|
payment_method.verifications.first.status == Braintree::UsBankAccountVerification::Status::Verified
|
411
175
|
payment_method.verifications.first.verification_method == Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck
|
412
|
-
payment_method.verifications.first.id.
|
413
|
-
payment_method.verifications.first.verification_determined_at.
|
414
|
-
payment_method.verified.
|
176
|
+
expect(payment_method.verifications.first.id).not_to be_empty
|
177
|
+
expect(payment_method.verifications.first.verification_determined_at).to be_a Time
|
178
|
+
expect(payment_method.verified).to eq(true)
|
415
179
|
|
416
180
|
result = Braintree::Transaction.create(
|
417
181
|
:type => "sale",
|
@@ -420,10 +184,10 @@ describe Braintree::Transaction do
|
|
420
184
|
:payment_method_token => payment_method.token,
|
421
185
|
:options => {
|
422
186
|
:submit_for_settlement => true,
|
423
|
-
}
|
187
|
+
},
|
424
188
|
)
|
425
189
|
|
426
|
-
result.success
|
190
|
+
expect(result.success?).to eq(true)
|
427
191
|
end
|
428
192
|
end
|
429
193
|
end
|
@@ -12,19 +12,19 @@ describe Braintree::UsBankAccount do
|
|
12
12
|
:customer_id => customer.id,
|
13
13
|
:options => {
|
14
14
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
15
|
-
}
|
15
|
+
},
|
16
16
|
)
|
17
|
-
result.
|
17
|
+
expect(result).to be_success
|
18
18
|
|
19
19
|
us_bank_account = Braintree::UsBankAccount.find(result.payment_method.token)
|
20
|
-
us_bank_account.
|
21
|
-
us_bank_account.routing_number.
|
22
|
-
us_bank_account.last_4.
|
23
|
-
us_bank_account.account_type.
|
24
|
-
us_bank_account.account_holder_name.
|
25
|
-
us_bank_account.bank_name.
|
26
|
-
us_bank_account.ach_mandate.text.
|
27
|
-
us_bank_account.ach_mandate.accepted_at.
|
20
|
+
expect(us_bank_account).to be_a(Braintree::UsBankAccount)
|
21
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
22
|
+
expect(us_bank_account.last_4).to eq("0000")
|
23
|
+
expect(us_bank_account.account_type).to eq("checking")
|
24
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
25
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
26
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
27
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
28
28
|
end
|
29
29
|
|
30
30
|
it "raises if the payment method token is not found" do
|
@@ -44,27 +44,27 @@ describe Braintree::UsBankAccount do
|
|
44
44
|
:customer_id => customer.id,
|
45
45
|
:options => {
|
46
46
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
47
|
-
}
|
47
|
+
},
|
48
48
|
)
|
49
|
-
result.
|
49
|
+
expect(result).to be_success
|
50
50
|
|
51
51
|
result = Braintree::UsBankAccount.sale(
|
52
52
|
result.payment_method.token,
|
53
53
|
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
54
|
-
:amount => "100.00"
|
54
|
+
:amount => "100.00",
|
55
55
|
)
|
56
56
|
|
57
|
-
result.success
|
58
|
-
result.transaction.amount.
|
59
|
-
result.transaction.type.
|
57
|
+
expect(result.success?).to eq(true)
|
58
|
+
expect(result.transaction.amount).to eq(BigDecimal("100.00"))
|
59
|
+
expect(result.transaction.type).to eq("sale")
|
60
60
|
us_bank_account = result.transaction.us_bank_account_details
|
61
|
-
us_bank_account.routing_number.
|
62
|
-
us_bank_account.last_4.
|
63
|
-
us_bank_account.account_type.
|
64
|
-
us_bank_account.account_holder_name.
|
65
|
-
us_bank_account.bank_name.
|
66
|
-
us_bank_account.ach_mandate.text.
|
67
|
-
us_bank_account.ach_mandate.accepted_at.
|
61
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
62
|
+
expect(us_bank_account.last_4).to eq("0000")
|
63
|
+
expect(us_bank_account.account_type).to eq("checking")
|
64
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
65
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
66
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
67
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
@@ -78,26 +78,26 @@ describe Braintree::UsBankAccount do
|
|
78
78
|
:customer_id => customer.id,
|
79
79
|
:options => {
|
80
80
|
:verification_merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
81
|
-
}
|
81
|
+
},
|
82
82
|
)
|
83
|
-
result.
|
83
|
+
expect(result).to be_success
|
84
84
|
|
85
85
|
transaction = Braintree::UsBankAccount.sale!(
|
86
86
|
result.payment_method.token,
|
87
87
|
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
88
|
-
:amount => "100.00"
|
88
|
+
:amount => "100.00",
|
89
89
|
)
|
90
90
|
|
91
|
-
transaction.amount.
|
92
|
-
transaction.type.
|
91
|
+
expect(transaction.amount).to eq(BigDecimal("100.00"))
|
92
|
+
expect(transaction.type).to eq("sale")
|
93
93
|
us_bank_account = transaction.us_bank_account_details
|
94
|
-
us_bank_account.routing_number.
|
95
|
-
us_bank_account.last_4.
|
96
|
-
us_bank_account.account_type.
|
97
|
-
us_bank_account.account_holder_name.
|
98
|
-
us_bank_account.bank_name.
|
99
|
-
us_bank_account.ach_mandate.text.
|
100
|
-
us_bank_account.ach_mandate.accepted_at.
|
94
|
+
expect(us_bank_account.routing_number).to eq("021000021")
|
95
|
+
expect(us_bank_account.last_4).to eq("0000")
|
96
|
+
expect(us_bank_account.account_type).to eq("checking")
|
97
|
+
expect(us_bank_account.account_holder_name).to eq("John Doe")
|
98
|
+
expect(us_bank_account.bank_name).to match(/CHASE/)
|
99
|
+
expect(us_bank_account.ach_mandate.text).to eq("cl mandate text")
|
100
|
+
expect(us_bank_account.ach_mandate.accepted_at).to be_a Time
|
101
101
|
end
|
102
102
|
|
103
103
|
it "does not creates a transaction using a us bank account and returns raises an exception" do
|
@@ -105,7 +105,7 @@ describe Braintree::UsBankAccount do
|
|
105
105
|
Braintree::UsBankAccount.sale!(
|
106
106
|
generate_invalid_us_bank_account_nonce,
|
107
107
|
:merchant_account_id => SpecHelper::UsBankMerchantAccountId,
|
108
|
-
:amount => "100.00"
|
108
|
+
:amount => "100.00",
|
109
109
|
)
|
110
110
|
end.to raise_error(Braintree::ValidationsFailed)
|
111
111
|
end
|