braintree 2.4.0 → 2.5.1

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.
Files changed (66) hide show
  1. data/README.rdoc +4 -0
  2. data/lib/braintree.rb +43 -32
  3. data/lib/braintree/add_on.rb +4 -0
  4. data/lib/braintree/address.rb +18 -72
  5. data/lib/braintree/address_gateway.rb +76 -0
  6. data/lib/braintree/advanced_search.rb +31 -13
  7. data/lib/braintree/base_module.rb +6 -0
  8. data/lib/braintree/configuration.rb +57 -39
  9. data/lib/braintree/credit_card.rb +75 -129
  10. data/lib/braintree/credit_card_gateway.rb +133 -0
  11. data/lib/braintree/credit_card_verification.rb +8 -0
  12. data/lib/braintree/customer.rb +70 -123
  13. data/lib/braintree/customer_gateway.rb +121 -0
  14. data/lib/braintree/digest.rb +2 -2
  15. data/lib/braintree/discount.rb +4 -0
  16. data/lib/braintree/error_codes.rb +50 -5
  17. data/lib/braintree/error_result.rb +4 -18
  18. data/lib/braintree/errors.rb +1 -2
  19. data/lib/braintree/exceptions.rb +11 -16
  20. data/lib/braintree/gateway.rb +39 -0
  21. data/lib/braintree/http.rb +30 -26
  22. data/lib/braintree/modification.rb +23 -0
  23. data/lib/braintree/resource_collection.rb +1 -1
  24. data/lib/braintree/subscription.rb +29 -129
  25. data/lib/braintree/subscription_gateway.rb +122 -0
  26. data/lib/braintree/subscription_search.rb +6 -7
  27. data/lib/braintree/successful_result.rb +1 -12
  28. data/lib/braintree/test/credit_card_numbers.rb +4 -2
  29. data/lib/braintree/test/transaction_amounts.rb +3 -0
  30. data/lib/braintree/transaction.rb +83 -243
  31. data/lib/braintree/transaction/credit_card_details.rb +4 -4
  32. data/lib/braintree/transaction_gateway.rb +124 -0
  33. data/lib/braintree/transaction_search.rb +5 -3
  34. data/lib/braintree/transparent_redirect.rb +19 -112
  35. data/lib/braintree/transparent_redirect_gateway.rb +105 -0
  36. data/lib/braintree/util.rb +4 -0
  37. data/lib/braintree/validation_error.rb +1 -0
  38. data/lib/braintree/validation_error_collection.rb +5 -23
  39. data/lib/braintree/version.rb +2 -2
  40. data/lib/braintree/xml/parser.rb +1 -1
  41. data/lib/braintree/xml/rexml.rb +2 -2
  42. data/spec/integration/braintree/advanced_search_spec.rb +532 -0
  43. data/spec/integration/braintree/credit_card_spec.rb +5 -8
  44. data/spec/integration/braintree/http_spec.rb +53 -39
  45. data/spec/integration/braintree/subscription_spec.rb +678 -213
  46. data/spec/integration/braintree/transaction_search_spec.rb +318 -43
  47. data/spec/integration/braintree/transaction_spec.rb +134 -3
  48. data/spec/integration/braintree/transparent_redirect_spec.rb +1 -1
  49. data/spec/spec_helper.rb +55 -4
  50. data/spec/unit/braintree/address_spec.rb +8 -8
  51. data/spec/unit/braintree/base_module_spec.rb +1 -1
  52. data/spec/unit/braintree/configuration_spec.rb +34 -29
  53. data/spec/unit/braintree/credit_card_spec.rb +14 -12
  54. data/spec/unit/braintree/credit_card_verification_spec.rb +16 -0
  55. data/spec/unit/braintree/customer_spec.rb +10 -8
  56. data/spec/unit/braintree/digest_spec.rb +8 -17
  57. data/spec/unit/braintree/error_result_spec.rb +12 -2
  58. data/spec/unit/braintree/http_spec.rb +2 -2
  59. data/spec/unit/braintree/subscription_search_spec.rb +77 -0
  60. data/spec/unit/braintree/subscription_spec.rb +16 -8
  61. data/spec/unit/braintree/transaction_spec.rb +17 -12
  62. data/spec/unit/braintree/transparent_redirect_spec.rb +12 -12
  63. data/spec/unit/braintree/util_spec.rb +24 -0
  64. data/spec/unit/braintree/xml/parser_spec.rb +1 -1
  65. data/spec/unit/braintree_spec.rb +1 -1
  66. metadata +16 -5
@@ -18,49 +18,53 @@ describe Braintree::Transaction, "search" do
18
18
  transaction = Braintree::Transaction.sale!(
19
19
  :amount => Braintree::Test::TransactionAmounts::Authorize,
20
20
  :credit_card => {
21
- :number => Braintree::Test::CreditCardNumbers::Visa,
22
- :expiration_date => "05/2012",
23
- :cardholder_name => "Tom Smith",
24
- :token => token,
25
- },
26
- :billing => {
27
- :company => "Braintree",
28
- :country_name => "United States of America",
29
- :extended_address => "Suite 123",
30
- :first_name => first_name,
31
- :last_name => "Smith",
32
- :locality => "Chicago",
33
- :postal_code => "12345",
34
- :region => "IL",
35
- :street_address => "123 Main St"
36
- },
37
- :customer => {
38
- :company => "Braintree",
39
- :email => "smith@example.com",
40
- :fax => "5551231234",
41
- :first_name => "Tom",
42
- :id => customer_id,
43
- :last_name => "Smith",
44
- :phone => "5551231234",
45
- :website => "http://example.com",
46
- },
47
- :options => {
48
- :store_in_vault => true
49
- },
21
+ :number => Braintree::Test::CreditCardNumbers::Visa,
22
+ :expiration_date => "05/2012",
23
+ :cardholder_name => "Tom Smith",
24
+ :token => token,
25
+ },
26
+ :billing => {
27
+ :company => "Braintree",
28
+ :country_name => "United States of America",
29
+ :extended_address => "Suite 123",
30
+ :first_name => first_name,
31
+ :last_name => "Smith",
32
+ :locality => "Chicago",
33
+ :postal_code => "12345",
34
+ :region => "IL",
35
+ :street_address => "123 Main St"
36
+ },
37
+ :customer => {
38
+ :company => "Braintree",
39
+ :email => "smith@example.com",
40
+ :fax => "5551231234",
41
+ :first_name => "Tom",
42
+ :id => customer_id,
43
+ :last_name => "Smith",
44
+ :phone => "5551231234",
45
+ :website => "http://example.com",
46
+ },
47
+ :options => {
48
+ :store_in_vault => true,
49
+ :submit_for_settlement => true
50
+ },
50
51
  :order_id => "myorder",
51
52
  :shipping => {
52
- :company => "Braintree P.S.",
53
- :country_name => "Mexico",
54
- :extended_address => "Apt 456",
55
- :first_name => "Thomas",
56
- :last_name => "Smithy",
57
- :locality => "Braintree",
58
- :postal_code => "54321",
59
- :region => "MA",
60
- :street_address => "456 Road"
61
- }
53
+ :company => "Braintree P.S.",
54
+ :country_name => "Mexico",
55
+ :extended_address => "Apt 456",
56
+ :first_name => "Thomas",
57
+ :last_name => "Smithy",
58
+ :locality => "Braintree",
59
+ :postal_code => "54321",
60
+ :region => "MA",
61
+ :street_address => "456 Road"
62
+ }
62
63
  )
63
64
 
65
+ SpecHelper.settle_transaction transaction.id
66
+ transaction = Braintree::Transaction.find(transaction.id)
67
+
64
68
  search_criteria = {
65
69
  :billing_company => "Braintree",
66
70
  :billing_country_name => "United States of America",
@@ -85,6 +89,7 @@ describe Braintree::Transaction, "search" do
85
89
  :order_id => "myorder",
86
90
  :payment_method_token => token,
87
91
  :processor_authorization_code => transaction.processor_authorization_code,
92
+ :settlement_batch_id => transaction.settlement_batch_id,
88
93
  :shipping_company => "Braintree P.S.",
89
94
  :shipping_country_name => "Mexico",
90
95
  :shipping_extended_address => "Apt 456",
@@ -416,7 +421,7 @@ describe Braintree::Transaction, "search" do
416
421
  },
417
422
  :options => { :submit_for_settlement => true }
418
423
  )
419
- Braintree::Http.put "/transactions/#{transaction.id}/settle"
424
+ SpecHelper.settle_transaction transaction.id
420
425
 
