Class: SpreeLoyalty::OrderCompletedSubscriber
- Inherits:
-
Spree::Subscriber
- Object
- Spree::Subscriber
- SpreeLoyalty::OrderCompletedSubscriber
- Defined in:
- app/subscribers/spree_loyalty/order_completed_subscriber.rb
Overview
Events & Subscribers is the preferred pattern for this kind of side effect (per this app's own CLAUDE.md conventions) — react to order.completed without touching Spree::Order itself. Mirrors SpreeSquare::OrderCompletedSubscriber / SpreeDoordash's own subscriber shape exactly; fully independent of both — Spree's Events system fires every subscriber for the same event, confirmed live this session watching all three fire for the same real order.
Instance Method Summary collapse
Instance Method Details
#handle(event) ⇒ Object
12 13 14 15 16 17 |
# File 'app/subscribers/spree_loyalty/order_completed_subscriber.rb', line 12 def handle(event) order = Spree::Order.find_by_prefix_id(event.payload['id']) return unless order SpreeLoyalty::Accrual.call(order) end |