api/app/models/spree/api/webhooks/shipment_decorator.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Spree
  module Api
    module Webhooks
      module ShipmentDecorator
        def self.prepended(base)
          def base.custom_webhook_events
            %w[shipment.shipped]
          end
        end

        def after_ship
          super
          queue_webhooks_requests!('shipment.shipped')
          order.queue_webhooks_requests!('order.shipped') if order.fully_shipped?
        end
      end
    end
  end
end

Spree::Shipment.prepend(Spree::Api::Webhooks::ShipmentDecorator)