421
426
  refund_transaction = transaction.refund.new_transaction
422
427
 
@@ -612,9 +617,9 @@ describe Braintree::Transaction, "search" do
612
617
  transaction = Braintree::Transaction.sale!(
613
618
  :amount => Braintree::Test::TransactionAmounts::Authorize,
614
619
  :credit_card => {
615
- :number => Braintree::Test::CreditCardNumbers::Visa,
616
- :expiration_date => "05/12"
617
- }
620
+ :number => Braintree::Test::CreditCardNumbers::Visa,
621
+ :expiration_date => "05/12"
622
+ }
618
623
  )
619
624
 
620
625
  collection = Braintree::Transaction.search do |search|
@@ -629,6 +634,276 @@ describe Braintree::Transaction, "search" do
629
634
  collection.first.id.should == transaction.id
630
635
  end
631
636
  end
637
+
638
+ context "status date ranges" do
639
+ it "finds transactions authorized in a given range" do
640
+ transaction = Braintree::Transaction.sale!(
641
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
642
+ :credit_card => {
643
+ :number => Braintree::Test::CreditCardNumbers::Visa,
644
+ :expiration_date => "05/12"
645
+ }
646
+ )
647
+
648
+ collection = Braintree::Transaction.search do |search|
649
+ search.id.is transaction.id
650
+ search.authorized_at.between(
651
+ Date.today - 2,
652
+ Date.today - 1
653
+ )
654
+ end
655
+
656
+ collection.maximum_size.should == 0
657
+
658
+ collection = Braintree::Transaction.search do |search|
659
+ search.id.is transaction.id
660
+ search.authorized_at.between(
661
+ Date.today - 1,
662
+ Date.today + 1
663
+ )
664
+ end
665
+
666
+ collection.maximum_size.should == 1
667
+ collection.first.id.should == transaction.id
668
+ end
669
+
670
+ it "finds transactions failed in a given range" do
671
+ transaction = Braintree::Transaction.sale(
672
+ :amount => Braintree::Test::TransactionAmounts::Fail,
673
+ :credit_card => {
674
+ :number => Braintree::Test::CreditCardNumbers::Visa,
675
+ :expiration_date => "05/12"
676
+ }
677
+ ).transaction
678
+
679
+ collection = Braintree::Transaction.search do |search|
680
+ search.id.is transaction.id
681
+ search.failed_at.between(
682
+ Date.today - 2,
683
+ Date.today - 1
684
+ )
685
+ end
686
+
687
+ collection.maximum_size.should == 0
688
+
689
+ collection = Braintree::Transaction.search do |search|
690
+ search.id.is transaction.id
691
+ search.failed_at.between(
692
+ Date.today - 1,
693
+ Date.today + 1
694
+ )
695
+ end
696
+
697
+ collection.maximum_size.should == 1
698
+ collection.first.id.should == transaction.id
699
+ end
700
+
701
+ it "finds transactions gateway_rejected in a given range" do
702
+ old_merchant = Braintree::Configuration.merchant_id
703
+ old_public_key = Braintree::Configuration.public_key
704
+ old_private_key = Braintree::Configuration.private_key
705
+
706
+ begin
707
+ Braintree::Configuration.merchant_id = "processing_rules_merchant_id"
708
+ Braintree::Configuration.public_key = "processing_rules_public_key"
709
+ Braintree::Configuration.private_key = "processing_rules_private_key"
710
+
711
+ transaction = Braintree::Transaction.sale(
712
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
713
+ :credit_card => {
714
+ :number => Braintree::Test::CreditCardNumbers::Visa,
715
+ :expiration_date => "05/12",
716
+ :cvv => "200"
717
+ }
718
+ ).transaction
719
+
720
+ collection = Braintree::Transaction.search do |search|
721
+ search.id.is transaction.id
722
+ search.gateway_rejected_at.between(
723
+ Date.today - 2,
724
+ Date.today - 1
725
+ )
726
+ end
727
+
728
+ collection.maximum_size.should == 0
729
+
730
+ collection = Braintree::Transaction.search do |search|
731
+ search.id.is transaction.id
732
+ search.gateway_rejected_at.between(
733
+ Date.today - 1,
734
+ Date.today + 1
735
+ )
736
+ end
737
+
738
+ collection.maximum_size.should == 1
739
+ collection.first.id.should == transaction.id
740
+ ensure
741
+ Braintree::Configuration.merchant_id = old_merchant
742
+ Braintree::Configuration.public_key = old_public_key
743
+ Braintree::Configuration.private_key = old_private_key
744
+ end
745
+ end
746
+
747
+ it "finds transactions processor declined in a given range" do
748
+ transaction = Braintree::Transaction.sale(
749
+ :amount => Braintree::Test::TransactionAmounts::Decline,
750
+ :credit_card => {
751
+ :number => Braintree::Test::CreditCardNumbers::Visa,
752
+ :expiration_date => "05/12"
753
+ }
754
+ ).transaction
755
+
756
+ collection = Braintree::Transaction.search do |search|
757
+ search.id.is transaction.id
758
+ search.processor_declined_at.between(
759
+ Date.today - 2,
760
+ Date.today - 1
761
+ )
762
+ end
763
+
764
+ collection.maximum_size.should == 0
765
+
766
+ collection = Braintree::Transaction.search do |search|
767
+ search.id.is transaction.id
768
+ search.processor_declined_at.between(
769
+ Date.today - 1,
770
+ Date.today + 1
771
+ )
772
+ end
773
+
774
+ collection.maximum_size.should == 1
775
+ collection.first.id.should == transaction.id
776
+ end
777
+
778
+ it "finds transactions settled in a given range" do
779
+ transaction = Braintree::Transaction.sale(
780
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
781
+ :credit_card => {
782
+ :number => Braintree::Test::CreditCardNumbers::Visa,
783
+ :expiration_date => "05/12"
784
+ },
785
+ :options => {
786
+ :submit_for_settlement => true
787
+ }
788
+ ).transaction
789
+
790
+ SpecHelper.settle_transaction transaction.id
791
+
792
+ collection = Braintree::Transaction.search do |search|
793
+ search.id.is transaction.id
794
+ search.settled_at.between(
795
+ Date.today - 2,
796
+ Date.today - 1
797
+ )
798
+ end
799
+
800
+ collection.maximum_size.should == 0
801
+
802
+ collection = Braintree::Transaction.search do |search|
803
+ search.id.is transaction.id
804
+ search.settled_at.between(
805
+ Date.today - 1,
806
+ Date.today + 1
807
+ )
808
+ end
809
+
810
+ collection.maximum_size.should == 1
811
+ collection.first.id.should == transaction.id
812
+ end
813
+
814
+ it "finds transactions submitted for settlement in a given range" do
815
+ transaction = Braintree::Transaction.sale(
816
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
817
+ :credit_card => {
818
+ :number => Braintree::Test::CreditCardNumbers::Visa,
819
+ :expiration_date => "05/12"
820
+ },
821
+ :options => {
822
+ :submit_for_settlement => true
823
+ }
824
+ ).transaction
825
+
826
+ collection = Braintree::Transaction.search do |search|
827
+ search.id.is transaction.id
828
+ search.submitted_for_settlement_at.between(
829
+ Date.today - 2,
830
+ Date.today - 1
831
+ )
832
+ end
833
+
834
+ collection.maximum_size.should == 0
835
+
836
+ collection = Braintree::Transaction.search do |search|
837
+ search.id.is transaction.id
838
+ search.submitted_for_settlement_at.between(
839
+ Date.today - 1,
840
+ Date.today + 1
841
+ )
842
+ end
843
+
844
+ collection.maximum_size.should == 1
845
+ collection.first.id.should == transaction.id
846
+ end
847
+
848
+ it "finds transactions voided in a given range" do
849
+ transaction = Braintree::Transaction.sale!(
850
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
851
+ :credit_card => {
852
+ :number => Braintree::Test::CreditCardNumbers::Visa,
853
+ :expiration_date => "05/12"
854
+ }
855
+ )
856
+ transaction = Braintree::Transaction.void(transaction.id).transaction
857
+
858
+ collection = Braintree::Transaction.search do |search|
859
+ search.id.is transaction.id
860
+ search.voided_at.between(
861
+ Date.today - 2,
862
+ Date.today - 1
863
+ )
864
+ end
865
+
866
+ collection.maximum_size.should == 0
867
+
868
+ collection = Braintree::Transaction.search do |search|
869
+ search.id.is transaction.id
870
+ search.voided_at.between(
871
+ Date.today - 1,
872
+ Date.today + 1
873
+ )
874
+ end
875
+
876
+ collection.maximum_size.should == 1
877
+ collection.first.id.should == transaction.id
878
+ end
879
+ end
880
+
881
+ it "allows searching on multiple statuses" do
882
+ transaction = Braintree::Transaction.sale!(
883
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
884
+ :credit_card => {
885
+ :number => Braintree::Test::CreditCardNumbers::Visa,
886
+ :expiration_date => "05/12"
887
+ },
888
+ :options => {
889
+ :submit_for_settlement => true
890
+ }
891
+ )
892
+
893
+ collection = Braintree::Transaction.search do |search|
894
+ search.id.is transaction.id
895
+ search.authorized_at.between(
896
+ Date.today - 1,
897
+ Date.today + 1
898
+ )
899
+ search.submitted_for_settlement_at.between(
900
+ Date.today - 1,
901
+ Date.today + 1
902
+ )
903
+ end
904
+
905
+ collection.maximum_size.should > 0
906
+ end
632
907
  end
