Merge pull request #1683 from internetee/fix-einvoice-job

EInvoiceJob: Make payable argument required
This commit is contained in:
Timo Võhmar 2020-09-15 17:13:52 +03:00 committed by GitHub
commit e1d379e106
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -1,5 +1,5 @@
class SendEInvoiceJob < Que::Job
def run(invoice_id, payable: true)
def run(invoice_id, payable = true)
invoice = run_condition(Invoice.find_by(id: invoice_id), payable: payable)
invoice.to_e_invoice(payable: payable).deliver

View file

@ -100,7 +100,7 @@ class Invoice < ApplicationRecord
end
def to_e_invoice(payable: true)
generator = Invoice::EInvoiceGenerator.new(self, payable: payable)
generator = Invoice::EInvoiceGenerator.new(self, payable)
generator.generate
end

View file

@ -104,7 +104,7 @@ class Registrar < ApplicationRecord
InvoiceMailer.invoice_email(invoice: invoice, recipient: billing_email).deliver_now
end
SendEInvoiceJob.enqueue(invoice.id, payable: payable)
SendEInvoiceJob.enqueue(invoice.id, payable)
invoice
end

View file

@ -13,7 +13,7 @@ class SendEInvoiceJobTest < ActiveSupport::TestCase
EInvoice::Providers::TestProvider.deliveries.clear
assert_nothing_raised do
SendEInvoiceJob.enqueue(@invoice.id)
SendEInvoiceJob.enqueue(@invoice.id, true)
end
@invoice.reload
@ -29,7 +29,7 @@ class SendEInvoiceJobTest < ActiveSupport::TestCase
stub_request(:get, "https://testfinance.post.ee/finance/erp/erpServices.wsdl").to_timeout
assert_raise HTTPClient::TimeoutError do
SendEInvoiceJob.enqueue(@invoice.id)
SendEInvoiceJob.enqueue(@invoice.id, true)
end
assert @invoicee_invoice_sent_at.blank?
@ -37,7 +37,7 @@ class SendEInvoiceJobTest < ActiveSupport::TestCase
EInvoice::Providers::TestProvider.deliveries.clear
assert_nothing_raised do
SendEInvoiceJob.enqueue(@invoice.id)
SendEInvoiceJob.enqueue(@invoice.id, true)
end
@invoice.reload