Fix some CC issues

This commit is contained in:
Karl Erik Õunapuu 2021-02-08 12:01:19 +02:00
parent 2dff215128
commit 115cefc0cf
No known key found for this signature in database
GPG key ID: C9DD647298A34764
2 changed files with 8 additions and 5 deletions

View file

@ -12,9 +12,6 @@ module Domains
if domain_pricelist.try(:price)
price = domain_pricelist.price.amount
return price if balance_ok?(price)
domain.add_epp_error(2104, nil, nil, I18n.t(:not_enough_funds))
errors.add(:domain, I18n.t(:billing_failure_credit_balance_low, domain: domain.name))
else
domain.add_epp_error(2104, nil, nil, I18n.t(:active_price_missing_for_this_operation))
errors.add(:domain, I18n.t(:active_price_missing_for_operation_with_domain,
@ -27,7 +24,13 @@ module Domains
private
def balance_ok?(price)
domain.registrar.cash_account.balance >= price
if domain.registrar.cash_account.balance >= price
true
else
domain.add_epp_error(2104, nil, nil, I18n.t(:not_enough_funds))
errors.add(:domain, I18n.t(:billing_failure_credit_balance_low, domain: domain.name))
false
end
end
def domain_pricelist

View file

@ -69,7 +69,7 @@ class ReppV1DomainsBulkRenewTest < ActionDispatch::IntegrationTest
assert_response :bad_request
assert_equal 2002, json[:code]
assert_equal 'Not enough funds for renew domains', json[:message]
assert_equal 'Domain Billing failure - credit balance low', json[:message]
end
end