Class: Jpi::V1::Admin::InvoicesController

Inherits:
BaseResourceController
  • Object
show all
Defined in:
app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb

Instance Method Summary collapse

Instance Method Details

#current_billing_amountObject

GET /mnoe/jpi/v1/admin/invoices/current_billing_amount



15
16
17
18
19
20
21
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 15

def current_billing_amount
  # Backward compatibility with old MnoHub (<= v1.0.2)
  # TODO: Remove once all mnohub are migrated to newer versions
  tenant.respond_to?(:current_billing_amount) && current_billing = tenant.current_billing_amount

  render json: {current_billing_amount: format_money(current_billing)}
end

#indexObject

GET /mnoe/jpi/v1/admin/invoices



5
6
7
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 5

def index
  @invoices = MnoEnterprise::Invoice.all
end

#last_commission_amountObject

GET /mnoe/jpi/v1/admin/invoices/last_commission_amount



42
43
44
45
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 42

def last_commission_amount
  tenant_billing = tenant.last_commission_amount
  render json: {last_commission_amount: format_money(tenant_billing)}
end

#last_invoicing_amountObject

GET /mnoe/jpi/v1/admin/invoices/last_invoicing_amount



24
25
26
27
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 24

def last_invoicing_amount
  tenant_billing = tenant.last_customers_invoicing_amount
  render json: {last_invoicing_amount: format_money(tenant_billing)}
end

#last_portfolio_amountObject

GET /mnoe/jpi/v1/admin/invoices/last_portfolio_amount



36
37
38
39
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 36

def last_portfolio_amount
  tenant_billing = tenant.last_portfolio_amount
  render json: {last_portfolio_amount: format_money(tenant_billing)}
end

#outstanding_amountObject

GET /mnoe/jpi/v1/admin/invoices/outstanding_amount



30
31
32
33
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 30

def outstanding_amount
  tenant_billing = tenant.last_customers_outstanding_amount
  render json: {outstanding_amount: format_money(tenant_billing)}
end

#showObject

GET /mnoe/jpi/v1/admin/invoices/1



10
11
12
# File 'app/controllers/mno_enterprise/jpi/v1/admin/invoices_controller.rb', line 10

def show
  @invoice = MnoEnterprise::Invoice.find(params[:id])
end