mirror of
https://github.com/internetee/registry.git
synced 2025-06-09 06:04:56 +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
|
end
|
||||||
|
|
||||||
invoice = Invoice.find_by(number: invoice_no)
|
invoice = Invoice.find_by(number: invoice_no)
|
||||||
errors.add(:base, I18n.t('invoice_was_not_found')) unless invoice
|
validate_invoice_data(invoice)
|
||||||
validate_invoice_data(invoice) if invoice
|
|
||||||
return if errors.any?
|
return if errors.any?
|
||||||
|
|
||||||
create_internal_payment_record(channel: (manual ? 'admin_payment' : nil), invoice: invoice,
|
create_internal_payment_record(channel: (manual ? 'admin_payment' : nil), invoice: invoice,
|
||||||
|
@ -68,6 +67,11 @@ class BankTransaction < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def validate_invoice_data(invoice)
|
def validate_invoice_data(invoice)
|
||||||
|
unless invoice
|
||||||
|
errors.add(:base, I18n.t('invoice_was_not_found'))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if invoice.paid?
|
if invoice.paid?
|
||||||
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue