mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Merge remote-tracking branch 'origin/master' into refactor-contact-archivation
This commit is contained in:
commit
ab1fa9064e
47 changed files with 453 additions and 290 deletions
|
@ -2,7 +2,7 @@ module Admin
|
|||
class BankStatementsController < BaseController
|
||||
load_and_authorize_resource
|
||||
|
||||
before_action :set_bank_statement, only: [:show, :download_import_file, :bind_invoices]
|
||||
before_action :set_bank_statement, only: %i[show bind_invoices]
|
||||
|
||||
def index
|
||||
@q = BankStatement.search(params[:q])
|
||||
|
@ -43,22 +43,6 @@ module Admin
|
|||
end
|
||||
end
|
||||
|
||||
def import
|
||||
@bank_statement = BankStatement.new
|
||||
end
|
||||
|
||||
def create_from_import
|
||||
@bank_statement = BankStatement.new(bank_statement_params)
|
||||
|
||||
if @bank_statement.import
|
||||
flash[:notice] = I18n.t('record_created')
|
||||
redirect_to [:admin, @bank_statement]
|
||||
else
|
||||
flash.now[:alert] = I18n.t('failed_to_create_record')
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
def bind_invoices
|
||||
@bank_statement.bind_invoices(manual: true)
|
||||
|
||||
|
@ -69,11 +53,6 @@ module Admin
|
|||
redirect_to [:admin, @bank_statement]
|
||||
end
|
||||
|
||||
def download_import_file
|
||||
filename = @bank_statement.import_file_path.split('/').last
|
||||
send_data File.open(@bank_statement.import_file_path, 'r').read, filename: filename
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_bank_statement
|
||||
|
@ -81,7 +60,7 @@ module Admin
|
|||
end
|
||||
|
||||
def bank_statement_params
|
||||
params.require(:bank_statement).permit(:th6_file, :bank_code, :iban, bank_transactions_attributes: [
|
||||
params.require(:bank_statement).permit(:bank_code, :iban, bank_transactions_attributes: [
|
||||
:description, :sum, :currency, :reference_no, :paid_at
|
||||
])
|
||||
end
|
||||
|
|
|
@ -2,15 +2,16 @@ class DirectoInvoiceForwardJob < Que::Job
|
|||
def run(monthly: false, dry: false)
|
||||
@dry = dry
|
||||
(@month = Time.zone.now - 1.month) if monthly
|
||||
api_url = ENV['directo_invoice_url']
|
||||
sales_agent = Setting.directo_sales_agent
|
||||
payment_term = Setting.directo_receipt_payment_term
|
||||
@prepayment_product_id = Setting.directo_receipt_product_name
|
||||
|
||||
@client = DirectoApi::Client.new(api_url, sales_agent, payment_term)
|
||||
@client = new_directo_client
|
||||
monthly ? send_monthly_invoices : send_receipts
|
||||
end
|
||||
|
||||
def new_directo_client
|
||||
DirectoApi::Client.new(ENV['directo_invoice_url'], Setting.directo_sales_agent,
|
||||
Setting.directo_receipt_payment_term)
|
||||
end
|
||||
|
||||
def send_receipts
|
||||
unsent_invoices = Invoice.where(in_directo: false).non_cancelled
|
||||
|
||||
|
@ -28,19 +29,18 @@ class DirectoInvoiceForwardJob < Que::Job
|
|||
|
||||
def send_monthly_invoices
|
||||
Registrar.where.not(test_registrar: true).find_each do |registrar|
|
||||
fetch_monthly_summary(registrar: registrar)
|
||||
next unless registrar.cash_account
|
||||
|
||||
@client = new_directo_client
|
||||
send_invoice_for_registrar(registrar)
|
||||
end
|
||||
|
||||
return unless @client.invoices.count.positive?
|
||||
|
||||
sync_with_directo
|
||||
end
|
||||
|
||||
def fetch_monthly_summary(registrar:)
|
||||
return unless registrar.cash_account
|
||||
|
||||
def send_invoice_for_registrar(registrar)
|
||||
summary = registrar.monthly_summary(month: @month)
|
||||
@client.invoices.add_with_schema(invoice: summary, schema: 'summary') unless summary.nil?
|
||||
|
||||
sync_with_directo if @client.invoices.count.positive?
|
||||
end
|
||||
|
||||
def assign_monthly_numbers
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
class SendEInvoiceJob < Que::Job
|
||||
def run(invoice_id)
|
||||
invoice = run_condition(Invoice.find_by(id: invoice_id))
|
||||
def run(invoice_id, payable = true)
|
||||
invoice = run_condition(Invoice.find_by(id: invoice_id), payable: payable)
|
||||
|
||||
invoice.to_e_invoice.deliver
|
||||
invoice.to_e_invoice(payable: payable).deliver
|
||||
ActiveRecord::Base.transaction do
|
||||
invoice.update(e_invoice_sent_at: Time.zone.now)
|
||||
log_success(invoice)
|
||||
|
@ -15,9 +15,9 @@ class SendEInvoiceJob < Que::Job
|
|||
|
||||
private
|
||||
|
||||
def run_condition(invoice)
|
||||
def run_condition(invoice, payable: true)
|
||||
destroy unless invoice
|
||||
destroy if invoice.do_not_send_e_invoice?
|
||||
destroy if invoice.do_not_send_e_invoice? && payable
|
||||
invoice
|
||||
end
|
||||
|
||||
|
|
|
@ -32,12 +32,14 @@ class Ability
|
|||
|
||||
def epp # Registrar/api_user dynamic role
|
||||
if @user.registrar.api_ip_white?(@ip)
|
||||
can :manage, :poll
|
||||
can :manage, Depp::Contact
|
||||
can :manage, :xml_console
|
||||
can :manage, Depp::Domain
|
||||
end
|
||||
|
||||
# Poll
|
||||
can :manage, :poll
|
||||
|
||||
# REPP
|
||||
can(:manage, :repp)
|
||||
|
||||
|
|
|
@ -4,70 +4,17 @@ class BankStatement < ApplicationRecord
|
|||
|
||||
accepts_nested_attributes_for :bank_transactions
|
||||
|
||||
attr_accessor :th6_file
|
||||
|
||||
validates :bank_code, :iban, presence: true
|
||||
|
||||
FULLY_BINDED = 'fully_binded'
|
||||
PARTIALLY_BINDED = 'partially_binded'
|
||||
NOT_BINDED = 'not_binded'
|
||||
|
||||
def import
|
||||
import_th6_file && save
|
||||
end
|
||||
|
||||
def import_th6_file
|
||||
return false unless th6_file
|
||||
|
||||
th6_file.open.each_line do |row|
|
||||
bt_params = parse_th6_row(row)
|
||||
next unless bt_params
|
||||
bank_transactions.build(bt_params)
|
||||
end
|
||||
|
||||
prepare_dir
|
||||
self.import_file_path = "#{ENV['bank_statement_import_dir']}/#{Time.zone.now.to_formatted_s(:number)}.txt"
|
||||
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
|
||||
end
|
||||
|
||||
def prepare_dir
|
||||
dirname = ENV['bank_statement_import_dir']
|
||||
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
||||
end
|
||||
|
||||
def parse_th6_row(row)
|
||||
return parse_th6_header(row) if row[4, 3].strip == '000'
|
||||
return if row[4, 3].strip == '999' # skip footer
|
||||
return unless row[4, 1].strip == '1' # import only transactions
|
||||
return unless row[266, 2].strip == 'C' # import only Credit transactions
|
||||
|
||||
{
|
||||
paid_at: DateTime.strptime(row[5, 8].strip, '%Y%m%d'),
|
||||
bank_reference: row[5, 16].strip,
|
||||
iban: row[25, 20].strip,
|
||||
currency: row[45, 3].strip,
|
||||
buyer_bank_code: row[48, 3].strip,
|
||||
buyer_iban: row[51, 32].strip,
|
||||
buyer_name: row[83, 35].strip,
|
||||
document_no: row[118, 8].strip,
|
||||
description: row[126, 140].strip,
|
||||
sum: BigDecimal(row[268, 12].strip) / BigDecimal('100.0'),
|
||||
reference_no: row[280, 35].strip
|
||||
}
|
||||
end
|
||||
|
||||
def parse_th6_header(row)
|
||||
self.bank_code = row[7, 3].strip
|
||||
self.iban = row[10, 20].strip
|
||||
self.queried_at = DateTime.strptime(row[30, 10].strip, '%y%m%d%H%M')
|
||||
nil
|
||||
end
|
||||
FULLY_BINDED = 'fully_binded'.freeze
|
||||
PARTIALLY_BINDED = 'partially_binded'.freeze
|
||||
NOT_BINDED = 'not_binded'.freeze
|
||||
|
||||
# TODO: Cache this to database so it can be used for searching
|
||||
def status
|
||||
if bank_transactions.unbinded.count == bank_transactions.count
|
||||
NOT_BINDED
|
||||
elsif bank_transactions.unbinded.count == 0
|
||||
elsif bank_transactions.unbinded.count.zero?
|
||||
FULLY_BINDED
|
||||
else
|
||||
PARTIALLY_BINDED
|
||||
|
|
|
@ -31,20 +31,18 @@ class BankTransaction < ApplicationRecord
|
|||
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
||||
end
|
||||
|
||||
def autobindable?
|
||||
!binded? && registrar && invoice.payable? ? true : false
|
||||
rescue NoMethodError
|
||||
false
|
||||
end
|
||||
|
||||
# For successful binding, reference number, invoice id and sum must match with the invoice
|
||||
def autobind_invoice(manual: false)
|
||||
return if binded?
|
||||
return unless registrar
|
||||
return unless invoice
|
||||
return unless invoice.payable?
|
||||
return unless autobindable?
|
||||
|
||||
channel = if manual
|
||||
'admin_payment'
|
||||
else
|
||||
'system_payment'
|
||||
end
|
||||
create_internal_payment_record(channel: channel, invoice: invoice,
|
||||
registrar: registrar)
|
||||
channel = manual ? 'admin_payment' : 'system_payment'
|
||||
create_internal_payment_record(channel: channel, invoice: invoice, registrar: registrar)
|
||||
end
|
||||
|
||||
def create_internal_payment_record(channel: nil, invoice:, registrar:)
|
||||
|
@ -93,12 +91,11 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def create_activity(registrar, invoice)
|
||||
activity = AccountActivity.new(
|
||||
account: registrar.cash_account, bank_transaction: self,
|
||||
invoice: invoice, sum: invoice.subtotal,
|
||||
currency: currency, description: description,
|
||||
activity_type: AccountActivity::ADD_CREDIT
|
||||
)
|
||||
activity = AccountActivity.new(account: registrar.cash_account, bank_transaction: self,
|
||||
invoice: invoice, sum: invoice.subtotal,
|
||||
currency: currency, description: description,
|
||||
activity_type: AccountActivity::ADD_CREDIT)
|
||||
|
||||
if activity.save
|
||||
reset_pending_registrar_balance_reload
|
||||
true
|
||||
|
@ -107,6 +104,10 @@ class BankTransaction < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def parsed_ref_number
|
||||
reference_no || ref_number_from_description
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def reset_pending_registrar_balance_reload
|
||||
|
@ -116,11 +117,12 @@ class BankTransaction < ApplicationRecord
|
|||
registrar.save!
|
||||
end
|
||||
|
||||
def parsed_ref_number
|
||||
reference_no || ref_number_from_description
|
||||
def ref_number_from_description
|
||||
matches = description.to_s.scan(Billing::ReferenceNo::MULTI_REGEXP).flatten
|
||||
matches.detect { |m| break m if m.length == 7 || valid_ref_no?(m) }
|
||||
end
|
||||
|
||||
def ref_number_from_description
|
||||
/(\d{7})/.match(description)[0]
|
||||
def valid_ref_no?(match)
|
||||
return true if Billing::ReferenceNo.valid?(match) && Registrar.find_by(reference_no: match)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
module Billing
|
||||
class Price < ApplicationRecord
|
||||
include Concerns::Billing::Price::Expirable
|
||||
include Versions
|
||||
|
||||
belongs_to :zone, class_name: 'DNS::Zone', required: true
|
||||
has_many :account_activities
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
module Billing
|
||||
class ReferenceNo
|
||||
REGEXP = /\A\d{2,20}\z/
|
||||
REGEXP = /\A\d{2,20}\z/.freeze
|
||||
MULTI_REGEXP = /(\d{2,20})/.freeze
|
||||
|
||||
def self.generate
|
||||
base = Base.generate
|
||||
"#{base}#{base.check_digit}"
|
||||
end
|
||||
|
||||
def self.valid?(ref)
|
||||
base = Base.new(ref.to_s[0...-1])
|
||||
ref.to_s == "#{base}#{base.check_digit}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ module Billing
|
|||
class ReferenceNo
|
||||
class Base
|
||||
def self.generate
|
||||
new(SecureRandom.random_number(1..1_000_000))
|
||||
new((SecureRandom.random_number(9e5) + 1e5).to_i)
|
||||
end
|
||||
|
||||
def initialize(base)
|
||||
|
|
|
@ -127,77 +127,20 @@ class Certificate < ApplicationRecord
|
|||
return false
|
||||
end
|
||||
|
||||
self.class.update_registry_crl
|
||||
self.class.reload_apache
|
||||
self.class.update_crl
|
||||
self
|
||||
end
|
||||
|
||||
class << self
|
||||
def tostdout(message)
|
||||
time = Time.zone.now.utc
|
||||
STDOUT << "#{time} - #{message}\n" unless Rails.env.test?
|
||||
end
|
||||
|
||||
def update_crl
|
||||
update_id_crl
|
||||
update_registry_crl
|
||||
reload_apache
|
||||
end
|
||||
|
||||
def update_id_crl
|
||||
STDOUT << "#{Time.zone.now.utc} - Updating ID CRL\n" unless Rails.env.test?
|
||||
|
||||
_out, _err, _st = Open3.capture3("
|
||||
mkdir -p #{ENV['crl_dir']}/crl-id-temp
|
||||
cd #{ENV['crl_dir']}/crl-id-temp
|
||||
|
||||
wget https://sk.ee/crls/esteid/esteid2007.crl
|
||||
wget https://sk.ee/crls/juur/crl.crl
|
||||
wget https://sk.ee/crls/eeccrca/eeccrca.crl
|
||||
wget https://sk.ee/repository/crls/esteid2011.crl
|
||||
|
||||
openssl crl -in esteid2007.crl -out esteid2007.crl -inform DER
|
||||
openssl crl -in crl.crl -out crl.crl -inform DER
|
||||
openssl crl -in eeccrca.crl -out eeccrca.crl -inform DER
|
||||
openssl crl -in esteid2011.crl -out esteid2011.crl -inform DER
|
||||
|
||||
ln -s crl.crl `openssl crl -hash -noout -in crl.crl`.r0
|
||||
ln -s esteid2007.crl `openssl crl -hash -noout -in esteid2007.crl`.r0
|
||||
ln -s eeccrca.crl `openssl crl -hash -noout -in eeccrca.crl`.r0
|
||||
ln -s esteid2011.crl `openssl crl -hash -noout -in esteid2011.crl`.r0
|
||||
|
||||
rm -rf #{ENV['crl_dir']}/*.crl #{ENV['crl_dir']}/*.r0
|
||||
|
||||
mv #{ENV['crl_dir']}/crl-id-temp/* #{ENV['crl_dir']}
|
||||
|
||||
rm -rf #{ENV['crl_dir']}/crl-id-temp
|
||||
")
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - ID CRL updated\n" unless Rails.env.test?
|
||||
end
|
||||
|
||||
def update_registry_crl
|
||||
STDOUT << "#{Time.zone.now.utc} - Updating registry CRL\n" unless Rails.env.test?
|
||||
|
||||
_out, _err, _st = Open3.capture3("
|
||||
mkdir -p #{ENV['crl_dir']}/crl-temp
|
||||
cd #{ENV['crl_dir']}/crl-temp
|
||||
|
||||
openssl ca -config #{ENV['openssl_config_path']} -keyfile #{ENV['ca_key_path']} -cert \
|
||||
#{ENV['ca_cert_path']} -gencrl -out #{ENV['crl_dir']}/crl-temp/crl.pem -key \
|
||||
'#{ENV['ca_key_password']}' -batch
|
||||
|
||||
ln -s crl.pem `openssl crl -hash -noout -in crl.pem`.r1
|
||||
|
||||
rm -rf #{ENV['crl_dir']}/*.pem #{ENV['crl_dir']}/*.r1
|
||||
|
||||
mv #{ENV['crl_dir']}/crl-temp/* #{ENV['crl_dir']}
|
||||
|
||||
rm -rf #{ENV['crl_dir']}/crl-temp
|
||||
")
|
||||
|
||||
STDOUT << "#{Time.zone.now.utc} - Registry CRL updated\n" unless Rails.env.test?
|
||||
end
|
||||
|
||||
def reload_apache
|
||||
STDOUT << "#{Time.zone.now.utc} - Reloading apache\n" unless Rails.env.test?
|
||||
_out, _err, _st = Open3.capture3("sudo /etc/init.d/apache2 reload")
|
||||
STDOUT << "#{Time.zone.now.utc} - Apache reloaded\n" unless Rails.env.test?
|
||||
tostdout('Running crlupdater')
|
||||
system('/bin/bash', ENV['crl_updater_path'].to_s)
|
||||
tostdout('Finished running crlupdater')
|
||||
end
|
||||
|
||||
def parse_md_from_string(crt)
|
||||
|
|
|
@ -18,6 +18,7 @@ class Domain < ApplicationRecord
|
|||
alias_attribute :on_hold_time, :outzone_at
|
||||
alias_attribute :outzone_time, :outzone_at
|
||||
alias_attribute :auth_info, :transfer_code # Old attribute name; for PaperTrail
|
||||
alias_attribute :registered_at, :created_at
|
||||
|
||||
# TODO: whois requests ip whitelist for full info for own domains and partial info for other domains
|
||||
# TODO: most inputs should be trimmed before validatation, probably some global logic?
|
||||
|
@ -627,7 +628,7 @@ class Domain < ApplicationRecord
|
|||
def as_json(_options)
|
||||
hash = super
|
||||
hash['auth_info'] = hash.delete('transfer_code') # API v1 requirement
|
||||
hash['valid_from'] = hash['registered_at'] # API v1 requirement
|
||||
hash['valid_from'] = hash['created_at'] # API v1 requirement
|
||||
hash.delete('statuses_before_force_delete')
|
||||
hash
|
||||
end
|
||||
|
|
|
@ -41,7 +41,6 @@ class Epp::Domain < Domain
|
|||
domain = Epp::Domain.new
|
||||
domain.attributes = domain.attrs_from(frame, current_user)
|
||||
domain.attach_default_contacts
|
||||
domain.registered_at = Time.zone.now
|
||||
|
||||
period = domain.period.to_i
|
||||
plural_period_unit_name = (domain.period_unit == 'm' ? 'months' : 'years').to_sym
|
||||
|
@ -150,7 +149,6 @@ class Epp::Domain < Domain
|
|||
|
||||
at[:name] = frame.css('name').text if new_record?
|
||||
at[:registrar_id] = current_user.registrar.try(:id)
|
||||
at[:registered_at] = Time.zone.now if new_record?
|
||||
|
||||
period = frame.css('period').text
|
||||
at[:period] = (period.to_i == 0) ? 1 : period.to_i
|
||||
|
@ -502,7 +500,7 @@ class Epp::Domain < Domain
|
|||
frame.css('registrant').attr('verified').to_s.downcase != 'yes'
|
||||
|
||||
if registrant_verification_needed && errors.empty? && verify &&
|
||||
Setting.request_confrimation_on_registrant_change_enabled &&
|
||||
Setting.request_confirmation_on_registrant_change_enabled &&
|
||||
unverified_registrant_params
|
||||
registrant_verification_asked!(frame.to_s, current_user.id) unless disputed?
|
||||
end
|
||||
|
|
|
@ -99,8 +99,8 @@ class Invoice < ApplicationRecord
|
|||
generator.as_pdf
|
||||
end
|
||||
|
||||
def to_e_invoice
|
||||
generator = Invoice::EInvoiceGenerator.new(self)
|
||||
def to_e_invoice(payable: true)
|
||||
generator = Invoice::EInvoiceGenerator.new(self, payable)
|
||||
generator.generate
|
||||
end
|
||||
|
||||
|
@ -112,6 +112,15 @@ class Invoice < ApplicationRecord
|
|||
e_invoice_sent_at.present?
|
||||
end
|
||||
|
||||
def self.create_from_transaction!(transaction)
|
||||
registrar_user = Registrar.find_by(reference_no: transaction.parsed_ref_number)
|
||||
return unless registrar_user
|
||||
|
||||
vat = VatRateCalculator.new(registrar: registrar_user).calculate
|
||||
net = (transaction.sum / (1 + (vat / 100)))
|
||||
registrar_user.issue_prepayment_invoice(net, 'Direct top-up via bank transfer', payable: false)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def apply_default_buyer_vat_no
|
||||
|
@ -119,6 +128,6 @@ class Invoice < ApplicationRecord
|
|||
end
|
||||
|
||||
def calculate_total
|
||||
self.total = subtotal + vat_amount
|
||||
self.total = (subtotal + vat_amount).round(3)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
class Invoice
|
||||
class EInvoiceGenerator
|
||||
attr_reader :invoice
|
||||
attr_reader :payable
|
||||
|
||||
def initialize(invoice)
|
||||
def initialize(invoice, payable)
|
||||
@invoice = invoice
|
||||
@payable = payable
|
||||
end
|
||||
|
||||
def generate
|
||||
|
@ -70,9 +72,10 @@ class Invoice
|
|||
i.total = invoice.total
|
||||
i.currency = invoice.currency
|
||||
i.delivery_channel = %i[internet_bank portal]
|
||||
i.payable = payable
|
||||
end
|
||||
|
||||
EInvoice::EInvoice.new(date: Time.zone.today, invoice: e_invoice_invoice)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ class InvoiceItem < ApplicationRecord
|
|||
delegate :vat_rate, to: :invoice
|
||||
|
||||
def item_sum_without_vat
|
||||
(price * quantity).round(2)
|
||||
(price * quantity).round(3)
|
||||
end
|
||||
alias_method :subtotal, :item_sum_without_vat
|
||||
|
||||
|
@ -14,6 +14,6 @@ class InvoiceItem < ApplicationRecord
|
|||
end
|
||||
|
||||
def total
|
||||
subtotal + vat_amount
|
||||
(subtotal + vat_amount)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ class Registrar < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
def issue_prepayment_invoice(amount, description = nil)
|
||||
def issue_prepayment_invoice(amount, description = nil, payable: true)
|
||||
vat_rate = ::Invoice::VatRateCalculator.new(registrar: self).calculate
|
||||
|
||||
invoice = invoices.create!(
|
||||
|
@ -99,7 +99,12 @@ class Registrar < ApplicationRecord
|
|||
}
|
||||
]
|
||||
)
|
||||
SendEInvoiceJob.enqueue(invoice.id)
|
||||
|
||||
unless payable
|
||||
InvoiceMailer.invoice_email(invoice: invoice, recipient: billing_email).deliver_now
|
||||
end
|
||||
|
||||
SendEInvoiceJob.enqueue(invoice.id, payable)
|
||||
|
||||
invoice
|
||||
end
|
||||
|
|
7
app/models/version/billing/price_version.rb
Normal file
7
app/models/version/billing/price_version.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module Billing
|
||||
class PriceVersion < PaperTrail::Version
|
||||
self.table_name = :log_prices
|
||||
self.sequence_name = :log_prices_id_seq
|
||||
end
|
||||
end
|
||||
|
|
@ -36,7 +36,7 @@ class WhoisRecord < ApplicationRecord
|
|||
h[:disclaimer] = disclaimer_text if disclaimer_text.present?
|
||||
h[:name] = domain.name
|
||||
h[:status] = domain.statuses.map { |x| status_map[x] || x }
|
||||
h[:registered] = domain.registered_at.try(:to_s, :iso8601)
|
||||
h[:registered] = domain.registered_at.iso8601
|
||||
h[:changed] = domain.updated_at.try(:to_s, :iso8601)
|
||||
h[:expire] = domain.valid_to.to_date.to_s
|
||||
h[:outzone] = domain.outzone_at.try(:to_date).try(:to_s)
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:back_to_bank_statements), admin_bank_statements_path, class: 'btn btn-default')
|
||||
= render 'shared/title', name: t(:import_th6_bank_statement)
|
||||
|
||||
= form_for(@bank_statement, url: { action: :create_from_import }, multipart: true) do |f|
|
||||
= render 'shared/full_errors', object: @bank_statement
|
||||
|
||||
.row
|
||||
.col-md-8
|
||||
.form-group
|
||||
.col-md-4.control-label
|
||||
= f.label :th6_file
|
||||
.col-md-8
|
||||
= f.file_field :th6_file
|
||||
.col-md-4
|
||||
%p= t(:bank_statement_desc).html_safe
|
||||
%hr
|
||||
.row
|
||||
.col-md-8.text-right
|
||||
= button_tag(t(:save), class: 'btn btn-primary')
|
|
@ -1,6 +1,5 @@
|
|||
- content_for :actions do
|
||||
= link_to(t(:add), new_admin_bank_statement_path, class: 'btn btn-primary')
|
||||
= link_to(t('.import_btn'), import_admin_bank_statements_path, class: 'btn btn-primary')
|
||||
= render 'shared/title', name: t(:bank_statements)
|
||||
|
||||
.row
|
||||
|
|
|
@ -30,10 +30,6 @@
|
|||
%dt= t(:created_at)
|
||||
%dd= l(@bank_statement.created_at)
|
||||
|
||||
- if @bank_statement.import_file_path
|
||||
%dt= t(:import_file)
|
||||
%dd= link_to(t(:download), download_import_file_admin_bank_statement_path(@bank_statement))
|
||||
|
||||
.row
|
||||
.col-sm-6
|
||||
%h3.text-center-xs
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<dt><%= t(:name) %></dt>
|
||||
<dd><%= @domain.name %></dd>
|
||||
|
||||
<dt><%= t(:registered_at) %></dt>
|
||||
<dt><%= Domain.human_attribute_name :registered_at %></dt>
|
||||
<dd><%= l(@domain.registered_at) %></dd>
|
||||
|
||||
<dt><%= t(:registrar_name) %></dt>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<dt><%= t(:name) %></dt>
|
||||
<dd><%= @domain.name %></dd>
|
||||
|
||||
<dt><%= t(:registered_at) %></dt>
|
||||
<dt><%= Domain.human_attribute_name :registered_at %></dt>
|
||||
<dd><%= l(@domain.registered_at) %></dd>
|
||||
|
||||
<dt><%= Registrar.model_name.human %></dt>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue