Sha256: 5c50734ab669af7d55115ab5d1dc4b08fcd67e974773fc49a22006b19b404b9e

Contents?: true

Size: 406 Bytes

Versions: 3

Compression:

Stored size: 406 Bytes

Contents

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

    if customer.save
      succeed!
    else
      fail! customer.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/customer/updated_service.rb
stripe_model_callbacks-0.1.1 app/services/stripe_model_callbacks/customer/updated_service.rb
stripe_model_callbacks-0.1.0 app/services/stripe_model_callbacks/customer/updated_service.rb