braintree 4.18.0 → 4.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/braintree/advanced_search.rb +1 -2
  3. data/lib/braintree/configuration.rb +1 -1
  4. data/lib/braintree/disbursement.rb +1 -1
  5. data/lib/braintree/dispute.rb +1 -0
  6. data/lib/braintree/http.rb +2 -4
  7. data/lib/braintree/util.rb +1 -1
  8. data/lib/braintree/version.rb +1 -1
  9. data/lib/braintree/webhook_notification.rb +4 -3
  10. data/lib/braintree/webhook_testing_gateway.rb +78 -6
  11. data/lib/braintree/xml/parser.rb +2 -2
  12. data/spec/integration/braintree/address_spec.rb +3 -3
  13. data/spec/integration/braintree/advanced_search_spec.rb +3 -3
  14. data/spec/integration/braintree/client_api/client_token_spec.rb +0 -2
  15. data/spec/integration/braintree/client_api/spec_helper.rb +1 -1
  16. data/spec/integration/braintree/credit_card_spec.rb +7 -10
  17. data/spec/integration/braintree/credit_card_verification_spec.rb +1 -1
  18. data/spec/integration/braintree/customer_spec.rb +8 -8
  19. data/spec/integration/braintree/dispute_search_spec.rb +0 -1
  20. data/spec/integration/braintree/dispute_spec.rb +1 -1
  21. data/spec/integration/braintree/document_upload_spec.rb +1 -1
  22. data/spec/integration/braintree/http_spec.rb +0 -2
  23. data/spec/integration/braintree/oauth_spec.rb +1 -1
  24. data/spec/integration/braintree/payment_method_spec.rb +10 -12
  25. data/spec/integration/braintree/payment_method_us_bank_account_spec.rb +3 -3
  26. data/spec/integration/braintree/paypal_account_spec.rb +6 -6
  27. data/spec/integration/braintree/plan_spec.rb +0 -1
  28. data/spec/integration/braintree/sepa_direct_debit_account_spec.rb +0 -2
  29. data/spec/integration/braintree/subscription_spec.rb +5 -6
  30. data/spec/integration/braintree/transaction_search_spec.rb +3 -7
  31. data/spec/integration/braintree/transaction_spec.rb +6 -22
  32. data/spec/unit/braintree/client_token_spec.rb +1 -1
  33. data/spec/unit/braintree/digest_spec.rb +0 -1
  34. data/spec/unit/braintree/error_result_spec.rb +1 -1
  35. data/spec/unit/braintree/paypal_account_spec.rb +1 -1
  36. data/spec/unit/braintree/transaction_spec.rb +2 -2
  37. data/spec/unit/braintree/webhook_notification_spec.rb +16 -0
  38. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8d5039746bfcbc33e3899cb43cf5a014084278543b5c83ea0b09146a0c0b63b
4
- data.tar.gz: 688a569cbff984a1d6a0571095a7f990efda7ce717ee9393c93263f8b9007f80
3
+ metadata.gz: f43df747b2db22253268db6e5f01b79ea162b6c0911125b056b7bab73684dd3f
4
+ data.tar.gz: 6fad0280817f00e0c0e3e8c6ef3761a5bd20d3e3a777a9f91182e556fad59aba
5
5
  SHA512:
6
- metadata.gz: df005acb10a67bdcf42ab131f49b93f595ad9431004922502b255c54d4222960e54a344a018abd0175c3b340d8474215a1f49b0a210b590fbe78fe020bf7daf1
7
- data.tar.gz: 783676045da0d1240f5b9cd808149f04fd9a7005c99015ff5ec07ff0a0ffcf4093e1e0ab896334f2e7e0f953829a62b8532130a3057bef5c344d506c58064d67
6
+ metadata.gz: 7e6aa6b5b10734d82c66f9f7f315c5759700412ddda2642e2424f71c8be71aca06d35aa77b69936514c8e3d0ddc2e5dd24d479e8c4359ff9d67e43222ebe0256
7
+ data.tar.gz: f762c62cadc6476aebfc9f0f2aee72bd254b32b93c1c069c22c67661482ac433b2598ff1f86f2f1cad943dcf28878bac4f3293025d7b45e26cb34aec3c6fbc81
@@ -80,8 +80,7 @@ module Braintree
80
80
  operators :is
81
81
 
82
82
  def between(min, max)
83
- self >= min
84
- self <= max
83
+ self >= min && self <= max
85
84
  end
86
85
 
87
86
  def >=(min)
@@ -72,7 +72,7 @@ module Braintree
72
72
  end
73
73
 
74
74
  def self.instantiate
75
- config = new(
75
+ new(
76
76
  :custom_user_agent => @custom_user_agent,
77
77
  :endpoint => @endpoint,
78
78
  :environment => environment,
@@ -29,7 +29,7 @@ module Braintree
29
29
  end
30
30
 
31
31
  def transactions
32
- transactions = @gateway.transaction.search do |search|
32
+ @gateway.transaction.search do |search|
33
33
  search.ids.in transaction_ids
34
34
  end
35
35
  end
@@ -43,6 +43,7 @@ module Braintree
43
43
  Expired = "expired"
44
44
  Open = "open"
45
45
  Lost = "lost"
46
+ UnderReview = "under_review"
46
47
  Won = "won"
47
48
 
48
49
  All = constants.map { |c| const_get(c) }
@@ -8,7 +8,6 @@ module Braintree
8
8
  end
9
9
 
10
10
  def delete(path, query_params = {})
11
- full_path = path + _build_query_string(query_params)
12
11
  response = _http_do Net::HTTP::Delete, path
13
12
  if response.code.to_i == 200 || response.code.to_i == 204
14
13
  true
@@ -20,7 +19,6 @@ module Braintree
20
19
  end
21
20
 
22
21
  def get(path, query_params = {})
23
- full_path = path + _build_query_string(query_params)
24
22
  response = _http_do Net::HTTP::Get, path
25
23
  if response.code.to_i == 200 || response.code.to_i == 422
26
24
  Xml.hash_from_xml(_body(response))
@@ -69,7 +67,7 @@ module Braintree
69
67
 
70
68
  def _setup_connection(server = @config.server, port = @config.port)
71
69
  if @config.proxy_address
72
- connection = Net::HTTP.new(
70
+ Net::HTTP.new(
73
71
  server,
74
72
  port,
75
73
  @config.proxy_address,
@@ -78,7 +76,7 @@ module Braintree
78
76
  @config.proxy_pass,
79
77
  )
80
78
  else
81
- connection = Net::HTTP.new(server, port)
79
+ Net::HTTP.new(server, port)
82
80
  end
83
81
  end
84
82
 
@@ -191,7 +191,7 @@ module Braintree
191
191
  def self._get_invalid_keys(valid_keys, hash)
192
192
  flattened_valid_keys = _flatten_valid_keys(valid_keys)
193
193
  keys = _flatten_hash_keys(hash) - flattened_valid_keys
194
- keys = _remove_wildcard_keys(flattened_valid_keys, keys)
194
+ _remove_wildcard_keys(flattened_valid_keys, keys)
195
195
  end
196
196
 
197
197
  module IdEquality
@@ -1,7 +1,7 @@
1
1
  module Braintree
2
2
  module Version
3
3
  Major = 4
4
- Minor = 18
4
+ Minor = 19
5
5
  Tiny = 0
6
6
 
7
7
  String = "#{Major}.#{Minor}.#{Tiny}"
@@ -15,13 +15,14 @@ module Braintree
15
15
  Disbursement = "disbursement"
16
16
  DisbursementException = "disbursement_exception"
17
17
 
18
- DisputeOpened = "dispute_opened"
19
- DisputeLost = "dispute_lost"
20
- DisputeWon = "dispute_won"
21
18
  DisputeAccepted = "dispute_accepted"
22
19
  DisputeAutoAccepted = "dispute_auto_accepted"
23
20
  DisputeDisputed = "dispute_disputed"
24
21
  DisputeExpired = "dispute_expired"
22
+ DisputeLost = "dispute_lost"
23
+ DisputeOpened = "dispute_opened"
24
+ DisputeUnderReview = "dispute_under_review"
25
+ DisputeWon = "dispute_won"
25
26
 
26
27
  GrantedPaymentInstrumentRevoked = "granted_payment_instrument_revoked"
27
28
 
@@ -34,12 +34,6 @@ module Braintree
34
34
  case kind
35
35
  when Braintree::WebhookNotification::Kind::Check
36
36
  _check
37
- when Braintree::WebhookNotification::Kind::DisputeOpened
38
- _dispute_opened_sample_xml(id)
39
- when Braintree::WebhookNotification::Kind::DisputeLost
40
- _dispute_lost_sample_xml(id)
41
- when Braintree::WebhookNotification::Kind::DisputeWon
42
- _dispute_won_sample_xml(id)
43
37
  when Braintree::WebhookNotification::Kind::DisputeAccepted
44
38
  _dispute_accepted_sample_xml(id)
45
39
  when Braintree::WebhookNotification::Kind::DisputeAutoAccepted
@@ -48,6 +42,14 @@ module Braintree
48
42
  _dispute_disputed_sample_xml(id)
49
43
  when Braintree::WebhookNotification::Kind::DisputeExpired
50
44
  _dispute_expired_sample_xml(id)
45
+ when Braintree::WebhookNotification::Kind::DisputeLost
46
+ _dispute_lost_sample_xml(id)
47
+ when Braintree::WebhookNotification::Kind::DisputeOpened
48
+ _dispute_opened_sample_xml(id)
49
+ when Braintree::WebhookNotification::Kind::DisputeUnderReview
50
+ _dispute_under_review_sample_xml(id)
51
+ when Braintree::WebhookNotification::Kind::DisputeWon
52
+ _dispute_won_sample_xml(id)
51
53
  when Braintree::WebhookNotification::Kind::PartnerMerchantConnected
52
54
  _partner_merchant_connected_sample_xml(id)
53
55
  when Braintree::WebhookNotification::Kind::PartnerMerchantDisconnected
@@ -324,6 +326,14 @@ module Braintree
324
326
  XML
325
327
  end
326
328
 
329
+ def _dispute_under_review_sample_xml(id)
330
+ if id == "legacy_dispute_id"
331
+ _old_dispute_under_review_sample_xml(id)
332
+ else
333
+ _new_dispute_under_review_sample_xml(id)
334
+ end
335
+ end
336
+
327
337
  def _dispute_opened_sample_xml(id)
328
338
  if id == "legacy_dispute_id"
329
339
  _old_dispute_opened_sample_xml(id)
@@ -380,6 +390,26 @@ module Braintree
380
390
  end
381
391
  end
382
392
 
393
+ def _old_dispute_under_review_sample_xml(id)
394
+ <<-XML
395
+ <dispute>
396
+ <amount>100.00</amount>
397
+ <currency-iso-code>USD</currency-iso-code>
398
+ <received-date type="date">2014-03-01</received-date>
399
+ <reply-by-date type="date">2014-03-21</reply-by-date>
400
+ <kind>chargeback</kind>
401
+ <status>under_review</status>
402
+ <reason>fraud</reason>
403
+ <id>#{id}</id>
404
+ <transaction>
405
+ <id>#{id}</id>
406
+ <amount>100.00</amount>
407
+ </transaction>
408
+ <date-opened type=\"date\">2014-03-21</date-opened>
409
+ </dispute>
410
+ XML
411
+ end
412
+
383
413
  def _old_dispute_opened_sample_xml(id)
384
414
  <<-XML
385
415
  <dispute>
@@ -521,6 +551,48 @@ module Braintree
521
551
  XML
522
552
  end
523
553
 
554
+ def _new_dispute_under_review_sample_xml(id)
555
+ <<-XML
556
+ <dispute>
557
+ <id>#{id}</id>
558
+ <amount>100.00</amount>
559
+ <amount-disputed>100.00</amount-disputed>
560
+ <amount-won>95.00</amount-won>
561
+ <case-number>CASE-12345</case-number>
562
+ <created-at type="datetime">2017-06-16T20:44:41Z</created-at>
563
+ <currency-iso-code>USD</currency-iso-code>
564
+ <forwarded-comments nil="true"/>
565
+ <kind>chargeback</kind>
566
+ <merchant-account-id>ytnlulaloidoqwvzxjrdqputg</merchant-account-id>
567
+ <reason>fraud</reason>
568
+ <reason-code nil="true"/>
569
+ <reason-description nil="true"/>
570
+ <received-date type="date">2016-02-15</received-date>
571
+ <reference-number>REF-9876</reference-number>
572
+ <reply-by-date type="date">2016-02-22</reply-by-date>
573
+ <status>under_review</status>
574
+ <updated-at type="datetime">2017-06-16T20:44:41Z</updated-at>
575
+ <original-dispute-id>9qde5qgp</original-dispute-id>
576
+ <status-history type="array">
577
+ <status-history>
578
+ <status>under_review</status>
579
+ <timestamp type="datetime">2017-06-16T20:44:41Z</timestamp>
580
+ </status-history>
581
+ </status-history>
582
+ <evidence type="array"/>
583
+ <transaction>
584
+ <id>#{id}</id>
585
+ <amount>100.00</amount>
586
+ <created-at>2017-06-21T20:44:41Z</created-at>
587
+ <order-id nil="true"/>
588
+ <purchase-order-number nil="true"/>
589
+ <payment-instrument-subtype>Visa</payment-instrument-subtype>
590
+ </transaction>
591
+ <date-opened type=\"date\">2014-03-21</date-opened>
592
+ </dispute>
593
+ XML
594
+ end
595
+
524
596
  def _new_dispute_opened_sample_xml(id)
525
597
  <<-XML
526
598
  <dispute>
@@ -32,7 +32,7 @@ module Braintree
32
32
  case value.class.to_s
33
33
  when "Hash"
34
34
  if value["type"] == "array"
35
- child_key, entries = value.detect { |k,_v| k != "type" } # child_key is throwaway
35
+ _child_key, entries = value.detect { |k,_v| k != "type" } # child_key is throwaway
36
36
  if entries.nil? || ((c = value[CONTENT_ROOT]) && c.strip.empty?)
37
37
  []
38
38
  else
@@ -47,7 +47,7 @@ module Braintree
47
47
  end
48
48
  elsif value.has_key?(CONTENT_ROOT)
49
49
  content = value[CONTENT_ROOT]
50
- if (parser = XML_PARSING[value["type"]])
50
+ if (XML_PARSING[value["type"]])
51
51
  XML_PARSING[value["type"]].call(content)
52
52
  else
53
53
  content
@@ -203,7 +203,7 @@ describe Braintree::Address do
203
203
 
204
204
  it "raises a NotFoundError if it cannot be found because of address id" do
205
205
  customer = Braintree::Customer.create!(:last_name => "Wilson")
206
- address = Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
206
+ Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
207
207
  expect do
208
208
  Braintree::Address.find(customer, "invalid")
209
209
  end.to raise_error(
@@ -215,7 +215,7 @@ describe Braintree::Address do
215
215
  describe "self.update" do
216
216
  it "raises NotFoundError if the address can't be found" do
217
217
  customer = Braintree::Customer.create!(:last_name => "Wilson")
218
- address = Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
218
+ Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
219
219
  expect do
220
220
  Braintree::Address.update(customer.id, "bad-id", {})
221
221
  end.to raise_error(Braintree::NotFoundError)
@@ -293,7 +293,7 @@ describe Braintree::Address do
293
293
  describe "self.update!" do
294
294
  it "raises NotFoundError if the address can't be found" do
295
295
  customer = Braintree::Customer.create!(:last_name => "Wilson")
296
- address = Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
296
+ Braintree::Address.create!(:customer_id => customer.id, :street_address => "123 E Main St")
297
297
  expect do
298
298
  Braintree::Address.update!(customer.id, "bad-id", {})
299
299
  end.to raise_error(Braintree::NotFoundError)
@@ -263,19 +263,19 @@ describe Braintree::AdvancedSearch do
263
263
  context "multiple_value_or_text_field" do
264
264
  describe "in" do
265
265
  it "works for the in operator" do
266
- subscription1 = Braintree::Subscription.create(
266
+ Braintree::Subscription.create(
267
267
  :payment_method_token => @credit_card.token,
268
268
  :plan_id => SpecHelper::TriallessPlan[:id],
269
269
  :price => "17",
270
270
  ).subscription
271
271
 
272
- subscription2 = Braintree::Subscription.create(
272
+ Braintree::Subscription.create(
273
273
  :payment_method_token => @credit_card.token,
274
274
  :plan_id => SpecHelper::TrialPlan[:id],
275
275
  :price => "17",
276
276
  ).subscription
277
277
 
278
- subscription3 = Braintree::Subscription.create(
278
+ Braintree::Subscription.create(
279
279
  :payment_method_token => @credit_card.token,
280
280
  :plan_id => SpecHelper::AddOnDiscountPlan[:id],
281
281
  :price => "17",
@@ -28,14 +28,12 @@ describe Braintree::ClientToken do
28
28
 
29
29
  describe "version" do
30
30
  it "allows a client token version to be specified" do
31
- config = Braintree::Configuration.instantiate
32
31
  client_token_string = Braintree::ClientToken.generate(:version => 1)
33
32
  client_token = JSON.parse(client_token_string)
34
33
  expect(client_token["version"]).to eq(1)
35
34
  end
36
35
 
37
36
  it "defaults to 2" do
38
- config = Braintree::Configuration.instantiate
39
37
  client_token_string = Braintree::ClientToken.generate
40
38
  client_token = decode_client_token(client_token_string)
41
39
  expect(client_token["version"]).to eq(2)
@@ -144,7 +144,7 @@ def generate_invalid_us_bank_account_nonce
144
144
  nonce_characters = "bcdfghjkmnpqrstvwxyz23456789".chars.to_a
145
145
  nonce = "tokenusbankacct_"
146
146
  nonce += 4.times.map { sample(nonce_characters) }.join("_")
147
- nonce += "_xxx"
147
+ nonce + "_xxx"
148
148
  end
149
149
 
150
150
  def _cosmos_post(token, url, payload)
@@ -322,16 +322,15 @@ describe Braintree::CreditCard do
322
322
  expect(result.success?).to eq(true)
323
323
 
324
324
  three_d_secure_info = result.credit_card.verification.three_d_secure_info
325
- expect(three_d_secure_info.enrolled).to eq("Y")
325
+ expect(three_d_secure_info.status).to eq("authenticate_successful")
326
326
  expect(three_d_secure_info).to be_liability_shifted
327
327
  expect(three_d_secure_info).to be_liability_shift_possible
328
- expect(three_d_secure_info.status).to eq("authenticate_successful")
329
- expect(three_d_secure_info.cavv).to eq("cavv_value")
330
- expect(three_d_secure_info.xid).to eq("xid_value")
331
- expect(three_d_secure_info.eci_flag).to eq("05")
332
- expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
333
- expect(three_d_secure_info.ds_transaction_id).to eq(nil)
334
- expect(three_d_secure_info.three_d_secure_authentication_id).not_to be_nil
328
+ expect(three_d_secure_info.enrolled).to be_a(String)
329
+ expect(three_d_secure_info.cavv).to be_a(String)
330
+ expect(three_d_secure_info.xid).to be_a(String)
331
+ expect(three_d_secure_info.eci_flag).to be_a(String)
332
+ expect(three_d_secure_info.three_d_secure_version).to be_a(String)
333
+ expect(three_d_secure_info.three_d_secure_authentication_id).to be_a(String)
335
334
  end
336
335
 
337
336
  it "adds credit card with billing address to customer" do
@@ -649,7 +648,6 @@ describe Braintree::CreditCard do
649
648
  end
650
649
 
651
650
  it "errors with invalid account_type" do
652
- customer = Braintree::Customer.create!
653
651
  result = Braintree::CreditCard.create(
654
652
  :number => Braintree::Test::CreditCardNumbers::Hiper,
655
653
  :expiration_month => "11",
@@ -666,7 +664,6 @@ describe Braintree::CreditCard do
666
664
  end
667
665
 
668
666
  it "errors when account_type not supported by merchant" do
669
- customer = Braintree::Customer.create!
670
667
  result = Braintree::CreditCard.create(
671
668
  :number => Braintree::Test::CreditCardNumbers::Visa,
672
669
  :expiration_month => "11",
@@ -283,7 +283,7 @@ describe Braintree::CreditCardVerification, "search" do
283
283
  it "returns prepaid on a prepaid card" do
284
284
  cardholder_name = "Tom #{rand(1_000_000)} Smith"
285
285
 
286
- result = Braintree::Customer.create(
286
+ Braintree::Customer.create(
287
287
  :credit_card => {
288
288
  :cardholder_name => cardholder_name,
289
289
  :expiration_date => "05/2012",
@@ -924,11 +924,11 @@ describe Braintree::Customer do
924
924
  },
925
925
  ).credit_card
926
926
 
927
- subscription = Braintree::Subscription.create(
927
+ Braintree::Subscription.create(
928
928
  :payment_method_token => credit_card.token,
929
929
  :plan_id => "integration_trialless_plan",
930
930
  :price => "1.00",
931
- ).subscription
931
+ )
932
932
 
933
933
  found_customer = Braintree::Customer.find(customer.id, {
934
934
  :association_filter_id => "customernoassociations"
@@ -958,11 +958,11 @@ describe Braintree::Customer do
958
958
  },
959
959
  ).credit_card
960
960
 
961
- subscription = Braintree::Subscription.create(
961
+ Braintree::Subscription.create(
962
962
  :payment_method_token => credit_card.token,
963
963
  :plan_id => "integration_trialless_plan",
964
964
  :price => "1.00",
965
- ).subscription
965
+ )
966
966
 
967
967
  found_customer = Braintree::Customer.find(customer.id, {
968
968
  :association_filter_id => "customertoplevelassociations"
@@ -1233,7 +1233,7 @@ describe Braintree::Customer do
1233
1233
 
1234
1234
  token1 = random_payment_method_token
1235
1235
 
1236
- payment_method1 = Braintree::PaymentMethod.create(
1236
+ Braintree::PaymentMethod.create(
1237
1237
  :customer_id => customer.id,
1238
1238
  :payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
1239
1239
  :token => token1,
@@ -1244,7 +1244,7 @@ describe Braintree::Customer do
1244
1244
 
1245
1245
  token2 = random_payment_method_token
1246
1246
 
1247
- payment_method2 = Braintree::PaymentMethod.create(
1247
+ Braintree::PaymentMethod.create(
1248
1248
  :customer_id => customer.id,
1249
1249
  :payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
1250
1250
  :token => token2,
@@ -1266,7 +1266,7 @@ describe Braintree::Customer do
1266
1266
 
1267
1267
  token1 = random_payment_method_token
1268
1268
 
1269
- payment_method1 = Braintree::PaymentMethod.create(
1269
+ Braintree::PaymentMethod.create(
1270
1270
  :customer_id => customer.id,
1271
1271
  :payment_method_nonce => Braintree::Test::Nonce::TransactableVisa,
1272
1272
  :token => token1,
@@ -1277,7 +1277,7 @@ describe Braintree::Customer do
1277
1277
 
1278
1278
  token2 = random_payment_method_token
1279
1279
 
1280
- payment_method2 = Braintree::PaymentMethod.create(
1280
+ Braintree::PaymentMethod.create(
1281
1281
  :customer_id => customer.id,
1282
1282
  :payment_method_nonce => Braintree::Test::Nonce::TransactableMasterCard,
1283
1283
  :token => token2,
@@ -74,7 +74,6 @@ describe Braintree::Dispute, "search" do
74
74
  end
75
75
 
76
76
  expect(collection.disputes.count).to be >= 2
77
- dispute = collection.disputes.first
78
77
  end
79
78
 
80
79
  it "correctly returns disputes by chargeback protection level flag" do
@@ -6,7 +6,7 @@ describe Braintree::Dispute do
6
6
  let(:document_upload) do
7
7
  file = File.new("#{File.dirname(__FILE__)}/../../fixtures/files/bt_logo.png", "r")
8
8
  response = Braintree::DocumentUpload.create({:kind => Braintree::DocumentUpload::Kind::EvidenceDocument, :file => file})
9
- document_upload = response.document_upload
9
+ response.document_upload
10
10
  end
11
11
 
12
12
  let(:transaction) do
@@ -67,7 +67,7 @@ describe Braintree::DocumentUploadGateway do
67
67
 
68
68
  it "returns invalid keys error if signature is invalid" do
69
69
  expect do
70
- response = Braintree::DocumentUpload.create({:invalid_key => "do not add", :kind => Braintree::DocumentUpload::Kind::EvidenceDocument})
70
+ Braintree::DocumentUpload.create({:invalid_key => "do not add", :kind => Braintree::DocumentUpload::Kind::EvidenceDocument})
71
71
  end.to raise_error(ArgumentError, "invalid keys: invalid_key")
72
72
  end
73
73
  end
@@ -255,7 +255,6 @@ describe Braintree::Http do
255
255
  old_logger = Braintree::Configuration.logger
256
256
  output = StringIO.new
257
257
  Braintree::Configuration.logger = Logger.new(output)
258
- utc_or_gmt = Time.now.utc.strftime("%Z")
259
258
  context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
260
259
  context.error = 19
261
260
  expect(Braintree::Configuration.instantiate.http._verify_ssl_certificate(false, context)).to eq(false)
@@ -270,7 +269,6 @@ describe Braintree::Http do
270
269
  old_logger = Braintree::Configuration.logger
271
270
  output = StringIO.new
272
271
  Braintree::Configuration.logger = Logger.new(output)
273
- utc_or_gmt = Time.now.utc.strftime("%Z")
274
272
  context = OpenSSL::X509::StoreContext.new(OpenSSL::X509::Store.new)
275
273
  expect do
276
274
  Braintree::Configuration.instantiate.http._verify_ssl_certificate(true, context)
@@ -36,7 +36,7 @@ describe "OAuth" do
36
36
  )
37
37
 
38
38
  expect(result).not_to be_success
39
- errors = expect(result.errors.for(:credentials).on(:code)[0].code).to eq(Braintree::ErrorCodes::OAuth::InvalidGrant)
39
+ expect(result.errors.for(:credentials).on(:code)[0].code).to eq(Braintree::ErrorCodes::OAuth::InvalidGrant)
40
40
  expect(result.message).to match(/Invalid grant: code not found/)
41
41
  end
42
42
 
@@ -390,15 +390,14 @@ describe Braintree::PaymentMethod do
390
390
  expect(result.success?).to eq(true)
391
391
 
392
392
  three_d_secure_info = result.payment_method.verification.three_d_secure_info
393
- expect(three_d_secure_info.enrolled).to eq("Y")
393
+ expect(three_d_secure_info.status).to eq("authenticate_successful")
394
394
  expect(three_d_secure_info).to be_liability_shifted
395
395
  expect(three_d_secure_info).to be_liability_shift_possible
396
- expect(three_d_secure_info.status).to eq("authenticate_successful")
397
- expect(three_d_secure_info.cavv).to eq("cavv_value")
398
- expect(three_d_secure_info.xid).to eq("xid_value")
399
- expect(three_d_secure_info.eci_flag).to eq("05")
400
- expect(three_d_secure_info.three_d_secure_version).to eq("1.0.2")
401
- expect(three_d_secure_info.ds_transaction_id).to eq(nil)
396
+ expect(three_d_secure_info.enrolled).to be_a(String)
397
+ expect(three_d_secure_info.cavv).to be_a(String)
398
+ expect(three_d_secure_info.xid).to be_a(String)
399
+ expect(three_d_secure_info.eci_flag).to be_a(String)
400
+ expect(three_d_secure_info.three_d_secure_version).to be_a(String)
402
401
  end
403
402
 
404
403
  it "respects fail_on_duplicate_payment_method when included outside of the nonce" do
@@ -1409,7 +1408,6 @@ describe Braintree::PaymentMethod do
1409
1408
 
1410
1409
  it "raises a NotFoundError exception if payment method cannot be found" do
1411
1410
  token = make_token
1412
- customer = Braintree::Customer.create!
1413
1411
 
1414
1412
  expect do
1415
1413
  Braintree::PaymentMethod.delete(token)
@@ -1878,7 +1876,7 @@ describe Braintree::PaymentMethod do
1878
1876
  )
1879
1877
 
1880
1878
  updated_token = make_token
1881
- updated_result = Braintree::PaymentMethod.update(
1879
+ Braintree::PaymentMethod.update(
1882
1880
  original_token,
1883
1881
  :token => updated_token,
1884
1882
  )
@@ -1907,7 +1905,7 @@ describe Braintree::PaymentMethod do
1907
1905
  :customer_id => customer.id,
1908
1906
  ).payment_method.token
1909
1907
 
1910
- updated_result = Braintree::PaymentMethod.update(
1908
+ Braintree::PaymentMethod.update(
1911
1909
  original_token,
1912
1910
  :options => {:make_default => true},
1913
1911
  )
@@ -1925,7 +1923,7 @@ describe Braintree::PaymentMethod do
1925
1923
  :consent_code => "consent-code",
1926
1924
  :token => first_token,
1927
1925
  )
1928
- first_result = Braintree::PaymentMethod.create(
1926
+ Braintree::PaymentMethod.create(
1929
1927
  :payment_method_nonce => first_nonce,
1930
1928
  :customer_id => customer.id,
1931
1929
  )
@@ -1934,7 +1932,7 @@ describe Braintree::PaymentMethod do
1934
1932
  :consent_code => "consent-code",
1935
1933
  :token => second_token,
1936
1934
  )
1937
- second_result = Braintree::PaymentMethod.create(
1935
+ Braintree::PaymentMethod.create(
1938
1936
  :payment_method_nonce => second_nonce,
1939
1937
  :customer_id => customer.id,
1940
1938
  )
@@ -116,7 +116,7 @@ describe Braintree::PaymentMethod do
116
116
 
117
117
  it "returns additional processor response for failed NetworkCheck" do
118
118
  customer = Braintree::Customer.create.customer
119
- invalid_nonce = generate_non_plaid_us_bank_account_nonce(account_number = "1000000005")
119
+ invalid_nonce = generate_non_plaid_us_bank_account_nonce("1000000005")
120
120
  result = Braintree::PaymentMethod.create(
121
121
  :payment_method_nonce => invalid_nonce,
122
122
  :customer_id => customer.id,
@@ -189,7 +189,7 @@ describe Braintree::PaymentMethod do
189
189
  context "unverified token" do
190
190
  let(:payment_method) do
191
191
  customer = Braintree::Customer.create.customer
192
- result = Braintree::PaymentMethod.create(
192
+ Braintree::PaymentMethod.create(
193
193
  :payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
194
194
  :customer_id => customer.id,
195
195
  :options => {
@@ -260,7 +260,7 @@ describe Braintree::PaymentMethod do
260
260
  context "unverified token" do
261
261
  let(:payment_method) do
262
262
  customer = Braintree::Customer.create.customer
263
- result = Braintree::PaymentMethod.create(
263
+ Braintree::PaymentMethod.create(
264
264
  :payment_method_nonce => generate_non_plaid_us_bank_account_nonce,
265
265
  :customer_id => customer.id,
266
266
  :options => {
@@ -51,7 +51,7 @@ describe Braintree::PayPalAccount do
51
51
 
52
52
  it "does not return a different payment method type" do
53
53
  customer = Braintree::Customer.create!
54
- result = Braintree::CreditCard.create(
54
+ Braintree::CreditCard.create(
55
55
  :customer_id => customer.id,
56
56
  :number => Braintree::Test::CreditCardNumbers::Visa,
57
57
  :expiration_date => "05/2009",
@@ -171,7 +171,7 @@ describe Braintree::PayPalAccount do
171
171
  )
172
172
 
173
173
  updated_token = "UPDATED_TOKEN-" + rand(36**3).to_s(36)
174
- updated_result = Braintree::PayPalAccount.update(
174
+ Braintree::PayPalAccount.update(
175
175
  original_token,
176
176
  :token => updated_token,
177
177
  )
@@ -200,7 +200,7 @@ describe Braintree::PayPalAccount do
200
200
  :customer_id => customer.id,
201
201
  ).payment_method.token
202
202
 
203
- updated_result = Braintree::PayPalAccount.update(
203
+ Braintree::PayPalAccount.update(
204
204
  original_token,
205
205
  :options => {:make_default => true},
206
206
  )
@@ -218,7 +218,7 @@ describe Braintree::PayPalAccount do
218
218
  :consent_code => "consent-code",
219
219
  :token => first_token,
220
220
  )
221
- first_result = Braintree::PaymentMethod.create(
221
+ Braintree::PaymentMethod.create(
222
222
  :payment_method_nonce => first_nonce,
223
223
  :customer_id => customer.id,
224
224
  )
@@ -227,7 +227,7 @@ describe Braintree::PayPalAccount do
227
227
  :consent_code => "consent-code",
228
228
  :token => second_token,
229
229
  )
230
- second_result = Braintree::PaymentMethod.create(
230
+ Braintree::PaymentMethod.create(
231
231
  :payment_method_nonce => second_nonce,
232
232
  :customer_id => customer.id,
233
233
  )
@@ -256,7 +256,7 @@ describe Braintree::PayPalAccount do
256
256
  :customer_id => customer.id,
257
257
  )
258
258
 
259
- result = Braintree::PayPalAccount.delete(token)
259
+ Braintree::PayPalAccount.delete(token)
260
260
 
261
261
  expect do
262
262
  Braintree::PayPalAccount.find(token)
@@ -113,7 +113,6 @@ describe Braintree::Plan do
113
113
  end
114
114
 
115
115
  it "returns the updated plan if valid" do
116
- new_id = rand(36**9).to_s(36)
117
116
  plan = Braintree::Plan.update!(@plan.id,
118
117
  :name => "updated name",
119
118
  :price => 99.88,
@@ -53,8 +53,6 @@ describe Braintree::SepaDirectDebitAccount do
53
53
 
54
54
  context "subscriptions" do
55
55
  it "returns subscriptions associated with a SEPA direct debit account" do
56
- customer = Braintree::Customer.create!
57
-
58
56
  subscription1 = Braintree::Subscription.create(
59
57
  :payment_method_token => token,
60
58
  :plan_id => SpecHelper::TriallessPlan[:id],
@@ -136,7 +136,6 @@ describe Braintree::Subscription do
136
136
  end
137
137
 
138
138
  it "returns an error if the payment_method_nonce hasn't been vaulted" do
139
- customer = Braintree::Customer.create!
140
139
  result = Braintree::Subscription.create(
141
140
  :payment_method_nonce => Braintree::Test::Nonce::PayPalFuturePayment,
142
141
  :plan_id => SpecHelper::TriallessPlan[:id],
@@ -937,17 +936,17 @@ describe Braintree::Subscription do
937
936
 
938
937
  it "has validation errors on duplicate id" do
939
938
  duplicate_id = "new_id_#{rand(36**6).to_s(36)}"
940
- duplicate = Braintree::Subscription.create(
939
+ Braintree::Subscription.create(
941
940
  :payment_method_token => @credit_card.token,
942
941
  :plan_id => SpecHelper::TrialPlan[:id],
943
942
  :id => duplicate_id,
944
943
  )
945
- result = Braintree::Subscription.update(
944
+ duplicate = Braintree::Subscription.update(
946
945
  @subscription.id,
947
946
  :id => duplicate_id,
948
947
  )
949
- expect(result.success?).to eq(false)
950
- expect(result.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
948
+ expect(duplicate.success?).to eq(false)
949
+ expect(duplicate.errors.for(:subscription).on(:id)[0].code).to eq(Braintree::ErrorCodes::Subscription::IdIsInUse)
951
950
  end
952
951
 
953
952
  it "cannot update a canceled subscription" do
@@ -1203,7 +1202,7 @@ describe Braintree::Subscription do
1203
1202
 
1204
1203
  it "returns a validation error if record not found" do
1205
1204
  expect {
1206
- r = Braintree::Subscription.cancel("noSuchSubscription")
1205
+ Braintree::Subscription.cancel("noSuchSubscription")
1207
1206
  }.to raise_error(Braintree::NotFoundError, 'subscription with id "noSuchSubscription" not found')
1208
1207
  end
1209
1208
 
@@ -640,7 +640,7 @@ describe Braintree::Transaction, "search" do
640
640
  context "invalid search" do
641
641
  it "raises an exception on invalid transaction type" do
642
642
  expect do
643
- collection = Braintree::Transaction.search do |search|
643
+ Braintree::Transaction.search do |search|
644
644
  search.customer_id.is "9171566"
645
645
  search.type.is "settled"
646
646
  end
@@ -649,7 +649,7 @@ describe Braintree::Transaction, "search" do
649
649
 
650
650
  it "raises an exception on invalid debit network" do
651
651
  expect do
652
- collection = Braintree::Transaction.search do |search|
652
+ Braintree::Transaction.search do |search|
653
653
  search.debit_network.is "invalid_network"
654
654
  end
655
655
  end.to raise_error(ArgumentError)
@@ -849,8 +849,6 @@ describe Braintree::Transaction, "search" do
849
849
 
850
850
  context "ach return response created at" do
851
851
  it "it finds records within date range of the custom field" do
852
- reason_code = "any_reason_code"
853
-
854
852
  date_search = Braintree::Transaction.search do |search|
855
853
  search.ach_return_responses_created_at.between(DateTime.now - 1.0, DateTime.now + 1.0)
856
854
  end
@@ -859,8 +857,6 @@ describe Braintree::Transaction, "search" do
859
857
  end
860
858
 
861
859
  it "it does not find records not within date range of the custom field" do
862
- reason_code = "any_reason_code"
863
-
864
860
  neg_date_search = Braintree::Transaction.search do |search|
865
861
  search.ach_return_responses_created_at.between(DateTime.now + 1.0, DateTime.now - 1.0)
866
862
  end
@@ -1488,7 +1484,7 @@ describe Braintree::Transaction, "search" do
1488
1484
  context "when the search times out" do
1489
1485
  it "raises a UnexpectedError" do
1490
1486
  expect {
1491
- collection = Braintree::Transaction.search do |search|
1487
+ Braintree::Transaction.search do |search|
1492
1488
  search.amount.is(-10)
1493
1489
  end
1494
1490
  }.to raise_error(Braintree::UnexpectedError)
@@ -2098,7 +2098,6 @@ describe Braintree::Transaction do
2098
2098
  end
2099
2099
 
2100
2100
  it "can create a transaction with a params nonce with PayPal account params" do
2101
- customer = Braintree::Customer.create!
2102
2101
  nonce = nonce_for_new_payment_method(
2103
2102
  :paypal_account => {
2104
2103
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2174,7 +2173,6 @@ describe Braintree::Transaction do
2174
2173
  end
2175
2174
 
2176
2175
  it "can create a transaction with a fake apple pay nonce" do
2177
- customer = Braintree::Customer.create!
2178
2176
  result = Braintree::Transaction.create(
2179
2177
  :type => "sale",
2180
2178
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2203,7 +2201,6 @@ describe Braintree::Transaction do
2203
2201
  end
2204
2202
 
2205
2203
  it "can create a vaulted transaction with a fake apple pay nonce" do
2206
- customer = Braintree::Customer.create!
2207
2204
  result = Braintree::Transaction.create(
2208
2205
  :type => "sale",
2209
2206
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2225,7 +2222,6 @@ describe Braintree::Transaction do
2225
2222
  end
2226
2223
 
2227
2224
  it "can create a transaction with a fake google pay proxy card nonce" do
2228
- customer = Braintree::Customer.create!
2229
2225
  result = Braintree::Transaction.create(
2230
2226
  :type => "sale",
2231
2227
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2257,7 +2253,6 @@ describe Braintree::Transaction do
2257
2253
  end
2258
2254
 
2259
2255
  it "can create a vaulted transaction with a fake google pay proxy card nonce" do
2260
- customer = Braintree::Customer.create!
2261
2256
  result = Braintree::Transaction.create(
2262
2257
  :type => "sale",
2263
2258
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2282,7 +2277,6 @@ describe Braintree::Transaction do
2282
2277
  end
2283
2278
 
2284
2279
  it "can create a transaction with a fake google pay network token nonce" do
2285
- customer = Braintree::Customer.create!
2286
2280
  result = Braintree::Transaction.create(
2287
2281
  :type => "sale",
2288
2282
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2335,7 +2329,6 @@ describe Braintree::Transaction do
2335
2329
  end
2336
2330
 
2337
2331
  it "can create a transaction with an unknown nonce" do
2338
- customer = Braintree::Customer.create!
2339
2332
  result = Braintree::Transaction.create(
2340
2333
  :type => "sale",
2341
2334
  :amount => Braintree::Test::TransactionAmounts::Authorize,
@@ -2364,7 +2357,6 @@ describe Braintree::Transaction do
2364
2357
  end
2365
2358
 
2366
2359
  it "can create a transaction with a payee id" do
2367
- customer = Braintree::Customer.create!
2368
2360
  nonce = nonce_for_new_payment_method(
2369
2361
  :paypal_account => {
2370
2362
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2388,7 +2380,6 @@ describe Braintree::Transaction do
2388
2380
  end
2389
2381
 
2390
2382
  it "can create a transaction with a payee id in the options params" do
2391
- customer = Braintree::Customer.create!
2392
2383
  nonce = nonce_for_new_payment_method(
2393
2384
  :paypal_account => {
2394
2385
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2413,7 +2404,6 @@ describe Braintree::Transaction do
2413
2404
  end
2414
2405
 
2415
2406
  it "can create a transaction with a payee id in options.paypal" do
2416
- customer = Braintree::Customer.create!
2417
2407
  nonce = nonce_for_new_payment_method(
2418
2408
  :paypal_account => {
2419
2409
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2439,7 +2429,6 @@ describe Braintree::Transaction do
2439
2429
  end
2440
2430
 
2441
2431
  it "can create a transaction with a payee email" do
2442
- customer = Braintree::Customer.create!
2443
2432
  nonce = nonce_for_new_payment_method(
2444
2433
  :paypal_account => {
2445
2434
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2463,7 +2452,6 @@ describe Braintree::Transaction do
2463
2452
  end
2464
2453
 
2465
2454
  it "can create a transaction with a payee email in the options params" do
2466
- customer = Braintree::Customer.create!
2467
2455
  nonce = nonce_for_new_payment_method(
2468
2456
  :paypal_account => {
2469
2457
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2488,7 +2476,6 @@ describe Braintree::Transaction do
2488
2476
  end
2489
2477
 
2490
2478
  it "can create a transaction with a payee email in options.paypal" do
2491
- customer = Braintree::Customer.create!
2492
2479
  nonce = nonce_for_new_payment_method(
2493
2480
  :paypal_account => {
2494
2481
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2514,7 +2501,6 @@ describe Braintree::Transaction do
2514
2501
  end
2515
2502
 
2516
2503
  it "can create a transaction with a paypal custom field" do
2517
- customer = Braintree::Customer.create!
2518
2504
  nonce = nonce_for_new_payment_method(
2519
2505
  :paypal_account => {
2520
2506
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2540,7 +2526,6 @@ describe Braintree::Transaction do
2540
2526
  end
2541
2527
 
2542
2528
  it "can create a transaction with a paypal description" do
2543
- customer = Braintree::Customer.create!
2544
2529
  nonce = nonce_for_new_payment_method(
2545
2530
  :paypal_account => {
2546
2531
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -2566,7 +2551,6 @@ describe Braintree::Transaction do
2566
2551
  end
2567
2552
 
2568
2553
  it "can create a transaction with STC supplementary data" do
2569
- customer = Braintree::Customer.create!
2570
2554
  nonce = nonce_for_new_payment_method(
2571
2555
  :paypal_account => {
2572
2556
  :consent_code => "PAYPAL_CONSENT_CODE",
@@ -3300,7 +3284,7 @@ describe Braintree::Transaction do
3300
3284
  )
3301
3285
 
3302
3286
  config = Braintree::Configuration.instantiate
3303
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3287
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3304
3288
  transaction = Braintree::Transaction.find(transaction.id)
3305
3289
 
3306
3290
  result = Braintree::Transaction.refund(
@@ -3390,7 +3374,7 @@ describe Braintree::Transaction do
3390
3374
  },
3391
3375
  )
3392
3376
  config = Braintree::Configuration.instantiate
3393
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3377
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3394
3378
  result = Braintree::Transaction.refund(transaction.id, :amount => "2046.00")
3395
3379
  expect(result.success?).to eq(false)
3396
3380
  expect(result.transaction.id).to match(/^\w{6,}$/)
@@ -3411,7 +3395,7 @@ describe Braintree::Transaction do
3411
3395
  },
3412
3396
  )
3413
3397
  config = Braintree::Configuration.instantiate
3414
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3398
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
3415
3399
  result = Braintree::Transaction.refund(transaction.id, :amount => "2009.00")
3416
3400
  expect(result.success?).to eq(false)
3417
3401
  expect(result.transaction.id).to match(/^\w{6,}$/)
@@ -7256,7 +7240,7 @@ describe Braintree::Transaction do
7256
7240
  )
7257
7241
 
7258
7242
  config = Braintree::Configuration.instantiate
7259
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
7243
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
7260
7244
  Braintree::Transaction.find(transaction.id)
7261
7245
  end
7262
7246
 
@@ -7287,8 +7271,8 @@ describe Braintree::Transaction do
7287
7271
  )
7288
7272
 
7289
7273
  config = Braintree::Configuration.instantiate
7290
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
7291
- response = config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/escrow")
7274
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/settle")
7275
+ config.http.put("#{config.base_merchant_path}/transactions/#{transaction.id}/escrow")
7292
7276
  Braintree::Transaction.find(transaction.id)
7293
7277
  end
7294
7278
 
@@ -14,7 +14,7 @@ module Braintree
14
14
 
15
15
  it "can't overwrite public_key, or created_at" do
16
16
  expect {
17
- client_token = Braintree::ClientToken.generate(
17
+ Braintree::ClientToken.generate(
18
18
  :public_key => "bad_key",
19
19
  :created_at => "bad_time",
20
20
  )
@@ -3,7 +3,6 @@ require File.expand_path(File.dirname(__FILE__) + "/../spec_helper")
3
3
  describe Braintree::Digest do
4
4
  describe "self.hexdigest" do
5
5
  it "returns the sha1 hmac of the input string (test case 6 from RFC 2202)" do
6
- original_key = Braintree::Configuration.private_key
7
6
  private_key = "\xaa" * 80
8
7
  data = "Test Using Larger Than Block-Size Key - Hash Key First"
9
8
  expect(Braintree::Digest.hexdigest(private_key, data)).to eq("aa4ae5e15272d00e95705637ce8a3b55ed402112")
@@ -5,7 +5,7 @@ describe Braintree::ErrorResult do
5
5
  it "ignores data other than params, errors, and message" do
6
6
  # so that we can add more data into the response in the future without breaking the client lib
7
7
  expect do
8
- result = Braintree::ErrorResult.new(
8
+ Braintree::ErrorResult.new(
9
9
  :gateway,
10
10
  :params => "params",
11
11
  :errors => {:errors => []},
@@ -4,7 +4,7 @@ describe Braintree::PayPalAccount do
4
4
  describe "self.create" do
5
5
  it "raises an exception if attributes contain an invalid key" do
6
6
  expect do
7
- result = Braintree::PayPalAccount.create(
7
+ Braintree::PayPalAccount.create(
8
8
  :invalid_key => "bad stuff",
9
9
  :options => {
10
10
  :invalid_option => "bad option",
@@ -200,8 +200,8 @@ describe Braintree::Transaction do
200
200
  },
201
201
  )
202
202
 
203
- expect(transaction.three_d_secure_info.enrolled).to eq("Y")
204
203
  expect(transaction.three_d_secure_info.status).to eq("authenticate_successful")
204
+ expect(transaction.three_d_secure_info.enrolled).to eq("Y")
205
205
  expect(transaction.three_d_secure_info.liability_shifted).to eq(true)
206
206
  expect(transaction.three_d_secure_info.liability_shift_possible).to eq(true)
207
207
  end
@@ -258,7 +258,7 @@ describe Braintree::Transaction do
258
258
  end
259
259
 
260
260
  it "handles receiving custom as an empty string" do
261
- transaction = Braintree::Transaction._new(
261
+ Braintree::Transaction._new(
262
262
  :gateway,
263
263
  :custom => "\n ",
264
264
  )
@@ -168,6 +168,22 @@ describe Braintree::WebhookNotification do
168
168
  expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
169
169
  end
170
170
 
171
+ it "builds a sample notification for a dispute under_review webhook" do
172
+ sample_notification = Braintree::WebhookTesting.sample_notification(
173
+ Braintree::WebhookNotification::Kind::DisputeUnderReview,
174
+ dispute_id,
175
+ )
176
+
177
+ notification = Braintree::WebhookNotification.parse(sample_notification[:bt_signature], sample_notification[:bt_payload])
178
+
179
+ expect(notification.kind).to eq(Braintree::WebhookNotification::Kind::DisputeUnderReview)
180
+
181
+ dispute = notification.dispute
182
+ expect(dispute.status).to eq(Braintree::Dispute::Status::UnderReview)
183
+ expect(dispute.id).to eq(dispute_id)
184
+ expect(dispute.kind).to eq(Braintree::Dispute::Kind::Chargeback)
185
+ end
186
+
171
187
  it "builds a sample notification for a dispute won webhook" do
172
188
  sample_notification = Braintree::WebhookTesting.sample_notification(
173
189
  Braintree::WebhookNotification::Kind::DisputeWon,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintree
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.18.0
4
+ version: 4.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder