Sha256: 396b87a0fca7d41676d00f85de54a686e0755133b1c3a195e1f69e9bfdd64a93
Contents?: true
Size: 715 Bytes
Versions: 3
Compression:
Stored size: 715 Bytes
Contents
class StripeModelCallbacks::Source::UpdatedService < StripeModelCallbacks::BaseEventService def execute source.assign_from_stripe(object) if source.save create_activity succeed! else fail! source.errors.full_messages end end private def create_activity case event.type when "source.canceled" source.create_activity :canceled when "source.chargeable" source.create_activity :chargeable when "source.failed" source.create_activity :failed when "source.mandate_notification" source.create_activity :mandate_notification end end def source @source ||= StripeSource.find_or_initialize_by(stripe_id: object.id) end end
Version data entries
3 entries across 3 versions & 1 rubygems