Skip to content

Commit

Permalink
Merge pull request #86 from Everapps/callback-webhook
Browse files Browse the repository at this point in the history
Stop passing `ActionController::Parameters` to `Stripe::Event.construct_from`
  • Loading branch information
tansengming authored Aug 29, 2017
2 parents 60adf3b + 0d78ff5 commit b1353f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/stripe/event_dispatch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def dispatch_stripe_event(params)
def retrieve_stripe_event(params)
id = params['id']
if id == 'evt_00000000000000' #this is a webhook test
yield Stripe::Event.construct_from(params)
yield Stripe::Event.construct_from(params.to_unsafe_h)
else
yield Stripe::Event.retrieve(id)
end
Expand Down
6 changes: 6 additions & 0 deletions test/callbacks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
->{ subject }.must_raise RuntimeError
end
end

describe 'when run from a Stripe webhook test' do
before { event['id'] = 'evt_00000000000000' }

it { subject } # must_not raise error
end
end

describe 'defined without a bang and raising an exception' do
Expand Down

0 comments on commit b1353f7

Please sign in to comment.