Permalink
Browse files

removes card decline context from refunds, as there is no card to dec…

…line in this transaction
  • Loading branch information...
1 parent 2cde5a7 commit 5deb8e1f05d45c79e429f2cd1aa2b1fb2541c879 Robert Whitney committed Oct 3, 2012
Showing with 5 additions and 18 deletions.
  1. +5 −9 lib/fake_braintree/sinatra_app.rb
  2. +0 −9 spec/fake_braintree/transaction_spec.rb
@@ -131,15 +131,11 @@ def hash_from_request_body_with_key(request, key)
# Braintree::Transaction.refund
post "/merchants/:merchant_id/transactions/:transaction_id/refund" do
- if FakeBraintree.decline_all_cards?
- gzipped_response(422, FakeBraintree.create_failure.to_xml(:root => 'api_error_response'))
- else
- transaction = hash_from_request_body_with_key(request, "transaction")
- transaction_id = md5("#{params[:merchant_id]}#{Time.now.to_f}")
- transaction_response = {"id" => transaction_id, "amount" => transaction["amount"], "type" => "credit"}
- FakeBraintree.registry.transactions[transaction_id] = transaction_response
- gzipped_response(200, transaction_response.to_xml(:root => "transaction"))
- end
+ transaction = hash_from_request_body_with_key(request, "transaction")
+ transaction_id = md5("#{params[:merchant_id]}#{Time.now.to_f}")
+ transaction_response = {"id" => transaction_id, "amount" => transaction["amount"], "type" => "credit"}
+ FakeBraintree.registry.transactions[transaction_id] = transaction_response
+ gzipped_response(200, transaction_response.to_xml(:root => "transaction"))
end
# Braintree::Transaction.void
@@ -24,15 +24,6 @@
result = Braintree::Transaction.refund(create_id('foobar'), '1')
result.should be_success
end
-
- context "when all cards are declined" do
- before { FakeBraintree.decline_all_cards! }
-
- it "fails" do
- result = Braintree::Transaction.refund(create_id('foobar'), '1')
- result.should_not be_success
- end
- end
end
end

0 comments on commit 5deb8e1

Please sign in to comment.