Class: SpreeSquare::WebhookEvent
- Inherits:
-
Object
- Object
- SpreeSquare::WebhookEvent
- Defined in:
- app/models/spree_square/webhook_event.rb
Overview
Idempotency + audit log for inbound Square webhook notifications. The unique index on square_event_id is what makes Square's at-least-once delivery safe to process without duplicating side effects.
Instance Method Summary collapse
Instance Method Details
#mark_failed!(error) ⇒ Object
17 18 19 |
# File 'app/models/spree_square/webhook_event.rb', line 17 def mark_failed!(error) update!(status: 'failed', processed_at: Time.current, error_message: error.to_s.truncate(1000)) end |
#mark_processed! ⇒ Object
13 14 15 |
# File 'app/models/spree_square/webhook_event.rb', line 13 def mark_processed! update!(status: 'processed', processed_at: Time.current) end |