mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 15:06:23 +02:00
Fixed codeclimate issues
This commit is contained in:
parent
5e6dbac462
commit
59ecfa8e2f
3 changed files with 18 additions and 21 deletions
|
@ -33,8 +33,7 @@ class SendMonthlyInvoicesJob < ApplicationJob # rubocop:disable Metrics/ClassLen
|
|||
|
||||
result = EisBilling::GetMonthlyInvoiceNumbers.send_request(invoice_without_numbers.size)
|
||||
response = JSON.parse(result.body)
|
||||
billing_restrictions_issue if response['code'] == '403'
|
||||
billing_out_of_range_issue if response['error'] == 'out of range'
|
||||
handle_assign_numbers_response_errors(response)
|
||||
|
||||
numbers = response['invoice_numbers']
|
||||
invoice_without_numbers.each_with_index do |inv, index|
|
||||
|
@ -61,11 +60,9 @@ class SendMonthlyInvoicesJob < ApplicationJob # rubocop:disable Metrics/ClassLen
|
|||
|
||||
private
|
||||
|
||||
def billing_out_of_range_issue
|
||||
raise 'INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE'
|
||||
end
|
||||
|
||||
def billing_restrictions_issue
|
||||
raise 'PROBLEM WITH TOKEN'
|
||||
def handle_assign_numbers_response_errors(response)
|
||||
raise 'INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE' if response['code'] == '403'
|
||||
raise 'PROBLEM WITH TOKEN' if response['error'] == 'out of range'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -25,6 +25,19 @@ module Invoice::BookKeeping
|
|||
invoice
|
||||
end
|
||||
|
||||
def to_e_invoice(payable: true)
|
||||
generator = Invoice::EInvoiceGenerator.new(self, payable)
|
||||
generator.generate
|
||||
end
|
||||
|
||||
def do_not_send_e_invoice?
|
||||
e_invoice_sent? || cancelled?
|
||||
end
|
||||
|
||||
def e_invoice_sent?
|
||||
e_invoice_sent_at.present?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def compose_monthly_directo_lines(lines: [])
|
||||
|
|
|
@ -131,19 +131,6 @@ class Invoice < ApplicationRecord
|
|||
generator.as_pdf
|
||||
end
|
||||
|
||||
def to_e_invoice(payable: true)
|
||||
generator = Invoice::EInvoiceGenerator.new(self, payable)
|
||||
generator.generate
|
||||
end
|
||||
|
||||
def do_not_send_e_invoice?
|
||||
e_invoice_sent? || cancelled?
|
||||
end
|
||||
|
||||
def e_invoice_sent?
|
||||
e_invoice_sent_at.present?
|
||||
end
|
||||
|
||||
def as_csv_row
|
||||
[
|
||||
number,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue