Class: StripeModelCallbacks::Customer::DiscountUpdatedService

Inherits:
BaseEventService
  • Object
show all
Defined in:
app/services/stripe_model_callbacks/customer/discount_updated_service.rb

Instance Method Summary collapse

Instance Method Details

#performObject



2
3
4
5
6
7
8
9
10
11
12
# File 'app/services/stripe_model_callbacks/customer/discount_updated_service.rb', line 2

def perform
  discount.assign_from_stripe(object)
  discount.deleted_at ||= Time.zone.now if event&.type == "customer.discount.deleted"

  if discount.save
    create_activity
    succeed! discount
  else
    fail! discount.errors.full_messages
  end
end