-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: add missing callbacks #231
Feature: add missing callbacks #231
Conversation
… rack version >= 3.1)
…n/stripe-rails into feature/add_missing_webhook_callbacks
Great job! Waiting for your fix to be merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the PR! Once you remove the change to def retrieve_stripe_event(request)
this looks good to go.
app/models/stripe/event_dispatch.rb
Outdated
@@ -8,7 +8,7 @@ def dispatch_stripe_event(request) | |||
end | |||
|
|||
def retrieve_stripe_event(request) | |||
id = request['id'] | |||
id = request.params[:id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @4nd2in can you split this change to it's own PR please? We might have to figure out a way to deal with this for rack versions that still use the old way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, let me help.
stripe-rails supports rails '>= 5.1'
https://github.com/tansengming/stripe-rails/blob/master/stripe-rails.gemspec#L17
So rails 5.1.7 requires rack '~> 2.0'
https://github.com/rails/rails/blob/5-1-stable/actionpack/actionpack.gemspec#L29
I installed rack 2.0.1
locally. Created simple app:
# config.ru
app = Proc.new do |env|
request = Rack::Request.new(env)
[200, {}, [request.params['id']]]
end
run app
Run puma
http://localhost:9292/?id=12
gives me correct result.
Note that using a symbol for id
does not work in this example!
So older versions of rack support request.params['id']
. We do not need to do anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created separate PR
#232
callbacks verified on https://docs.stripe.com/api/events/types |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good thanks for the help @4nd2in !
checkout.session.async_payment_failed
checkout.session.async_payment_succeeded
customer.subscription.paused
customer.subscription.pending_update_applied
customer.subscription.pending_update_expired
customer.subscription.resumed
invoice.deleted
invoice.finalization_failed
invoice.overdue
invoice.will_be_due
Request#[]
is deprecated (undefined method `[]' for an instance of ActionDispatch::Request #230)