Class: Spree::ShipstationController

Inherits:
BaseController
  • Object
show all
Includes:
Pagy::Method, IntegrationsHelper
Defined in:
app/controllers/spree/shipstation_controller.rb

Instance Method Summary collapse

Instance Method Details

#exportObject



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/spree/shipstation_controller.rb', line 13

def export
  @pagy, @shipments = pagy(
    current_store.shipments
      .exportable
      .between(date_param(:start_date), date_param(:end_date)),
    page: params[:page],
    items: 50
  )

  respond_to do |format|
    format.xml { render layout: false }
  end
end

#shipnotifyObject



27
28
29
30
31
32
33
# File 'app/controllers/spree/shipstation_controller.rb', line 27

def shipnotify
  Shipstation::ShipmentNotice.from_payload(params.permit(:order_number, :tracking_number).to_h, store: current_store).apply
  head :ok
rescue Shipstation::Error => e
  Rails.logger.error("ShipStation Notification Error: #{e.message}")
  render plain: e.message, status: :bad_request
end