braintree 3.1.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +8 -1
- data/lib/braintree/account_updater_daily_report.rb +1 -1
- data/lib/braintree/address.rb +2 -1
- data/lib/braintree/apple_pay.rb +1 -1
- data/lib/braintree/apple_pay_card.rb +1 -1
- data/lib/braintree/apple_pay_options.rb +1 -1
- data/lib/braintree/authorization_adjustment.rb +1 -1
- data/lib/braintree/client_token.rb +1 -1
- data/lib/braintree/configuration.rb +11 -11
- 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 +2 -2
- data/lib/braintree/credit_card_gateway.rb +14 -4
- data/lib/braintree/credit_card_verification.rb +5 -5
- data/lib/braintree/credit_card_verification_search.rb +1 -1
- data/lib/braintree/customer.rb +6 -4
- data/lib/braintree/customer_gateway.rb +2 -0
- data/lib/braintree/customer_search.rb +1 -1
- data/lib/braintree/disbursement.rb +1 -1
- data/lib/braintree/dispute.rb +15 -1
- data/lib/braintree/dispute/paypal_message.rb +15 -0
- data/lib/braintree/dispute_gateway.rb +2 -2
- data/lib/braintree/dispute_search.rb +3 -2
- data/lib/braintree/document_upload.rb +1 -1
- data/lib/braintree/error_codes.rb +12 -4
- data/lib/braintree/google_pay_card.rb +1 -1
- data/lib/braintree/granted_payment_instrument_update.rb +1 -1
- data/lib/braintree/graphql_client.rb +7 -7
- data/lib/braintree/http.rb +3 -3
- data/lib/braintree/local_payment_completed.rb +1 -1
- data/lib/braintree/local_payment_reversed.rb +19 -0
- data/lib/braintree/merchant.rb +1 -1
- data/lib/braintree/merchant_account.rb +1 -1
- data/lib/braintree/merchant_account_gateway.rb +1 -1
- data/lib/braintree/merchant_gateway.rb +1 -1
- data/lib/braintree/modification.rb +1 -1
- data/lib/braintree/oauth_credentials.rb +1 -1
- data/lib/braintree/oauth_gateway.rb +5 -5
- data/lib/braintree/payment_instrument_type.rb +10 -10
- data/lib/braintree/payment_method_gateway.rb +11 -8
- data/lib/braintree/payment_method_nonce.rb +1 -1
- data/lib/braintree/payment_method_nonce_details.rb +37 -0
- data/lib/braintree/payment_method_nonce_details_payer_info.rb +32 -0
- data/lib/braintree/payment_method_nonce_gateway.rb +1 -1
- data/lib/braintree/plan.rb +1 -1
- data/lib/braintree/processor_response_types.rb +3 -3
- data/lib/braintree/resource_collection.rb +8 -3
- data/lib/braintree/revoked_payment_method_metadata.rb +1 -1
- data/lib/braintree/risk_data.rb +3 -1
- data/lib/braintree/samsung_pay_card.rb +1 -1
- data/lib/braintree/settlement_batch_summary.rb +2 -2
- data/lib/braintree/subscription.rb +6 -6
- data/lib/braintree/test/credit_card.rb +1 -0
- data/lib/braintree/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +40 -24
- data/lib/braintree/transaction/installment.rb +28 -0
- data/lib/braintree/transaction/installment/adjustment.rb +33 -0
- data/lib/braintree/transaction_gateway.rb +27 -6
- data/lib/braintree/transaction_line_item.rb +1 -1
- data/lib/braintree/transaction_search.rb +3 -1
- data/lib/braintree/unknown_payment_method.rb +1 -1
- data/lib/braintree/us_bank_account.rb +3 -3
- data/lib/braintree/us_bank_account_verification.rb +1 -1
- data/lib/braintree/us_bank_account_verification_gateway.rb +1 -1
- data/lib/braintree/util.rb +4 -4
- data/lib/braintree/venmo_account.rb +1 -1
- data/lib/braintree/version.rb +1 -1
- data/lib/braintree/visa_checkout_card.rb +2 -2
- data/lib/braintree/webhook_notification.rb +30 -20
- data/lib/braintree/webhook_notification_gateway.rb +5 -5
- data/lib/braintree/webhook_testing_gateway.rb +30 -0
- data/lib/braintree/xml/generator.rb +5 -4
- data/lib/braintree/xml/libxml.rb +0 -1
- data/lib/braintree/xml/parser.rb +22 -12
- data/lib/braintree/xml/rexml.rb +70 -0
- data/spec/integration/braintree/add_on_spec.rb +1 -1
- data/spec/integration/braintree/address_spec.rb +28 -24
- data/spec/integration/braintree/advanced_search_spec.rb +45 -45
- data/spec/integration/braintree/apple_pay_spec.rb +3 -3
- data/spec/integration/braintree/braintree_gateway_spec.rb +2 -1
- data/spec/integration/braintree/client_api/client_token_spec.rb +14 -14
- data/spec/integration/braintree/client_api/spec_helper.rb +5 -5
- data/spec/integration/braintree/credit_card_spec.rb +213 -122
- data/spec/integration/braintree/credit_card_verification_search_spec.rb +2 -2
- data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
- data/spec/integration/braintree/customer_search_spec.rb +8 -8
- data/spec/integration/braintree/customer_spec.rb +433 -149
- data/spec/integration/braintree/dispute_search_spec.rb +28 -3
- data/spec/integration/braintree/dispute_spec.rb +6 -6
- data/spec/integration/braintree/error_codes_spec.rb +1 -1
- data/spec/integration/braintree/http_spec.rb +2 -2
- data/spec/integration/braintree/merchant_account_spec.rb +25 -26
- data/spec/integration/braintree/merchant_spec.rb +14 -14
- data/spec/integration/braintree/oauth_spec.rb +11 -11
- data/spec/integration/braintree/payment_method_nonce_spec.rb +26 -35
- data/spec/integration/braintree/payment_method_spec.rb +430 -149
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +17 -13
- data/spec/integration/braintree/paypal_account_spec.rb +28 -28
- data/spec/integration/braintree/samsung_pay_card_spec.rb +9 -9
- data/spec/integration/braintree/settlement_batch_summary_spec.rb +8 -8
- data/spec/integration/braintree/subscription_spec.rb +133 -133
- data/spec/integration/braintree/test/transaction_amounts_spec.rb +2 -2
- data/spec/integration/braintree/test_transaction_spec.rb +10 -10
- data/spec/integration/braintree/transaction_search_spec.rb +93 -67
- data/spec/integration/braintree/transaction_spec.rb +752 -383
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +32 -26
- data/spec/integration/braintree/us_bank_account_spec.rb +6 -6
- data/spec/integration/braintree/us_bank_account_verification_search_spec.rb +7 -7
- data/spec/integration/braintree/us_bank_account_verification_spec.rb +8 -8
- data/spec/integration/braintree/visa_checkout_card_spec.rb +5 -5
- data/spec/integration/spec_helper.rb +9 -3
- data/spec/oauth_test_helper.rb +1 -1
- data/spec/script/httpsd.rb +6 -6
- data/spec/spec_helper.rb +6 -3
- data/spec/unit/braintree/address_spec.rb +1 -1
- data/spec/unit/braintree/apple_pay_card_spec.rb +1 -1
- data/spec/unit/braintree/client_token_spec.rb +2 -2
- data/spec/unit/braintree/configuration_spec.rb +42 -42
- data/spec/unit/braintree/credit_card_spec.rb +13 -13
- data/spec/unit/braintree/credit_card_verification_search_spec.rb +1 -1
- data/spec/unit/braintree/credit_card_verification_spec.rb +8 -4
- data/spec/unit/braintree/customer_spec.rb +21 -10
- data/spec/unit/braintree/disbursement_spec.rb +7 -7
- data/spec/unit/braintree/dispute_search_spec.rb +1 -0
- data/spec/unit/braintree/dispute_spec.rb +34 -9
- data/spec/unit/braintree/error_result_spec.rb +5 -5
- data/spec/unit/braintree/errors_spec.rb +8 -8
- data/spec/unit/braintree/http_spec.rb +5 -5
- data/spec/unit/braintree/merchant_account_spec.rb +1 -1
- data/spec/unit/braintree/payment_method_nonce_details_payer_info_spec.rb +31 -0
- data/spec/unit/braintree/payment_method_nonce_details_spec.rb +43 -0
- data/spec/unit/braintree/payment_method_spec.rb +1 -1
- data/spec/unit/braintree/paypal_account_spec.rb +2 -2
- data/spec/unit/braintree/resource_collection_spec.rb +30 -1
- data/spec/unit/braintree/risk_data_spec.rb +9 -5
- data/spec/unit/braintree/subscription_search_spec.rb +1 -1
- data/spec/unit/braintree/successful_result_spec.rb +1 -1
- data/spec/unit/braintree/three_d_secure_info_spec.rb +32 -14
- data/spec/unit/braintree/transaction/credit_card_details_spec.rb +3 -3
- 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/installment_spec.rb +25 -0
- data/spec/unit/braintree/transaction/paypal_details_spec.rb +1 -1
- data/spec/unit/braintree/transaction_search_spec.rb +12 -12
- data/spec/unit/braintree/transaction_spec.rb +25 -17
- data/spec/unit/braintree/util_spec.rb +18 -18
- data/spec/unit/braintree/validation_error_collection_spec.rb +36 -36
- data/spec/unit/braintree/webhook_notification_spec.rb +88 -56
- data/spec/unit/braintree/xml/rexml_spec.rb +51 -0
- data/spec/unit/braintree/xml_spec.rb +31 -31
- metadata +18 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
|
|
3
3
|
describe Braintree::Customer do
|
4
4
|
describe "inspect" do
|
5
5
|
it "includes the id first" do
|
6
|
-
output = Braintree::Customer._new(:gateway, {:first_name =>
|
6
|
+
output = Braintree::Customer._new(:gateway, {:first_name => "Dan", :id => "1234"}).inspect
|
7
7
|
output.should include("#<Braintree::Customer id: \"1234\",")
|
8
8
|
end
|
9
9
|
|
@@ -18,7 +18,7 @@ describe Braintree::Customer do
|
|
18
18
|
:phone => "802-483-5932",
|
19
19
|
:website => "patrick.smith.com",
|
20
20
|
:created_at => Time.now,
|
21
|
-
:updated_at => Time.now
|
21
|
+
:updated_at => Time.now,
|
22
22
|
)
|
23
23
|
output = customer.inspect
|
24
24
|
output.should include(%q(company: "Company"))
|
@@ -31,6 +31,7 @@ describe Braintree::Customer do
|
|
31
31
|
output.should include(%q(addresses: []))
|
32
32
|
output.should include(%q(credit_cards: []))
|
33
33
|
output.should include(%q(paypal_accounts: []))
|
34
|
+
output.should include(%q(tax_identifiers: []))
|
34
35
|
output.should include(%Q(created_at: #{customer.created_at.inspect}))
|
35
36
|
output.should include(%Q(updated_at: #{customer.updated_at.inspect}))
|
36
37
|
end
|
@@ -75,7 +76,7 @@ describe Braintree::Customer do
|
|
75
76
|
|
76
77
|
describe "self.create_signature" do
|
77
78
|
it "should be what we expect" do
|
78
|
-
Braintree::CustomerGateway._create_signature.
|
79
|
+
expect(Braintree::CustomerGateway._create_signature).to match([
|
79
80
|
:company,
|
80
81
|
:email,
|
81
82
|
:fax,
|
@@ -100,7 +101,7 @@ describe Braintree::Customer do
|
|
100
101
|
:device_data,
|
101
102
|
:payment_method_nonce,
|
102
103
|
{:external_vault=>[:network_transaction_id]},
|
103
|
-
{:options => [:make_default, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type]},
|
104
|
+
{:options => match_array([:make_default, :skip_advanced_fraud_checking, :verification_merchant_account_id, :verify_card, :verification_amount, :venmo_sdk_session, :fail_on_duplicate_payment_method, :verification_account_type, :verification_currency_iso_code])},
|
104
105
|
{:billing_address => [
|
105
106
|
:company,
|
106
107
|
:country_code_alpha2,
|
@@ -133,6 +134,10 @@ describe Braintree::Customer do
|
|
133
134
|
:billing_agreement_id,
|
134
135
|
{:options => [:make_default]},
|
135
136
|
]},
|
137
|
+
{:tax_identifiers => [
|
138
|
+
:country_code,
|
139
|
+
:identifier
|
140
|
+
]},
|
136
141
|
{:options =>
|
137
142
|
[:paypal => [
|
138
143
|
:payee_email,
|
@@ -158,13 +163,13 @@ describe Braintree::Customer do
|
|
158
163
|
]]
|
159
164
|
},
|
160
165
|
{:custom_fields => :_any_key_}
|
161
|
-
]
|
166
|
+
])
|
162
167
|
end
|
163
168
|
end
|
164
169
|
|
165
170
|
describe "self.update_signature" do
|
166
171
|
it "should be what we expect" do
|
167
|
-
Braintree::CustomerGateway._update_signature.
|
172
|
+
expect(Braintree::CustomerGateway._update_signature).to match([
|
168
173
|
:company,
|
169
174
|
:email,
|
170
175
|
:fax,
|
@@ -189,16 +194,18 @@ describe Braintree::Customer do
|
|
189
194
|
:device_data,
|
190
195
|
:payment_method_nonce,
|
191
196
|
{:external_vault=>[:network_transaction_id]},
|
192
|
-
{:options => [
|
197
|
+
{:options => match_array([
|
193
198
|
:make_default,
|
199
|
+
:skip_advanced_fraud_checking,
|
194
200
|
:verification_merchant_account_id,
|
195
201
|
:verify_card,
|
196
202
|
:verification_amount,
|
197
203
|
:venmo_sdk_session,
|
198
204
|
:fail_on_duplicate_payment_method,
|
199
205
|
:verification_account_type,
|
206
|
+
:verification_currency_iso_code,
|
200
207
|
:update_existing_token
|
201
|
-
]},
|
208
|
+
])},
|
202
209
|
{:billing_address => [
|
203
210
|
:company,
|
204
211
|
:country_code_alpha2,
|
@@ -226,6 +233,10 @@ describe Braintree::Customer do
|
|
226
233
|
:ds_transaction_id,
|
227
234
|
]},
|
228
235
|
]},
|
236
|
+
{:tax_identifiers => [
|
237
|
+
:country_code,
|
238
|
+
:identifier
|
239
|
+
]},
|
229
240
|
{:options =>
|
230
241
|
[:paypal => [
|
231
242
|
:payee_email,
|
@@ -251,7 +262,7 @@ describe Braintree::Customer do
|
|
251
262
|
]]
|
252
263
|
},
|
253
264
|
{:custom_fields => :_any_key_}
|
254
|
-
]
|
265
|
+
])
|
255
266
|
end
|
256
267
|
end
|
257
268
|
|
@@ -289,7 +300,7 @@ describe Braintree::Customer do
|
|
289
300
|
:paypal_accounts => [
|
290
301
|
{:token => "paypal_1"},
|
291
302
|
{:token => "paypal_2"}
|
292
|
-
]
|
303
|
+
],
|
293
304
|
)
|
294
305
|
|
295
306
|
customer.credit_cards.size.should == 2
|
@@ -28,18 +28,18 @@ describe Braintree::Disbursement do
|
|
28
28
|
:exception_message => "invalid_account_number",
|
29
29
|
:follow_up_action => "update",
|
30
30
|
:retry => false,
|
31
|
-
:success => false
|
31
|
+
:success => false,
|
32
32
|
)
|
33
33
|
|
34
34
|
disbursement.inspect.should include('id: "123456"')
|
35
35
|
disbursement.inspect.should include('amount: "100.0"')
|
36
36
|
disbursement.inspect.should include('exception_message: "invalid_account_number"')
|
37
|
-
disbursement.inspect.should include(
|
37
|
+
disbursement.inspect.should include("disbursement_date: 2013-04-10")
|
38
38
|
disbursement.inspect.should include('follow_up_action: "update"')
|
39
|
-
disbursement.inspect.should include(
|
39
|
+
disbursement.inspect.should include("merchant_account: #<Braintree::MerchantAccount: ")
|
40
40
|
disbursement.inspect.should include('transaction_ids: ["sub_merchant_transaction"]')
|
41
|
-
disbursement.inspect.should include(
|
42
|
-
disbursement.inspect.should include(
|
41
|
+
disbursement.inspect.should include("retry: false")
|
42
|
+
disbursement.inspect.should include("success: false")
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -56,7 +56,7 @@ describe Braintree::Disbursement do
|
|
56
56
|
:status => "active"
|
57
57
|
},
|
58
58
|
:success => false,
|
59
|
-
:disbursement_date => "2013-04-10"
|
59
|
+
:disbursement_date => "2013-04-10",
|
60
60
|
)
|
61
61
|
disbursement.success?.should == false
|
62
62
|
|
@@ -71,7 +71,7 @@ describe Braintree::Disbursement do
|
|
71
71
|
:status => "active"
|
72
72
|
},
|
73
73
|
:success => true,
|
74
|
-
:disbursement_date => "2013-04-10"
|
74
|
+
:disbursement_date => "2013-04-10",
|
75
75
|
)
|
76
76
|
disbursement.success?.should == true
|
77
77
|
end
|
@@ -46,7 +46,14 @@ describe Braintree::Dispute do
|
|
46
46
|
:order_id => nil,
|
47
47
|
:purchase_order_number => "po",
|
48
48
|
:payment_instrument_subtype => "Visa",
|
49
|
-
}
|
49
|
+
},
|
50
|
+
:paypal_messages => [
|
51
|
+
{
|
52
|
+
:message => "message",
|
53
|
+
:sender => "seller",
|
54
|
+
:sent_at => Time.utc(2009, 3, 9, 10, 50, 39),
|
55
|
+
}
|
56
|
+
]
|
50
57
|
}
|
51
58
|
end
|
52
59
|
|
@@ -137,13 +144,13 @@ describe Braintree::Dispute do
|
|
137
144
|
it "does not raise an exception if the optional parameters are valid" do
|
138
145
|
Braintree::Http.stub(:new).and_return double.as_null_object
|
139
146
|
expect do
|
140
|
-
Braintree::Dispute.add_file_evidence("dispute_id", {
|
147
|
+
Braintree::Dispute.add_file_evidence("dispute_id", {category: "GENERAL", document_id: "document_id"})
|
141
148
|
end.to_not raise_error
|
142
149
|
end
|
143
150
|
|
144
151
|
it "raises an exception if the optional params contain invalid keys" do
|
145
152
|
expect do
|
146
|
-
Braintree::Dispute.add_file_evidence("dispute_id", {
|
153
|
+
Braintree::Dispute.add_file_evidence("dispute_id", {random_param: ""})
|
147
154
|
end.to raise_error(ArgumentError)
|
148
155
|
end
|
149
156
|
|
@@ -151,7 +158,7 @@ describe Braintree::Dispute do
|
|
151
158
|
Braintree::Http.stub(:new).and_return double.as_null_object
|
152
159
|
|
153
160
|
expect do
|
154
|
-
Braintree::Dispute.add_file_evidence("dispute_id", {
|
161
|
+
Braintree::Dispute.add_file_evidence("dispute_id", {category: 3, document_id: "document_id"})
|
155
162
|
end.to raise_error(ArgumentError)
|
156
163
|
end
|
157
164
|
end
|
@@ -200,31 +207,31 @@ describe Braintree::Dispute do
|
|
200
207
|
it "does not raise an exception if the optional parameters are valid" do
|
201
208
|
Braintree::Http.stub(:new).and_return double.as_null_object
|
202
209
|
expect do
|
203
|
-
Braintree::Dispute.add_text_evidence("dispute_id", {
|
210
|
+
Braintree::Dispute.add_text_evidence("dispute_id", {content: "a", category: "", sequence_number: 3})
|
204
211
|
end.to_not raise_error
|
205
212
|
end
|
206
213
|
|
207
214
|
it "raises an exception if the optional params contain invalid keys" do
|
208
215
|
expect do
|
209
|
-
Braintree::Dispute.add_text_evidence("dispute_id", {
|
216
|
+
Braintree::Dispute.add_text_evidence("dispute_id", {random_param: ""})
|
210
217
|
end.to raise_error(ArgumentError)
|
211
218
|
end
|
212
219
|
|
213
220
|
it "raises an exception if sequence_number is provided and not an integer" do
|
214
221
|
expect do
|
215
|
-
Braintree::Dispute.add_text_evidence("dispute_id", {
|
222
|
+
Braintree::Dispute.add_text_evidence("dispute_id", {sequence_number: "abc"})
|
216
223
|
end.to raise_error(ArgumentError)
|
217
224
|
end
|
218
225
|
|
219
226
|
it "raises an exception if the param tag is not a string" do
|
220
227
|
expect do
|
221
|
-
Braintree::Dispute.add_text_evidence("dispute_id", {
|
228
|
+
Braintree::Dispute.add_text_evidence("dispute_id", {tag: 3})
|
222
229
|
end.to raise_error(ArgumentError)
|
223
230
|
end
|
224
231
|
|
225
232
|
it "raises an exception if the param category is not a string" do
|
226
233
|
expect do
|
227
|
-
Braintree::Dispute.add_text_evidence("dispute_id", {
|
234
|
+
Braintree::Dispute.add_text_evidence("dispute_id", {category: 3})
|
228
235
|
end.to raise_error(ArgumentError)
|
229
236
|
end
|
230
237
|
end
|
@@ -348,6 +355,16 @@ describe Braintree::Dispute do
|
|
348
355
|
evidence2.url.should == nil
|
349
356
|
end
|
350
357
|
|
358
|
+
it "converts paypal_messages hash into an array of Dispute::PayPalMessage objects" do
|
359
|
+
dispute = Braintree::Dispute._new(attributes)
|
360
|
+
|
361
|
+
dispute.paypal_messages.length.should == 1
|
362
|
+
paypal_message_1 = dispute.paypal_messages.first
|
363
|
+
paypal_message_1.message.should == "message"
|
364
|
+
paypal_message_1.sender.should == "seller"
|
365
|
+
paypal_message_1.sent_at.should == Time.utc(2009, 3, 9, 10, 50, 39)
|
366
|
+
end
|
367
|
+
|
351
368
|
it "handles nil evidence" do
|
352
369
|
attributes.delete(:evidence)
|
353
370
|
|
@@ -356,6 +373,14 @@ describe Braintree::Dispute do
|
|
356
373
|
dispute.evidence.should == nil
|
357
374
|
end
|
358
375
|
|
376
|
+
it "handles nil paypal_messages" do
|
377
|
+
attributes.delete(:paypal_messages)
|
378
|
+
|
379
|
+
dispute = Braintree::Dispute._new(attributes)
|
380
|
+
|
381
|
+
dispute.paypal_messages.should == nil
|
382
|
+
end
|
383
|
+
|
359
384
|
it "sets the older webhook fields for backwards compatibility" do
|
360
385
|
dispute = Braintree::Dispute._new(attributes)
|
361
386
|
|
@@ -10,7 +10,7 @@ describe Braintree::ErrorResult do
|
|
10
10
|
:params => "params",
|
11
11
|
:errors => {:errors => []},
|
12
12
|
:extra => "is ignored",
|
13
|
-
:message => "foo bar"
|
13
|
+
:message => "foo bar",
|
14
14
|
)
|
15
15
|
end.to_not raise_error
|
16
16
|
end
|
@@ -36,7 +36,7 @@ describe Braintree::ErrorResult do
|
|
36
36
|
:params => "params",
|
37
37
|
:errors => {},
|
38
38
|
:verification => {},
|
39
|
-
:transaction => nil
|
39
|
+
:transaction => nil,
|
40
40
|
)
|
41
41
|
result.inspect.should include("credit_card_verification: #<Braintree::CreditCardVerification status: ")
|
42
42
|
end
|
@@ -47,7 +47,7 @@ describe Braintree::ErrorResult do
|
|
47
47
|
:params => "params",
|
48
48
|
:errors => {},
|
49
49
|
:verification => nil,
|
50
|
-
:transaction => nil
|
50
|
+
:transaction => nil,
|
51
51
|
)
|
52
52
|
result.inspect.should_not include("credit_card_verification")
|
53
53
|
end
|
@@ -58,7 +58,7 @@ describe Braintree::ErrorResult do
|
|
58
58
|
:params => "params",
|
59
59
|
:errors => {},
|
60
60
|
:verification => nil,
|
61
|
-
:transaction => {}
|
61
|
+
:transaction => {},
|
62
62
|
)
|
63
63
|
result.inspect.should include("transaction: #<Braintree::Transaction id: ")
|
64
64
|
end
|
@@ -69,7 +69,7 @@ describe Braintree::ErrorResult do
|
|
69
69
|
:params => "params",
|
70
70
|
:errors => {},
|
71
71
|
:verification => nil,
|
72
|
-
:transaction => nil
|
72
|
+
:transaction => nil,
|
73
73
|
)
|
74
74
|
result.inspect.should_not include("transaction")
|
75
75
|
end
|
@@ -4,7 +4,7 @@ describe Braintree::Errors do
|
|
4
4
|
describe "for" do
|
5
5
|
it "accesses errors for the given scope" do
|
6
6
|
errors = Braintree::Errors.new(
|
7
|
-
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
|
7
|
+
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
|
8
8
|
)
|
9
9
|
errors.for(:level1).size.should == 1
|
10
10
|
errors.for(:level1)[0].code.should == "code1"
|
@@ -12,7 +12,7 @@ describe Braintree::Errors do
|
|
12
12
|
|
13
13
|
it "returns nil if there are no errors at the given scope" do
|
14
14
|
errors = Braintree::Errors.new(
|
15
|
-
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
|
15
|
+
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
|
16
16
|
)
|
17
17
|
errors.for(:no_errors_here).should == nil
|
18
18
|
end
|
@@ -21,7 +21,7 @@ describe Braintree::Errors do
|
|
21
21
|
describe "inspect" do
|
22
22
|
it "is better than the default inspect" do
|
23
23
|
errors = Braintree::Errors.new(
|
24
|
-
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]}
|
24
|
+
:level1 => {:errors => [{:code => "code1", :attribute => "attr", :message => "message"}]},
|
25
25
|
)
|
26
26
|
errors.inspect.should == "#<Braintree::Errors level1:[(code1) message]>"
|
27
27
|
end
|
@@ -33,7 +33,7 @@ describe Braintree::Errors do
|
|
33
33
|
:level2 => {
|
34
34
|
:errors => [{:code => "code2", :attribute => "attr2", :message => "message2"}],
|
35
35
|
}
|
36
|
-
}
|
36
|
+
},
|
37
37
|
)
|
38
38
|
errors.inspect.should == "#<Braintree::Errors level1:[(code1) message], level1/level2:[(code2) message2]>"
|
39
39
|
end
|
@@ -48,7 +48,7 @@ describe Braintree::Errors do
|
|
48
48
|
:errors => [{:code => "code3", :attribute => "attr3", :message => "message3"}],
|
49
49
|
}
|
50
50
|
}
|
51
|
-
}
|
51
|
+
},
|
52
52
|
)
|
53
53
|
errors.inspect.should == "#<Braintree::Errors level1:[(code1) message], level1/level2:[(code2) message2], level1/level2/level3:[(code3) message3]>"
|
54
54
|
end
|
@@ -65,7 +65,7 @@ describe Braintree::Errors do
|
|
65
65
|
{:code => "3", :attribute => "attr3", :message => "message3"}
|
66
66
|
],
|
67
67
|
}
|
68
|
-
}
|
68
|
+
},
|
69
69
|
)
|
70
70
|
errors.map { |e| e.code }.sort.should == %w[1 2 3]
|
71
71
|
end
|
@@ -74,7 +74,7 @@ describe Braintree::Errors do
|
|
74
74
|
describe "size" do
|
75
75
|
it "returns the number of validation errors at the first level if only has one level" do
|
76
76
|
errors = Braintree::Errors.new(
|
77
|
-
:level1 => {:errors => [{:code => "1", :attribute => "attr", :message => "message"}]}
|
77
|
+
:level1 => {:errors => [{:code => "1", :attribute => "attr", :message => "message"}]},
|
78
78
|
)
|
79
79
|
errors.size.should == 1
|
80
80
|
end
|
@@ -89,7 +89,7 @@ describe Braintree::Errors do
|
|
89
89
|
{:code => "3", :attribute => "attr3", :message => "message3"}
|
90
90
|
],
|
91
91
|
}
|
92
|
-
}
|
92
|
+
},
|
93
93
|
)
|
94
94
|
errors.size.should == 3
|
95
95
|
end
|
@@ -67,7 +67,7 @@ END
|
|
67
67
|
:proxy_address => "localhost",
|
68
68
|
:proxy_port => 8080,
|
69
69
|
:proxy_user => "user",
|
70
|
-
:proxy_pass => "test"
|
70
|
+
:proxy_pass => "test",
|
71
71
|
)
|
72
72
|
|
73
73
|
http = Braintree::Http.new(config)
|
@@ -75,7 +75,7 @@ END
|
|
75
75
|
"Net::HTTP",
|
76
76
|
:open_timeout= => nil,
|
77
77
|
:read_timeout= => nil,
|
78
|
-
:start => nil
|
78
|
+
:start => nil,
|
79
79
|
)
|
80
80
|
|
81
81
|
Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, "user", "test").and_return(net_http_instance)
|
@@ -86,7 +86,7 @@ END
|
|
86
86
|
it "accepts a partially specified proxy" do
|
87
87
|
config = Braintree::Configuration.new(
|
88
88
|
:proxy_address => "localhost",
|
89
|
-
:proxy_port => 8080
|
89
|
+
:proxy_port => 8080,
|
90
90
|
)
|
91
91
|
|
92
92
|
http = Braintree::Http.new(config)
|
@@ -94,7 +94,7 @@ END
|
|
94
94
|
"Net::HTTP",
|
95
95
|
:open_timeout= => nil,
|
96
96
|
:read_timeout= => nil,
|
97
|
-
:start => nil
|
97
|
+
:start => nil,
|
98
98
|
)
|
99
99
|
|
100
100
|
Net::HTTP.should_receive(:new).with(nil, nil, "localhost", 8080, nil, nil).and_return(net_http_instance)
|
@@ -109,7 +109,7 @@ END
|
|
109
109
|
"Net::HTTP",
|
110
110
|
:open_timeout= => nil,
|
111
111
|
:read_timeout= => nil,
|
112
|
-
:start => nil
|
112
|
+
:start => nil,
|
113
113
|
)
|
114
114
|
|
115
115
|
Net::HTTP.should_receive(:new).with(nil, nil).and_return(net_http_instance)
|
@@ -13,7 +13,7 @@ describe Braintree::MerchantAccount do
|
|
13
13
|
nil,
|
14
14
|
:id => "merchant_account",
|
15
15
|
:status => "active",
|
16
|
-
:master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil}
|
16
|
+
:master_merchant_account => {:id => "master_merchant_account", :status => "active", :master_merchant_account => nil},
|
17
17
|
)
|
18
18
|
|
19
19
|
master_merchant_account = "#<Braintree::MerchantAccount: id: \"master_merchant_account\", status: \"active\", master_merchant_account: nil>"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::PaymentMethodNonceDetailsPayerInfo do
|
4
|
+
let(:payment_method_nonce_details_payer_info) {
|
5
|
+
Braintree::PaymentMethodNonceDetailsPayerInfo.new(
|
6
|
+
:billing_agreement_id => "billing-agreement-id",
|
7
|
+
:country_code => "US",
|
8
|
+
:email => "test@example.com",
|
9
|
+
:first_name => "First",
|
10
|
+
:last_name => "Last",
|
11
|
+
:payer_id => "payer-id",
|
12
|
+
)
|
13
|
+
}
|
14
|
+
|
15
|
+
describe "#initialize" do
|
16
|
+
it "sets attributes" do
|
17
|
+
payment_method_nonce_details_payer_info.billing_agreement_id.should == "billing-agreement-id"
|
18
|
+
payment_method_nonce_details_payer_info.country_code.should == "US"
|
19
|
+
payment_method_nonce_details_payer_info.email.should == "test@example.com"
|
20
|
+
payment_method_nonce_details_payer_info.first_name.should == "First"
|
21
|
+
payment_method_nonce_details_payer_info.last_name.should == "Last"
|
22
|
+
payment_method_nonce_details_payer_info.payer_id.should == "payer-id"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "inspect" do
|
27
|
+
it "prints the attributes" do
|
28
|
+
payment_method_nonce_details_payer_info.inspect.should == %(#<PaymentMethodNonceDetailsPayerInfo billing_agreement_id: \"billing-agreement-id\", country_code: \"US\", email: \"test@example.com\", first_name: \"First\", last_name: \"Last\", payer_id: \"payer-id\">)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|