Send unpayable e-invoice when invoice has already been paid via wire transfer

This commit is contained in:
Karl Erik Õunapuu 2020-09-08 13:09:12 +03:00
parent 6b2aaf305f
commit 17188ec635
No known key found for this signature in database
GPG key ID: C9DD647298A34764
4 changed files with 15 additions and 12 deletions

View file

@ -99,8 +99,8 @@ class Invoice < ApplicationRecord
generator.as_pdf
end
def to_e_invoice
generator = Invoice::EInvoiceGenerator.new(self)
def to_e_invoice(payable: true)
generator = Invoice::EInvoiceGenerator.new(self, payable: payable)
generator.generate
end
@ -120,7 +120,7 @@ class Invoice < ApplicationRecord
wo_vat = transaction.sum / (1 + (vat / 100))
registrar_user.issue_prepayment_invoice(amount: wo_vat,
description: 'Direct top-up via bank transfer',
paid: true)
payable: false)
end
private