Sha256: 9e056e038c81bcb2400653f943d975d317a086702b0dcbec3c27e54b8a207266

Contents?: true

Size: 406 Bytes

Versions: 5

Compression:

Stored size: 406 Bytes

Contents

class StripeModelCallbacks::Customer::UpdatedService < StripeModelCallbacks::BaseEventService
  def perform
    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

5 entries across 5 versions & 1 rubygems

Version Path
stripe_model_callbacks-0.1.7 app/services/stripe_model_callbacks/customer/updated_service.rb
stripe_model_callbacks-0.1.6 app/services/stripe_model_callbacks/customer/updated_service.rb
stripe_model_callbacks-0.1.5 app/services/stripe_model_callbacks/customer/updated_service.rb
stripe_model_callbacks-0.1.4 app/services/stripe_model_callbacks/customer/updated_service.rb
stripe_model_callbacks-0.1.3 app/services/stripe_model_callbacks/customer/updated_service.rb