mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 08:52:04 +02:00
Handling of cancelled monthly invoices
This commit is contained in:
parent
8244066d5d
commit
51066fe4b4
3 changed files with 55 additions and 13 deletions
|
@ -1,4 +1,4 @@
|
|||
class SendMonthlyInvoicesJob < ApplicationJob # rubocop:disable Metrics/ClassLength
|
||||
class SendMonthlyInvoicesJob < ApplicationJob
|
||||
queue_as :default
|
||||
discard_on StandardError
|
||||
|
||||
|
@ -61,6 +61,7 @@ class SendMonthlyInvoicesJob < ApplicationJob # rubocop:disable Metrics/ClassLen
|
|||
private
|
||||
|
||||
def handle_assign_numbers_response_errors(response)
|
||||
raise 'ASSIGN NUMBER RESPONSE ERROR: Not Found' if response['error'] == 'Not Found'
|
||||
raise 'INVOICE NUMBER LIMIT REACHED, COULD NOT GENERATE INVOICE' if response['code'] == '403'
|
||||
raise 'PROBLEM WITH TOKEN' if response['error'] == 'out of range'
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module Registrar::BookKeeping # rubocop:disable Metrics/ModuleLength
|
||||
module Registrar::BookKeeping
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
DOMAIN_TO_PRODUCT = { 'ee': '01EE', 'com.ee': '02COM', 'pri.ee': '03PRI',
|
||||
|
@ -39,7 +39,8 @@ module Registrar::BookKeeping # rubocop:disable Metrics/ModuleLength
|
|||
end
|
||||
|
||||
def find_or_init_monthly_invoice(month:)
|
||||
invoice = invoices.find_by(monthly_invoice: true, issue_date: month.end_of_month.to_date)
|
||||
invoice = invoices.find_by(monthly_invoice: true, issue_date: month.end_of_month.to_date,
|
||||
cancelled_at: nil)
|
||||
return invoice if invoice
|
||||
|
||||
summary = monthly_summary(month: month)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue