braintree 3.2.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/braintree.gemspec +3 -3
- data/lib/braintree.rb +6 -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 +10 -6
- 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 +10 -7
- data/lib/braintree/payment_method_nonce.rb +7 -4
- 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/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/three_d_secure_info.rb +22 -12
- data/lib/braintree/transaction.rb +32 -24
- data/lib/braintree/transaction_gateway.rb +24 -5
- 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 +282 -165
- 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 +28 -35
- data/spec/integration/braintree/payment_method_spec.rb +269 -165
- data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +9 -9
- 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 +574 -360
- data/spec/integration/braintree/transaction_us_bank_account_spec.rb +20 -20
- 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 +20 -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_nonce_spec.rb +40 -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 +9 -9
- 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/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 +16 -8
- data/lib/braintree/settlement_batch.rb +0 -0
@@ -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
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::PaymentMethodNonceDetails do
|
4
|
+
let(:payment_method_nonce_details) {
|
5
|
+
Braintree::PaymentMethodNonceDetails.new(
|
6
|
+
:bin => "bin",
|
7
|
+
:card_type => "American Express",
|
8
|
+
:expiration_month => "12",
|
9
|
+
:expiration_year => "2025",
|
10
|
+
:is_network_tokenized => true,
|
11
|
+
:last_two => "11",
|
12
|
+
:payer_info => {
|
13
|
+
:billing_agreement_id => "1234",
|
14
|
+
:country_code => "US",
|
15
|
+
},
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
describe "#initialize" do
|
20
|
+
it "sets attributes" do
|
21
|
+
payment_method_nonce_details.bin.should == "bin"
|
22
|
+
payment_method_nonce_details.card_type.should == "American Express"
|
23
|
+
payment_method_nonce_details.expiration_month.should == "12"
|
24
|
+
payment_method_nonce_details.expiration_year.should == "2025"
|
25
|
+
payment_method_nonce_details.is_network_tokenized.should == true
|
26
|
+
payment_method_nonce_details.last_two.should == "11"
|
27
|
+
payment_method_nonce_details.payer_info.billing_agreement_id.should == "1234"
|
28
|
+
payment_method_nonce_details.payer_info.country_code.should == "US"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "inspect" do
|
33
|
+
it "prints the attributes" do
|
34
|
+
payment_method_nonce_details.inspect.should == %(#<PaymentMethodNonceDetails bin: "bin", card_type: "American Express", expiration_month: "12", expiration_year: "2025", is_network_tokenized: true, last_two: "11", payer_info: #<PaymentMethodNonceDetailsPayerInfo billing_agreement_id: "1234", country_code: "US", email: nil, first_name: nil, last_name: nil, payer_id: nil>>)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe "is_network_tokenized" do
|
39
|
+
it "is aliased to is_network_tokenized?" do
|
40
|
+
payment_method_nonce_details.is_network_tokenized?.should == true
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + "/../../spec_helper")
|
2
|
+
|
3
|
+
describe Braintree::PaymentMethodNonce do
|
4
|
+
let(:payment_method_nonce) {
|
5
|
+
Braintree::PaymentMethodNonce._new(
|
6
|
+
:gateway,
|
7
|
+
:nonce => "some-nonce",
|
8
|
+
:type => "CreditCard",
|
9
|
+
:default => true,
|
10
|
+
:details => {
|
11
|
+
:bin => "some-bin"
|
12
|
+
},
|
13
|
+
:three_d_secure_info => {
|
14
|
+
:liability_shift_possible => false,
|
15
|
+
:liability_shifted => false
|
16
|
+
},
|
17
|
+
:bin_data => {
|
18
|
+
:country_of_issuance => "USA"
|
19
|
+
},
|
20
|
+
)
|
21
|
+
}
|
22
|
+
|
23
|
+
describe "#initialize" do
|
24
|
+
it "sets attributes" do
|
25
|
+
expect(payment_method_nonce.nonce).to eq("some-nonce")
|
26
|
+
expect(payment_method_nonce.type).to eq("CreditCard")
|
27
|
+
expect(payment_method_nonce.default).to be true
|
28
|
+
expect(payment_method_nonce.details.bin).to eq("some-bin")
|
29
|
+
expect(payment_method_nonce.three_d_secure_info.liability_shift_possible).to be false
|
30
|
+
expect(payment_method_nonce.three_d_secure_info.liability_shifted).to be false
|
31
|
+
expect(payment_method_nonce.bin_data.country_of_issuance).to eq("USA")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "default" do
|
36
|
+
it "is aliased to default?" do
|
37
|
+
expect(payment_method_nonce.default?).to be true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -28,7 +28,7 @@ describe Braintree::PaymentMethod do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "delete" do
|
31
|
-
let(:http_stub) { double(
|
31
|
+
let(:http_stub) { double("http_stub").as_null_object }
|
32
32
|
it "accepts revoke_all_grants option with value true" do
|
33
33
|
Braintree::Http.stub(:new).and_return http_stub
|
34
34
|
http_stub.should_receive(:delete).with("/merchants/integration_merchant_id/payment_methods/any/some_token?revoke_all_grants=true")
|