mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Add configurable minimum deposit #2782
This commit is contained in:
parent
e92ef92331
commit
1fe8bd3f46
6 changed files with 31 additions and 1 deletions
|
@ -61,7 +61,7 @@ class Admin::SettingsController < AdminController
|
|||
:expire_pending_confirmation
|
||||
]
|
||||
|
||||
floats = [:registry_vat_prc]
|
||||
floats = [:registry_vat_prc, :minimum_deposit]
|
||||
|
||||
booleans = [
|
||||
:ds_data_allowed,
|
||||
|
|
|
@ -7,6 +7,11 @@ class Deposit
|
|||
attr_accessor :amount, :description, :registrar, :registrar_id
|
||||
|
||||
validates :amount, :registrar, presence: true
|
||||
validate :validate_amount
|
||||
def validate_amount
|
||||
return if BigDecimal.new(amount) >= Setting.minimum_deposit
|
||||
errors.add(:amount, I18n.t(:is_too_small_minimum_deposit_is, amount: Setting.minimum_deposit, currency: 'EUR'))
|
||||
end
|
||||
|
||||
def initialize(attributes = {})
|
||||
attributes.each do |name, value|
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
= render 'setting_row', var: :invoice_number_max
|
||||
= render 'setting_row', var: :days_to_keep_invoices_active
|
||||
= render 'setting_row', var: :days_to_keep_overdue_invoices_active
|
||||
= render 'setting_row', var: :minimum_deposit
|
||||
= render 'setting_row', var: :registry_billing_email
|
||||
= render 'setting_row', var: :registry_invoice_contact
|
||||
= render 'setting_row', var: :registry_vat_no
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue