Class: SolidusEasypost::TrackerWebhookHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_easypost/tracker_webhook_handler.rb

Class Method Summary collapse

Class Method Details

.call(payload) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/solidus_easypost/tracker_webhook_handler.rb', line 5

def self.call(payload)
  return unless payload['description'] == 'tracker.updated'

  carton = ::Spree::Carton.find_by(easy_post_tracker_id: payload['result']['id'])
  return unless carton

  ::Spree::Event.fire 'solidus_easypost.tracker.updated', carton: carton, payload: payload
end