RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.
http://railsapps.github.io/rails-stripe-membership-saas
1.14k stars 232 forks source link

Cancel my account - undefined method 'deleted' #39

Closed tmock12 closed 11 years ago

tmock12 commented 11 years ago

Has anyone tried cancelling their account? I just tried it in the browser and got.

undefined method `deleted' for #<Stripe::Customer:0x007f80907e25a8>

It's coming from line 63 in the user.rb

And now that I'm looking at it, the method expire in user.rb is the method that sends the "sad to see you go message". I don't see this message being called on a user anywhere in the app though. I can fix this stuff today if someone else can confirm. Or am I missing something?

def expire                                                                                                          
  UserMailer.expire_email(self).deliver                                                                             
  destroy                                                                                                           
end
kathyonu commented 11 years ago

I can confirm the "sad to see you go" message never showed up in my deleting the Gold account. I did see the "Are You Sure" alert, and this message: "Bye! Your account was successfully cancelled. We hope to see you again soon." I log in as Admin, and the Gold account is gone.

DanielKehoe commented 11 years ago

The method User.expire gets called when a webhook triggers a StripeEvent as defined in config/initializers/stripe.rb.

I'm responsible for introducing the bug in user.rb line 63 with commit bea4611d8f48201408796b09c3245772f2cf85f9 "handle cancellation when Stripe customer is already deleted". I was trying to handle a case where the site owner uses the Stripe dashboard to delete the customer and then deletes the user from the app admin dashboard.

DanielKehoe commented 11 years ago

@tmock12 You might be able to improve the Cucumber tests I wrote for this.

PendragonDevelopment commented 11 years ago

I had this issue as well. The Stripe method that needs to be called in user.rb at line 63 is customer.delete, not customer.deleted. If I'm understanding the issue correctly, that is.

EDIT: Which I just saw the diff that @DanielKehoe pushed fixed. Withdrawn.