mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
27 lines
670 B
Ruby
27 lines
670 B
Ruby
module Domains
|
|
module CheckBalance
|
|
class SingleDomain < ActiveInteraction::Base
|
|
object :domain,
|
|
class: Epp::Domain
|
|
|
|
string :operation
|
|
integer :period
|
|
string :unit
|
|
|
|
def execute
|
|
return domain_pricelist.price.amount if domain_pricelist.try(:price)
|
|
|
|
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,
|
|
domain: domain.name))
|
|
false
|
|
end
|
|
|
|
private
|
|
|
|
def domain_pricelist
|
|
domain.pricelist(operation, period.try(:to_i), unit)
|
|
end
|
|
end
|
|
end
|
|
end
|