braintree 2.2.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -58,7 +58,7 @@ describe Braintree::CreditCard do
58
58
  credit_card.expiration_date.should == "05/2009"
59
59
  end
60
60
 
61
- it "verifes the credit card if options[verify_card]=true" do
61
+ it "verifies the credit card if options[verify_card]=true" do
62
62
  customer = Braintree::Customer.create!
63
63
  result = Braintree::CreditCard.create(
64
64
  :customer_id => customer.id,
@@ -76,6 +76,21 @@ describe Braintree::CreditCard do
76
76
  result.credit_card_verification.avs_street_address_response_code.should == "I"
77
77
  end
78
78
 
79
+ it "allows user to specify merchant account for verification" do
80
+ customer = Braintree::Customer.create!
81
+ result = Braintree::CreditCard.create(
82
+ :customer_id => customer.id,
83
+ :number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
84
+ :expiration_date => "05/2009",
85
+ :options => {
86
+ :verify_card => true,
87
+ :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
88
+ }
89
+ )
90
+ result.success?.should == false
91
+ result.credit_card_verification.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
92
+ end
93
+
79
94
  it "does not verify the card if options[verify_card]=false" do
80
95
  customer = Braintree::Customer.create!
81
96
  result = Braintree::CreditCard.create(
@@ -230,7 +245,7 @@ describe Braintree::CreditCard do
230
245
  }
231
246
  }
232
247
  tr_data = Braintree::TransparentRedirect.create_credit_card_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
233
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::CreditCard.create_credit_card_url, tr_data, params)
248
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::CreditCard.create_credit_card_url)
234
249
  result = Braintree::CreditCard.create_from_transparent_redirect(query_string_response)
235
250
  result.success?.should == true
236
251
  credit_card = result.credit_card
@@ -267,7 +282,7 @@ describe Braintree::CreditCard do
267
282
  }
268
283
  }
269
284
  tr_data = Braintree::TransparentRedirect.create_credit_card_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
270
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::CreditCard.create_credit_card_url, tr_data, params)
285
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::CreditCard.create_credit_card_url)
271
286
  result = Braintree::CreditCard.create_from_transparent_redirect(query_string_response)
272
287
  result.success?.should == true
273
288
  card2 = result.credit_card
@@ -291,7 +306,7 @@ describe Braintree::CreditCard do
291
306
  }
292
307
  }
293
308
  tr_data = Braintree::TransparentRedirect.create_credit_card_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
294
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::CreditCard.create_credit_card_url, tr_data, params)
309
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::CreditCard.create_credit_card_url)
295
310
  result = Braintree::CreditCard.create_from_transparent_redirect(query_string_response)
296
311
  result.success?.should == false
297
312
  result.params[:customer_id] == customer.id
@@ -566,7 +581,7 @@ describe Braintree::CreditCard do
566
581
  }
567
582
  }
568
583
  tr_data = Braintree::TransparentRedirect.update_credit_card_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
569
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::CreditCard.update_credit_card_url, tr_data, params)
584
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::CreditCard.update_credit_card_url)
570
585
  result = Braintree::CreditCard.update_from_transparent_redirect(query_string_response)
571
586
  result.success?.should == true
572
587
  credit_card = result.credit_card
@@ -604,7 +619,7 @@ describe Braintree::CreditCard do
604
619
  :payment_method_token => card2.token
605
620
  }
606
621
  tr_data = Braintree::TransparentRedirect.update_credit_card_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
607
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::CreditCard.update_credit_card_url, tr_data, params)
622
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::CreditCard.update_credit_card_url)
608
623
  result = Braintree::CreditCard.update_from_transparent_redirect(query_string_response)
609
624
 
610
625
  Braintree::CreditCard.find(card1.token).should_not be_default
@@ -919,6 +934,33 @@ describe Braintree::CreditCard do
919
934
  update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
920
935
  end
921
936
 
937
+ it "allows user to specify merchant account for verification" do
938
+ customer = Braintree::Customer.create!
939
+ credit_card = Braintree::CreditCard.create!(
940
+ :cardholder_name => "Original Holder",
941
+ :customer_id => customer.id,
942
+ :cvv => "123",
943
+ :number => Braintree::Test::CreditCardNumbers::Visa,
944
+ :expiration_date => "05/2012"
945
+ )
946
+ update_result = credit_card.update(
947
+ :number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::Visa,
948
+ :expiration_date => "05/2009",
949
+ :options => {
950
+ :verify_card => true,
951
+ :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
952
+ }
953
+ )
954
+ update_result.success?.should == false
955
+ update_result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
956
+ update_result.credit_card_verification.processor_response_code.should == "2000"
957
+ update_result.credit_card_verification.processor_response_text.should == "Do Not Honor"
958
+ update_result.credit_card_verification.cvv_response_code.should == "I"
959
+ update_result.credit_card_verification.avs_error_response_code.should == nil
960
+ update_result.credit_card_verification.avs_postal_code_response_code.should == "I"
961
+ update_result.credit_card_verification.avs_street_address_response_code.should == "I"
962
+ end
963
+
922
964
  it "can update the billing address" do
923
965
  customer = Braintree::Customer.create!
924
966
  credit_card = Braintree::CreditCard.create!(
@@ -109,6 +109,23 @@ describe Braintree::Customer do
109
109
  result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
110
110
  end
111
111
 
112
+ it "allows the user to specify the merchant account for verification" do
113
+ result = Braintree::Customer.create(
114
+ :first_name => "Mike",
115
+ :last_name => "Jones",
116
+ :credit_card => {
117
+ :number => Braintree::Test::CreditCardNumbers::FailsSandboxVerification::MasterCard,
118
+ :expiration_date => "05/2010",
119
+ :options => {
120
+ :verify_card => true,
121
+ :verification_merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
122
+ }
123
+ }
124
+ )
125
+ result.success?.should == false
126
+ result.credit_card_verification.status.should == Braintree::Transaction::Status::ProcessorDeclined
127
+ end
128
+
112
129
  it "can create a customer, payment method, and billing address at the same time" do
113
130
  result = Braintree::Customer.create(
114
131
  :first_name => "Mike",
@@ -410,7 +427,7 @@ describe Braintree::Customer do
410
427
  }
411
428
 
412
429
  tr_data = Braintree::TransparentRedirect.create_customer_data({:redirect_url => "http://example.com"}.merge({}))
413
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Customer.create_customer_url, tr_data, params)
430
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Customer.create_customer_url)
414
431
  result = Braintree::Customer.create_from_transparent_redirect(query_string_response)
415
432
 
416
433
  result.success?.should == true
@@ -440,7 +457,7 @@ describe Braintree::Customer do
440
457
  }
441
458
 
442
459
  tr_data = Braintree::TransparentRedirect.create_customer_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
443
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Customer.create_customer_url, tr_data, {})
460
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, {}, Braintree::Customer.create_customer_url)
444
461
  result = Braintree::Customer.create_from_transparent_redirect(query_string_response)
445
462
 
446
463
  result.success?.should == true
@@ -554,6 +571,46 @@ describe Braintree::Customer do
554
571
  result.customer.custom_fields[:store_me].should == "a value"
555
572
  end
556
573
 
574
+ it "can update the customer, credit card, and billing address in one request" do
575
+ customer = Braintree::Customer.create!(
576
+ :first_name => "Joe",
577
+ :credit_card => {
578
+ :number => Braintree::Test::CreditCardNumbers::Visa,
579
+ :expiration_date => "12/2009",
580
+ :billing_address => {
581
+ :first_name => "Joe",
582
+ :postal_code => "60622"
583
+ }
584
+ }
585
+ )
586
+
587
+ result = Braintree::Customer.update(
588
+ customer.id,
589
+ :first_name => "New Joe",
590
+ :credit_card => {
591
+ :cardholder_name => "New Joe Cardholder",
592
+ :options => { :update_existing_token => customer.credit_cards.first.token },
593
+ :billing_address => {
594
+ :last_name => "Cool",
595
+ :postal_code => "60666",
596
+ :options => { :update_existing => true }
597
+ }
598
+ }
599
+ )
600
+ result.success?.should == true
601
+ result.customer.id.should == customer.id
602
+ result.customer.first_name.should == "New Joe"
603
+
604
+ result.customer.credit_cards.size.should == 1
605
+ credit_card = result.customer.credit_cards.first
606
+ credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa.slice(0, 6)
607
+ credit_card.cardholder_name.should == "New Joe Cardholder"
608
+
609
+ credit_card.billing_address.first_name.should == "Joe"
610
+ credit_card.billing_address.last_name.should == "Cool"
611
+ credit_card.billing_address.postal_code.should == "60666"
612
+ end
613
+
557
614
  it "returns an error response if invalid" do
558
615
  customer = Braintree::Customer.create!(:email => "valid@email.com")
559
616
  result = Braintree::Customer.update(
@@ -672,7 +729,7 @@ describe Braintree::Customer do
672
729
  }
673
730
 
674
731
  tr_data = Braintree::TransparentRedirect.update_customer_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
675
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Customer.update_customer_url, tr_data, params)
732
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Customer.update_customer_url)
676
733
  result = Braintree::Customer.update_from_transparent_redirect(query_string_response)
677
734
 
678
735
  result.success?.should == true
@@ -687,6 +744,73 @@ describe Braintree::Customer do
687
744
  customer.website.should == "new.website.com"
688
745
  end
689
746
 
747
+ it "returns a successful result when updating an existing credit card" do
748
+ result = Braintree::Customer.create(
749
+ :first_name => "Old First",
750
+ :last_name => "Old Last",
751
+ :company => "Old Company",
752
+ :email => "old@email.com",
753
+ :phone => "000.111.2222",
754
+ :fax => "000.222.3333",
755
+ :website => "old.website.com",
756
+ :credit_card => {
757
+ :number => Braintree::Test::CreditCardNumbers::Visa,
758
+ :expiration_date => "12/2009",
759
+ :billing_address => {
760
+ :first_name => "Joe",
761
+ :postal_code => "60622"
762
+ }
763
+ }
764
+ )
765
+ result.success?.should == true
766
+ original_customer = result.customer
767
+
768
+ tr_data_params = {
769
+ :customer_id => original_customer.id,
770
+ :customer => {
771
+ :first_name => "New First",
772
+ :last_name => "New Last",
773
+ :company => "New Company",
774
+ :email => "new@email.com",
775
+ :phone => "888.111.2222",
776
+ :fax => "999.222.3333",
777
+ :website => "new.website.com",
778
+ :credit_card => {
779
+ :cardholder_name => "New Joe Cardholder",
780
+ :options => { :update_existing_token => original_customer.credit_cards.first.token },
781
+ :billing_address => {
782
+ :last_name => "Cool",
783
+ :postal_code => "60666",
784
+ :options => { :update_existing => true }
785
+ }
786
+ }
787
+ }
788
+ }
789
+
790
+ tr_data = Braintree::TransparentRedirect.update_customer_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
791
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, {}, Braintree::Customer.update_customer_url)
792
+ result = Braintree::Customer.update_from_transparent_redirect(query_string_response)
793
+
794
+ result.success?.should == true
795
+ customer = result.customer
796
+ customer.id.should == original_customer.id
797
+ customer.first_name.should == "New First"
798
+ customer.last_name.should == "New Last"
799
+ customer.company.should == "New Company"
800
+ customer.email.should == "new@email.com"
801
+ customer.phone.should == "888.111.2222"
802
+ customer.fax.should == "999.222.3333"
803
+ customer.website.should == "new.website.com"
804
+
805
+ credit_card = customer.credit_cards.first
806
+ credit_card.bin.should == Braintree::Test::CreditCardNumbers::Visa.slice(0, 6)
807
+ credit_card.cardholder_name.should == "New Joe Cardholder"
808
+
809
+ credit_card.billing_address.first_name.should == "Joe"
810
+ credit_card.billing_address.last_name.should == "Cool"
811
+ credit_card.billing_address.postal_code.should == "60666"
812
+ end
813
+
690
814
  it "can pass any attribute through tr_data" do
691
815
  original_customer = Braintree::Customer.create!(
692
816
  :first_name => "Old First",
@@ -713,7 +837,7 @@ describe Braintree::Customer do
713
837
  }
714
838
 
715
839
  tr_data = Braintree::TransparentRedirect.update_customer_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
716
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Customer.update_customer_url, tr_data, {})
840
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, {}, Braintree::Customer.update_customer_url)
717
841
  result = Braintree::Customer.update_from_transparent_redirect(query_string_response)
718
842
 
719
843
  result.success?.should == true
@@ -10,7 +10,6 @@ end
10
10
 
11
11
  describe Braintree::SSLExpirationCheck do
12
12
  SANDBOX = "sandbox.braintreegateway.com"
13
- QA = "qa.braintreegateway.com"
14
13
  PRODUCTION = "www.braintreegateway.com"
15
14
 
16
15
  describe "check_dates" do
@@ -18,9 +17,9 @@ describe Braintree::SSLExpirationCheck do
18
17
  Braintree::SSLExpirationCheck.ssl_expiration_dates_checked.should == true
19
18
  end
20
19
 
21
- describe "QA Cert" do
20
+ describe "Sandbox Cert" do
22
21
  it "logs when the cert is expired" do
23
- Braintree::SSLExpirationCheck.stub(:qa_expiration_date).and_return(Date.today - 1)
22
+ Braintree::SSLExpirationCheck.stub(:sandbox_expiration_date).and_return(Date.today - 1)
24
23
 
25
24
  output = StringIO.new
26
25
  Braintree::Configuration.logger = Logger.new(output)
@@ -28,22 +27,22 @@ describe Braintree::SSLExpirationCheck do
28
27
 
29
28
  Braintree::SSLExpirationCheck.check_dates
30
29
 
31
- output.string.should match(/\[Braintree\] The SSL Certificate for the QA environment will expire on \d{4}-\d{2}-\d{2}\. Please check for an updated client library\./)
30
+ output.string.should match(/\[Braintree\] The SSL Certificate for the Sandbox environment will expire on \d{4}-\d{2}-\d{2}\. Please check for an updated client library\./)
32
31
  end
33
32
 
34
33
  it "logs when the cert is close to expiring" do
35
- Braintree::SSLExpirationCheck.stub(:qa_expiration_date).and_return(Date.today)
34
+ Braintree::SSLExpirationCheck.stub(:sandbox_expiration_date).and_return(Date.today)
36
35
  output = StringIO.new
37
36
  Braintree::Configuration.logger = Logger.new(output)
38
37
  Braintree::Configuration.logger.level = Logger::WARN
39
38
 
40
39
  Braintree::SSLExpirationCheck.check_dates
41
40
 
42
- output.string.should match(/\[Braintree\] The SSL Certificate for the QA environment will expire on \d{4}-\d{2}-\d{2}\. Please check for an updated client library\./)
41
+ output.string.should match(/\[Braintree\] The SSL Certificate for the Sandbox environment will expire on \d{4}-\d{2}-\d{2}\. Please check for an updated client library\./)
43
42
  end
44
43
 
45
44
  it "doesn't log when the cert is not expired" do
46
- Braintree::SSLExpirationCheck.stub(:qa_expiration_date).and_return(Date.today + 365)
45
+ Braintree::SSLExpirationCheck.stub(:sandbox_expiration_date).and_return(Date.today + 365)
47
46
  output = StringIO.new
48
47
  Braintree::Configuration.logger = Logger.new(output)
49
48
  Braintree::Configuration.logger.level = Logger::WARN
@@ -85,13 +84,6 @@ describe Braintree::SSLExpirationCheck do
85
84
  end
86
85
  end
87
86
 
88
- describe "qa_expiration_date" do
89
- it "is the date the QA cert expires" do
90
- Braintree::SSLExpirationCheck.qa_expiration_date.should be_a(Date)
91
- Braintree::SSLExpirationCheck.qa_expiration_date.should == fetch_expiration_date(QA)
92
- end
93
- end
94
-
95
87
  describe "sandbox_expiration_date" do
96
88
  it "is the date the Sandbox cert expires" do
97
89
  Braintree::SSLExpirationCheck.sandbox_expiration_date.should be_a(Date)
@@ -20,9 +20,9 @@ describe Braintree::Subscription do
20
20
  before(:each) do
21
21
  @credit_card = Braintree::Customer.create!(
22
22
  :credit_card => {
23
- :number => Braintree::Test::CreditCardNumbers::Visa,
24
- :expiration_date => "05/2010"
25
- }
23
+ :number => Braintree::Test::CreditCardNumbers::Visa,
24
+ :expiration_date => "05/2010"
25
+ }
26
26
  ).credit_cards[0]
27
27
  end
28
28
 
@@ -141,6 +141,7 @@ describe Braintree::Subscription do
141
141
  result.subscription.transactions.first.should be_a(Braintree::Transaction)
142
142
  result.subscription.transactions.first.amount.should == TriallessPlan[:price]
143
143
  result.subscription.transactions.first.type.should == Braintree::Transaction::Type::Sale
144
+ result.subscription.transactions.first.subscription_id.should == result.subscription.id
144
145
  end
145
146
 
146
147
  it "doesn't create a transaction if there's a trial period" do
@@ -257,15 +258,27 @@ describe Braintree::Subscription do
257
258
  ).subscription
258
259
  end
259
260
 
260
- context "merchant_account_id" do
261
- it "allows changing the merchant_account_id" do
262
- result = Braintree::Subscription.update(@subscription.id,
263
- :merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
264
- )
261
+ it "allows changing the merchant_account_id" do
262
+ result = Braintree::Subscription.update(@subscription.id,
263
+ :merchant_account_id => SpecHelper::NonDefaultMerchantAccountId
264
+ )
265
265
 
266
- result.success?.should == true
267
- result.subscription.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
268
- end
266
+ result.success?.should == true
267
+ result.subscription.merchant_account_id.should == SpecHelper::NonDefaultMerchantAccountId
268
+ end
269
+
270
+ it "allows changing the payment_method_token" do
271
+ new_credit_card = Braintree::CreditCard.create!(
272
+ :customer_id => @credit_card.customer_id,
273
+ :number => Braintree::Test::CreditCardNumbers::Visa,
274
+ :expiration_date => "05/2010"
275
+ )
276
+
277
+ result = Braintree::Subscription.update(@subscription.id,
278
+ :payment_method_token => new_credit_card.token
279
+ )
280
+
281
+ result.subscription.payment_method_token.should == new_credit_card.token
269
282
  end
270
283
 
271
284
  context "when successful" do
@@ -344,6 +344,7 @@ describe Braintree::Transaction do
344
344
  transaction.type.should == "sale"
345
345
  transaction.status.should == Braintree::Transaction::Status::Authorized
346
346
  transaction.amount.should == BigDecimal.new("100.00")
347
+ transaction.currency_iso_code.should == "USD"
347
348
  transaction.order_id.should == "123"
348
349
  transaction.processor_response_code.should == "1000"
349
350
  transaction.created_at.between?(Time.now - 60, Time.now).should == true
@@ -804,7 +805,7 @@ describe Braintree::Transaction do
804
805
  }
805
806
  }
806
807
  tr_data = Braintree::TransparentRedirect.transaction_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
807
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Transaction.create_transaction_url, tr_data, params)
808
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Transaction.create_transaction_url)
808
809
  result = Braintree::Transaction.create_from_transparent_redirect(query_string_response)
809
810
 
810
811
  result.success?.should == true
@@ -833,7 +834,7 @@ describe Braintree::Transaction do
833
834
  }
834
835
  }
835
836
  tr_data = Braintree::TransparentRedirect.transaction_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
836
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Transaction.create_transaction_url, tr_data, params)
837
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Transaction.create_transaction_url)
837
838
 
838
839
  expect do
839
840
  Braintree::Transaction.create_from_transparent_redirect(query_string_response)
@@ -889,7 +890,7 @@ describe Braintree::Transaction do
889
890
  }
890
891
  }
891
892
  tr_data = Braintree::TransparentRedirect.transaction_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
892
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Transaction.create_transaction_url, tr_data, params)
893
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Transaction.create_transaction_url)
893
894
  result = Braintree::Transaction.create_from_transparent_redirect(query_string_response)
894
895
 
895
896
  transaction = result.transaction
@@ -953,7 +954,7 @@ describe Braintree::Transaction do
953
954
  }
954
955
  }
955
956
  tr_data = Braintree::TransparentRedirect.transaction_data({:redirect_url => "http://example.com"}.merge(tr_data_params))
956
- query_string_response = SpecHelper.simulate_form_post_for_tr(Braintree::Transaction.create_transaction_url, tr_data, params)
957
+ query_string_response = SpecHelper.simulate_form_post_for_tr(tr_data, params, Braintree::Transaction.create_transaction_url)
957
958
  result = Braintree::Transaction.create_from_transparent_redirect(query_string_response)
958
959
 
959
960
  result.success?.should == false
@@ -1068,6 +1069,21 @@ describe Braintree::Transaction do
1068
1069
  result.new_transaction.type.should == "credit"
1069
1070
  end
1070
1071
 
1072
+ it "assigns the refund_id on the original transaction" do
1073
+ transaction = create_transaction_to_refund
1074
+ refund_transaction = transaction.refund.new_transaction
1075
+ transaction = Braintree::Transaction.find(transaction.id)
1076
+
1077
+ transaction.refund_id.should == refund_transaction.id
1078
+ end
1079
+
1080
+ it "assigns the refunded_transaction_id to the original transaction" do
1081
+ transaction = create_transaction_to_refund
1082
+ refund_transaction = transaction.refund.new_transaction
1083
+
1084
+ refund_transaction.refunded_transaction_id.should == transaction.id
1085
+ end
1086
+
1071
1087
  it "returns an error if already refunded" do
1072
1088
  transaction = create_transaction_to_refund
1073
1089
  result = transaction.refund