braintree 4.14.0 → 4.16.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_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_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 +1 -1
- 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 +1 -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/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 +27 -20
- data/lib/braintree/transaction_gateway.rb +23 -12
- data/lib/braintree/transaction_line_item.rb +2 -2
- 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 +3 -3
- 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 +2 -2
- data/lib/braintree/xml/rexml.rb +2 -2
- data/lib/braintree/xml.rb +1 -1
- data/lib/braintree.rb +4 -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/credit_card_spec.rb +223 -223
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +16 -16
- data/spec/integration/braintree/credit_card_verification_spec.rb +52 -52
- data/spec/integration/braintree/customer_search_spec.rb +20 -20
- data/spec/integration/braintree/customer_spec.rb +313 -313
- 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/payment_method_nonce_spec.rb +89 -69
- data/spec/integration/braintree/payment_method_spec.rb +389 -389
- 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 +6 -6
- data/spec/integration/braintree/transaction_search_spec.rb +225 -165
- data/spec/integration/braintree/transaction_spec.rb +1502 -1210
- 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 +28 -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/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 +39 -7
- 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 +11 -2
@@ -6,14 +6,14 @@ module Braintree
|
|
6
6
|
it "allows Active, Canceled, Expired, and PastDue" do
|
7
7
|
search = SubscriptionSearch.new
|
8
8
|
|
9
|
-
|
9
|
+
expect do
|
10
10
|
search.status.in(
|
11
11
|
Subscription::Status::Active,
|
12
12
|
Subscription::Status::Canceled,
|
13
13
|
Subscription::Status::Expired,
|
14
14
|
Subscription::Status::PastDue,
|
15
15
|
)
|
16
|
-
end.
|
16
|
+
end.not_to raise_error
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -22,14 +22,14 @@ module Braintree
|
|
22
22
|
search = SubscriptionSearch.new
|
23
23
|
search.in_trial_period.is true
|
24
24
|
|
25
|
-
search.to_hash.
|
25
|
+
expect(search.to_hash).to eq({:in_trial_period => [true]})
|
26
26
|
end
|
27
27
|
|
28
28
|
it "allows false" do
|
29
29
|
search = SubscriptionSearch.new
|
30
30
|
search.in_trial_period.is false
|
31
31
|
|
32
|
-
search.to_hash.
|
32
|
+
expect(search.to_hash).to eq({:in_trial_period => [false]})
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -38,14 +38,14 @@ module Braintree
|
|
38
38
|
search = SubscriptionSearch.new
|
39
39
|
search.days_past_due.is "30"
|
40
40
|
|
41
|
-
search.to_hash.
|
41
|
+
expect(search.to_hash).to eq({:days_past_due => {:is => "30"}})
|
42
42
|
end
|
43
43
|
|
44
44
|
it "coverts ints to strings" do
|
45
45
|
search = SubscriptionSearch.new
|
46
46
|
search.days_past_due.is 30
|
47
47
|
|
48
|
-
search.to_hash.
|
48
|
+
expect(search.to_hash).to eq({:days_past_due => {:is => "30"}})
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -54,7 +54,7 @@ module Braintree
|
|
54
54
|
search = SubscriptionSearch.new
|
55
55
|
search.merchant_account_id.in "ma_id1", "ma_id2"
|
56
56
|
|
57
|
-
search.to_hash.
|
57
|
+
expect(search.to_hash).to eq({:merchant_account_id => ["ma_id1", "ma_id2"]})
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
@@ -63,63 +63,63 @@ module Braintree
|
|
63
63
|
search = SubscriptionSearch.new
|
64
64
|
search.plan_id.starts_with "plan_"
|
65
65
|
|
66
|
-
search.to_hash.
|
66
|
+
expect(search.to_hash).to eq({:plan_id => {:starts_with => "plan_"}})
|
67
67
|
end
|
68
68
|
|
69
69
|
it "ends_with" do
|
70
70
|
search = SubscriptionSearch.new
|
71
71
|
search.plan_id.ends_with "_id"
|
72
72
|
|
73
|
-
search.to_hash.
|
73
|
+
expect(search.to_hash).to eq({:plan_id => {:ends_with => "_id"}})
|
74
74
|
end
|
75
75
|
|
76
76
|
it "is" do
|
77
77
|
search = SubscriptionSearch.new
|
78
78
|
search.plan_id.is "p_id"
|
79
79
|
|
80
|
-
search.to_hash.
|
80
|
+
expect(search.to_hash).to eq({:plan_id => {:is => "p_id"}})
|
81
81
|
end
|
82
82
|
|
83
83
|
it "is_not" do
|
84
84
|
search = SubscriptionSearch.new
|
85
85
|
search.plan_id.is_not "p_id"
|
86
86
|
|
87
|
-
search.to_hash.
|
87
|
+
expect(search.to_hash).to eq({:plan_id => {:is_not => "p_id"}})
|
88
88
|
end
|
89
89
|
|
90
90
|
it "contains" do
|
91
91
|
search = SubscriptionSearch.new
|
92
92
|
search.plan_id.contains "p_id"
|
93
93
|
|
94
|
-
search.to_hash.
|
94
|
+
expect(search.to_hash).to eq({:plan_id => {:contains => "p_id"}})
|
95
95
|
end
|
96
96
|
|
97
97
|
it "in" do
|
98
98
|
search = SubscriptionSearch.new
|
99
99
|
search.plan_id.in ["plan1", "plan2"]
|
100
100
|
|
101
|
-
search.to_hash.
|
101
|
+
expect(search.to_hash).to eq({:plan_id => ["plan1", "plan2"]})
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
105
105
|
context "days_past_due" do
|
106
106
|
it "is a range node" do
|
107
107
|
search = SubscriptionSearch.new
|
108
|
-
search.days_past_due.
|
108
|
+
expect(search.days_past_due).to be_kind_of(Braintree::AdvancedSearch::RangeNode)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
112
|
context "billing_cycles_remaining" do
|
113
113
|
it "is a range node" do
|
114
114
|
search = SubscriptionSearch.new
|
115
|
-
search.billing_cycles_remaining.
|
115
|
+
expect(search.billing_cycles_remaining).to be_kind_of(Braintree::AdvancedSearch::RangeNode)
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
119
|
context "created_at" do
|
120
120
|
it "is a range node" do
|
121
121
|
search = SubscriptionSearch.new
|
122
|
-
search.created_at.
|
122
|
+
expect(search.created_at).to be_kind_of(Braintree::AdvancedSearch::RangeNode)
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -128,7 +128,7 @@ module Braintree
|
|
128
128
|
search = SubscriptionSearch.new
|
129
129
|
search.id.is "s_id"
|
130
130
|
|
131
|
-
search.to_hash.
|
131
|
+
expect(search.to_hash).to eq({:id => {:is => "s_id"}})
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
@@ -11,8 +11,8 @@ describe Braintree::Subscription do
|
|
11
11
|
|
12
12
|
context "price" do
|
13
13
|
it "accepts price as either a String or a BigDecimal" do
|
14
|
-
Braintree::Subscription._new(:gateway, default_params.merge(:price => "12.34")).price.
|
15
|
-
Braintree::Subscription._new(:gateway, default_params.merge(:price => BigDecimal("12.34"))).price.
|
14
|
+
expect(Braintree::Subscription._new(:gateway, default_params.merge(:price => "12.34")).price).to eq(BigDecimal("12.34"))
|
15
|
+
expect(Braintree::Subscription._new(:gateway, default_params.merge(:price => BigDecimal("12.34"))).price).to eq(BigDecimal("12.34"))
|
16
16
|
end
|
17
17
|
|
18
18
|
it "blows up if price is not a string or BigDecimal" do
|
@@ -42,7 +42,7 @@ describe Braintree::Subscription do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "does not raise an error if subscription id does not respond to strip" do
|
45
|
-
Braintree::Http.
|
45
|
+
allow(Braintree::Http).to receive(:new).and_return double(:get => {:subscription => default_params})
|
46
46
|
expect do
|
47
47
|
Braintree::Subscription.find(8675309)
|
48
48
|
end.to_not raise_error
|
@@ -51,11 +51,11 @@ describe Braintree::Subscription do
|
|
51
51
|
|
52
52
|
describe "self.search" do
|
53
53
|
it "only allows specified values for status" do
|
54
|
-
|
54
|
+
expect do
|
55
55
|
Braintree::Subscription.search do |search|
|
56
56
|
search.status.in "Hammer"
|
57
57
|
end
|
58
|
-
end.
|
58
|
+
end.to raise_error(ArgumentError)
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
@@ -63,18 +63,18 @@ describe Braintree::Subscription do
|
|
63
63
|
it "returns true for subscriptions with the same id" do
|
64
64
|
subscription1 = Braintree::Subscription._new(:gateway, default_params.merge(:id => "123"))
|
65
65
|
subscription2 = Braintree::Subscription._new(:gateway, default_params.merge(:id => "123"))
|
66
|
-
subscription1.
|
66
|
+
expect(subscription1).to eq(subscription2)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "returns false for subscriptions with different ids" do
|
70
70
|
subscription1 = Braintree::Subscription._new(:gateway, default_params.merge(:id => "123"))
|
71
71
|
subscription2 = Braintree::Subscription._new(:gateway, default_params.merge(:id => "not_123"))
|
72
|
-
subscription1.
|
72
|
+
expect(subscription1).not_to eq(subscription2)
|
73
73
|
end
|
74
74
|
|
75
75
|
it "returns false if not comparing to a subscription" do
|
76
76
|
subscription = Braintree::Subscription._new(:gateway, default_params.merge(:id => "123"))
|
77
|
-
subscription.
|
77
|
+
expect(subscription).not_to eq("not a subscription")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
@@ -7,21 +7,21 @@ describe Braintree::SuccessfulResult do
|
|
7
7
|
:transaction => "transaction_value",
|
8
8
|
:credit_card => "credit_card_value",
|
9
9
|
)
|
10
|
-
result.success
|
11
|
-
result.transaction.
|
12
|
-
result.credit_card.
|
10
|
+
expect(result.success?).to eq(true)
|
11
|
+
expect(result.transaction).to eq("transaction_value")
|
12
|
+
expect(result.credit_card).to eq("credit_card_value")
|
13
13
|
end
|
14
14
|
|
15
15
|
it "can be initialized without any values" do
|
16
16
|
result = Braintree::SuccessfulResult.new
|
17
|
-
result.success
|
17
|
+
expect(result.success?).to eq(true)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
21
|
describe "inspect" do
|
22
22
|
it "is pretty" do
|
23
23
|
result = Braintree::SuccessfulResult.new(:transaction => "transaction_value")
|
24
|
-
result.inspect.
|
24
|
+
expect(result.inspect).to eq("#<Braintree::SuccessfulResult transaction:\"transaction_value\">")
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -29,41 +29,41 @@ describe Braintree::ThreeDSecureInfo do
|
|
29
29
|
|
30
30
|
describe "#initialize" do
|
31
31
|
it "sets attributes" do
|
32
|
-
three_d_secure_info.acs_transaction_id.
|
33
|
-
three_d_secure_info.cavv.
|
34
|
-
three_d_secure_info.ds_transaction_id.
|
35
|
-
three_d_secure_info.eci_flag.
|
36
|
-
three_d_secure_info.enrolled.
|
37
|
-
three_d_secure_info.liability_shift_possible.
|
38
|
-
three_d_secure_info.liability_shifted.
|
39
|
-
three_d_secure_info.pares_status.
|
40
|
-
three_d_secure_info.status.
|
41
|
-
three_d_secure_info.three_d_secure_authentication_id.
|
42
|
-
three_d_secure_info.three_d_secure_transaction_id.
|
43
|
-
three_d_secure_info.three_d_secure_version.
|
44
|
-
three_d_secure_info.xid.
|
45
|
-
three_d_secure_info.lookup[:trans_status].
|
46
|
-
three_d_secure_info.lookup[:trans_status_reason].
|
47
|
-
three_d_secure_info.authentication[:trans_status].
|
48
|
-
three_d_secure_info.authentication[:trans_status_reason].
|
32
|
+
expect(three_d_secure_info.acs_transaction_id).to eq("acs_id")
|
33
|
+
expect(three_d_secure_info.cavv).to eq("cavvvalue")
|
34
|
+
expect(three_d_secure_info.ds_transaction_id).to eq("dstrxid")
|
35
|
+
expect(three_d_secure_info.eci_flag).to eq("06")
|
36
|
+
expect(three_d_secure_info.enrolled).to eq("Y")
|
37
|
+
expect(three_d_secure_info.liability_shift_possible).to eq(true)
|
38
|
+
expect(three_d_secure_info.liability_shifted).to eq(true)
|
39
|
+
expect(three_d_secure_info.pares_status).to eq("Y")
|
40
|
+
expect(three_d_secure_info.status).to eq("authenticate_successful")
|
41
|
+
expect(three_d_secure_info.three_d_secure_authentication_id).to eq("auth_id")
|
42
|
+
expect(three_d_secure_info.three_d_secure_transaction_id).to eq("trans_id")
|
43
|
+
expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
|
44
|
+
expect(three_d_secure_info.xid).to eq("xidvalue")
|
45
|
+
expect(three_d_secure_info.lookup[:trans_status]).to eq("lookupstatus")
|
46
|
+
expect(three_d_secure_info.lookup[:trans_status_reason]).to eq("lookupstatusreason")
|
47
|
+
expect(three_d_secure_info.authentication[:trans_status]).to eq("authstatus")
|
48
|
+
expect(three_d_secure_info.authentication[:trans_status_reason]).to eq("authstatusreason")
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
describe "inspect" do
|
53
53
|
it "prints the attributes" do
|
54
|
-
three_d_secure_info.inspect.
|
54
|
+
expect(three_d_secure_info.inspect).to eq(%(#<ThreeDSecureInfo acs_transaction_id: "acs_id", authentication: {:trans_status=>"authstatus", :trans_status_reason=>"authstatusreason"}, cavv: "cavvvalue", ds_transaction_id: "dstrxid", eci_flag: "06", enrolled: "Y", liability_shift_possible: true, liability_shifted: true, lookup: {:trans_status=>"lookupstatus", :trans_status_reason=>"lookupstatusreason"}, pares_status: "Y", status: "authenticate_successful", three_d_secure_authentication_id: "auth_id", three_d_secure_transaction_id: "trans_id", three_d_secure_version: "1.0.2", xid: "xidvalue">))
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
describe "liability_shifted" do
|
59
59
|
it "is aliased to liability_shifted?" do
|
60
|
-
three_d_secure_info.liability_shifted
|
60
|
+
expect(three_d_secure_info.liability_shifted?).to eq(true)
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
describe "liability_shift_possible" do
|
65
65
|
it "is aliased to liability_shift_possible?" do
|
66
|
-
three_d_secure_info.liability_shift_possible
|
66
|
+
expect(three_d_secure_info.liability_shift_possible?).to eq(true)
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -7,7 +7,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
7
7
|
:expiration_month => "08",
|
8
8
|
:expiration_year => "2009",
|
9
9
|
)
|
10
|
-
details.expiration_date.
|
10
|
+
expect(details.expiration_date).to eq("08/2009")
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -34,7 +34,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
34
34
|
:image_url => "example.com/visa.png",
|
35
35
|
:unique_number_identifier => "abc123",
|
36
36
|
)
|
37
|
-
details.inspect.
|
37
|
+
expect(details.inspect).to eq(%(#<token: "token", bin: "123456", last_4: "6789", card_type: "Visa", expiration_date: "05/2012", cardholder_name: "The Cardholder", customer_location: "US", prepaid: "Yes", healthcare: "No", durbin_regulated: "No", debit: "Yes", commercial: "Unknown", payroll: "Unknown", product_id: "Unknown", country_of_issuance: "Lilliput", issuing_bank: "Gulliver Bank", image_url: "example.com/visa.png", unique_number_identifier: "abc123">))
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
@@ -43,7 +43,7 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
43
43
|
details = Braintree::Transaction::CreditCardDetails.new(
|
44
44
|
:bin => "510510", :last_4 => "5100",
|
45
45
|
)
|
46
|
-
details.masked_number.
|
46
|
+
expect(details.masked_number).to eq("510510******5100")
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
@@ -52,14 +52,14 @@ describe Braintree::Transaction::CreditCardDetails do
|
|
52
52
|
details = Braintree::Transaction::CreditCardDetails.new(
|
53
53
|
:is_network_tokenized => true,
|
54
54
|
)
|
55
|
-
details.is_network_tokenized
|
55
|
+
expect(details.is_network_tokenized?).to eq(true)
|
56
56
|
end
|
57
57
|
|
58
58
|
it "returns false if is_network_tokenized is false" do
|
59
59
|
details = Braintree::Transaction::CreditCardDetails.new(
|
60
60
|
:is_network_tokenized => false,
|
61
61
|
)
|
62
|
-
details.is_network_tokenized
|
62
|
+
expect(details.is_network_tokenized?).to eq(false)
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -13,7 +13,7 @@ describe Braintree::Transaction::CustomerDetails do
|
|
13
13
|
:phone => "6145551234",
|
14
14
|
:fax => "3125551234",
|
15
15
|
)
|
16
|
-
details.inspect.
|
16
|
+
expect(details.inspect).to eq(%(#<id: "id", first_name: "Amy", last_name: "Smith", email: "amy.smith@example.com", company: "Smith Co.", website: "http://www.example.com", phone: "6145551234", fax: "3125551234">))
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -6,13 +6,13 @@ describe Braintree::Transaction::DisbursementDetails do
|
|
6
6
|
details = Braintree::Transaction::DisbursementDetails.new(
|
7
7
|
:disbursement_date => Date.new(2013, 4, 1).to_s,
|
8
8
|
)
|
9
|
-
details.valid
|
9
|
+
expect(details.valid?).to eq(true)
|
10
10
|
end
|
11
11
|
it "returns true if disbursement details are initialized" do
|
12
12
|
details = Braintree::Transaction::DisbursementDetails.new(
|
13
13
|
:disbursement_date => nil,
|
14
14
|
)
|
15
|
-
details.valid
|
15
|
+
expect(details.valid?).to eq(false)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::Transaction::LocalPaymentDetails do
|
4
|
+
describe "initialize" do
|
5
|
+
let(:params) do
|
6
|
+
{
|
7
|
+
capture_id: "a-capture-id",
|
8
|
+
custom_field: "custom-field",
|
9
|
+
debug_id: "debug-id",
|
10
|
+
description: "description",
|
11
|
+
funding_source: "ideal",
|
12
|
+
implicitly_vaulted_payment_method_global_id: "global-id",
|
13
|
+
implicitly_vaulted_payment_method_token: "payment-method-token",
|
14
|
+
payer_id: "payer-id",
|
15
|
+
payment_id: "payment-id",
|
16
|
+
refund_from_transaction_fee_amount: "2.34",
|
17
|
+
refund_from_transaction_fee_currency_iso_code: "EUR",
|
18
|
+
refund_id: "a-refund-id",
|
19
|
+
transaction_fee_amount: "12.34",
|
20
|
+
transaction_fee_currency_iso_code: "EUR",
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
subject { described_class.new(params) }
|
25
|
+
|
26
|
+
it "sets all fields" do
|
27
|
+
is_expected.to have_attributes(**params)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -14,9 +14,9 @@ describe Braintree::TransactionGateway do
|
|
14
14
|
it "creates a transactionGateway gateway" do
|
15
15
|
result = Braintree::TransactionGateway.new(gateway)
|
16
16
|
|
17
|
-
result.inspect.
|
18
|
-
result.inspect.
|
19
|
-
result.inspect.
|
17
|
+
expect(result.inspect).to include("merchant_id")
|
18
|
+
expect(result.inspect).to include("public_key")
|
19
|
+
expect(result.inspect).to include("private_key")
|
20
20
|
end
|
21
21
|
|
22
22
|
describe "self.create" do
|
@@ -28,6 +28,9 @@ describe Braintree::TransactionGateway do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
# NEXT_MAJOR_VERSION Remove three_d_secure_token, venmo_sdk_payment_method_code, and venmo_sdk_session
|
32
|
+
# the old venmo SDK has been deprecated
|
33
|
+
# three_d_secure_token has been deprecated in favor of three_d_secure_authentication_id
|
31
34
|
it "creates a transaction gateway signature" do
|
32
35
|
expect(Braintree::TransactionGateway._create_signature).to match([
|
33
36
|
:amount, :billing_address_id, :channel, :customer_id, :device_data, :discount_amount,
|
@@ -35,8 +38,8 @@ describe Braintree::TransactionGateway do
|
|
35
38
|
:product_sku, :purchase_order_number, :service_fee_amount, :shared_billing_address_id,
|
36
39
|
:shared_customer_id, :shared_payment_method_nonce, :shared_payment_method_token,
|
37
40
|
:shared_shipping_address_id, :shipping_address_id, :shipping_amount,
|
38
|
-
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,
|
39
|
-
:
|
41
|
+
:ships_from_postal_code, :tax_amount, :tax_exempt, :three_d_secure_authentication_id,:three_d_secure_token, #Deprecated
|
42
|
+
:transaction_source, :type, :venmo_sdk_payment_method_code, #Deprecated
|
40
43
|
:sca_exemption, :currency_iso_code, :exchange_rate_quote_id,
|
41
44
|
{:line_items => [:quantity, :name, :description, :kind, :unit_amount, :unit_tax_amount, :total_amount, :discount_amount, :tax_amount, :unit_of_measure, :product_code, :commodity_code, :url]},
|
42
45
|
{:risk_data => [:customer_browser, :customer_device_id, :customer_ip, :customer_location_zip, :customer_tenure]},
|
@@ -67,7 +70,7 @@ describe Braintree::TransactionGateway do
|
|
67
70
|
:submit_for_settlement,
|
68
71
|
:add_billing_address_to_payment_method,
|
69
72
|
:store_shipping_address_in_vault,
|
70
|
-
:venmo_sdk_session,
|
73
|
+
:venmo_sdk_session, #Deprecated
|
71
74
|
:payee_id,
|
72
75
|
:payee_email,
|
73
76
|
:skip_advanced_fraud_checking,
|
@@ -91,7 +94,7 @@ describe Braintree::TransactionGateway do
|
|
91
94
|
{:industry => [
|
92
95
|
:industry_type,
|
93
96
|
{:data => [
|
94
|
-
:folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
97
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
95
98
|
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
96
99
|
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
97
100
|
{:legs => [
|
@@ -108,5 +111,34 @@ describe Braintree::TransactionGateway do
|
|
108
111
|
{:installments => [:count]},
|
109
112
|
])
|
110
113
|
end
|
114
|
+
|
115
|
+
it "creates a transaction gateway submit for settlement signature" do
|
116
|
+
expect(Braintree::TransactionGateway._submit_for_settlement_signature).to match([
|
117
|
+
:order_id,
|
118
|
+
{:descriptor => [:name, :phone, :url]},
|
119
|
+
{:industry => [
|
120
|
+
:industry_type,
|
121
|
+
{:data => [
|
122
|
+
:country_code, :date_of_birth, :folio_number, :check_in_date, :check_out_date, :travel_package, :lodging_check_in_date, :lodging_check_out_date, :departure_date, :lodging_name, :room_rate, :room_tax,
|
123
|
+
:passenger_first_name, :passenger_last_name, :passenger_middle_initial, :passenger_title, :issued_date, :travel_agency_name, :travel_agency_code, :ticket_number,
|
124
|
+
:issuing_carrier_code, :customer_code, :fare_amount, :fee_amount, :tax_amount, :restricted_ticket, :no_show, :advanced_deposit, :fire_safe, :property_phone, :ticket_issuer_address, :arrival_date,
|
125
|
+
{:legs => [
|
126
|
+
:conjunction_ticket, :exchange_ticket, :coupon_number, :service_class, :carrier_code, :fare_basis_code, :flight_number, :departure_date, :departure_airport_code, :departure_time,
|
127
|
+
:arrival_airport_code, :arrival_time, :stopover_permitted, :fare_amount, :fee_amount, :tax_amount, :endorsement_or_restrictions,
|
128
|
+
]},
|
129
|
+
{:additional_charges => [
|
130
|
+
:kind, :amount,
|
131
|
+
]},
|
132
|
+
]},
|
133
|
+
]},
|
134
|
+
:purchase_order_number,
|
135
|
+
:tax_amount,
|
136
|
+
:tax_exempt,
|
137
|
+
:discount_amount,
|
138
|
+
:shipping_amount,
|
139
|
+
:ships_from_postal_code,
|
140
|
+
:line_items => [:commodity_code, :description, :discount_amount, :kind, :name, :product_code, :quantity, :tax_amount, :total_amount, :unit_amount, :unit_of_measure, :unit_tax_amount, :url, :tax_amount],
|
141
|
+
])
|
142
|
+
end
|
111
143
|
end
|
112
144
|
end
|
@@ -5,14 +5,14 @@ describe Braintree::TransactionSearch do
|
|
5
5
|
search = Braintree::TransactionSearch.new
|
6
6
|
search.billing_company.is "one"
|
7
7
|
search.billing_company.is "two"
|
8
|
-
search.to_hash.
|
8
|
+
expect(search.to_hash).to eq({:billing_company => {:is => "two"}})
|
9
9
|
end
|
10
10
|
|
11
11
|
it "overrides previous 'in' with new 'in' for the same field" do
|
12
12
|
search = Braintree::TransactionSearch.new
|
13
13
|
search.status.in Braintree::Transaction::Status::Authorized
|
14
14
|
search.status.in Braintree::Transaction::Status::SubmittedForSettlement
|
15
|
-
search.to_hash.
|
15
|
+
expect(search.to_hash).to eq({:status => [Braintree::Transaction::Status::SubmittedForSettlement]})
|
16
16
|
end
|
17
17
|
|
18
18
|
it "raises if the operator 'is' is left off" do
|