Skip to content

Commit

Permalink
Initial work on moving payment_gateway into gem extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
schof committed Jul 12, 2010
1 parent 05de3d6 commit cc29606
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 38 deletions.
29 changes: 28 additions & 1 deletion payment_gateway/lib/payment_gateway.rb
@@ -1 +1,28 @@
#TDOD - May want to add code directly to this lib file later
require 'active_merchant'

# Mixin the payment_gateway method into the base controller so it can be accessed by the checkout process, etc.
Creditcard.class_eval do
# add gateway methods to the creditcard so we can authorize, capture, etc.
include Spree::PaymentGateway
end

silence_warnings { require 'active_merchant/billing/authorize_net_cim' }

#register all payment methods
[
Gateway::Bogus,
Gateway::AuthorizeNet,
Gateway::AuthorizeNetCim,
Gateway::Eway,
Gateway::Linkpoint,
Gateway::PayPal,
Gateway::SagePay,
Gateway::Beanstream,
PaymentMethod::Check
].each{|gw|
begin
gw.register
rescue Exception => e
$stderr.puts "Error registering gateway #{gw}: #{e}"
end
}
6 changes: 6 additions & 0 deletions payment_gateway/lib/payment_gateway/engine.rb
@@ -0,0 +1,6 @@
require "spree_core"

module SpreePaymentGateway
class Engine < Rails::Engine
end
end
37 changes: 0 additions & 37 deletions payment_gateway/payment_gateway_extension.rb

This file was deleted.

0 comments on commit cc29606

Please sign in to comment.