Skip to content

Commit

Permalink
Adding callback gateway for wepay testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
karledurante committed Nov 9, 2012
1 parent 5bcc07a commit 42c93fb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/goals_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def sms
render :xml => twiml.text
end

def approved

pgc = PaymentGatewayCallback.create({:callback_type => 'preapprove', :query_params => params.to_s })
render :text => pgc.to_s
end

private
def find_goal
Expand Down
3 changes: 3 additions & 0 deletions app/models/payment_gateway_callback.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class PaymentGatewayCallback < ActiveRecord::Base
attr_accessible :callback_type, :query_params
end
2 changes: 2 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
get :edit
post :update
get :sms
get :approved
post :approved
end

end
Expand Down
14 changes: 14 additions & 0 deletions db/migrate/20121109145523_add_callback_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class AddCallbackTable < ActiveRecord::Migration
def up
create_table :payment_gateway_callbacks do |t|
t.string :callback_type # preapproval, checkout
t.string :query_params, :limit => 1000

t.timestamps
end
end

def down
drop_table :payment_gateway_callbacks
end
end

0 comments on commit 42c93fb

Please sign in to comment.