633
908
 
634
909
  it "returns multiple results" do
@@ -231,7 +231,7 @@ describe Braintree::Transaction do
231
231
  }
232
232
  )
233
233
  result.success?.should == false
234
- result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::AVS_AND_CVV
234
+ result.transaction.gateway_rejection_reason.should == Braintree::Transaction::GatewayRejectionReason::AVSAndCVV
235
235
  ensure
236
236
  Braintree::Configuration.merchant_id = old_merchant
237
237
  Braintree::Configuration.public_key = old_public_key
@@ -446,6 +446,72 @@ describe Braintree::Transaction do
446
446
  result.transaction.vault_credit_card.masked_number.should == "401288******1881"
447
447
  end
448
448
  end
449
+
450
+ it "snapshots add_ons and discounts from subscription" do
451
+ customer = Braintree::Customer.create!(
452
+ :credit_card => {
453
+ :number => Braintree::Test::CreditCardNumbers::Visa,
454
+ :expiration_date => "05/2010"
455
+ }
456
+ )
457
+
458
+ result = Braintree::Subscription.create(
459
+ :payment_method_token => customer.credit_cards.first.token,
460
+ :plan_id => SpecHelper::TriallessPlan[:id],
461
+ :add_ons => {
462
+ :add => [
463
+ {
464
+ :amount => BigDecimal.new("11.00"),
465
+ :inherited_from_id => SpecHelper::AddOnIncrease10,
466
+ :quantity => 2,
467
+ :number_of_billing_cycles => 5
468
+ },
469
+ {
470
+ :amount => BigDecimal.new("21.00"),
471
+ :inherited_from_id => SpecHelper::AddOnIncrease20,
472
+ :quantity => 3,
473
+ :number_of_billing_cycles => 6
474
+ }
475
+ ]
476
+ },
477
+ :discounts => {
478
+ :add => [
479
+ {
480
+ :amount => BigDecimal.new("7.50"),
481
+ :inherited_from_id => SpecHelper::Discount7,
482
+ :quantity => 2,
483
+ :never_expires => true
484
+ }
485
+ ]
486
+ }
487
+ )
488
+
489
+ result.success?.should be_true
490
+ transaction = result.subscription.transactions.first
491
+
492
+ transaction.add_ons.size.should == 2
493
+ add_ons = transaction.add_ons.sort_by { |add_on| add_on.id }
494
+
495
+ add_ons.first.id.should == "increase_10"
496
+ add_ons.first.amount.should == BigDecimal.new("11.00")
497
+ add_ons.first.quantity.should == 2
498
+ add_ons.first.number_of_billing_cycles.should == 5
499
+ add_ons.first.never_expires?.should be_false
500
+
501
+ add_ons.last.id.should == "increase_20"
502
+ add_ons.last.amount.should == BigDecimal.new("21.00")
503
+ add_ons.last.quantity.should == 3
504
+ add_ons.last.number_of_billing_cycles.should == 6
505
+ add_ons.last.never_expires?.should be_false
506
+
507
+ transaction.discounts.size.should == 1
508
+
509
+ transaction.discounts.first.id.should == "discount_7"
510
+ transaction.discounts.first.amount.should == BigDecimal.new("7.50")
511
+ transaction.discounts.first.quantity.should == 2
512
+ transaction.discounts.first.number_of_billing_cycles.should be_nil
513
+ transaction.discounts.first.never_expires?.should be_true
514
+ end
449
515
  end
