mirror of
https://github.com/internetee/registry.git
synced 2025-06-08 13:44:47 +02:00
fixes by review result
This commit is contained in:
parent
1885ddf749
commit
405e6804cc
1 changed files with 6 additions and 2 deletions
|
@ -59,8 +59,7 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
invoice = Invoice.find_by(number: invoice_no)
|
||||
errors.add(:base, I18n.t('invoice_was_not_found')) unless invoice
|
||||
validate_invoice_data(invoice) if invoice
|
||||
validate_invoice_data(invoice)
|
||||
return if errors.any?
|
||||
|
||||
create_internal_payment_record(channel: (manual ? 'admin_payment' : nil), invoice: invoice,
|
||||
|
@ -68,6 +67,11 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def validate_invoice_data(invoice)
|
||||
unless invoice
|
||||
errors.add(:base, I18n.t('invoice_was_not_found'))
|
||||
return
|
||||
end
|
||||
|
||||
if invoice.paid?
|
||||
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue