Permalink
Browse files

removed selenium, debugger and add failed_refund response

  • Loading branch information...
sbounmy committed Dec 3, 2013
1 parent cd625b2 commit da6c271f736f95e69fca815af9bdb09d66c51d0c
Showing with 15 additions and 9 deletions.
  1. +13 −4 app/models/spree/gateway/pay_pal_express.rb
  2. +2 −3 spec/spec_helper.rb
  3. +0 −2 spree_paypal_express.gemspec
@@ -59,7 +59,7 @@ def purchase(amount, express_checkout, gateway_options={})
# This is mainly so we can use it later on to refund the payment if the user wishes.
transaction_id = pp_response.do_express_checkout_payment_response_details.payment_info.first.transaction_id
express_checkout.update_column(:transaction_id, transaction_id)
- successfull_refund
+ successful_refund
else
class << pp_response
def to_s
@@ -99,7 +99,7 @@ def refund(payment, amount)
end
def credit(amount, source, response_code={}, options={})
- amount /= 100 #was in cts
+ amount /= 100 #was in cents
total = (options[:shipping] + options[:tax] + options[:subtotal] + options[:discount]) / 100
refund_type = total == amount ? 'Full' : 'Partial'
@@ -118,19 +118,28 @@ def credit(amount, source, response_code={}, options={})
:state => "refunded",
:refund_type => refund_type
}, :without_protection => true)
+ successful_refund
+ else
+ failed_refund
end
- successfull_refund
end
protected
# This is rather hackish, required for payment/processing handle_response code.
- def successfull_refund
+ def successful_refund
Class.new do
def success?; true; end
def authorization; nil; end
end.new
end
+
+ def failed_refund
+ Class.new do
+ def success?; false; end
+ def authorization; nil; end
+ end.new
+ end
end
end
View
@@ -22,10 +22,9 @@
require 'pry'
require 'capybara/rspec'
require 'capybara/rails'
-# require 'capybara/poltergeist'
-require 'debugger'
+require 'capybara/poltergeist'
-# Capybara.javascript_driver = :poltergeist
+Capybara.javascript_driver = :poltergeist
Capybara.default_wait_time = 15
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
@@ -26,10 +26,8 @@ Gem::Specification.new do |s|
s.add_dependency 'paypal-sdk-merchant', '1.106.1'
s.add_development_dependency 'capybara', '~> 2.1'
- s.add_development_dependency 'selenium-webdriver'
s.add_development_dependency 'coffee-rails'
s.add_development_dependency 'database_cleaner'
- s.add_development_dependency 'debugger'
s.add_development_dependency 'factory_girl', '~> 4.2'
s.add_development_dependency 'ffaker'
s.add_development_dependency 'rspec-rails', '~> 2.13'

0 comments on commit da6c271

Please sign in to comment.