Sha256: f81abdd8404b50b10fe0401661c531695d145357c7c46fc55ebbb08d6fff2586

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

class StripeModelCallbacks::Recipient::UpdatedService < StripeModelCallbacks::BaseEventService
  def execute
    recipient = StripeRecipient.find_or_initialize_by(stripe_id: object.id)
    recipient.assign_from_stripe(object)
    recipient.deleted_at ||= Time.zone.now if event.type == "recipient.deleted"

    if recipient.save
      recipient.create_activity :deleted if event.type == "recipient.deleted"
      succeed!
    else
      fail! recipient.errors.full_messages
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.2 app/services/stripe_model_callbacks/recipient/updated_service.rb
stripe_model_callbacks-0.1.1 app/services/stripe_model_callbacks/recipient/updated_service.rb
stripe_model_callbacks-0.1.0 app/services/stripe_model_callbacks/recipient/updated_service.rb