Class: Spree::BactracsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/bactracs_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/bactracs_controller.rb', line 9

def export
  @shipments = SolidusBactracs::Shipment::ExportableQuery.apply(Spree::Shipment.all)
  @shipments = SolidusBactracs::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/bactracs_controller.rb', line 23

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