Class: Spree::BacktracsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/backtracs_controller.rb

Instance Method Summary collapse

Instance Method Details

#exportObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/spree/backtracs_controller.rb', line 9

def export
  @shipments = SolidusBacktracs::Shipment::ExportableQuery.apply(Spree::Shipment.all)
  @shipments = SolidusBacktracs::Shipment::BetweenQuery.apply(
    @shipments,
    from: date_param(:start_date),
    to: date_param(:end_date),
  )
  @shipments = @shipments.page(params[:page]).per(50)

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

#shipnotifyObject



23
24
25
26
27
28
29
# File 'app/controllers/spree/backtracs_controller.rb', line 23

def shipnotify
  shipment_notice_class = SolidusBacktracs.configuration.shipment_notice_class.constantize
  shipment_notice_class.from_payload(params.to_unsafe_h).apply
  head :ok
rescue SolidusBacktracs::Error => e
  head :bad_request
end