mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Some tests for invoice binding
This commit is contained in:
parent
e678e655da
commit
57d23976c7
19 changed files with 206 additions and 25 deletions
|
@ -5,11 +5,13 @@ class Registrar < ActiveRecord::Base
|
|||
has_many :contacts, dependent: :restrict_with_error
|
||||
has_many :api_users, dependent: :restrict_with_error
|
||||
has_many :messages
|
||||
belongs_to :country_deprecated, foreign_key: :country_id
|
||||
has_many :invoices, foreign_key: 'buyer_id'
|
||||
has_many :accounts
|
||||
|
||||
belongs_to :country_deprecated, foreign_key: :country_id
|
||||
|
||||
validates :name, :reg_no, :country_code, :email, presence: true
|
||||
validates :name, :reg_no, uniqueness: true
|
||||
validates :name, :reg_no, :reference_no, uniqueness: true
|
||||
validate :set_code, if: :new_record?
|
||||
|
||||
before_create :generate_iso_11649_reference_no
|
||||
|
@ -99,6 +101,10 @@ class Registrar < ActiveRecord::Base
|
|||
)
|
||||
end
|
||||
|
||||
def cash_account
|
||||
accounts.find_by(account_type: Account::CASH)
|
||||
end
|
||||
|
||||
def domain_transfers
|
||||
at = DomainTransfer.arel_table
|
||||
DomainTransfer.where(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue