Class: StripeModelCallbacks::InvoiceItem::UpdatedService
- Inherits:
-
BaseEventService
- Object
- BaseEventService
- StripeModelCallbacks::InvoiceItem::UpdatedService
- Defined in:
- app/services/stripe_model_callbacks/invoice_item/updated_service.rb
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/services/stripe_model_callbacks/invoice_item/updated_service.rb', line 2 def perform invoice_item = ::StripeInvoiceItem.find_or_initialize_by(stripe_id: object.id) invoice_item.assign_from_stripe(object) invoice_item.deleted_at = Time.zone.now if event.type == "invoiceitem.deleted" if invoice_item.save succeed! else fail! invoice_item.errors. end end |