mirror of
https://github.com/internetee/registry.git
synced 2025-06-12 15:44:45 +02:00
Fall back on contact email if billing email is absent
Affects e-invoice and invoice delivery form. Fixes #1255
This commit is contained in:
parent
26fa15f76c
commit
6356ce0e9f
2 changed files with 17 additions and 0 deletions
|
@ -176,6 +176,11 @@ class Registrar < ActiveRecord::Base
|
||||||
iban
|
iban
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def billing_email
|
||||||
|
return contact_email if self[:billing_email].blank?
|
||||||
|
self[:billing_email]
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_defaults
|
def set_defaults
|
||||||
|
|
|
@ -63,6 +63,18 @@ class RegistrarTest < ActiveSupport::TestCase
|
||||||
assert registrar.valid?
|
assert registrar.valid?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_returns_billing_email_when_provided
|
||||||
|
billing_email = 'billing@registrar.test'
|
||||||
|
registrar = Registrar.new(billing_email: billing_email)
|
||||||
|
assert_equal billing_email, registrar.billing_email
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_billing_email_fallback
|
||||||
|
contact_email = 'info@registrar.test'
|
||||||
|
registrar = Registrar.new(contact_email: contact_email, billing_email: '')
|
||||||
|
assert_equal contact_email, registrar.billing_email
|
||||||
|
end
|
||||||
|
|
||||||
def test_invalid_without_language
|
def test_invalid_without_language
|
||||||
registrar = valid_registrar
|
registrar = valid_registrar
|
||||||
registrar.language = ''
|
registrar.language = ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue