Created
November 20, 2011 20:05
-
-
Save swalberg/1380806 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app/controllers/webhooks/versapay_controller.rb: | |
class Webhooks::VersapayController < ApplicationController | |
check_versapay_signatures VERSAPAYSIGNINGKEY | |
... | |
end | |
from gem: | |
class ActionController::Base | |
def self.check_versapay_signatures(key, *args) | |
before_filter lambda { |controller| check_versapay_signature(key, controller)}, *args | |
# before_filter lambda { |controller| ActionController::Base.check_versapay_signature(key, controller)}, *args | |
end | |
def self.check_versapay_signature(key, controller) | |
... | |
if all_is_good | |
true | |
else | |
raise Versapay::InvalidWebhookSignature | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment