Fix price checking for all the domains

This commit is contained in:
Alex Sherman 2020-12-14 13:52:21 +05:00
parent 7d2aad570e
commit a954f3c8e6
5 changed files with 51 additions and 34 deletions

View file

@ -9,18 +9,11 @@ module Domains
string :unit
def execute
if domain_pricelist.try(:price) # checking if price list is not found
if current_user.registrar.balance < domain_pricelist.price.amount
errors.add(:domain, I18n.t('billing_failure_credit_balance_low_for_domain',
domain: domain.name))
return false
end
else
errors.add(:domain, I18n.t(:active_price_missing_for_operation_with_domain,
domain: domain.name))
return false
end
true
return domain_pricelist.price.amount if domain_pricelist.try(:price)
errors.add(:domain, I18n.t(:active_price_missing_for_operation_with_domain,
domain: domain.name))
false
end
private