Permalink
Browse files

add cancel callback for change subscription notify

  • Loading branch information...
1 parent ad8072d commit 4440cf354660de2476e8f1bf9a3fda0d9a4d3715 @zhendi committed Apr 6, 2012
Showing with 9 additions and 1 deletion.
  1. +8 −1 app/controllers/saasy_simple/subscriptions_controller.rb
  2. +1 −0 config/routes.rb
View
9 app/controllers/saasy_simple/subscriptions_controller.rb
@@ -19,8 +19,15 @@ def billing
end
end
+ def change
+ if Digest::MD5.hexdigest(params["security_data"] + SaasySimple.config.c_secret) == params["security_hash"]
+ unless params["SubscriptionEndDate"].blank?
+ SaasySimple.config.model.cancel( params['token'], params['id'] )
+ end
+ end
+ end
+
def deactivate
- Rails.logger.warn params
if Digest::MD5.hexdigest(params["security_data"] + SaasySimple.config.d_secret) == params["security_hash"]
SaasySimple.config.model.deactivate( params['token'], params['id'] )
end
View
1 config/routes.rb
@@ -2,6 +2,7 @@
namespace :saasy_simple do
post "subscriptions/activate", :controller => 'subscriptions', :action => 'activate'
get "subscriptions/billing", :controller => 'subscriptions', :action => 'billing'
+ post "subscriptions/change", :controller => 'subscriptions', :action => 'change'
post "subscriptions/deactivate", :controller => 'subscriptions', :action => 'deactivate'
end
end

0 comments on commit 4440cf3

Please sign in to comment.