Skip to content

Instantly share code, notes, and snippets.

@ankita199
Created January 20, 2015 16:22
Show Gist options
  • Save ankita199/85d3db1cdd7b826e60f2 to your computer and use it in GitHub Desktop.
Save ankita199/85d3db1cdd7b826e60f2 to your computer and use it in GitHub Desktop.
class NotificationsController < ApplicationController
protect_from_forgery :except => :paypal_ipn
def create
params.permit! # Permit all Paypal input params
#query = params
puts "in method*************************************"
#query[:cmd] = "_notify-validate"
#if params[:txn_type] == 'subscr_cancel'
# user_subscription = Subscription.find_by(paypal_customer_token: params[:payer_id])
# user_subscription.update_column("cancelled",1) if user_subscription.present?
#els
if params[:txn_type] == 'recurring_payment_profile_cancel'
user_subscription = Subscription.find_by(paypal_recurring_profile_token: params[:recurring_payment_id])
user_subscription.update_column("cancelled",1) if user_subscription.present?
end
render :text => 'OK'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment