mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 19:20:37 +02:00
Add a pause at the e-invoice creation
This commit is contained in:
parent
c7298cde0c
commit
dbda76200d
3 changed files with 16 additions and 2 deletions
|
@ -2,6 +2,7 @@ class SendEInvoiceJob < ApplicationJob
|
|||
discard_on HTTPClient::TimeoutError
|
||||
|
||||
def perform(invoice_id, payable = true)
|
||||
logger.info "Started to process e-invoice for invoice_id #{invoice_id}"
|
||||
invoice = Invoice.find_by(id: invoice_id)
|
||||
return unless need_to_process_invoice?(invoice: invoice, payable: payable)
|
||||
|
||||
|
@ -14,6 +15,7 @@ class SendEInvoiceJob < ApplicationJob
|
|||
private
|
||||
|
||||
def need_to_process_invoice?(invoice:, payable:)
|
||||
logger.info "Checking if need to process e-invoice #{invoice}, payable: #{payable}"
|
||||
return false if invoice.blank?
|
||||
return false if invoice.do_not_send_e_invoice? && payable
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class Registrar < ApplicationRecord
|
|||
.deliver_later(wait: 1.minute)
|
||||
end
|
||||
|
||||
SendEInvoiceJob.perform_now(invoice.id, payable)
|
||||
SendEInvoiceJob.set(wait: 1.minute).perform_now(invoice.id, payable)
|
||||
|
||||
invoice
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue