Sha256: 51fb398e9f8152ed3e4965e003e00f5690c4cbaba95c0fd973c832ae63ee3458
Contents?: true
Size: 725 Bytes
Versions: 5
Compression:
Stored size: 725 Bytes
Contents
class StripeModelCallbacks::Invoice::UpdatedService < StripeModelCallbacks::BaseEventService def perform invoice.assign_from_stripe(object) if invoice.save create_activity succeed! else fail! invoice.errors.full_messages end end private def create_activity invoice.create_activity :payment_failed if event.type == "invoice.payment_failed" invoice.create_activity :payment_succeeded if event.type == "invoice.payment_succeeded" invoice.create_activity :sent if event.type == "invoice.sent" invoice.create_activity :upcoming if event.type == "invoice.upcoming" end def invoice @invoice ||= StripeInvoice.find_or_initialize_by(stripe_id: object.id) end end
Version data entries
5 entries across 5 versions & 1 rubygems