Class: Spree::Billing::InvoiceController

Inherits:
BaseController
  • Object
show all
Includes:
OrderParentsConcern
Defined in:
app/controllers/spree/billing/invoice_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#collection_url, #current_vendor, #default_url_options, #edit_object_url, #handle_unauthorized_vendor, #page, #per_page, #required_vendor_user!, #set_locale, #switch_vendor, #vendors

Methods included from SpreeCmCommissioner::Billing::RoleAuthorization

#auth_action, #auth_entry, #auth_user, #authorize!, #authorize?, #authorize_admin, #authorize_role!, #redirect_unauthorized_access

Instance Method Details

#createObject



11
12
13
14
# File 'app/controllers/spree/billing/invoice_controller.rb', line 11

def create
  SpreeCmCommissioner::InvoiceCreator.call(order: @order)
  redirect_back fallback_location: admin_path
end

#model_classObject



27
28
29
# File 'app/controllers/spree/billing/invoice_controller.rb', line 27

def model_class
  SpreeCmCommissioner::Invoice
end

#object_nameObject



31
32
33
# File 'app/controllers/spree/billing/invoice_controller.rb', line 31

def object_name
  'spree_cm_commissioner_invoice'
end

#orderObject



23
24
25
# File 'app/controllers/spree/billing/invoice_controller.rb', line 23

def order
  @order = Spree::Order.find_by!(number: params[:order_id])
end

print_invoice_date_billing_order_invoice_path => /spree/orders/:order_id/invoice/print_invoice_date method to record the date when the invoice was printed



18
19
20
# File 'app/controllers/spree/billing/invoice_controller.rb', line 18

def print_invoice_date
  @order.invoice.update(invoice_issued_date: Time.zone.now)
end

#showObject



7
8
9
# File 'app/controllers/spree/billing/invoice_controller.rb', line 7

def show
  @invoice = @order.invoice
end