Sha256: 36b9f495131ba1077336d1bf4c51eddde679369b2fbdfa7385b59e4ef7585dd3
Contents?: true
Size: 1.23 KB
Versions: 141
Compression:
Stored size: 1.23 KB
Contents
module Webhooks::Incoming::Oauth::StripeAccountWebhooks::Base extend ActiveSupport::Concern included do include Webhooks::Incoming::Webhook belongs_to :oauth_stripe_account, class_name: "Oauth::StripeAccount", optional: true end def process # if this is a stripe connect webhook .. if data["account"] # if we're able to find an account in our system that this webhook should be routed to .. if (self.oauth_stripe_account = Oauth::StripeAccount.find_by(uid: data["account"])) # save the reference to the account. save # delegate processing to that account. oauth_stripe_account.process_webhook(self) end # if we didn't find an account for the webhook, they've probably deleted their account. we'll just ignore it for # now, but it's still in our database for debugging purposes. we'll probably want to send a request to stripe # in order to disconnect their account from our application so we stop receiving webhooks. else # it's possible we're receiving a general webhook that isn't specific to an account. # however, we want to know about these, so raise an error. raise "received a webhook we weren't expecting" end end end
Version data entries
141 entries across 141 versions & 1 rubygems