450
516
 
451
517
  describe "self.create!" do
@@ -480,6 +546,71 @@ describe Braintree::Transaction do
480
546
  end
481
547
  end
482
548
 
549
+ describe "self.refund" do
550
+ context "partial refunds" do
551
+ it "allows partial refunds" do
552
+ transaction = create_transaction_to_refund
553
+ result = Braintree::Transaction.refund(transaction.id, transaction.amount / 2)
554
+ result.success?.should == true
555
+ result.transaction.type.should == "credit"
556
+ end
557
+
558
+ it "does not allow multiple refunds" do
559
+ transaction = create_transaction_to_refund
560
+ Braintree::Transaction.refund(transaction.id, transaction.amount / 2)
561
+ result = Braintree::Transaction.refund(transaction.id, BigDecimal.new("1"))
562
+ result.success?.should == false
563
+ result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::HasAlreadyBeenRefunded
564
+ end
565
+ end
566
+
567
+ it "returns a successful result if successful" do
568
+ transaction = create_transaction_to_refund
569
+ transaction.status.should == Braintree::Transaction::Status::Settled
570
+ result = Braintree::Transaction.refund(transaction.id)
571
+ result.success?.should == true
572
+ result.transaction.type.should == "credit"
573
+ end
574
+
575
+ it "assigns the refund_id on the original transaction" do
576
+ transaction = create_transaction_to_refund
577
+ refund_transaction = Braintree::Transaction.refund(transaction.id).transaction
578
+ transaction = Braintree::Transaction.find(transaction.id)
579
+
580
+ transaction.refund_id.should == refund_transaction.id
581
+ end
582
+
583
+ it "assigns the refunded_transaction_id to the original transaction" do
584
+ transaction = create_transaction_to_refund
585
+ refund_transaction = Braintree::Transaction.refund(transaction.id).transaction
586
+
587
+ refund_transaction.refunded_transaction_id.should == transaction.id
588
+ end
589
+
590
+ it "returns an error if already refunded" do
591
+ transaction = create_transaction_to_refund
592
+ result = Braintree::Transaction.refund(transaction.id)
593
+ result.success?.should == true
594
+ result = Braintree::Transaction.refund(transaction.id)
595
+ result.success?.should == false
596
+ result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::HasAlreadyBeenRefunded
597
+ end
598
+
599
+ it "returns an error result if unsettled" do
600
+ transaction = Braintree::Transaction.create!(
601
+ :type => "sale",
602
+ :amount => Braintree::Test::TransactionAmounts::Authorize,
603
+ :credit_card => {
604
+ :number => Braintree::Test::CreditCardNumbers::Visa,
605
+ :expiration_date => "05/2009"
606
+ }
607
+ )
608
+ result = Braintree::Transaction.refund(transaction.id)
609
+ result.success?.should == false
610
+ result.errors.for(:transaction).on(:base)[0].code.should == Braintree::ErrorCodes::Transaction::CannotRefundUnlessSettled
611
+ end
612
+ end
613
+
483
614
  describe "self.sale" do
484
615
  it "returns a successful result with type=sale if successful" do
485
616
  result = Braintree::Transaction.sale(
@@ -1260,7 +1391,7 @@ describe Braintree::Transaction do
1260
1391
  result.new_transaction.type.should == "credit"
1261
1392
  end
1262
1393
 
1263
- it "does not all multiple refunds" do
1394
+ it "does not allow multiple refunds" do
1264
1395
  transaction = create_transaction_to_refund
1265
1396
  transaction.refund(transaction.amount / 2)
1266
1397
  result = transaction.refund(BigDecimal.new("1"))
@@ -1544,7 +1675,7 @@ describe Braintree::Transaction do
1544
1675
  }
1545
1676
  )
1546
1677
 
1547
- response = Braintree::Http.put "/transactions/#{transaction.id}/settle"
1678
+ response = Braintree::Configuration.instantiate.http.put "/transactions/#{transaction.id}/settle"
1548
1679
  Braintree::Transaction.find(transaction.id)
1549
1680
  end
1550
1681
  end