Class: SpreeSquare::OrderCompletedSubscriber

Inherits:
Spree::Subscriber
  • Object
show all
Defined in:
app/subscribers/spree_square/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.

Instance Method Summary collapse

Instance Method Details

#handle(event) ⇒ Object



8
9
10
11
12
13
# File 'app/subscribers/spree_square/order_completed_subscriber.rb', line 8

def handle(event)
  order = Spree::Order.find_by_prefix_id(event.payload['id'])
  return unless order

  SpreeSquare::OrderPushJob.perform_later(order.id)
end