Sha256: ed08fbd19dc4c5f4b34db706fc171590b3f0a2a4453c84384fb4f3795377ac1d
Contents?: true
Size: 725 Bytes
Versions: 3
Compression:
Stored size: 725 Bytes
Contents
class StripeModelCallbacks::Invoice::UpdatedService < StripeModelCallbacks::BaseEventService def execute 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
3 entries across 3 versions & 1 rubygems