braintree 4.14.0 → 4.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/braintree/account_updater_daily_report.rb +3 -3
- data/lib/braintree/ach_mandate.rb +1 -1
- data/lib/braintree/add_on_gateway.rb +1 -1
- data/lib/braintree/address.rb +4 -4
- data/lib/braintree/address_gateway.rb +5 -5
- data/lib/braintree/advanced_search.rb +10 -10
- data/lib/braintree/apple_pay.rb +3 -3
- data/lib/braintree/apple_pay_card.rb +3 -3
- data/lib/braintree/apple_pay_options.rb +3 -3
- data/lib/braintree/authorization_adjustment.rb +3 -3
- data/lib/braintree/base_module.rb +1 -1
- data/lib/braintree/bin_data.rb +2 -2
- data/lib/braintree/client_token_gateway.rb +1 -1
- data/lib/braintree/configuration.rb +22 -22
- data/lib/braintree/connected_merchant_paypal_status_changed.rb +1 -1
- data/lib/braintree/connected_merchant_status_transitioned.rb +1 -1
- data/lib/braintree/credit_card.rb +22 -9
- data/lib/braintree/credit_card_gateway.rb +23 -11
- data/lib/braintree/credit_card_verification.rb +3 -3
- data/lib/braintree/credit_card_verification_gateway.rb +28 -11
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +5 -9
- data/lib/braintree/customer_gateway.rb +7 -7
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/descriptor.rb +1 -1
- data/lib/braintree/digest.rb +1 -1
- data/lib/braintree/disbursement.rb +5 -5
- data/lib/braintree/discount_gateway.rb +1 -1
- data/lib/braintree/dispute/evidence.rb +1 -1
- data/lib/braintree/dispute/paypal_message.rb +1 -1
- data/lib/braintree/dispute/status_history.rb +1 -1
- data/lib/braintree/dispute/transaction.rb +1 -1
- data/lib/braintree/dispute/transaction_details.rb +1 -1
- data/lib/braintree/dispute.rb +3 -3
- data/lib/braintree/dispute_gateway.rb +1 -1
- data/lib/braintree/dispute_search.rb +1 -1
- data/lib/braintree/document_upload.rb +2 -2
- data/lib/braintree/document_upload_gateway.rb +3 -3
- data/lib/braintree/enriched_customer_data.rb +2 -2
- data/lib/braintree/error_codes.rb +4 -0
- data/lib/braintree/error_result.rb +2 -3
- data/lib/braintree/errors.rb +3 -3
- data/lib/braintree/exceptions.rb +1 -2
- data/lib/braintree/exchange_rate.rb +2 -2
- data/lib/braintree/exchange_rate_quote.rb +3 -3
- data/lib/braintree/exchange_rate_quote_gateway.rb +1 -1
- data/lib/braintree/exchange_rate_quote_input.rb +3 -3
- data/lib/braintree/exchange_rate_quote_request.rb +3 -3
- data/lib/braintree/exchange_rate_quote_response.rb +3 -3
- data/lib/braintree/facilitated_details.rb +1 -1
- data/lib/braintree/facilitator_details.rb +1 -1
- data/lib/braintree/google_pay_card.rb +3 -3
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +1 -1
- data/lib/braintree/http.rb +5 -5
- data/lib/braintree/local_payment_completed.rb +2 -2
- data/lib/braintree/local_payment_expired.rb +2 -2
- data/lib/braintree/local_payment_funded.rb +2 -2
- data/lib/braintree/local_payment_reversed.rb +2 -2
- data/lib/braintree/merchant.rb +3 -3
- data/lib/braintree/merchant_account.rb +2 -2
- data/lib/braintree/merchant_account_gateway.rb +9 -9
- data/lib/braintree/meta_checkout_card.rb +89 -0
- data/lib/braintree/meta_checkout_token.rb +88 -0
- data/lib/braintree/modification.rb +3 -3
- data/lib/braintree/oauth_credentials.rb +3 -3
- data/lib/braintree/paginated_collection.rb +2 -2
- data/lib/braintree/paginated_result.rb +1 -1
- data/lib/braintree/payment_instrument_type.rb +2 -0
- data/lib/braintree/payment_method_customer_data_updated_metadata.rb +2 -2
- data/lib/braintree/payment_method_gateway.rb +23 -10
- data/lib/braintree/payment_method_nonce.rb +4 -4
- data/lib/braintree/payment_method_nonce_details.rb +1 -1
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +1 -1
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/paypal_account.rb +1 -2
- data/lib/braintree/paypal_account_gateway.rb +5 -5
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/plan_gateway.rb +2 -2
- data/lib/braintree/resource_collection.rb +2 -2
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +1 -1
- data/lib/braintree/samsung_pay_card.rb +5 -5
- data/lib/braintree/sepa_direct_debit_account.rb +2 -2
- data/lib/braintree/sepa_direct_debit_account_nonce_details.rb +1 -1
- data/lib/braintree/settlement_batch_summary_gateway.rb +1 -1
- data/lib/braintree/sha256_digest.rb +1 -1
- data/lib/braintree/subscription/status_details.rb +1 -1
- data/lib/braintree/subscription.rb +2 -2
- data/lib/braintree/subscription_gateway.rb +6 -6
- data/lib/braintree/subscription_search.rb +1 -1
- data/lib/braintree/successful_result.rb +2 -2
- data/lib/braintree/test/credit_card.rb +7 -10
- data/lib/braintree/test/merchant_account.rb +1 -1
- data/lib/braintree/test/nonce.rb +4 -0
- data/lib/braintree/test/transaction_amounts.rb +2 -3
- data/lib/braintree/test/venmo_sdk.rb +2 -0
- data/lib/braintree/testing_gateway.rb +1 -1
- data/lib/braintree/three_d_secure_info.rb +1 -1
- data/lib/braintree/transaction/address_details.rb +2 -1
- data/lib/braintree/transaction/credit_card_details.rb +4 -1
- data/lib/braintree/transaction/customer_details.rb +1 -1
- data/lib/braintree/transaction/disbursement_details.rb +1 -1
- data/lib/braintree/transaction/local_payment_details.rb +2 -0
- data/lib/braintree/transaction/meta_checkout_card_details.rb +52 -0
- data/lib/braintree/transaction/meta_checkout_token_details.rb +54 -0
- data/lib/braintree/transaction/package_details.rb +16 -0
- data/lib/braintree/transaction/samsung_pay_card_details.rb +1 -1
- data/lib/braintree/transaction/sepa_direct_debit_account_details.rb +1 -1
- data/lib/braintree/transaction/status_details.rb +1 -1
- data/lib/braintree/transaction/subscription_details.rb +1 -1
- data/lib/braintree/transaction/us_bank_account_details.rb +1 -1
- data/lib/braintree/transaction/visa_checkout_card_details.rb +1 -1
- data/lib/braintree/transaction.rb +37 -20
- data/lib/braintree/transaction_gateway.rb +44 -15
- data/lib/braintree/transaction_line_item.rb +13 -10
- data/lib/braintree/transaction_line_item_gateway.rb +1 -1
- data/lib/braintree/transaction_review.rb +1 -1
- data/lib/braintree/transaction_search.rb +7 -6
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +2 -2
- data/lib/braintree/us_bank_account_verification.rb +23 -15
- data/lib/braintree/us_bank_account_verification_search.rb +1 -1
- data/lib/braintree/util.rb +3 -3
- data/lib/braintree/validation_error.rb +1 -1
- data/lib/braintree/validation_error_collection.rb +3 -3
- data/lib/braintree/venmo_account.rb +3 -3
- data/lib/braintree/venmo_profile_data.rb +6 -4
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +7 -7
- data/lib/braintree/webhook_notification.rb +3 -2
- data/lib/braintree/webhook_notification_gateway.rb +4 -4
- data/lib/braintree/webhook_testing.rb +1 -1
- data/lib/braintree/webhook_testing_gateway.rb +18 -1
- data/lib/braintree/xml/generator.rb +1 -1
- data/lib/braintree/xml/libxml.rb +1 -1
- data/lib/braintree/xml/parser.rb +3 -3
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +5 -1
- data/spec/integration/braintree/add_on_spec.rb +9 -9
- data/spec/integration/braintree/address_spec.rb +69 -69
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +8 -8
- data/spec/integration/braintree/client_api/client_token_spec.rb +15 -15
- data/spec/integration/braintree/client_api/spec_helper.rb +2 -2
- data/spec/integration/braintree/credit_card_spec.rb +227 -228
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
- data/spec/integration/braintree/credit_card_verification_spec.rb +98 -53
- data/spec/integration/braintree/customer_search_spec.rb +20 -20
- data/spec/integration/braintree/customer_spec.rb +317 -317
- data/spec/integration/braintree/disbursement_spec.rb +2 -2
- data/spec/integration/braintree/discount_spec.rb +9 -9
- data/spec/integration/braintree/dispute_search_spec.rb +0 -1
- data/spec/integration/braintree/dispute_spec.rb +87 -87
- data/spec/integration/braintree/document_upload_spec.rb +17 -17
- data/spec/integration/braintree/error_codes_spec.rb +2 -2
- data/spec/integration/braintree/http_spec.rb +28 -28
- data/spec/integration/braintree/merchant_account_spec.rb +127 -127
- data/spec/integration/braintree/merchant_spec.rb +103 -103
- data/spec/integration/braintree/oauth_spec.rb +61 -61
- data/spec/integration/braintree/package_tracking_spec.rb +111 -0
- data/spec/integration/braintree/payment_method_nonce_spec.rb +89 -69
- data/spec/integration/braintree/payment_method_spec.rb +391 -391
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +150 -78
- data/spec/integration/braintree/paypal_account_spec.rb +38 -38
- data/spec/integration/braintree/plan_spec.rb +15 -15
- data/spec/integration/braintree/samsung_pay_card_spec.rb +65 -65
- data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +51 -51
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +11 -11
- data/spec/integration/braintree/subscription_spec.rb +364 -364
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +19 -19
- data/spec/integration/braintree/transaction_line_item_spec.rb +12 -6
- data/spec/integration/braintree/transaction_search_spec.rb +225 -165
- data/spec/integration/braintree/transaction_spec.rb +1606 -1230
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -32
- data/spec/integration/braintree/us_bank_account_spec.rb +30 -30
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +18 -18
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +33 -33
- data/spec/integration/braintree/visa_checkout_card_spec.rb +57 -57
- data/spec/spec_helper.rb +9 -8
- data/spec/unit/braintree/address_spec.rb +8 -8
- data/spec/unit/braintree/base_module_spec.rb +4 -4
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +57 -57
- data/spec/unit/braintree/credentials_parser_spec.rb +6 -6
- data/spec/unit/braintree/credit_card_spec.rb +31 -29
- data/spec/unit/braintree/credit_card_verification_gateway_spec.rb +33 -28
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +9 -9
- data/spec/unit/braintree/credit_card_verification_spec.rb +17 -17
- data/spec/unit/braintree/customer_spec.rb +41 -40
- data/spec/unit/braintree/digest_spec.rb +5 -5
- data/spec/unit/braintree/disbursement_spec.rb +11 -11
- data/spec/unit/braintree/dispute_search_spec.rb +2 -2
- data/spec/unit/braintree/dispute_spec.rb +56 -56
- data/spec/unit/braintree/document_upload_spec.rb +8 -8
- data/spec/unit/braintree/enriched_customer_data_spec.rb +11 -2
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +9 -9
- data/spec/unit/braintree/http_spec.rb +9 -9
- data/spec/unit/braintree/local_payment_completed_spec.rb +11 -11
- data/spec/unit/braintree/local_payment_expired_spec.rb +2 -2
- data/spec/unit/braintree/local_payment_funded_spec.rb +6 -6
- data/spec/unit/braintree/merchant_account_spec.rb +4 -4
- data/spec/unit/braintree/meta_checkout_card_details_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_card_spec.rb +60 -0
- data/spec/unit/braintree/meta_checkout_token_details_spec.rb +63 -0
- data/spec/unit/braintree/meta_checkout_token_spec.rb +63 -0
- data/spec/unit/braintree/modification_spec.rb +1 -1
- data/spec/unit/braintree/package_tracking_spec.rb +74 -0
- data/spec/unit/braintree/payment_method_customer_data_updated_metadata_spec.rb +6 -6
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +7 -7
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +14 -14
- data/spec/unit/braintree/payment_method_spec.rb +19 -19
- data/spec/unit/braintree/paypal_account_spec.rb +4 -4
- data/spec/unit/braintree/resource_collection_spec.rb +7 -7
- data/spec/unit/braintree/sepa_debit_account_nonce_details_spec.rb +1 -1
- data/spec/unit/braintree/sha256_digest_spec.rb +1 -1
- data/spec/unit/braintree/signature_service_spec.rb +2 -2
- data/spec/unit/braintree/subscription_search_spec.rb +17 -17
- data/spec/unit/braintree/subscription_spec.rb +8 -8
- data/spec/unit/braintree/successful_result_spec.rb +5 -5
- data/spec/unit/braintree/three_d_secure_info_spec.rb +20 -20
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +5 -5
- data/spec/unit/braintree/transaction/customer_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction/deposit_details_spec.rb +2 -2
- data/spec/unit/braintree/transaction/local_payment_details_spec.rb +30 -0
- data/spec/unit/braintree/transaction_gateway_spec.rb +41 -9
- data/spec/unit/braintree/transaction_search_spec.rb +2 -2
- data/spec/unit/braintree/transaction_spec.rb +101 -93
- data/spec/unit/braintree/unknown_payment_method_spec.rb +4 -4
- data/spec/unit/braintree/us_bank_account_spec.rb +2 -2
- data/spec/unit/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/unit/braintree/us_bank_account_verification_spec.rb +12 -7
- data/spec/unit/braintree/util_spec.rb +27 -27
- data/spec/unit/braintree/validation_error_collection_spec.rb +34 -34
- data/spec/unit/braintree/validation_error_spec.rb +4 -4
- data/spec/unit/braintree/venmo_profile_data_spec.rb +16 -5
- data/spec/unit/braintree/webhook_notification_spec.rb +206 -191
- data/spec/unit/braintree/xml/libxml_spec.rb +5 -5
- data/spec/unit/braintree/xml/parser_spec.rb +8 -8
- data/spec/unit/braintree/xml/rexml_spec.rb +5 -5
- data/spec/unit/braintree/xml_spec.rb +17 -17
- data/spec/unit/braintree_spec.rb +2 -2
- metadata +14 -2
@@ -76,14 +76,14 @@ describe Braintree::Transaction do
|
|
76
76
|
:fax => "012-161-8055"
|
77
77
|
},
|
78
78
|
)
|
79
|
-
transaction.customer_details.id.
|
80
|
-
transaction.customer_details.first_name.
|
81
|
-
transaction.customer_details.last_name.
|
82
|
-
transaction.customer_details.company.
|
83
|
-
transaction.customer_details.email.
|
84
|
-
transaction.customer_details.website.
|
85
|
-
transaction.customer_details.phone.
|
86
|
-
transaction.customer_details.fax.
|
79
|
+
expect(transaction.customer_details.id).to eq("123")
|
80
|
+
expect(transaction.customer_details.first_name).to eq("Adam")
|
81
|
+
expect(transaction.customer_details.last_name).to eq("Taylor")
|
82
|
+
expect(transaction.customer_details.company).to eq("Ledner LLC")
|
83
|
+
expect(transaction.customer_details.email).to eq("adam.taylor@lednerllc.com")
|
84
|
+
expect(transaction.customer_details.website).to eq("lednerllc.com")
|
85
|
+
expect(transaction.customer_details.phone).to eq("1-999-652-4189 x56883")
|
86
|
+
expect(transaction.customer_details.fax).to eq("012-161-8055")
|
87
87
|
end
|
88
88
|
|
89
89
|
it "sets up disbursement attributes in disbursement_details" do
|
@@ -99,12 +99,12 @@ describe Braintree::Transaction do
|
|
99
99
|
},
|
100
100
|
)
|
101
101
|
disbursement = transaction.disbursement_details
|
102
|
-
disbursement.disbursement_date.
|
103
|
-
disbursement.settlement_amount.
|
104
|
-
disbursement.settlement_currency_iso_code.
|
105
|
-
disbursement.settlement_currency_exchange_rate.
|
106
|
-
disbursement.funds_held
|
107
|
-
disbursement.success
|
102
|
+
expect(disbursement.disbursement_date).to eq(Date.parse("2013-04-03"))
|
103
|
+
expect(disbursement.settlement_amount).to eq("120.00")
|
104
|
+
expect(disbursement.settlement_currency_iso_code).to eq("USD")
|
105
|
+
expect(disbursement.settlement_currency_exchange_rate).to eq("1")
|
106
|
+
expect(disbursement.funds_held?).to be(false)
|
107
|
+
expect(disbursement.success?).to be(true)
|
108
108
|
end
|
109
109
|
|
110
110
|
it "sets up credit card attributes in credit_card_details" do
|
@@ -129,22 +129,22 @@ describe Braintree::Transaction do
|
|
129
129
|
:issuing_bank => "Mr Tumnus"
|
130
130
|
},
|
131
131
|
)
|
132
|
-
transaction.credit_card_details.token.
|
133
|
-
transaction.credit_card_details.bin.
|
134
|
-
transaction.credit_card_details.last_4.
|
135
|
-
transaction.credit_card_details.card_type.
|
136
|
-
transaction.credit_card_details.expiration_month.
|
137
|
-
transaction.credit_card_details.expiration_year.
|
138
|
-
transaction.credit_card_details.customer_location.
|
139
|
-
transaction.credit_card_details.prepaid.
|
140
|
-
transaction.credit_card_details.healthcare.
|
141
|
-
transaction.credit_card_details.durbin_regulated.
|
142
|
-
transaction.credit_card_details.debit.
|
143
|
-
transaction.credit_card_details.commercial.
|
144
|
-
transaction.credit_card_details.payroll.
|
145
|
-
transaction.credit_card_details.product_id.
|
146
|
-
transaction.credit_card_details.country_of_issuance.
|
147
|
-
transaction.credit_card_details.issuing_bank.
|
132
|
+
expect(transaction.credit_card_details.token).to eq("mzg2")
|
133
|
+
expect(transaction.credit_card_details.bin).to eq("411111")
|
134
|
+
expect(transaction.credit_card_details.last_4).to eq("1111")
|
135
|
+
expect(transaction.credit_card_details.card_type).to eq("Visa")
|
136
|
+
expect(transaction.credit_card_details.expiration_month).to eq("08")
|
137
|
+
expect(transaction.credit_card_details.expiration_year).to eq("2009")
|
138
|
+
expect(transaction.credit_card_details.customer_location).to eq("US")
|
139
|
+
expect(transaction.credit_card_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
140
|
+
expect(transaction.credit_card_details.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
|
141
|
+
expect(transaction.credit_card_details.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
|
142
|
+
expect(transaction.credit_card_details.debit).to eq(Braintree::CreditCard::Debit::Yes)
|
143
|
+
expect(transaction.credit_card_details.commercial).to eq(Braintree::CreditCard::Commercial::No)
|
144
|
+
expect(transaction.credit_card_details.payroll).to eq(Braintree::CreditCard::Payroll::Unknown)
|
145
|
+
expect(transaction.credit_card_details.product_id).to eq(Braintree::CreditCard::ProductId::Unknown)
|
146
|
+
expect(transaction.credit_card_details.country_of_issuance).to eq("Narnia")
|
147
|
+
expect(transaction.credit_card_details.issuing_bank).to eq("Mr Tumnus")
|
148
148
|
end
|
149
149
|
|
150
150
|
it "sets up network token attributes in network_token_details" do
|
@@ -170,23 +170,23 @@ describe Braintree::Transaction do
|
|
170
170
|
:is_network_tokenized => true
|
171
171
|
},
|
172
172
|
)
|
173
|
-
transaction.network_token_details.token.
|
174
|
-
transaction.network_token_details.bin.
|
175
|
-
transaction.network_token_details.last_4.
|
176
|
-
transaction.network_token_details.card_type.
|
177
|
-
transaction.network_token_details.expiration_month.
|
178
|
-
transaction.network_token_details.expiration_year.
|
179
|
-
transaction.network_token_details.customer_location.
|
180
|
-
transaction.network_token_details.prepaid.
|
181
|
-
transaction.network_token_details.healthcare.
|
182
|
-
transaction.network_token_details.durbin_regulated.
|
183
|
-
transaction.network_token_details.debit.
|
184
|
-
transaction.network_token_details.commercial.
|
185
|
-
transaction.network_token_details.payroll.
|
186
|
-
transaction.network_token_details.product_id.
|
187
|
-
transaction.network_token_details.country_of_issuance.
|
188
|
-
transaction.network_token_details.issuing_bank.
|
189
|
-
transaction.network_token_details.is_network_tokenized
|
173
|
+
expect(transaction.network_token_details.token).to eq("mzg2")
|
174
|
+
expect(transaction.network_token_details.bin).to eq("411111")
|
175
|
+
expect(transaction.network_token_details.last_4).to eq("1111")
|
176
|
+
expect(transaction.network_token_details.card_type).to eq("Visa")
|
177
|
+
expect(transaction.network_token_details.expiration_month).to eq("08")
|
178
|
+
expect(transaction.network_token_details.expiration_year).to eq("2009")
|
179
|
+
expect(transaction.network_token_details.customer_location).to eq("US")
|
180
|
+
expect(transaction.network_token_details.prepaid).to eq(Braintree::CreditCard::Prepaid::Yes)
|
181
|
+
expect(transaction.network_token_details.healthcare).to eq(Braintree::CreditCard::Healthcare::Yes)
|
182
|
+
expect(transaction.network_token_details.durbin_regulated).to eq(Braintree::CreditCard::DurbinRegulated::Yes)
|
183
|
+
expect(transaction.network_token_details.debit).to eq(Braintree::CreditCard::Debit::Yes)
|
184
|
+
expect(transaction.network_token_details.commercial).to eq(Braintree::CreditCard::Commercial::No)
|
185
|
+
expect(transaction.network_token_details.payroll).to eq(Braintree::CreditCard::Payroll::Unknown)
|
186
|
+
expect(transaction.network_token_details.product_id).to eq(Braintree::CreditCard::ProductId::Unknown)
|
187
|
+
expect(transaction.network_token_details.country_of_issuance).to eq("Narnia")
|
188
|
+
expect(transaction.network_token_details.issuing_bank).to eq("Mr Tumnus")
|
189
|
+
expect(transaction.network_token_details.is_network_tokenized?).to eq(true)
|
190
190
|
end
|
191
191
|
|
192
192
|
it "sets up three_d_secure_info" do
|
@@ -200,10 +200,10 @@ describe Braintree::Transaction do
|
|
200
200
|
},
|
201
201
|
)
|
202
202
|
|
203
|
-
transaction.three_d_secure_info.enrolled.
|
204
|
-
transaction.three_d_secure_info.status.
|
205
|
-
transaction.three_d_secure_info.liability_shifted.
|
206
|
-
transaction.three_d_secure_info.liability_shift_possible.
|
203
|
+
expect(transaction.three_d_secure_info.enrolled).to eq("Y")
|
204
|
+
expect(transaction.three_d_secure_info.status).to eq("authenticate_successful")
|
205
|
+
expect(transaction.three_d_secure_info.liability_shifted).to eq(true)
|
206
|
+
expect(transaction.three_d_secure_info.liability_shift_possible).to eq(true)
|
207
207
|
end
|
208
208
|
|
209
209
|
it "sets up history attributes in status_history" do
|
@@ -216,13 +216,13 @@ describe Braintree::Transaction do
|
|
216
216
|
{:timestamp => Time.utc(2010,1,15), :amount => "12.00", :transaction_source => "API",
|
217
217
|
:user => "curly", :status => "scheduled_for_settlement"}
|
218
218
|
])
|
219
|
-
transaction.status_history.size.
|
220
|
-
transaction.status_history[0].user.
|
221
|
-
transaction.status_history[0].amount.
|
222
|
-
transaction.status_history[0].status.
|
223
|
-
transaction.status_history[0].transaction_source.
|
224
|
-
transaction.status_history[0].timestamp.
|
225
|
-
transaction.status_history[1].user.
|
219
|
+
expect(transaction.status_history.size).to eq(2)
|
220
|
+
expect(transaction.status_history[0].user).to eq("larry")
|
221
|
+
expect(transaction.status_history[0].amount).to eq("12.00")
|
222
|
+
expect(transaction.status_history[0].status).to eq(Braintree::Transaction::Status::Authorized)
|
223
|
+
expect(transaction.status_history[0].transaction_source).to eq("API")
|
224
|
+
expect(transaction.status_history[0].timestamp).to eq(time)
|
225
|
+
expect(transaction.status_history[1].user).to eq("curly")
|
226
226
|
end
|
227
227
|
|
228
228
|
it "sets up authorization_adjustments" do
|
@@ -233,17 +233,17 @@ describe Braintree::Transaction do
|
|
233
233
|
{:timestamp => timestamp, :processor_response_code => "1000", :processor_response_text => "Approved", :amount => "12.00", :success => true},
|
234
234
|
{:timestamp => timestamp, :processor_response_code => "3000", :processor_response_text => "Processor Network Unavailable - Try Again", :amount => "12.34", :success => false},
|
235
235
|
])
|
236
|
-
transaction.authorization_adjustments.size.
|
237
|
-
transaction.authorization_adjustments[0].amount.
|
238
|
-
transaction.authorization_adjustments[0].success.
|
239
|
-
transaction.authorization_adjustments[0].timestamp.
|
240
|
-
transaction.authorization_adjustments[0].processor_response_code.
|
241
|
-
transaction.authorization_adjustments[0].processor_response_text.
|
242
|
-
transaction.authorization_adjustments[1].amount.
|
243
|
-
transaction.authorization_adjustments[1].success.
|
244
|
-
transaction.authorization_adjustments[1].timestamp.
|
245
|
-
transaction.authorization_adjustments[1].processor_response_code.
|
246
|
-
transaction.authorization_adjustments[1].processor_response_text.
|
236
|
+
expect(transaction.authorization_adjustments.size).to eq(2)
|
237
|
+
expect(transaction.authorization_adjustments[0].amount).to eq("12.00")
|
238
|
+
expect(transaction.authorization_adjustments[0].success).to eq(true)
|
239
|
+
expect(transaction.authorization_adjustments[0].timestamp).to eq(timestamp)
|
240
|
+
expect(transaction.authorization_adjustments[0].processor_response_code).to eq("1000")
|
241
|
+
expect(transaction.authorization_adjustments[0].processor_response_text).to eq("Approved")
|
242
|
+
expect(transaction.authorization_adjustments[1].amount).to eq("12.34")
|
243
|
+
expect(transaction.authorization_adjustments[1].success).to eq(false)
|
244
|
+
expect(transaction.authorization_adjustments[1].timestamp).to eq(timestamp)
|
245
|
+
expect(transaction.authorization_adjustments[1].processor_response_code).to eq("3000")
|
246
|
+
expect(transaction.authorization_adjustments[1].processor_response_text).to eq("Processor Network Unavailable - Try Again")
|
247
247
|
end
|
248
248
|
|
249
249
|
it "accepts retry_ids and retried_transaction_id attributes in a transactions" do
|
@@ -252,9 +252,9 @@ describe Braintree::Transaction do
|
|
252
252
|
:retry_ids => ["retry_id_1"],
|
253
253
|
:retried_transaction_id => "original_retried_tranction_id",
|
254
254
|
)
|
255
|
-
transaction.retry_ids.count.
|
256
|
-
transaction.retry_ids[0].
|
257
|
-
transaction.retried_transaction_id.
|
255
|
+
expect(transaction.retry_ids.count).to eq(1)
|
256
|
+
expect(transaction.retry_ids[0]).to eq("retry_id_1")
|
257
|
+
expect(transaction.retried_transaction_id).to eq("original_retried_tranction_id")
|
258
258
|
end
|
259
259
|
|
260
260
|
it "handles receiving custom as an empty string" do
|
@@ -265,8 +265,8 @@ describe Braintree::Transaction do
|
|
265
265
|
end
|
266
266
|
|
267
267
|
it "accepts amount as either a String or a BigDecimal" do
|
268
|
-
Braintree::Transaction._new(:gateway, :amount => "12.34").amount.
|
269
|
-
Braintree::Transaction._new(:gateway, :amount => BigDecimal("12.34")).amount.
|
268
|
+
expect(Braintree::Transaction._new(:gateway, :amount => "12.34").amount).to eq(BigDecimal("12.34"))
|
269
|
+
expect(Braintree::Transaction._new(:gateway, :amount => BigDecimal("12.34")).amount).to eq(BigDecimal("12.34"))
|
270
270
|
end
|
271
271
|
|
272
272
|
it "blows up if amount is not a string or BigDecimal" do
|
@@ -280,7 +280,7 @@ describe Braintree::Transaction do
|
|
280
280
|
:gateway,
|
281
281
|
:risk_data => nil,
|
282
282
|
)
|
283
|
-
transaction.risk_data.
|
283
|
+
expect(transaction.risk_data).to be_nil
|
284
284
|
end
|
285
285
|
|
286
286
|
it "accepts network_transaction_id" do
|
@@ -288,7 +288,7 @@ describe Braintree::Transaction do
|
|
288
288
|
:gateway,
|
289
289
|
:network_transaction_id => "123456789012345",
|
290
290
|
)
|
291
|
-
transaction.network_transaction_id.
|
291
|
+
expect(transaction.network_transaction_id).to eq("123456789012345")
|
292
292
|
end
|
293
293
|
|
294
294
|
it "accepts ach_return_code" do
|
@@ -339,7 +339,15 @@ describe Braintree::Transaction do
|
|
339
339
|
},
|
340
340
|
)
|
341
341
|
details = transaction.sepa_direct_debit_account_details
|
342
|
-
details.token.
|
342
|
+
expect(details.token).to eq("1234")
|
343
|
+
end
|
344
|
+
|
345
|
+
it "accepts debit_network" do
|
346
|
+
transaction = Braintree::Transaction._new(
|
347
|
+
:gateway,
|
348
|
+
:debit_network => "STAR",
|
349
|
+
)
|
350
|
+
expect(transaction.debit_network).to eq "STAR"
|
343
351
|
end
|
344
352
|
end
|
345
353
|
|
@@ -354,8 +362,8 @@ describe Braintree::Transaction do
|
|
354
362
|
:processed_with_network_token => false,
|
355
363
|
)
|
356
364
|
output = transaction.inspect
|
357
|
-
output.
|
358
|
-
output.
|
365
|
+
expect(output).to include(%Q(#<Braintree::Transaction id: "1234", type: "sale", amount: "100.0", status: "authorized"))
|
366
|
+
expect(output).to include(%Q(processed_with_network_token?: false))
|
359
367
|
end
|
360
368
|
end
|
361
369
|
|
@@ -364,27 +372,27 @@ describe Braintree::Transaction do
|
|
364
372
|
first = Braintree::Transaction._new(:gateway, :id => 123)
|
365
373
|
second = Braintree::Transaction._new(:gateway, :id => 123)
|
366
374
|
|
367
|
-
first.
|
368
|
-
second.
|
375
|
+
expect(first).to eq(second)
|
376
|
+
expect(second).to eq(first)
|
369
377
|
end
|
370
378
|
|
371
379
|
it "returns false for transactions with different ids" do
|
372
380
|
first = Braintree::Transaction._new(:gateway, :id => 123)
|
373
381
|
second = Braintree::Transaction._new(:gateway, :id => 124)
|
374
382
|
|
375
|
-
first.
|
376
|
-
second.
|
383
|
+
expect(first).not_to eq(second)
|
384
|
+
expect(second).not_to eq(first)
|
377
385
|
end
|
378
386
|
|
379
387
|
it "returns false when comparing to nil" do
|
380
|
-
Braintree::Transaction._new(:gateway, {}).
|
388
|
+
expect(Braintree::Transaction._new(:gateway, {})).not_to eq(nil)
|
381
389
|
end
|
382
390
|
|
383
391
|
it "returns false when comparing to non-transactions" do
|
384
392
|
same_id_different_object = Object.new
|
385
393
|
def same_id_different_object.id; 123; end
|
386
394
|
transaction = Braintree::Transaction._new(:gateway, :id => 123)
|
387
|
-
transaction.
|
395
|
+
expect(transaction).not_to eq(same_id_different_object)
|
388
396
|
end
|
389
397
|
end
|
390
398
|
|
@@ -399,12 +407,12 @@ describe Braintree::Transaction do
|
|
399
407
|
describe "refunded?" do
|
400
408
|
it "is true if the transaciton has been refunded" do
|
401
409
|
transaction = Braintree::Transaction._new(:gateway, :refund_id => "123")
|
402
|
-
transaction.refunded
|
410
|
+
expect(transaction.refunded?).to eq(true)
|
403
411
|
end
|
404
412
|
|
405
413
|
it "is false if the transaciton has not been refunded" do
|
406
414
|
transaction = Braintree::Transaction._new(:gateway, :refund_id => nil)
|
407
|
-
transaction.refunded
|
415
|
+
expect(transaction.refunded?).to eq(false)
|
408
416
|
end
|
409
417
|
end
|
410
418
|
|
@@ -417,7 +425,7 @@ describe Braintree::Transaction do
|
|
417
425
|
end
|
418
426
|
|
419
427
|
it "accepts skip_advanced_fraud_checking options with value true" do
|
420
|
-
Braintree::Http.
|
428
|
+
allow(Braintree::Http).to receive(:new).and_return http_stub
|
421
429
|
expect(http_stub).to receive(:post).with(anything, skip_advanced_fraud_check_value_is(true)).and_return(mock_response)
|
422
430
|
|
423
431
|
Braintree::Transaction.sale(
|
@@ -433,7 +441,7 @@ describe Braintree::Transaction do
|
|
433
441
|
end
|
434
442
|
|
435
443
|
it "accepts skip_advanced_fraud_checking options with value false" do
|
436
|
-
Braintree::Http.
|
444
|
+
allow(Braintree::Http).to receive(:new).and_return http_stub
|
437
445
|
expect(http_stub).to receive(:post).with(anything, skip_advanced_fraud_check_value_is(false)).and_return(mock_response)
|
438
446
|
|
439
447
|
Braintree::Transaction.sale(
|
@@ -449,7 +457,7 @@ describe Braintree::Transaction do
|
|
449
457
|
end
|
450
458
|
|
451
459
|
it "doesn't include skip_advanced_fraud_checking in params if its not specified" do
|
452
|
-
Braintree::Http.
|
460
|
+
allow(Braintree::Http).to receive(:new).and_return http_stub
|
453
461
|
expect(http_stub).to receive(:post).with(anything, skip_advanced_fraud_check_value_is(nil)).and_return(mock_response)
|
454
462
|
|
455
463
|
Braintree::Transaction.sale(
|
@@ -468,19 +476,19 @@ describe Braintree::Transaction do
|
|
468
476
|
describe "processed_with_network_token?" do
|
469
477
|
it "is true if the transaction was processed with a network token" do
|
470
478
|
transaction = Braintree::Transaction._new(:gateway, :processed_with_network_token => true)
|
471
|
-
transaction.processed_with_network_token
|
479
|
+
expect(transaction.processed_with_network_token?).to eq(true)
|
472
480
|
end
|
473
481
|
|
474
482
|
it "is false if the transaction was not processed with a network token" do
|
475
483
|
transaction = Braintree::Transaction._new(:gateway, :processed_with_network_token => false)
|
476
|
-
transaction.processed_with_network_token
|
484
|
+
expect(transaction.processed_with_network_token?).to eq(false)
|
477
485
|
end
|
478
486
|
end
|
479
487
|
|
480
488
|
describe "gateway rejection reason" do
|
481
489
|
it "verifies excessive_retry mapping" do
|
482
490
|
transaction = Braintree::Transaction._new(:gateway, :gateway_rejection_reason => "excessive_retry")
|
483
|
-
transaction.gateway_rejection_reason.
|
491
|
+
expect(transaction.gateway_rejection_reason).to eq(Braintree::Transaction::GatewayRejectionReason::ExcessiveRetry)
|
484
492
|
end
|
485
493
|
end
|
486
494
|
end
|
@@ -8,26 +8,26 @@ describe Braintree::PayPalAccount do
|
|
8
8
|
describe "token" do
|
9
9
|
it "has a token identifier" do
|
10
10
|
params = {:unknown_payment_method => {:token => 1234, :default => true}}
|
11
|
-
Braintree::UnknownPaymentMethod.new(@gateway, params).token.
|
11
|
+
expect(Braintree::UnknownPaymentMethod.new(@gateway, params).token).to eq(1234)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "image_url" do
|
16
16
|
it "has a image_url" do
|
17
17
|
params = {:unknown_payment_method => {:token => 1234, :default => true}}
|
18
|
-
Braintree::UnknownPaymentMethod.new(@gateway, params).image_url.
|
18
|
+
expect(Braintree::UnknownPaymentMethod.new(@gateway, params).image_url).to eq("https://assets.braintreegateway.com/payment_method_logo/unknown.png")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "default?" do
|
23
23
|
it "is true if the paypal account is the default payment method for the customer" do
|
24
24
|
params = {:unknown_payment_method => {:token => 1234, :default => true}}
|
25
|
-
Braintree::UnknownPaymentMethod.new(@gateway, params).
|
25
|
+
expect(Braintree::UnknownPaymentMethod.new(@gateway, params)).to be_default
|
26
26
|
end
|
27
27
|
|
28
28
|
it "is false if the paypal account is not the default payment methodfor the customer" do
|
29
29
|
params = {:unknown_payment_method => {:token => 1234, :default => false}}
|
30
|
-
Braintree::UnknownPaymentMethod.new(@gateway, params).
|
30
|
+
expect(Braintree::UnknownPaymentMethod.new(@gateway, params)).not_to be_default
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -3,11 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
3
3
|
describe Braintree::UsBankAccount do
|
4
4
|
describe "default?" do
|
5
5
|
it "is true if the us bank account is the default us bank account for the customer" do
|
6
|
-
Braintree::UsBankAccount._new(:gateway, :default => true).default
|
6
|
+
expect(Braintree::UsBankAccount._new(:gateway, :default => true).default?).to eq(true)
|
7
7
|
end
|
8
8
|
|
9
9
|
it "is false if the us bank account is not the default us bank account for the customer" do
|
10
|
-
Braintree::UsBankAccount._new(:gateway, :default => false).default
|
10
|
+
expect(Braintree::UsBankAccount._new(:gateway, :default => false).default?).to eq(false)
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
@@ -6,11 +6,11 @@ module Braintree
|
|
6
6
|
it "allows All verification methods" do
|
7
7
|
search = UsBankAccountVerificationSearch.new
|
8
8
|
|
9
|
-
|
9
|
+
expect do
|
10
10
|
search.verification_method.in(
|
11
11
|
*Braintree::UsBankAccountVerification::VerificationMethod::All,
|
12
12
|
)
|
13
|
-
end.
|
13
|
+
end.not_to raise_error
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -19,7 +19,7 @@ module Braintree
|
|
19
19
|
search = UsBankAccountVerificationSearch.new
|
20
20
|
search.id.is "v_id"
|
21
21
|
|
22
|
-
search.to_hash.
|
22
|
+
expect(search.to_hash).to eq({:id => {:is => "v_id"}})
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -28,7 +28,7 @@ module Braintree
|
|
28
28
|
search = UsBankAccountVerificationSearch.new
|
29
29
|
search.ids.in("id1", "id2")
|
30
30
|
|
31
|
-
search.to_hash.
|
31
|
+
expect(search.to_hash).to eq({:ids => ["id1", "id2"]})
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -37,14 +37,14 @@ module Braintree
|
|
37
37
|
search = UsBankAccountVerificationSearch.new
|
38
38
|
search.account_holder_name.is "v_account_holder_name"
|
39
39
|
|
40
|
-
search.to_hash.
|
40
|
+
expect(search.to_hash).to eq({:account_holder_name => {:is => "v_account_holder_name"}})
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
context "created_at" do
|
45
45
|
it "is a range node" do
|
46
46
|
search = UsBankAccountVerificationSearch.new
|
47
|
-
search.created_at.
|
47
|
+
expect(search.created_at).to be_kind_of(Braintree::AdvancedSearch::RangeNode)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -53,7 +53,7 @@ module Braintree
|
|
53
53
|
search = UsBankAccountVerificationSearch.new
|
54
54
|
search.account_number.ends_with "1234"
|
55
55
|
|
56
|
-
search.to_hash.
|
56
|
+
expect(search.to_hash).to eq({:account_number => {:ends_with => "1234"}})
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -8,11 +8,16 @@ describe Braintree::UsBankAccountVerification do
|
|
8
8
|
:status => Braintree::UsBankAccountVerification::Status::Verified,
|
9
9
|
:verification_method => Braintree::UsBankAccountVerification::VerificationMethod::IndependentCheck,
|
10
10
|
:verification_determined_at => "2018-02-28T12:01:01Z",
|
11
|
+
:additional_processor_response => "some_invalid_processor_response",
|
11
12
|
)
|
12
13
|
end
|
13
14
|
|
14
15
|
it "has a status" do
|
15
|
-
verification.status.
|
16
|
+
expect(verification.status).to eq(Braintree::UsBankAccountVerification::Status::Verified)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "has additional processor response" do
|
20
|
+
expect(verification.additional_processor_response).to eq("some_invalid_processor_response")
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
@@ -67,27 +72,27 @@ describe Braintree::UsBankAccountVerification do
|
|
67
72
|
first = Braintree::UsBankAccountVerification._new(:id => "123")
|
68
73
|
second = Braintree::UsBankAccountVerification._new(:id => "123")
|
69
74
|
|
70
|
-
first.
|
71
|
-
second.
|
75
|
+
expect(first).to eq(second)
|
76
|
+
expect(second).to eq(first)
|
72
77
|
end
|
73
78
|
|
74
79
|
it "returns false for verifications with different ids" do
|
75
80
|
first = Braintree::UsBankAccountVerification._new(:id => "123")
|
76
81
|
second = Braintree::UsBankAccountVerification._new(:id => "124")
|
77
82
|
|
78
|
-
first.
|
79
|
-
second.
|
83
|
+
expect(first).not_to eq(second)
|
84
|
+
expect(second).not_to eq(first)
|
80
85
|
end
|
81
86
|
|
82
87
|
it "returns false when comparing to nil" do
|
83
|
-
Braintree::UsBankAccountVerification._new({}).
|
88
|
+
expect(Braintree::UsBankAccountVerification._new({})).not_to eq(nil)
|
84
89
|
end
|
85
90
|
|
86
91
|
it "returns false when comparing to non-verifications" do
|
87
92
|
same_id_different_object = Object.new
|
88
93
|
def same_id_different_object.id; "123"; end
|
89
94
|
verification = Braintree::UsBankAccountVerification._new(:id => "123")
|
90
|
-
verification.
|
95
|
+
expect(verification).not_to eq(same_id_different_object)
|
91
96
|
end
|
92
97
|
end
|
93
98
|
end
|