mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 06:26:15 +02:00
Added endpoints for creating and downloading api user certificates
This commit is contained in:
parent
b558c80e83
commit
47b6a1b87a
18 changed files with 377 additions and 102 deletions
|
@ -2,6 +2,7 @@ require 'serializers/repp/invoice'
|
|||
module Repp
|
||||
module V1
|
||||
class InvoicesController < BaseController # rubocop:disable Metrics/ClassLength
|
||||
before_action :find_invoice, only: %i[show download send_to_recipient cancel]
|
||||
load_and_authorize_resource
|
||||
|
||||
THROTTLED_ACTIONS = %i[download add_credit send_to_recipient cancel index show].freeze
|
||||
|
@ -35,8 +36,6 @@ module Repp
|
|||
desc 'Download a specific invoice as pdf file'
|
||||
def download
|
||||
filename = "Invoice-#{@invoice.number}.pdf"
|
||||
@response = { code: 1000, message: 'Command completed successfully',
|
||||
data: filename }
|
||||
send_data @invoice.as_pdf, filename: filename
|
||||
end
|
||||
|
||||
|
@ -91,6 +90,10 @@ module Repp
|
|||
|
||||
private
|
||||
|
||||
def find_invoice
|
||||
@invoice = current_user.registrar.invoices.find(params[:id])
|
||||
end
|
||||
|
||||
def index_params
|
||||
params.permit(:id, :limit, :offset, :details, :q, :simple,
|
||||
:page, :per_page,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue