mirror of
https://github.com/internetee/registry.git
synced 2025-06-07 21:25:39 +02:00
Merge remote-tracking branch 'origin/master' into fix-registrant-contact-view
This commit is contained in:
commit
05a8c5f031
133 changed files with 2328 additions and 1182 deletions
|
@ -1 +1 @@
|
||||||
2.4.7
|
2.6.5
|
||||||
|
|
68
CHANGELOG.md
68
CHANGELOG.md
|
@ -1,3 +1,71 @@
|
||||||
|
30.04.2020
|
||||||
|
* Fix for internal error on opening domain history with legacy id record [#1576](https://github.com/internetee/registry/issues/1576)
|
||||||
|
|
||||||
|
27.04.2020
|
||||||
|
* Downgrade SimpleCov to 0.17 due to incompatibiilty with CodeClimate [#1575](https://github.com/internetee/registry/pull/1575)
|
||||||
|
|
||||||
|
17.04.2020
|
||||||
|
* Webinterfaces have now clickable version string pointing to the latest deployed commit in github [#1345](https://github.com/internetee/registry/pull/1345)
|
||||||
|
|
||||||
|
15.04.2020
|
||||||
|
* Updated Rails to 5.2 and fixed acitionview security issue [#1568](https://github.com/internetee/registry/issues/1568)
|
||||||
|
|
||||||
|
25.03.2020
|
||||||
|
* Implemented Directo gem [#1547](https://github.com/internetee/registry/pull/1547)
|
||||||
|
|
||||||
|
11.03.2020
|
||||||
|
* Fixed glue record issues when using 2nd level domain as host [#1562](https://github.com/internetee/registry/issues/1562)
|
||||||
|
|
||||||
|
10.03.2020
|
||||||
|
* Updated lhv, e-invoice & company_register gem due to security updates [#1564](https://github.com/internetee/registry/pull/1564)
|
||||||
|
|
||||||
|
06.03.2020
|
||||||
|
* Record payment method and failed payments [#1422](https://github.com/internetee/registry/issues/1422)
|
||||||
|
|
||||||
|
04.03.2020
|
||||||
|
* Bump Puma to 4.3.3 [#1557](https://github.com/internetee/registry/pull/1557)
|
||||||
|
|
||||||
|
03.03.2020
|
||||||
|
* Admin: fixed import of th6 bank statement [#1551](https://github.com/internetee/registry/issues/1551)
|
||||||
|
|
||||||
|
02.03.2020
|
||||||
|
* Registrar: fixed statuses based contact filtering [#1004](https://github.com/internetee/registry/issues/1004)
|
||||||
|
|
||||||
|
28.02.2020
|
||||||
|
* Registrar: fixed account switching [#1535](https://github.com/internetee/registry/issues/1535)
|
||||||
|
|
||||||
|
27.02.2020
|
||||||
|
* Registrar: fixed the verified checkbox bug that did not change the element value to yes in epp request [#1540](https://github.com/internetee/registry/issues/1540)
|
||||||
|
* Ruby version update to 2.6.5 [#1545](https://github.com/internetee/registry/pull/1545)
|
||||||
|
|
||||||
|
26.02.2020
|
||||||
|
* Registrar: added an option to remove clientHold status [#1481](https://github.com/internetee/registry/issues/1481)
|
||||||
|
* Admin: fixed domain status removal issue [#1543](https://github.com/internetee/registry/issues/1543)
|
||||||
|
* Implemented consistent and automated data migrations [#1298](https://github.com/internetee/registry/issues/1298)
|
||||||
|
|
||||||
|
20.02.2020
|
||||||
|
* E-invoice sending to Que to manage resending in case of an error [#1509](https://github.com/internetee/registry/issues/1509)
|
||||||
|
* Check to make sure all monthly invoices fit in available invoice number range [#277](https://github.com/internetee/registry/issues/277)
|
||||||
|
* Disabled aurbreak performance monitoring [#1534](https://github.com/internetee/registry/pull/1534)
|
||||||
|
|
||||||
|
14.02.2020
|
||||||
|
* Fixed Papertrail warnings [#1530](https://github.com/internetee/registry/issues/1530)
|
||||||
|
|
||||||
|
12.02.2020
|
||||||
|
* Fixed papertrails double recording issue [#1526](https://github.com/internetee/registry/issues/1526)
|
||||||
|
* Requests to Directo are now saved for both credit and monthly invoices [#344](https://github.com/internetee/registry/issues/344)
|
||||||
|
|
||||||
|
10.02.2020
|
||||||
|
* Resolved Money gem deprecation warning and silenced all warnings due plan to replace papertrail [#1522](https://github.com/internetee/registry/pull/1522)
|
||||||
|
|
||||||
|
06.02.2020
|
||||||
|
* Permit & turn ActiveController::Parameters to hash on domain create [#1516](https://github.com/internetee/registry/issues/1516)
|
||||||
|
|
||||||
|
05.02.2020
|
||||||
|
* Ruby version upgrade to 2.6.3 [#846](https://github.com/internetee/registry/issues/846)
|
||||||
|
* Added retries & raise to connect api to handle timeouts [#1474](https://github.com/internetee/registry/issues/1474)
|
||||||
|
* Added logging of XML if there is NoMethodError#text on xml data fields [#1475](https://github.com/internetee/registry/issues/1475)
|
||||||
|
|
||||||
04.02.2020
|
04.02.2020
|
||||||
* Fixed bug that allowed bypassing blocked domain validation using punycode [#1142](https://github.com/internetee/registry/issues/1142)
|
* Fixed bug that allowed bypassing blocked domain validation using punycode [#1142](https://github.com/internetee/registry/issues/1142)
|
||||||
* SimpleIDN gem update to 0.0.9 [#1508](https://github.com/internetee/registry/pull/1508)
|
* SimpleIDN gem update to 0.0.9 [#1508](https://github.com/internetee/registry/pull/1508)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM internetee/ruby:2.4
|
FROM internetee/ruby:2.6-buster
|
||||||
|
|
||||||
RUN mkdir -p /opt/webapps/app/tmp/pids
|
RUN mkdir -p /opt/webapps/app/tmp/pids
|
||||||
WORKDIR /opt/webapps/app
|
WORKDIR /opt/webapps/app
|
||||||
|
|
20
Gemfile
20
Gemfile
|
@ -1,8 +1,8 @@
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
# core
|
# core
|
||||||
gem 'iso8601', '0.8.6' # for dates and times
|
gem 'iso8601', '0.12.1' # for dates and times
|
||||||
gem 'rails', '~> 5.0.7'
|
gem 'rails', '~> 5.2.4.2'
|
||||||
gem 'rest-client'
|
gem 'rest-client'
|
||||||
gem 'uglifier'
|
gem 'uglifier'
|
||||||
|
|
||||||
|
@ -10,11 +10,11 @@ gem 'uglifier'
|
||||||
gem 'figaro', '1.1.1'
|
gem 'figaro', '1.1.1'
|
||||||
|
|
||||||
# model related
|
# model related
|
||||||
gem 'pg', '0.19.0'
|
gem 'paper_trail', '~> 9.2'
|
||||||
|
gem 'pg', '1.2.2'
|
||||||
# 1.8 is for Rails < 5.0
|
# 1.8 is for Rails < 5.0
|
||||||
gem 'ransack', '~> 1.8'
|
gem 'ransack', '~> 2.3'
|
||||||
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
|
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
|
||||||
gem 'paper_trail', '~> 4.0'
|
|
||||||
|
|
||||||
# 0.7.3 is the latest for Rails 4.2, however, it is absent on Rubygems server
|
# 0.7.3 is the latest for Rails 4.2, however, it is absent on Rubygems server
|
||||||
# https://github.com/huacnlee/rails-settings-cached/issues/165
|
# https://github.com/huacnlee/rails-settings-cached/issues/165
|
||||||
|
@ -36,10 +36,10 @@ gem 'devise', '~> 4.7'
|
||||||
gem 'grape'
|
gem 'grape'
|
||||||
|
|
||||||
# registry specfic
|
# registry specfic
|
||||||
|
gem 'data_migrate', '~> 6.1'
|
||||||
gem 'isikukood' # for EE-id validation
|
gem 'isikukood' # for EE-id validation
|
||||||
gem 'simpleidn', '0.0.9' # For punycode
|
gem 'simpleidn', '0.0.9' # For punycode
|
||||||
gem 'money-rails'
|
gem 'money-rails'
|
||||||
gem 'data_migrate'
|
|
||||||
gem 'whenever', '0.9.4', require: false
|
gem 'whenever', '0.9.4', require: false
|
||||||
|
|
||||||
# country listing
|
# country listing
|
||||||
|
@ -63,11 +63,13 @@ gem 'airbrake'
|
||||||
|
|
||||||
gem 'company_register', github: 'internetee/company_register', branch: :master
|
gem 'company_register', github: 'internetee/company_register', branch: :master
|
||||||
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
|
gem 'e_invoice', github: 'internetee/e_invoice', branch: :master
|
||||||
gem 'lhv', github: 'internetee/lhv', tag: 'v0.1.0'
|
gem 'lhv', github: 'internetee/lhv', branch: :master
|
||||||
gem 'domain_name'
|
gem 'domain_name'
|
||||||
gem 'haml', '~> 5.0'
|
gem 'haml', '~> 5.0'
|
||||||
gem 'wkhtmltopdf-binary'
|
gem 'wkhtmltopdf-binary'
|
||||||
|
|
||||||
|
gem 'directo', github: 'internetee/directo', branch: 'master'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
# deploy
|
# deploy
|
||||||
gem 'mina', '0.3.1' # for fast deployment
|
gem 'mina', '0.3.1' # for fast deployment
|
||||||
|
@ -84,8 +86,8 @@ end
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
gem 'simplecov', require: false
|
gem 'minitest', '~> 5.14'
|
||||||
|
gem 'simplecov', '0.17.1', require: false # CC last supported v0.17
|
||||||
gem 'webdrivers'
|
gem 'webdrivers'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
gem 'minitest', '~> 5.10.0'
|
|
||||||
end
|
end
|
||||||
|
|
302
Gemfile.lock
302
Gemfile.lock
|
@ -1,15 +1,24 @@
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/internetee/company_register.git
|
remote: https://github.com/internetee/company_register.git
|
||||||
revision: da7130542304fc543c90d54cd037d019a777c526
|
revision: 86d691997aa7def9f86d88f6c92cabb86cd65487
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
company_register (0.1.0)
|
company_register (0.1.0)
|
||||||
activesupport
|
activesupport
|
||||||
savon
|
savon
|
||||||
|
|
||||||
|
GIT
|
||||||
|
remote: https://github.com/internetee/directo.git
|
||||||
|
revision: 8cb63d2fb91c640b264d5af05f4a6afbcfd46979
|
||||||
|
branch: master
|
||||||
|
specs:
|
||||||
|
directo (1.0.0)
|
||||||
|
money (~> 6.13)
|
||||||
|
nokogiri (~> 1.10)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/internetee/e_invoice.git
|
remote: https://github.com/internetee/e_invoice.git
|
||||||
revision: 3a754974ed25569aa85d99a87ae9e131b7c10a24
|
revision: b374ffd7be77b559b30c7a0210dc0df5ac3ed723
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
e_invoice (0.1.0)
|
e_invoice (0.1.0)
|
||||||
|
@ -27,7 +36,7 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/internetee/epp.git
|
remote: https://github.com/internetee/epp.git
|
||||||
revision: 76f9fd487d0ca3865b6f706c5a72703951c03996
|
revision: af7cefda37ac81d14b1d12641cde410776082d59
|
||||||
branch: master
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
epp (1.5.0)
|
epp (1.5.0)
|
||||||
|
@ -36,11 +45,12 @@ GIT
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/internetee/lhv.git
|
remote: https://github.com/internetee/lhv.git
|
||||||
revision: e211516bc5fff2139584d4da41c17511863c229d
|
revision: cf0d30816ca9cd6a35d206aa1007c378f8acb502
|
||||||
tag: v0.1.0
|
branch: master
|
||||||
specs:
|
specs:
|
||||||
lhv (0.1.0)
|
lhv (0.1.0)
|
||||||
keystores
|
keystores
|
||||||
|
logger
|
||||||
nokogiri
|
nokogiri
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
|
@ -58,70 +68,70 @@ GIT
|
||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (5.0.7.2)
|
actioncable (5.2.4.2)
|
||||||
actionpack (= 5.0.7.2)
|
actionpack (= 5.2.4.2)
|
||||||
nio4r (>= 1.2, < 3.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (~> 0.6.1)
|
websocket-driver (>= 0.6.1)
|
||||||
actionmailer (5.0.7.2)
|
actionmailer (5.2.4.2)
|
||||||
actionpack (= 5.0.7.2)
|
actionpack (= 5.2.4.2)
|
||||||
actionview (= 5.0.7.2)
|
actionview (= 5.2.4.2)
|
||||||
activejob (= 5.0.7.2)
|
activejob (= 5.2.4.2)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (5.0.7.2)
|
actionpack (5.2.4.2)
|
||||||
actionview (= 5.0.7.2)
|
actionview (= 5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0, >= 2.0.8)
|
||||||
rack-test (~> 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (5.0.7.2)
|
actionview (5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubis (~> 2.7.0)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||||
activejob (5.0.7.2)
|
activejob (5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (5.0.7.2)
|
activemodel (5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
activerecord (5.0.7.2)
|
activerecord (5.2.4.2)
|
||||||
activemodel (= 5.0.7.2)
|
activemodel (= 5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
arel (~> 7.0)
|
arel (>= 9.0)
|
||||||
activesupport (5.0.7.2)
|
activestorage (5.2.4.2)
|
||||||
|
actionpack (= 5.2.4.2)
|
||||||
|
activerecord (= 5.2.4.2)
|
||||||
|
marcel (~> 0.3.1)
|
||||||
|
activesupport (5.2.4.2)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (>= 0.7, < 2)
|
i18n (>= 0.7, < 2)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
tzinfo (~> 1.1)
|
tzinfo (~> 1.1)
|
||||||
addressable (2.7.0)
|
addressable (2.7.0)
|
||||||
public_suffix (>= 2.0.2, < 5.0)
|
public_suffix (>= 2.0.2, < 5.0)
|
||||||
airbrake (9.4.5)
|
airbrake (10.0.1)
|
||||||
airbrake-ruby (~> 4.7)
|
airbrake-ruby (~> 4.13)
|
||||||
airbrake-ruby (4.7.1)
|
airbrake-ruby (4.13.0)
|
||||||
rbtree3 (~> 0.5)
|
rbtree3 (~> 0.5)
|
||||||
akami (1.3.1)
|
akami (1.3.1)
|
||||||
gyoku (>= 0.4.0)
|
gyoku (>= 0.4.0)
|
||||||
nokogiri
|
nokogiri
|
||||||
arel (7.1.4)
|
arel (9.0.0)
|
||||||
autodoc (0.7.3)
|
autodoc (0.7.3)
|
||||||
actionpack
|
actionpack
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
rspec
|
rspec
|
||||||
autoprefixer-rails (9.6.5)
|
autoprefixer-rails (9.7.4)
|
||||||
execjs
|
execjs
|
||||||
axiom-types (0.1.1)
|
|
||||||
descendants_tracker (~> 0.0.4)
|
|
||||||
ice_nine (~> 0.11.0)
|
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
|
||||||
bcrypt (3.1.13)
|
bcrypt (3.1.13)
|
||||||
bootstrap-sass (3.4.1)
|
bootstrap-sass (3.4.1)
|
||||||
autoprefixer-rails (>= 5.2.1)
|
autoprefixer-rails (>= 5.2.1)
|
||||||
sassc (>= 2.0.0)
|
sassc (>= 2.0.0)
|
||||||
builder (3.2.3)
|
builder (3.2.4)
|
||||||
cancancan (3.0.1)
|
cancancan (3.0.2)
|
||||||
capybara (3.29.0)
|
capybara (3.31.0)
|
||||||
addressable
|
addressable
|
||||||
mini_mime (>= 0.1.3)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
@ -132,8 +142,6 @@ GEM
|
||||||
childprocess (3.0.0)
|
childprocess (3.0.0)
|
||||||
chronic (0.10.2)
|
chronic (0.10.2)
|
||||||
coderay (1.1.0)
|
coderay (1.1.0)
|
||||||
coercible (1.0.0)
|
|
||||||
descendants_tracker (~> 0.0.1)
|
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
coffee-script (>= 2.2.0)
|
coffee-script (>= 2.2.0)
|
||||||
railties (>= 4.0.0)
|
railties (>= 4.0.0)
|
||||||
|
@ -141,23 +149,21 @@ GEM
|
||||||
coffee-script-source
|
coffee-script-source
|
||||||
execjs
|
execjs
|
||||||
coffee-script-source (1.12.2)
|
coffee-script-source (1.12.2)
|
||||||
concurrent-ruby (1.1.5)
|
concurrent-ruby (1.1.6)
|
||||||
countries (3.0.0)
|
countries (3.0.0)
|
||||||
i18n_data (~> 0.8.0)
|
i18n_data (~> 0.8.0)
|
||||||
sixarm_ruby_unaccent (~> 1.1)
|
sixarm_ruby_unaccent (~> 1.1)
|
||||||
unicode_utils (~> 1.4)
|
unicode_utils (~> 1.4)
|
||||||
crack (0.4.3)
|
crack (0.4.3)
|
||||||
safe_yaml (~> 1.0.0)
|
safe_yaml (~> 1.0.0)
|
||||||
crass (1.0.5)
|
crass (1.0.6)
|
||||||
daemons (1.3.1)
|
daemons (1.3.1)
|
||||||
daemons-rails (1.2.1)
|
daemons-rails (1.2.1)
|
||||||
daemons
|
daemons
|
||||||
multi_json (~> 1.0)
|
multi_json (~> 1.0)
|
||||||
data_migrate (6.0.5)
|
data_migrate (6.2.0)
|
||||||
rails (>= 5.0)
|
rails (>= 5.0)
|
||||||
database_cleaner (1.7.0)
|
database_cleaner (1.8.2)
|
||||||
descendants_tracker (0.0.4)
|
|
||||||
thread_safe (~> 0.3, >= 0.3.1)
|
|
||||||
devise (4.7.1)
|
devise (4.7.1)
|
||||||
bcrypt (~> 3.0)
|
bcrypt (~> 3.0)
|
||||||
orm_adapter (~> 0.1)
|
orm_adapter (~> 0.1)
|
||||||
|
@ -168,21 +174,42 @@ GEM
|
||||||
docile (1.3.2)
|
docile (1.3.2)
|
||||||
domain_name (0.5.20190701)
|
domain_name (0.5.20190701)
|
||||||
unf (>= 0.0.5, < 1.0.0)
|
unf (>= 0.0.5, < 1.0.0)
|
||||||
equalizer (0.0.11)
|
dry-configurable (0.9.0)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
dry-core (~> 0.4, >= 0.4.7)
|
||||||
|
dry-container (0.7.2)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
dry-configurable (~> 0.1, >= 0.1.3)
|
||||||
|
dry-core (0.4.9)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
dry-equalizer (0.3.0)
|
||||||
|
dry-inflector (0.2.0)
|
||||||
|
dry-logic (1.0.5)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
dry-core (~> 0.2)
|
||||||
|
dry-equalizer (~> 0.2)
|
||||||
|
dry-types (1.2.2)
|
||||||
|
concurrent-ruby (~> 1.0)
|
||||||
|
dry-container (~> 0.3)
|
||||||
|
dry-core (~> 0.4, >= 0.4.4)
|
||||||
|
dry-equalizer (~> 0.3)
|
||||||
|
dry-inflector (~> 0.1, >= 0.1.2)
|
||||||
|
dry-logic (~> 1.0, >= 1.0.2)
|
||||||
|
erubi (1.9.0)
|
||||||
erubis (2.7.0)
|
erubis (2.7.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
ffi (1.11.1)
|
ffi (1.12.2)
|
||||||
figaro (1.1.1)
|
figaro (1.1.1)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
globalid (0.4.2)
|
globalid (0.4.2)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
grape (1.2.4)
|
grape (1.3.0)
|
||||||
activesupport
|
activesupport
|
||||||
builder
|
builder
|
||||||
|
dry-types (>= 1.1)
|
||||||
mustermann-grape (~> 1.0.0)
|
mustermann-grape (~> 1.0.0)
|
||||||
rack (>= 1.3.0)
|
rack (>= 1.3.0)
|
||||||
rack-accept
|
rack-accept
|
||||||
virtus (>= 1.0.0)
|
|
||||||
gyoku (1.3.1)
|
gyoku (1.3.1)
|
||||||
builder (>= 2.1.2)
|
builder (>= 2.1.2)
|
||||||
haml (5.1.2)
|
haml (5.1.2)
|
||||||
|
@ -197,12 +224,11 @@ GEM
|
||||||
httpi (2.4.4)
|
httpi (2.4.4)
|
||||||
rack
|
rack
|
||||||
socksify
|
socksify
|
||||||
i18n (1.7.0)
|
i18n (1.8.2)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
i18n_data (0.8.0)
|
i18n_data (0.8.0)
|
||||||
ice_nine (0.11.2)
|
|
||||||
isikukood (0.1.2)
|
isikukood (0.1.2)
|
||||||
iso8601 (0.8.6)
|
iso8601 (0.12.1)
|
||||||
jquery-rails (4.3.5)
|
jquery-rails (4.3.5)
|
||||||
rails-dom-testing (>= 1, < 3)
|
rails-dom-testing (>= 1, < 3)
|
||||||
railties (>= 4.2.0)
|
railties (>= 4.2.0)
|
||||||
|
@ -210,92 +236,101 @@ GEM
|
||||||
jquery-ui-rails (5.0.5)
|
jquery-ui-rails (5.0.5)
|
||||||
railties (>= 3.2.16)
|
railties (>= 3.2.16)
|
||||||
json (1.8.6)
|
json (1.8.6)
|
||||||
kaminari (1.1.1)
|
kaminari (1.2.0)
|
||||||
activesupport (>= 4.1.0)
|
activesupport (>= 4.1.0)
|
||||||
kaminari-actionview (= 1.1.1)
|
kaminari-actionview (= 1.2.0)
|
||||||
kaminari-activerecord (= 1.1.1)
|
kaminari-activerecord (= 1.2.0)
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.2.0)
|
||||||
kaminari-actionview (1.1.1)
|
kaminari-actionview (1.2.0)
|
||||||
actionview
|
actionview
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.2.0)
|
||||||
kaminari-activerecord (1.1.1)
|
kaminari-activerecord (1.2.0)
|
||||||
activerecord
|
activerecord
|
||||||
kaminari-core (= 1.1.1)
|
kaminari-core (= 1.2.0)
|
||||||
kaminari-core (1.1.1)
|
kaminari-core (1.2.0)
|
||||||
keystores (0.4.0)
|
keystores (0.4.0)
|
||||||
libxml-ruby (3.1.0)
|
libxml-ruby (3.1.0)
|
||||||
loofah (2.3.1)
|
logger (1.4.2)
|
||||||
|
loofah (2.5.0)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.7.1)
|
mail (2.7.1)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
|
marcel (0.3.3)
|
||||||
|
mimemagic (~> 0.3.2)
|
||||||
method_source (0.8.2)
|
method_source (0.8.2)
|
||||||
mime-types (3.3)
|
mime-types (3.3.1)
|
||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2019.1009)
|
mime-types-data (3.2019.1009)
|
||||||
|
mimemagic (0.3.4)
|
||||||
mina (0.3.1)
|
mina (0.3.1)
|
||||||
open4 (~> 1.3.4)
|
open4 (~> 1.3.4)
|
||||||
rake
|
rake
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.10.3)
|
minitest (5.14.0)
|
||||||
monetize (1.9.2)
|
monetize (1.9.4)
|
||||||
money (~> 6.12)
|
money (~> 6.12)
|
||||||
money (6.13.4)
|
money (6.13.7)
|
||||||
i18n (>= 0.6.4, <= 2)
|
i18n (>= 0.6.4, <= 2)
|
||||||
money-rails (1.13.2)
|
money-rails (1.13.3)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
monetize (~> 1.9.0)
|
monetize (~> 1.9.0)
|
||||||
money (~> 6.13.2)
|
money (~> 6.13.2)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
multi_json (1.14.1)
|
multi_json (1.14.1)
|
||||||
mustermann (1.0.3)
|
mustermann (1.1.1)
|
||||||
mustermann-grape (1.0.0)
|
ruby2_keywords (~> 0.0.1)
|
||||||
mustermann (~> 1.0.0)
|
mustermann-grape (1.0.1)
|
||||||
|
mustermann (>= 1.0.0)
|
||||||
netrc (0.11.0)
|
netrc (0.11.0)
|
||||||
nio4r (2.5.2)
|
nio4r (2.5.2)
|
||||||
nokogiri (1.10.4)
|
nokogiri (1.10.9)
|
||||||
mini_portile2 (~> 2.4.0)
|
mini_portile2 (~> 2.4.0)
|
||||||
nori (2.6.0)
|
nori (2.6.0)
|
||||||
open4 (1.3.4)
|
open4 (1.3.4)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
paper_trail (4.2.0)
|
paper_trail (9.2.0)
|
||||||
activerecord (>= 3.0, < 6.0)
|
activerecord (>= 4.2, < 5.3)
|
||||||
activesupport (>= 3.0, < 6.0)
|
paper_trail-association_tracking (< 2)
|
||||||
request_store (~> 1.1)
|
request_store (~> 1.1)
|
||||||
|
paper_trail-association_tracking (1.1.1)
|
||||||
pdfkit (0.8.4.1)
|
pdfkit (0.8.4.1)
|
||||||
pg (0.19.0)
|
pg (1.2.2)
|
||||||
|
polyamorous (2.3.2)
|
||||||
|
activerecord (>= 5.2.1)
|
||||||
pry (0.10.1)
|
pry (0.10.1)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
method_source (~> 0.8.1)
|
method_source (~> 0.8.1)
|
||||||
slop (~> 3.4)
|
slop (~> 3.4)
|
||||||
public_suffix (4.0.1)
|
public_suffix (4.0.3)
|
||||||
puma (4.3.1)
|
puma (4.3.3)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
que (0.14.3)
|
que (0.14.3)
|
||||||
que-web (0.7.2)
|
que-web (0.7.2)
|
||||||
erubis
|
erubis
|
||||||
que (~> 0.8)
|
que (~> 0.8)
|
||||||
sinatra
|
sinatra
|
||||||
rack (2.0.8)
|
rack (2.2.2)
|
||||||
rack-accept (0.4.5)
|
rack-accept (0.4.5)
|
||||||
rack (>= 0.4)
|
rack (>= 0.4)
|
||||||
rack-protection (2.0.7)
|
rack-protection (2.0.8.1)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.3)
|
rack-test (1.1.0)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0, < 3)
|
||||||
railroady (1.3.0)
|
railroady (1.3.0)
|
||||||
rails (5.0.7.2)
|
rails (5.2.4.2)
|
||||||
actioncable (= 5.0.7.2)
|
actioncable (= 5.2.4.2)
|
||||||
actionmailer (= 5.0.7.2)
|
actionmailer (= 5.2.4.2)
|
||||||
actionpack (= 5.0.7.2)
|
actionpack (= 5.2.4.2)
|
||||||
actionview (= 5.0.7.2)
|
actionview (= 5.2.4.2)
|
||||||
activejob (= 5.0.7.2)
|
activejob (= 5.2.4.2)
|
||||||
activemodel (= 5.0.7.2)
|
activemodel (= 5.2.4.2)
|
||||||
activerecord (= 5.0.7.2)
|
activerecord (= 5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activestorage (= 5.2.4.2)
|
||||||
|
activesupport (= 5.2.4.2)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 5.0.7.2)
|
railties (= 5.2.4.2)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-dom-testing (2.0.3)
|
rails-dom-testing (2.0.3)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
|
@ -304,25 +339,25 @@ GEM
|
||||||
loofah (~> 2.3)
|
loofah (~> 2.3)
|
||||||
rails-settings-cached (0.7.2)
|
rails-settings-cached (0.7.2)
|
||||||
rails (>= 4.2.0)
|
rails (>= 4.2.0)
|
||||||
railties (5.0.7.2)
|
railties (5.2.4.2)
|
||||||
actionpack (= 5.0.7.2)
|
actionpack (= 5.2.4.2)
|
||||||
activesupport (= 5.0.7.2)
|
activesupport (= 5.2.4.2)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.19.0, < 2.0)
|
||||||
rake (13.0.0)
|
rake (13.0.1)
|
||||||
ransack (1.8.10)
|
ransack (2.3.2)
|
||||||
actionpack (>= 3.0, < 5.2)
|
activerecord (>= 5.2.1)
|
||||||
activerecord (>= 3.0, < 5.2)
|
activesupport (>= 5.2.1)
|
||||||
activesupport (>= 3.0, < 5.2)
|
|
||||||
i18n
|
i18n
|
||||||
|
polyamorous (= 2.3.2)
|
||||||
rb-fsevent (0.10.3)
|
rb-fsevent (0.10.3)
|
||||||
rb-inotify (0.10.0)
|
rb-inotify (0.10.1)
|
||||||
ffi (~> 1.0)
|
ffi (~> 1.0)
|
||||||
rbtree3 (0.5.0)
|
rbtree3 (0.6.0)
|
||||||
rdoc (4.3.0)
|
rdoc (4.3.0)
|
||||||
regexp_parser (1.6.0)
|
regexp_parser (1.6.0)
|
||||||
request_store (1.4.1)
|
request_store (1.5.0)
|
||||||
rack (>= 1.4)
|
rack (>= 1.4)
|
||||||
responders (3.0.0)
|
responders (3.0.0)
|
||||||
actionpack (>= 5.0)
|
actionpack (>= 5.0)
|
||||||
|
@ -336,16 +371,17 @@ GEM
|
||||||
rspec-core (~> 3.9.0)
|
rspec-core (~> 3.9.0)
|
||||||
rspec-expectations (~> 3.9.0)
|
rspec-expectations (~> 3.9.0)
|
||||||
rspec-mocks (~> 3.9.0)
|
rspec-mocks (~> 3.9.0)
|
||||||
rspec-core (3.9.0)
|
rspec-core (3.9.1)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.1)
|
||||||
rspec-expectations (3.9.0)
|
rspec-expectations (3.9.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-mocks (3.9.0)
|
rspec-mocks (3.9.1)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.9.0)
|
rspec-support (~> 3.9.0)
|
||||||
rspec-support (3.9.0)
|
rspec-support (3.9.2)
|
||||||
rubyzip (2.0.0)
|
ruby2_keywords (0.0.2)
|
||||||
|
rubyzip (2.2.0)
|
||||||
safe_yaml (1.0.5)
|
safe_yaml (1.0.5)
|
||||||
sass (3.7.4)
|
sass (3.7.4)
|
||||||
sass-listen (~> 4.0.0)
|
sass-listen (~> 4.0.0)
|
||||||
|
@ -374,7 +410,7 @@ GEM
|
||||||
select2-rails (3.5.9.3)
|
select2-rails (3.5.9.3)
|
||||||
thor (~> 0.14)
|
thor (~> 0.14)
|
||||||
selectize-rails (0.12.1)
|
selectize-rails (0.12.1)
|
||||||
selenium-webdriver (3.142.6)
|
selenium-webdriver (3.142.7)
|
||||||
childprocess (>= 0.5, < 4.0)
|
childprocess (>= 0.5, < 4.0)
|
||||||
rubyzip (>= 1.2.2)
|
rubyzip (>= 1.2.2)
|
||||||
simplecov (0.17.1)
|
simplecov (0.17.1)
|
||||||
|
@ -383,10 +419,10 @@ GEM
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.2)
|
simplecov-html (0.10.2)
|
||||||
simpleidn (0.0.9)
|
simpleidn (0.0.9)
|
||||||
sinatra (2.0.7)
|
sinatra (2.0.8.1)
|
||||||
mustermann (~> 1.0)
|
mustermann (~> 1.0)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-protection (= 2.0.7)
|
rack-protection (= 2.0.8.1)
|
||||||
tilt (~> 2.0)
|
tilt (~> 2.0)
|
||||||
sixarm_ruby_unaccent (1.2.0)
|
sixarm_ruby_unaccent (1.2.0)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
|
@ -402,7 +438,7 @@ GEM
|
||||||
thor (0.20.3)
|
thor (0.20.3)
|
||||||
thread_safe (0.3.6)
|
thread_safe (0.3.6)
|
||||||
tilt (2.0.10)
|
tilt (2.0.10)
|
||||||
tzinfo (1.2.5)
|
tzinfo (1.2.7)
|
||||||
thread_safe (~> 0.1)
|
thread_safe (~> 0.1)
|
||||||
uglifier (4.2.0)
|
uglifier (4.2.0)
|
||||||
execjs (>= 0.3.0, < 3)
|
execjs (>= 0.3.0, < 3)
|
||||||
|
@ -412,30 +448,25 @@ GEM
|
||||||
unicode_utils (1.4.0)
|
unicode_utils (1.4.0)
|
||||||
validates_email_format_of (1.6.3)
|
validates_email_format_of (1.6.3)
|
||||||
i18n
|
i18n
|
||||||
virtus (1.0.5)
|
|
||||||
axiom-types (~> 0.1)
|
|
||||||
coercible (~> 1.0)
|
|
||||||
descendants_tracker (~> 0.0, >= 0.0.3)
|
|
||||||
equalizer (~> 0.0, >= 0.0.9)
|
|
||||||
warden (1.2.8)
|
warden (1.2.8)
|
||||||
rack (>= 2.0.6)
|
rack (>= 2.0.6)
|
||||||
wasabi (3.5.0)
|
wasabi (3.5.0)
|
||||||
httpi (~> 2.0)
|
httpi (~> 2.0)
|
||||||
nokogiri (>= 1.4.2)
|
nokogiri (>= 1.4.2)
|
||||||
webdrivers (4.1.3)
|
webdrivers (4.2.0)
|
||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
rubyzip (>= 1.3.0)
|
rubyzip (>= 1.3.0)
|
||||||
selenium-webdriver (>= 3.0, < 4.0)
|
selenium-webdriver (>= 3.0, < 4.0)
|
||||||
webmock (3.7.6)
|
webmock (3.8.0)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff (>= 0.4.0, < 2.0.0)
|
hashdiff (>= 0.4.0, < 2.0.0)
|
||||||
websocket-driver (0.6.5)
|
websocket-driver (0.7.1)
|
||||||
websocket-extensions (>= 0.1.0)
|
websocket-extensions (>= 0.1.0)
|
||||||
websocket-extensions (0.1.4)
|
websocket-extensions (0.1.4)
|
||||||
whenever (0.9.4)
|
whenever (0.9.4)
|
||||||
chronic (>= 0.6.3)
|
chronic (>= 0.6.3)
|
||||||
wkhtmltopdf-binary (0.12.4)
|
wkhtmltopdf-binary (0.12.5.1)
|
||||||
xpath (3.2.0)
|
xpath (3.2.0)
|
||||||
nokogiri (~> 1.8)
|
nokogiri (~> 1.8)
|
||||||
|
|
||||||
|
@ -453,10 +484,11 @@ DEPENDENCIES
|
||||||
company_register!
|
company_register!
|
||||||
countries
|
countries
|
||||||
daemons-rails (= 1.2.1)
|
daemons-rails (= 1.2.1)
|
||||||
data_migrate
|
data_migrate (~> 6.1)
|
||||||
database_cleaner
|
database_cleaner
|
||||||
devise (~> 4.7)
|
devise (~> 4.7)
|
||||||
digidoc_client!
|
digidoc_client!
|
||||||
|
directo!
|
||||||
domain_name
|
domain_name
|
||||||
e_invoice!
|
e_invoice!
|
||||||
epp!
|
epp!
|
||||||
|
@ -465,32 +497,32 @@ DEPENDENCIES
|
||||||
grape
|
grape
|
||||||
haml (~> 5.0)
|
haml (~> 5.0)
|
||||||
isikukood
|
isikukood
|
||||||
iso8601 (= 0.8.6)
|
iso8601 (= 0.12.1)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
jquery-ui-rails (= 5.0.5)
|
jquery-ui-rails (= 5.0.5)
|
||||||
kaminari
|
kaminari
|
||||||
lhv!
|
lhv!
|
||||||
mina (= 0.3.1)
|
mina (= 0.3.1)
|
||||||
minitest (~> 5.10.0)
|
minitest (~> 5.14)
|
||||||
money-rails
|
money-rails
|
||||||
nokogiri
|
nokogiri
|
||||||
paper_trail (~> 4.0)
|
paper_trail (~> 9.2)
|
||||||
pdfkit
|
pdfkit
|
||||||
pg (= 0.19.0)
|
pg (= 1.2.2)
|
||||||
pry (= 0.10.1)
|
pry (= 0.10.1)
|
||||||
puma
|
puma
|
||||||
que
|
que
|
||||||
que-web
|
que-web
|
||||||
railroady (= 1.3.0)
|
railroady (= 1.3.0)
|
||||||
rails (~> 5.0.7)
|
rails (~> 5.2.4.2)
|
||||||
rails-settings-cached (= 0.7.2)
|
rails-settings-cached (= 0.7.2)
|
||||||
ransack (~> 1.8)
|
ransack (~> 2.3)
|
||||||
rest-client
|
rest-client
|
||||||
sass-rails (= 5.0.6)
|
sass-rails (= 5.0.6)
|
||||||
sdoc (= 0.4.1)
|
sdoc (= 0.4.1)
|
||||||
select2-rails (= 3.5.9.3)
|
select2-rails (= 3.5.9.3)
|
||||||
selectize-rails (= 0.12.1)
|
selectize-rails (= 0.12.1)
|
||||||
simplecov
|
simplecov (= 0.17.1)
|
||||||
simpleidn (= 0.0.9)
|
simpleidn (= 0.0.9)
|
||||||
uglifier
|
uglifier
|
||||||
validates_email_format_of (= 1.6.3)
|
validates_email_format_of (= 1.6.3)
|
||||||
|
@ -500,4 +532,4 @@ DEPENDENCIES
|
||||||
wkhtmltopdf-binary
|
wkhtmltopdf-binary
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
2.0.2
|
2.1.4
|
||||||
|
|
|
@ -15,6 +15,9 @@ body > .container
|
||||||
padding-top: 15px
|
padding-top: 15px
|
||||||
font-size: 10px
|
font-size: 10px
|
||||||
|
|
||||||
|
a.footer-version-link
|
||||||
|
color: black
|
||||||
|
|
||||||
.nowrap
|
.nowrap
|
||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def bind_invoices
|
def bind_invoices
|
||||||
@bank_statement.bind_invoices
|
@bank_statement.bind_invoices(manual: true)
|
||||||
|
|
||||||
flash[:notice] = t('invoices_were_fully_binded') if @bank_statement.fully_binded?
|
flash[:notice] = t('invoices_were_fully_binded') if @bank_statement.fully_binded?
|
||||||
flash[:warning] = t('invoices_were_partially_binded') if @bank_statement.partially_binded?
|
flash[:warning] = t('invoices_were_partially_binded') if @bank_statement.partially_binded?
|
||||||
|
|
|
@ -34,7 +34,7 @@ module Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def bind
|
def bind
|
||||||
if @bank_transaction.bind_invoice(params[:invoice_no])
|
if @bank_transaction.bind_invoice(params[:invoice_no], manual: true)
|
||||||
flash[:notice] = I18n.t('record_created')
|
flash[:notice] = I18n.t('record_created')
|
||||||
redirect_to [:admin, @bank_transaction]
|
redirect_to [:admin, @bank_transaction]
|
||||||
else
|
else
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Admin
|
||||||
send_data @zonefile, filename: "#{params[:origin]}.txt"
|
send_data @zonefile, filename: "#{params[:origin]}.txt"
|
||||||
else
|
else
|
||||||
flash[:alert] = 'Origin not supported'
|
flash[:alert] = 'Origin not supported'
|
||||||
redirect_to :back
|
redirect_back(fallback_location: root_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
check_authorization unless: :devise_controller?
|
check_authorization unless: :devise_controller?
|
||||||
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
# Prevent CSRF attacks by raising an exception.
|
# Prevent CSRF attacks by raising an exception.
|
||||||
# For APIs, you may want to use :null_session instead.
|
# For APIs, you may want to use :null_session instead.
|
||||||
|
|
|
@ -10,7 +10,7 @@ module Epp
|
||||||
before_action :latin_only
|
before_action :latin_only
|
||||||
before_action :validate_against_schema
|
before_action :validate_against_schema
|
||||||
before_action :validate_request
|
before_action :validate_request
|
||||||
before_action :update_epp_session, if: 'signed_in?'
|
before_action :update_epp_session, if: -> { signed_in? }
|
||||||
|
|
||||||
around_action :wrap_exceptions
|
around_action :wrap_exceptions
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ module Epp
|
||||||
class DomainsController < BaseController
|
class DomainsController < BaseController
|
||||||
before_action :find_domain, only: %i[info renew update transfer delete]
|
before_action :find_domain, only: %i[info renew update transfer delete]
|
||||||
before_action :find_password, only: %i[info update transfer delete]
|
before_action :find_password, only: %i[info update transfer delete]
|
||||||
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
def info
|
def info
|
||||||
authorize! :info, @domain
|
authorize! :info, @domain
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Epp
|
module Epp
|
||||||
class SessionsController < BaseController
|
class SessionsController < BaseController
|
||||||
skip_authorization_check only: [:hello, :login, :logout]
|
skip_authorization_check only: [:hello, :login, :logout]
|
||||||
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
def hello
|
def hello
|
||||||
render_epp_response('greeting')
|
render_epp_response('greeting')
|
||||||
|
|
|
@ -17,12 +17,13 @@ class Registrar
|
||||||
search_params[:registrant_domains_id_not_null] = 1
|
search_params[:registrant_domains_id_not_null] = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:statuses_contains]
|
contacts = current_registrar_user.registrar.contacts.includes(:registrar)
|
||||||
contacts = current_registrar_user.registrar.contacts.includes(:registrar).where(
|
status_list = params[:statuses_contains]
|
||||||
"contacts.statuses @> ?::varchar[]", "{#{params[:statuses_contains].join(',')}}"
|
|
||||||
)
|
if status_list
|
||||||
else
|
contacts_ids = contacts.select { |c| (c.statuses & status_list.to_a) == status_list.to_a }
|
||||||
contacts = current_registrar_user.registrar.contacts.includes(:registrar)
|
.map(&:id)
|
||||||
|
contacts = contacts.where(id: contacts_ids)
|
||||||
end
|
end
|
||||||
|
|
||||||
normalize_search_parameters do
|
normalize_search_parameters do
|
||||||
|
|
|
@ -6,7 +6,7 @@ class Registrar
|
||||||
raise 'Cannot switch to unlinked user' unless current_registrar_user.linked_with?(new_user)
|
raise 'Cannot switch to unlinked user' unless current_registrar_user.linked_with?(new_user)
|
||||||
|
|
||||||
sign_in(:registrar_user, new_user)
|
sign_in(:registrar_user, new_user)
|
||||||
redirect_to :back, notice: t('.switched', new_user: new_user)
|
redirect_back(fallback_location: root_path, notice: t('.switched', new_user: new_user))
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -59,6 +59,7 @@ class Registrar
|
||||||
def info
|
def info
|
||||||
authorize! :info, Depp::Domain
|
authorize! :info, Depp::Domain
|
||||||
@data = @domain.info(params[:domain_name]) if params[:domain_name]
|
@data = @domain.info(params[:domain_name]) if params[:domain_name]
|
||||||
|
@client_holded = client_holded(@data)
|
||||||
if response_ok?
|
if response_ok?
|
||||||
render 'info'
|
render 'info'
|
||||||
else
|
else
|
||||||
|
@ -85,7 +86,7 @@ class Registrar
|
||||||
|
|
||||||
def create
|
def create
|
||||||
authorize! :create, Depp::Domain
|
authorize! :create, Depp::Domain
|
||||||
@domain_params = params[:domain]
|
@domain_params = domain_params.to_h
|
||||||
@data = @domain.create(@domain_params)
|
@data = @domain.create(@domain_params)
|
||||||
|
|
||||||
if response_ok?
|
if response_ok?
|
||||||
|
@ -153,12 +154,26 @@ class Registrar
|
||||||
render json: scope.pluck(:name, :code).map { |c| { display_key: "#{c.second} #{c.first}", value: c.second } }
|
render json: scope.pluck(:name, :code).map { |c| { display_key: "#{c.second} #{c.first}", value: c.second } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def remove_hold
|
||||||
|
authorize! :remove_hold, Depp::Domain
|
||||||
|
return unless params[:domain_name]
|
||||||
|
|
||||||
|
@data = @domain.remove_hold(params)
|
||||||
|
|
||||||
|
flash[:alert] = @data.css('msg').text unless response_ok?
|
||||||
|
redirect_to info_registrar_domains_url(domain_name: params[:domain_name])
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def init_domain
|
def init_domain
|
||||||
@domain = Depp::Domain.new(current_user: depp_current_user)
|
@domain = Depp::Domain.new(current_user: depp_current_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def client_holded(data)
|
||||||
|
data.css('status')&.map { |element| element.attribute('s').value }
|
||||||
|
&.any? { |status| status == DomainStatus::CLIENT_HOLD }
|
||||||
|
end
|
||||||
|
|
||||||
def contacts
|
def contacts
|
||||||
current_registrar_user.registrar.contacts
|
current_registrar_user.registrar.contacts
|
||||||
|
@ -187,5 +202,12 @@ class Registrar
|
||||||
:valid_to_lteq,
|
:valid_to_lteq,
|
||||||
:s)
|
:s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def domain_params
|
||||||
|
params.require(:domain).permit(:name, :period, :registrant, :registrant_helper, :reserved_pw,
|
||||||
|
:verified, :legal_document, contacts_attributes: {},
|
||||||
|
nameservers_attributes: {},
|
||||||
|
dnskeys_attributes: {})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,50 +5,51 @@ class Registrar
|
||||||
skip_authorization_check # actually anyone can pay, no problems at all
|
skip_authorization_check # actually anyone can pay, no problems at all
|
||||||
skip_before_action :authenticate_registrar_user!, :check_ip_restriction,
|
skip_before_action :authenticate_registrar_user!, :check_ip_restriction,
|
||||||
only: [:back, :callback]
|
only: [:back, :callback]
|
||||||
before_action :check_supported_payment_method
|
|
||||||
|
before_action :check_supported_payment_method, only: [:pay]
|
||||||
|
|
||||||
def pay
|
def pay
|
||||||
invoice = Invoice.find(params[:invoice_id])
|
invoice = Invoice.find(params[:invoice_id])
|
||||||
bank = params[:bank]
|
channel = params[:bank]
|
||||||
opts = {
|
|
||||||
return_url: registrar_return_payment_with_url(
|
@payment_order = PaymentOrder.new_with_type(type: channel, invoice: invoice)
|
||||||
bank, invoice_id: invoice
|
@payment_order.save
|
||||||
),
|
@payment_order.reload
|
||||||
response_url: registrar_response_payment_with_url(
|
|
||||||
bank, invoice_id: invoice
|
@payment_order.return_url = registrar_return_payment_with_url(@payment_order)
|
||||||
)
|
@payment_order.response_url = registrar_response_payment_with_url(@payment_order)
|
||||||
}
|
|
||||||
@payment = ::PaymentOrders.create_with_type(bank, invoice, opts)
|
@payment_order.save
|
||||||
@payment.create_transaction
|
@payment_order.reload
|
||||||
end
|
end
|
||||||
|
|
||||||
def back
|
def back
|
||||||
invoice = Invoice.find(params[:invoice_id])
|
@payment_order = PaymentOrder.find_by!(id: params[:payment_order])
|
||||||
opts = { response: params }
|
@payment_order.update!(response: params.to_unsafe_h)
|
||||||
@payment = ::PaymentOrders.create_with_type(params[:bank], invoice, opts)
|
|
||||||
if @payment.valid_response_from_intermediary? && @payment.settled_payment?
|
|
||||||
Rails.logger.info("User paid invoice ##{invoice.number} successfully")
|
|
||||||
|
|
||||||
@payment.complete_transaction
|
if @payment_order.payment_received?
|
||||||
|
@payment_order.complete_transaction
|
||||||
|
|
||||||
if invoice.paid?
|
if @payment_order.invoice.paid?
|
||||||
flash[:notice] = t(:pending_applied)
|
flash[:notice] = t('.payment_successful')
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:something_wrong)
|
flash[:alert] = t('.successful_payment_backend_error')
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
flash[:alert] = t(:something_wrong)
|
@payment_order.create_failure_report
|
||||||
|
flash[:alert] = t('.payment_not_received')
|
||||||
end
|
end
|
||||||
redirect_to registrar_invoice_path(invoice)
|
redirect_to registrar_invoice_path(@payment_order.invoice)
|
||||||
end
|
end
|
||||||
|
|
||||||
def callback
|
def callback
|
||||||
invoice = Invoice.find(params[:invoice_id])
|
@payment_order = PaymentOrder.find_by!(id: params[:payment_order])
|
||||||
opts = { response: params }
|
@payment_order.update!(response: params.to_unsafe_h)
|
||||||
@payment = ::PaymentOrders.create_with_type(params[:bank], invoice, opts)
|
|
||||||
|
|
||||||
if @payment.valid_response_from_intermediary? && @payment.settled_payment?
|
if @payment_order.payment_received?
|
||||||
@payment.complete_transaction
|
@payment_order.complete_transaction
|
||||||
|
else
|
||||||
|
@payment_order.create_failure_report
|
||||||
end
|
end
|
||||||
|
|
||||||
render status: 200, json: { status: 'ok' }
|
render status: 200, json: { status: 'ok' }
|
||||||
|
@ -57,13 +58,9 @@ class Registrar
|
||||||
private
|
private
|
||||||
|
|
||||||
def check_supported_payment_method
|
def check_supported_payment_method
|
||||||
return if supported_payment_method?
|
return if PaymentOrder.supported_method?(params[:bank], shortname: true)
|
||||||
raise StandardError.new("Not supported payment method")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
raise(StandardError, 'Not supported payment method')
|
||||||
def supported_payment_method?
|
|
||||||
PaymentOrders::PAYMENT_METHODS.include?(params[:bank])
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,6 +33,18 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_commit_link
|
||||||
|
hash = `git rev-parse --short HEAD`
|
||||||
|
current_repo = `git remote get-url origin`.gsub('com:', 'com/')
|
||||||
|
.gsub('git@', 'https://')
|
||||||
|
.gsub('.git', '')
|
||||||
|
|
||||||
|
link_to hash.to_s, "#{current_repo}/commit/#{hash}",
|
||||||
|
class: 'footer-version-link',
|
||||||
|
target: '_blank',
|
||||||
|
rel: 'noopener'
|
||||||
|
end
|
||||||
|
|
||||||
def creator_link(model)
|
def creator_link(model)
|
||||||
return 'not present' if model.blank?
|
return 'not present' if model.blank?
|
||||||
return 'unknown' if model.creator.blank?
|
return 'unknown' if model.creator.blank?
|
||||||
|
|
125
app/jobs/directo_invoice_forward_job.rb
Normal file
125
app/jobs/directo_invoice_forward_job.rb
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
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)
|
||||||
|
monthly ? send_monthly_invoices : send_receipts
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_receipts
|
||||||
|
unsent_invoices = Invoice.where(in_directo: false).non_cancelled
|
||||||
|
|
||||||
|
Rails.logger.info("[DIRECTO] Trying to send #{unsent_invoices.count} prepayment invoices")
|
||||||
|
unsent_invoices.each do |invoice|
|
||||||
|
unless valid_invoice_conditions?(invoice)
|
||||||
|
Rails.logger.info "[DIRECTO] Invoice #{invoice.number} has been skipped"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
@client.invoices.add_with_schema(invoice: invoice.as_directo_json, schema: 'prepayment')
|
||||||
|
end
|
||||||
|
|
||||||
|
sync_with_directo
|
||||||
|
end
|
||||||
|
|
||||||
|
def send_monthly_invoices
|
||||||
|
Registrar.where.not(test_registrar: true).find_each do |registrar|
|
||||||
|
fetch_monthly_summary(registrar: registrar)
|
||||||
|
end
|
||||||
|
|
||||||
|
return unless @client.invoices.count.positive?
|
||||||
|
|
||||||
|
sync_with_directo
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch_monthly_summary(registrar:)
|
||||||
|
return unless registrar.cash_account
|
||||||
|
|
||||||
|
summary = registrar.monthly_summary(month: @month)
|
||||||
|
@client.invoices.add_with_schema(invoice: summary, schema: 'summary') unless summary.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
def assign_monthly_numbers
|
||||||
|
if directo_counter_exceedable?(@client.invoices.count)
|
||||||
|
raise 'Directo Counter is going to be out of period!'
|
||||||
|
end
|
||||||
|
|
||||||
|
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
||||||
|
directo_number = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
||||||
|
min_directo].compact.max || 0
|
||||||
|
|
||||||
|
@client.invoices.each do |inv|
|
||||||
|
directo_number += 1
|
||||||
|
inv.number = directo_number
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def valid_invoice_conditions?(invoice)
|
||||||
|
if invoice.account_activity.nil? || invoice.account_activity.bank_transaction.nil? ||
|
||||||
|
invoice.account_activity.bank_transaction.sum.nil? ||
|
||||||
|
invoice.account_activity.bank_transaction.sum != invoice.total
|
||||||
|
return false
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
|
def sync_with_directo
|
||||||
|
assign_monthly_numbers if @month
|
||||||
|
Rails.logger.info("[Directo] - attempting to send following XML:\n #{@client.invoices.as_xml}")
|
||||||
|
return if @dry
|
||||||
|
|
||||||
|
res = @client.invoices.deliver(ssl_verify: false)
|
||||||
|
process_directo_response(res.body, @client.invoices.as_xml)
|
||||||
|
rescue SocketError, Errno::ECONNREFUSED, Timeout::Error, Errno::EINVAL, Errno::ECONNRESET,
|
||||||
|
EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError
|
||||||
|
Rails.logger.info('[Directo] Failed to communicate via API')
|
||||||
|
end
|
||||||
|
|
||||||
|
def process_directo_response(xml, req)
|
||||||
|
Rails.logger.info "[Directo] - Responded with body: #{xml}"
|
||||||
|
Nokogiri::XML(xml).css('Result').each do |res|
|
||||||
|
if @month
|
||||||
|
mark_invoice_as_sent(res: res, req: req)
|
||||||
|
else
|
||||||
|
inv = Invoice.find_by(number: res.attributes['docid'].value.to_i)
|
||||||
|
mark_invoice_as_sent(invoice: inv, res: res, req: req)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def mark_invoice_as_sent(invoice: nil, res:, req:)
|
||||||
|
directo_record = Directo.new(response: res.as_json.to_h,
|
||||||
|
request: req, invoice_number: res.attributes['docid'].value.to_i)
|
||||||
|
if invoice
|
||||||
|
directo_record.item = invoice
|
||||||
|
invoice.update(in_directo: true)
|
||||||
|
else
|
||||||
|
update_directo_number(num: directo_record.invoice_number)
|
||||||
|
end
|
||||||
|
|
||||||
|
directo_record.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
def update_directo_number(num:)
|
||||||
|
return unless num.to_i > Setting.directo_monthly_number_last.to_i
|
||||||
|
|
||||||
|
Setting.directo_monthly_number_last = num.to_i
|
||||||
|
end
|
||||||
|
|
||||||
|
def directo_counter_exceedable?(invoice_count)
|
||||||
|
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
||||||
|
max_directo = Setting.directo_monthly_number_max.presence.try(:to_i)
|
||||||
|
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i),
|
||||||
|
min_directo].compact.max || 0
|
||||||
|
|
||||||
|
return true if max_directo && max_directo < (last_directo + invoice_count)
|
||||||
|
|
||||||
|
false
|
||||||
|
end
|
||||||
|
end
|
43
app/jobs/send_e_invoice_job.rb
Normal file
43
app/jobs/send_e_invoice_job.rb
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
class SendEInvoiceJob < Que::Job
|
||||||
|
def run(invoice_id)
|
||||||
|
invoice = run_condition(Invoice.find_by(id: invoice_id))
|
||||||
|
|
||||||
|
invoice.to_e_invoice.deliver
|
||||||
|
ActiveRecord::Base.transaction do
|
||||||
|
invoice.update(e_invoice_sent_at: Time.zone.now)
|
||||||
|
log_success(invoice)
|
||||||
|
destroy
|
||||||
|
end
|
||||||
|
rescue StandardError => e
|
||||||
|
log_error(invoice: invoice, error: e)
|
||||||
|
raise e
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def run_condition(invoice)
|
||||||
|
destroy unless invoice
|
||||||
|
destroy if invoice.do_not_send_e_invoice?
|
||||||
|
invoice
|
||||||
|
end
|
||||||
|
|
||||||
|
def log_success(invoice)
|
||||||
|
id = invoice.try(:id) || invoice
|
||||||
|
message = "E-Invoice for an invoice with ID # #{id} was sent successfully"
|
||||||
|
logger.info message
|
||||||
|
end
|
||||||
|
|
||||||
|
def log_error(invoice:, error:)
|
||||||
|
id = invoice.try(:id) || invoice
|
||||||
|
message = <<~TEXT.squish
|
||||||
|
There was an error sending e-invoice for invoice with ID # #{id}.
|
||||||
|
The error message was the following: #{error}
|
||||||
|
This job will retry.
|
||||||
|
TEXT
|
||||||
|
logger.error message
|
||||||
|
end
|
||||||
|
|
||||||
|
def logger
|
||||||
|
Rails.logger
|
||||||
|
end
|
||||||
|
end
|
|
@ -50,6 +50,7 @@ class Ability
|
||||||
can(:check, Epp::Domain)
|
can(:check, Epp::Domain)
|
||||||
can(:create, Epp::Domain)
|
can(:create, Epp::Domain)
|
||||||
can(:renew, Epp::Domain) { |d| d.registrar_id == @user.registrar_id }
|
can(:renew, Epp::Domain) { |d| d.registrar_id == @user.registrar_id }
|
||||||
|
can(:remove_hold, Epp::Domain) { |d| d.registrar_id == @user.registrar_id }
|
||||||
can(:update, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
can(:update, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
||||||
can(:transfer, Epp::Domain)
|
can(:transfer, Epp::Domain)
|
||||||
can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
can(:delete, Epp::Domain) { |d, pw| d.registrar_id == @user.registrar_id || d.transfer_code == pw }
|
||||||
|
|
|
@ -4,7 +4,7 @@ class AdminUser < User
|
||||||
validates :identity_code, presence: true, if: -> { country_code == 'EE' }
|
validates :identity_code, presence: true, if: -> { country_code == 'EE' }
|
||||||
validates :email, presence: true
|
validates :email, presence: true
|
||||||
validates :password, :password_confirmation, presence: true, if: :new_record?
|
validates :password, :password_confirmation, presence: true, if: :new_record?
|
||||||
validates :password_confirmation, presence: true, if: :encrypted_password_changed?
|
validates :password_confirmation, presence: true, if: :will_save_change_to_encrypted_password?
|
||||||
validate :validate_identity_code, if: -> { country_code == 'EE' }
|
validate :validate_identity_code, if: -> { country_code == 'EE' }
|
||||||
|
|
||||||
ROLES = %w(user customer_service admin) # should not match to api_users roles
|
ROLES = %w(user customer_service admin) # should not match to api_users roles
|
||||||
|
|
|
@ -43,7 +43,7 @@ class ApiUser < User
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
def set_defaults
|
def set_defaults
|
||||||
return unless new_record?
|
return unless new_record?
|
||||||
self.active = true unless active_changed?
|
self.active = true unless saved_change_to_active?
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
|
@ -25,10 +25,16 @@ class BankStatement < ApplicationRecord
|
||||||
bank_transactions.build(bt_params)
|
bank_transactions.build(bt_params)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepare_dir
|
||||||
self.import_file_path = "#{ENV['bank_statement_import_dir']}/#{Time.zone.now.to_formatted_s(:number)}.txt"
|
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) }
|
File.open(import_file_path, 'w') { |f| f.write(th6_file.open.read) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def prepare_dir
|
||||||
|
dirname = ENV['bank_statement_import_dir']
|
||||||
|
FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
|
||||||
|
end
|
||||||
|
|
||||||
def parse_th6_row(row)
|
def parse_th6_row(row)
|
||||||
return parse_th6_header(row) if row[4, 3].strip == '000'
|
return parse_th6_header(row) if row[4, 3].strip == '000'
|
||||||
return if row[4, 3].strip == '999' # skip footer
|
return if row[4, 3].strip == '999' # skip footer
|
||||||
|
@ -45,7 +51,7 @@ class BankStatement < ApplicationRecord
|
||||||
buyer_name: row[83, 35].strip,
|
buyer_name: row[83, 35].strip,
|
||||||
document_no: row[118, 8].strip,
|
document_no: row[118, 8].strip,
|
||||||
description: row[126, 140].strip,
|
description: row[126, 140].strip,
|
||||||
sum: BigDecimal.new(row[268, 12].strip) / BigDecimal.new('100.0'),
|
sum: BigDecimal(row[268, 12].strip) / BigDecimal('100.0'),
|
||||||
reference_no: row[280, 35].strip
|
reference_no: row[280, 35].strip
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -80,7 +86,9 @@ class BankStatement < ApplicationRecord
|
||||||
status == FULLY_BINDED
|
status == FULLY_BINDED
|
||||||
end
|
end
|
||||||
|
|
||||||
def bind_invoices
|
def bind_invoices(manual: false)
|
||||||
bank_transactions.unbinded.each(&:autobind_invoice)
|
bank_transactions.unbinded.each do |transaction|
|
||||||
|
transaction.autobind_invoice(manual: manual)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ class BankTransaction < ApplicationRecord
|
||||||
|
|
||||||
def binded_invoice
|
def binded_invoice
|
||||||
return unless binded?
|
return unless binded?
|
||||||
|
|
||||||
account_activity.invoice
|
account_activity.invoice
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -30,31 +31,54 @@ class BankTransaction < ApplicationRecord
|
||||||
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
@registrar ||= Invoice.find_by(reference_no: parsed_ref_number)&.buyer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# For successful binding, reference number, invoice id and sum must match with the invoice
|
# For successful binding, reference number, invoice id and sum must match with the invoice
|
||||||
def autobind_invoice
|
def autobind_invoice(manual: false)
|
||||||
return if binded?
|
return if binded?
|
||||||
return unless registrar
|
return unless registrar
|
||||||
return unless invoice
|
return unless invoice
|
||||||
return unless invoice.payable?
|
return unless invoice.payable?
|
||||||
|
|
||||||
create_activity(registrar, invoice)
|
channel = if manual
|
||||||
|
'admin_payment'
|
||||||
|
else
|
||||||
|
'system_payment'
|
||||||
|
end
|
||||||
|
create_internal_payment_record(channel: channel, invoice: invoice,
|
||||||
|
registrar: registrar)
|
||||||
end
|
end
|
||||||
|
|
||||||
def bind_invoice(invoice_no)
|
def create_internal_payment_record(channel: nil, invoice:, registrar:)
|
||||||
|
if channel.nil?
|
||||||
|
create_activity(invoice.buyer, invoice)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
payment_order = PaymentOrder.new_with_type(type: channel, invoice: invoice)
|
||||||
|
payment_order.save!
|
||||||
|
|
||||||
|
if create_activity(registrar, invoice)
|
||||||
|
payment_order.paid!
|
||||||
|
else
|
||||||
|
payment_order.update(notes: 'Failed to create activity', status: 'failed')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def bind_invoice(invoice_no, manual: false)
|
||||||
if binded?
|
if binded?
|
||||||
errors.add(:base, I18n.t('transaction_is_already_binded'))
|
errors.add(:base, I18n.t('transaction_is_already_binded'))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
invoice = Invoice.find_by(number: invoice_no)
|
invoice = Invoice.find_by(number: invoice_no)
|
||||||
@registrar = invoice.buyer
|
errors.add(:base, I18n.t('invoice_was_not_found')) unless invoice
|
||||||
|
validate_invoice_data(invoice)
|
||||||
|
return if errors.any?
|
||||||
|
|
||||||
unless invoice
|
create_internal_payment_record(channel: (manual ? 'admin_payment' : nil), invoice: invoice,
|
||||||
errors.add(:base, I18n.t('invoice_was_not_found'))
|
registrar: invoice.buyer)
|
||||||
return
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
def validate_invoice_data(invoice)
|
||||||
if invoice.paid?
|
if invoice.paid?
|
||||||
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
errors.add(:base, I18n.t('invoice_is_already_binded'))
|
||||||
return
|
return
|
||||||
|
@ -65,23 +89,21 @@ class BankTransaction < ApplicationRecord
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if invoice.total != sum
|
errors.add(:base, I18n.t('invoice_and_transaction_sums_do_not_match')) if invoice.total != sum
|
||||||
errors.add(:base, I18n.t('invoice_and_transaction_sums_do_not_match'))
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
create_activity(invoice.buyer, invoice)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_activity(registrar, invoice)
|
def create_activity(registrar, invoice)
|
||||||
ActiveRecord::Base.transaction do
|
activity = AccountActivity.new(
|
||||||
create_account_activity!(account: registrar.cash_account,
|
account: registrar.cash_account, bank_transaction: self,
|
||||||
invoice: invoice,
|
invoice: invoice, sum: invoice.subtotal,
|
||||||
sum: invoice.subtotal,
|
currency: currency, description: description,
|
||||||
currency: currency,
|
activity_type: AccountActivity::ADD_CREDIT
|
||||||
description: description,
|
)
|
||||||
activity_type: AccountActivity::ADD_CREDIT)
|
if activity.save
|
||||||
reset_pending_registrar_balance_reload
|
reset_pending_registrar_balance_reload
|
||||||
|
true
|
||||||
|
else
|
||||||
|
false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ module Concerns::Contact::Transferable
|
||||||
|
|
||||||
included do
|
included do
|
||||||
validates :auth_info, presence: true
|
validates :auth_info, presence: true
|
||||||
after_initialize :generate_auth_info, if: 'new_record? && auth_info.blank?'
|
after_initialize :generate_auth_info, if: -> { new_record? && auth_info.blank? }
|
||||||
end
|
end
|
||||||
|
|
||||||
def transfer(new_registrar)
|
def transfer(new_registrar)
|
||||||
|
|
26
app/models/concerns/invoice/book_keeping.rb
Normal file
26
app/models/concerns/invoice/book_keeping.rb
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
module Concerns
|
||||||
|
module Invoice
|
||||||
|
module BookKeeping
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
def as_directo_json
|
||||||
|
invoice = ActiveSupport::JSON.decode(ActiveSupport::JSON.encode(self))
|
||||||
|
invoice['customer_code'] = buyer.accounting_customer_code
|
||||||
|
invoice['issue_date'] = issue_date.strftime('%Y-%m-%d')
|
||||||
|
invoice['transaction_date'] = account_activity
|
||||||
|
.bank_transaction&.paid_at&.strftime('%Y-%m-%d')
|
||||||
|
invoice['language'] = buyer.language == 'en' ? 'ENG' : ''
|
||||||
|
invoice['invoice_lines'] = compose_directo_product
|
||||||
|
|
||||||
|
invoice
|
||||||
|
end
|
||||||
|
|
||||||
|
def compose_directo_product
|
||||||
|
[{ 'product_id': Setting.directo_receipt_product_name, 'description': order,
|
||||||
|
'quantity': 1, 'price': ActionController::Base.helpers.number_with_precision(
|
||||||
|
subtotal, precision: 2, separator: '.'
|
||||||
|
) }].as_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
120
app/models/concerns/registrar/book_keeping.rb
Normal file
120
app/models/concerns/registrar/book_keeping.rb
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
module Concerns
|
||||||
|
module Registrar
|
||||||
|
module BookKeeping
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
DOMAIN_TO_PRODUCT = { 'ee': '01EE', 'com.ee': '02COM', 'pri.ee': '03PRI',
|
||||||
|
'fie.ee': '04FIE', 'med.ee': '05MED' }.freeze
|
||||||
|
|
||||||
|
def monthly_summary(month:)
|
||||||
|
activities = monthly_activites(month)
|
||||||
|
return unless activities.any?
|
||||||
|
|
||||||
|
invoice = {
|
||||||
|
'number': 1,
|
||||||
|
'customer_code': accounting_customer_code,
|
||||||
|
'language': language == 'en' ? 'ENG' : '', 'currency': activities.first.currency,
|
||||||
|
'date': month.end_of_month.strftime('%Y-%m-%d')
|
||||||
|
}.as_json
|
||||||
|
|
||||||
|
invoice['invoice_lines'] = prepare_invoice_lines(month: month, activities: activities)
|
||||||
|
|
||||||
|
invoice
|
||||||
|
end
|
||||||
|
|
||||||
|
def prepare_invoice_lines(month:, activities:)
|
||||||
|
lines = []
|
||||||
|
|
||||||
|
lines << { 'description': title_for_summary(month) }
|
||||||
|
activities.each do |activity|
|
||||||
|
fetch_invoice_lines(activity, lines)
|
||||||
|
end
|
||||||
|
lines << prepayment_for_all(lines)
|
||||||
|
|
||||||
|
lines.as_json
|
||||||
|
end
|
||||||
|
|
||||||
|
def title_for_summary(date)
|
||||||
|
I18n.with_locale(language == 'en' ? 'en' : 'et') do
|
||||||
|
I18n.t('registrar.monthly_summary_title', date: I18n.l(date, format: '%B %Y'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch_invoice_lines(activity, lines)
|
||||||
|
price = load_price(activity)
|
||||||
|
if price.duration.include? 'year'
|
||||||
|
price.duration.to_i.times do |duration|
|
||||||
|
lines << new_monthly_invoice_line(activity: activity, duration: duration + 1).as_json
|
||||||
|
end
|
||||||
|
else
|
||||||
|
lines << new_monthly_invoice_line(activity: activity).as_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def monthly_activites(month)
|
||||||
|
AccountActivity.where(account_id: account_ids)
|
||||||
|
.where(created_at: month.beginning_of_month..month.end_of_month)
|
||||||
|
.where(activity_type: [AccountActivity::CREATE, AccountActivity::RENEW])
|
||||||
|
end
|
||||||
|
|
||||||
|
def new_monthly_invoice_line(activity:, duration: nil)
|
||||||
|
price = load_price(activity)
|
||||||
|
line = {
|
||||||
|
'product_id': DOMAIN_TO_PRODUCT[price.zone_name.to_sym],
|
||||||
|
'quantity': 1,
|
||||||
|
'unit': language == 'en' ? 'pc' : 'tk',
|
||||||
|
}
|
||||||
|
|
||||||
|
finalize_invoice_line(line, price: price, duration: duration, activity: activity)
|
||||||
|
end
|
||||||
|
|
||||||
|
def finalize_invoice_line(line, price:, activity:, duration:)
|
||||||
|
yearly = price.duration.include?('year')
|
||||||
|
|
||||||
|
line['price'] = yearly ? (price.price.amount / price.duration.to_i) : price.price.amount
|
||||||
|
line['description'] = description_in_language(price: price, yearly: yearly)
|
||||||
|
|
||||||
|
if duration.present?
|
||||||
|
add_product_timeframe(line: line, activity: activity, duration: duration) if duration > 1
|
||||||
|
end
|
||||||
|
|
||||||
|
line
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_product_timeframe(line:, activity:, duration:)
|
||||||
|
create_time = activity.created_at
|
||||||
|
line['start_date'] = (create_time + (duration - 1).year).end_of_month.strftime('%Y-%m-%d')
|
||||||
|
line['end_date'] = (create_time + (duration - 1).year + 1).end_of_month.strftime('%Y-%m-%d')
|
||||||
|
end
|
||||||
|
|
||||||
|
def description_in_language(price:, yearly:)
|
||||||
|
timeframe_string = yearly ? 'yearly' : 'monthly'
|
||||||
|
locale_string = "registrar.invoice_#{timeframe_string}_product_description"
|
||||||
|
|
||||||
|
I18n.with_locale(language == 'en' ? 'en' : 'et') do
|
||||||
|
I18n.t(locale_string, tld: ".#{price.zone_name}", length: price.duration.to_i)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def prepayment_for_all(lines)
|
||||||
|
total = 0
|
||||||
|
en = language == 'en'
|
||||||
|
lines.each { |l| total += l['quantity'].to_f * l['price'].to_f }
|
||||||
|
{
|
||||||
|
'product_id': Setting.directo_receipt_product_name,
|
||||||
|
'description': en ? 'Domains prepayment' : 'Domeenide ettemaks',
|
||||||
|
'quantity': -1,
|
||||||
|
'price': total,
|
||||||
|
'unit': en ? 'pc' : 'tk',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
def load_price(account_activity)
|
||||||
|
@pricelists ||= {}
|
||||||
|
return @pricelists[account_activity.price_id] if @pricelists.key? account_activity.price_id
|
||||||
|
|
||||||
|
@pricelists[account_activity.price_id] = account_activity.price
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
app/models/concerns/remove_hold.rb
Normal file
9
app/models/concerns/remove_hold.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module RemoveHold
|
||||||
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
|
def remove_hold(params)
|
||||||
|
xml = epp_xml.update(name: { value: params[:domain_name] },
|
||||||
|
rem: [status: { attrs: { s: 'clientHold' }, value: '' }])
|
||||||
|
current_user.request(xml)
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,10 +1,16 @@
|
||||||
# Papertrail concerns is mainly tested at country spec
|
# Papertrail concerns is mainly tested at country spec
|
||||||
module Versions
|
module Versions
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
WITH_CHILDREN = %w[Domain Contact].freeze
|
||||||
|
|
||||||
included do
|
included do
|
||||||
attr_accessor :version_loader
|
attr_accessor :version_loader
|
||||||
has_paper_trail class_name: "#{model_name}Version"
|
|
||||||
|
if WITH_CHILDREN.include?(model_name.name)
|
||||||
|
has_paper_trail class_name: "#{model_name}Version", meta: { children: :children_log }
|
||||||
|
else
|
||||||
|
has_paper_trail class_name: "#{model_name}Version"
|
||||||
|
end
|
||||||
|
|
||||||
# add creator and updator
|
# add creator and updator
|
||||||
before_create :add_creator
|
before_create :add_creator
|
||||||
|
@ -45,17 +51,17 @@ module Versions
|
||||||
|
|
||||||
# callbacks
|
# callbacks
|
||||||
def touch_domain_version
|
def touch_domain_version
|
||||||
domain.try(:touch_with_version)
|
domain.paper_trail.try(:touch_with_version)
|
||||||
end
|
end
|
||||||
|
|
||||||
def touch_domains_version
|
def touch_domains_version
|
||||||
domains.each(&:touch_with_version)
|
domains.each { |domain| domain.paper_trail.touch_with_version }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def all_versions_for(ids, time)
|
def all_versions_for(ids, time)
|
||||||
ver_klass = paper_trail_version_class
|
ver_klass = paper_trail.version_class
|
||||||
from_history = ver_klass.where(item_id: ids.to_a).
|
from_history = ver_klass.where(item_id: ids.to_a).
|
||||||
order(:item_id).
|
order(:item_id).
|
||||||
preceding(time + 1, true).
|
preceding(time + 1, true).
|
||||||
|
@ -64,7 +70,8 @@ module Versions
|
||||||
valid_columns = ver.item_type.constantize&.column_names
|
valid_columns = ver.item_type.constantize&.column_names
|
||||||
o = new(ver.object&.slice(*valid_columns))
|
o = new(ver.object&.slice(*valid_columns))
|
||||||
o.version_loader = ver
|
o.version_loader = ver
|
||||||
ver.object_changes.to_h.each { |k, v| o.public_send("#{k}=", v[-1]) }
|
changes = ver.object_changes.to_h&.slice(*valid_columns)
|
||||||
|
changes.each { |k, v| o.public_send("#{k}=", v[-1]) }
|
||||||
o
|
o
|
||||||
end
|
end
|
||||||
not_in_history = where(id: (ids.to_a - from_history.map(&:id)))
|
not_in_history = where(id: (ids.to_a - from_history.map(&:id)))
|
||||||
|
|
|
@ -14,8 +14,6 @@ class Contact < ApplicationRecord
|
||||||
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
has_many :registrant_domains, class_name: 'Domain', foreign_key: 'registrant_id'
|
||||||
has_many :actions, dependent: :destroy
|
has_many :actions, dependent: :destroy
|
||||||
|
|
||||||
has_paper_trail class_name: "ContactVersion", meta: { children: :children_log }
|
|
||||||
|
|
||||||
attr_accessor :legal_document_id
|
attr_accessor :legal_document_id
|
||||||
alias_attribute :kind, :ident_type
|
alias_attribute :kind, :ident_type
|
||||||
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
alias_attribute :copy_from_id, :original_id # Old attribute name; for PaperTrail
|
||||||
|
@ -23,12 +21,14 @@ class Contact < ApplicationRecord
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
validates :name, :email, presence: true
|
validates :name, :email, presence: true
|
||||||
validates :street, :city, :zip, :country_code, presence: true, if: 'self.class.address_processing?'
|
validates :street, :city, :zip, :country_code, presence: true, if: lambda {
|
||||||
|
self.class.address_processing?
|
||||||
|
}
|
||||||
|
|
||||||
validates :phone, presence: true, e164: true, phone: true
|
validates :phone, presence: true, e164: true, phone: true
|
||||||
|
|
||||||
validates :email, format: /@/
|
validates :email, format: /@/
|
||||||
validates :email, email_format: { message: :invalid }, if: proc { |c| c.email_changed? }
|
validates :email, email_format: { message: :invalid }, if: proc { |c| c.will_save_change_to_email? }
|
||||||
|
|
||||||
validates :code,
|
validates :code,
|
||||||
uniqueness: { message: :epp_id_taken },
|
uniqueness: { message: :epp_id_taken },
|
||||||
|
@ -37,7 +37,7 @@ class Contact < ApplicationRecord
|
||||||
validates_associated :identifier
|
validates_associated :identifier
|
||||||
|
|
||||||
validate :validate_html
|
validate :validate_html
|
||||||
validate :validate_country_code, if: 'self.class.address_processing?'
|
validate :validate_country_code, if: -> { self.class.address_processing? }
|
||||||
|
|
||||||
after_initialize do
|
after_initialize do
|
||||||
self.status_notes = {} if status_notes.nil?
|
self.status_notes = {} if status_notes.nil?
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
class Counter
|
|
||||||
def initialize value = 0
|
|
||||||
@value = value
|
|
||||||
end
|
|
||||||
attr_accessor :value
|
|
||||||
def method_missing *args, &blk
|
|
||||||
@value.send(*args, &blk)
|
|
||||||
end
|
|
||||||
def to_s
|
|
||||||
@value.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
def now
|
|
||||||
@value
|
|
||||||
end
|
|
||||||
|
|
||||||
# pre-increment ".+" when x not present
|
|
||||||
def next(x = 1)
|
|
||||||
@value += x
|
|
||||||
end
|
|
||||||
def prev(x = 1)
|
|
||||||
@value -= x
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Depp
|
module Depp
|
||||||
class Domain
|
class Domain
|
||||||
include ActiveModel::Conversion
|
include ActiveModel::Conversion
|
||||||
|
include RemoveHold
|
||||||
extend ActiveModel::Naming
|
extend ActiveModel::Naming
|
||||||
|
|
||||||
attr_accessor :name, :current_user, :epp_xml
|
attr_accessor :name, :current_user, :epp_xml
|
||||||
|
|
|
@ -1,198 +1,3 @@
|
||||||
class Directo < ApplicationRecord
|
class Directo < ApplicationRecord
|
||||||
DOMAIN_TO_PRODUCT = {"ee" => "01EE", "com.ee" => "02COM", "pri.ee" => "03PRI", "fie.ee"=>"04FIE", "med.ee" => "05MED"}.freeze
|
|
||||||
belongs_to :item, polymorphic: true
|
belongs_to :item, polymorphic: true
|
||||||
|
|
||||||
def self.send_receipts
|
|
||||||
new_trans = Invoice.where(in_directo: false).non_cancelled
|
|
||||||
total = new_trans.count
|
|
||||||
counter = 0
|
|
||||||
Rails.logger.info("[DIRECTO] Will try to send #{total} invoices")
|
|
||||||
|
|
||||||
new_trans.find_in_batches(batch_size: 10).each do |group|
|
|
||||||
mappers = {} # need them as no direct connection between invoice
|
|
||||||
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
|
||||||
xml.invoices {
|
|
||||||
group.each do |invoice|
|
|
||||||
|
|
||||||
if invoice.account_activity.nil? || invoice.account_activity.bank_transaction.nil? ||
|
|
||||||
invoice.account_activity.bank_transaction.sum.nil? || invoice.account_activity.bank_transaction.sum != invoice.total
|
|
||||||
Rails.logger.info("[DIRECTO] Invoice #{invoice.number} has been skipped")
|
|
||||||
next
|
|
||||||
end
|
|
||||||
counter += 1
|
|
||||||
|
|
||||||
num = invoice.number
|
|
||||||
paid_at = invoice.account_activity.bank_transaction&.paid_at&.strftime("%Y-%m-%d")
|
|
||||||
mappers[num] = invoice
|
|
||||||
xml.invoice(
|
|
||||||
"SalesAgent" => Setting.directo_sales_agent,
|
|
||||||
"Number" => num,
|
|
||||||
"InvoiceDate" => invoice.issue_date.strftime("%Y-%m-%d"),
|
|
||||||
'TransactionDate' => paid_at,
|
|
||||||
"PaymentTerm" => Setting.directo_receipt_payment_term,
|
|
||||||
"Currency" => invoice.currency,
|
|
||||||
"CustomerCode"=> invoice.buyer.accounting_customer_code
|
|
||||||
){
|
|
||||||
xml.line(
|
|
||||||
"ProductID" => Setting.directo_receipt_product_name,
|
|
||||||
"Quantity" => 1,
|
|
||||||
"UnitPriceWoVAT" => ActionController::Base.helpers.number_with_precision(invoice.subtotal, precision: 2, separator: "."),
|
|
||||||
"ProductName" => invoice.order
|
|
||||||
)
|
|
||||||
}
|
|
||||||
end
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
data = builder.to_xml.gsub("\n",'')
|
|
||||||
Rails.logger.info("[Directo] XML request: #{data}")
|
|
||||||
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
|
|
||||||
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
|
|
||||||
dump_result_to_db(mappers, response.to_s)
|
|
||||||
end
|
|
||||||
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Directo receipts sending finished. #{counter} of #{total} are sent\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.dump_result_to_db mappers, xml
|
|
||||||
Nokogiri::XML(xml).css("Result").each do |res|
|
|
||||||
obj = mappers[res.attributes["docid"].value.to_i]
|
|
||||||
obj.directo_records.create!(response: res.as_json.to_h, invoice_number: obj.number)
|
|
||||||
obj.update_columns(in_directo: true)
|
|
||||||
Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
def self.send_monthly_invoices(debug: false)
|
|
||||||
I18n.locale = :et
|
|
||||||
month = Time.now - 1.month
|
|
||||||
invoices_until = month.end_of_month
|
|
||||||
date_format = "%Y-%m-%d"
|
|
||||||
invoice_counter= Counter.new
|
|
||||||
|
|
||||||
min_directo = Setting.directo_monthly_number_min.presence.try(:to_i)
|
|
||||||
max_directo = Setting.directo_monthly_number_max.presence.try(:to_i)
|
|
||||||
last_directo = [Setting.directo_monthly_number_last.presence.try(:to_i), min_directo].compact.max || 0
|
|
||||||
if max_directo && max_directo <= last_directo
|
|
||||||
raise "Directo counter is out of period (max allowed number is smaller than last counter number)"
|
|
||||||
end
|
|
||||||
|
|
||||||
directo_next = last_directo
|
|
||||||
Registrar.where.not(test_registrar: true).find_each do |registrar|
|
|
||||||
unless registrar.cash_account
|
|
||||||
Rails.logger.info("[DIRECTO] Monthly invoice for registrar #{registrar.id} has been skipped as it doesn't has cash_account")
|
|
||||||
next
|
|
||||||
end
|
|
||||||
counter = Counter.new(1)
|
|
||||||
items = {}
|
|
||||||
registrar_activities = AccountActivity.where(account_id: registrar.account_ids).where("created_at BETWEEN ? AND ?",month.beginning_of_month, month.end_of_month)
|
|
||||||
|
|
||||||
# adding domains items
|
|
||||||
registrar_activities.where(activity_type: [AccountActivity::CREATE, AccountActivity::RENEW]).each do |activity|
|
|
||||||
price = load_price(activity)
|
|
||||||
|
|
||||||
if price.duration.include?('year')
|
|
||||||
price.duration.to_i.times do |i|
|
|
||||||
year = i+1
|
|
||||||
hash = {
|
|
||||||
"ProductID" => DOMAIN_TO_PRODUCT[price.zone_name],
|
|
||||||
"Unit" => "tk",
|
|
||||||
"ProductName" => ".#{price.zone_name} registreerimine: #{price.duration.to_i} aasta#{price.duration.to_i > 1 ? 't' : ''}",
|
|
||||||
"UnitPriceWoVAT" => price.price.amount / price.duration.to_i
|
|
||||||
}
|
|
||||||
hash["StartDate"] = (activity.created_at + (year-1).year).end_of_month.strftime(date_format) if year > 1
|
|
||||||
hash["EndDate"] = (activity.created_at + (year-1).year + 1).end_of_month.strftime(date_format) if year > 1
|
|
||||||
|
|
||||||
if items.has_key?(hash)
|
|
||||||
items[hash]["Quantity"] += 1
|
|
||||||
else
|
|
||||||
items[hash] = { "RN" => counter.next, "RR" => counter.now - i, "Quantity" => 1 }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
1.times do |i|
|
|
||||||
quantity = price.account_activities
|
|
||||||
.where(account_id: registrar.account_ids)
|
|
||||||
.where(created_at: month.beginning_of_month..month.end_of_month)
|
|
||||||
.where(activity_type: [AccountActivity::CREATE, AccountActivity::RENEW])
|
|
||||||
.count
|
|
||||||
|
|
||||||
hash = {
|
|
||||||
"ProductID" => DOMAIN_TO_PRODUCT[price.zone_name],
|
|
||||||
"Unit" => "tk",
|
|
||||||
"ProductName" => ".#{price.zone_name} registreerimine: #{price.duration.to_i} kuud",
|
|
||||||
"UnitPriceWoVAT" => price.price.amount,
|
|
||||||
}
|
|
||||||
|
|
||||||
if items.has_key?(hash)
|
|
||||||
#items[hash]["Quantity"] += 1
|
|
||||||
else
|
|
||||||
items[hash] = { "RN" => counter.next, "RR" => counter.now - i, "Quantity" => quantity }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
#adding prepaiments
|
|
||||||
if items.any?
|
|
||||||
total = 0
|
|
||||||
items.each{ |key, val| total += val["Quantity"] * key["UnitPriceWoVAT"] }
|
|
||||||
hash = {"ProductID" => Setting.directo_receipt_product_name, "Unit" => "tk", "ProductName" => "Domeenide ettemaks", "UnitPriceWoVAT"=>total}
|
|
||||||
items[hash] = {"RN"=>counter.next, "RR" => counter.now, "Quantity"=> -1}
|
|
||||||
end
|
|
||||||
|
|
||||||
# generating XML
|
|
||||||
if items.any?
|
|
||||||
directo_next += 1
|
|
||||||
invoice_counter.next
|
|
||||||
|
|
||||||
builder = Nokogiri::XML::Builder.new(encoding: "UTF-8") do |xml|
|
|
||||||
xml.invoices{
|
|
||||||
xml.invoice("Number" =>directo_next,
|
|
||||||
"InvoiceDate" =>invoices_until.strftime(date_format),
|
|
||||||
"PaymentTerm" =>Setting.directo_receipt_payment_term,
|
|
||||||
"CustomerCode"=>registrar.accounting_customer_code,
|
|
||||||
"Language" =>"",
|
|
||||||
"Currency" =>registrar_activities.first.currency,
|
|
||||||
"SalesAgent" =>Setting.directo_sales_agent){
|
|
||||||
xml.line("RN" => 1, "RR"=>1, "ProductName"=> "Domeenide registreerimine - #{I18n.l(invoices_until, format: "%B %Y").titleize}")
|
|
||||||
items.each do |line, val|
|
|
||||||
xml.line(val.merge(line))
|
|
||||||
end
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
data = builder.to_xml.gsub("\n",'')
|
|
||||||
Rails.logger.info("[Directo] XML request: #{data}")
|
|
||||||
|
|
||||||
if debug
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Directo xml had to be sent #{data}\n"
|
|
||||||
else
|
|
||||||
response = RestClient::Request.execute(url: ENV['directo_invoice_url'], method: :post, payload: {put: "1", what: "invoice", xmldata: data}, verify_ssl: false)
|
|
||||||
Rails.logger.info("[Directo] Directo responded with code: #{response.code}, body: #{response.body}")
|
|
||||||
response = response.to_s
|
|
||||||
|
|
||||||
Setting.directo_monthly_number_last = directo_next
|
|
||||||
Nokogiri::XML(response).css("Result").each do |res|
|
|
||||||
Directo.create!(request: data, response: res.as_json.to_h, invoice_number: directo_next)
|
|
||||||
Rails.logger.info("[DIRECTO] Invoice #{res.attributes["docid"].value} was pushed and return is #{res.as_json.to_h.inspect}")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Rails.logger.info("[DIRECTO] Registrar #{registrar.id} has nothing to be sent to Directo")
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Directo invoices sending finished. #{invoice_counter.now} are sent\n"
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.load_price(account_activity)
|
|
||||||
@pricelists ||= {}
|
|
||||||
return @pricelists[account_activity.price_id] if @pricelists.has_key?(account_activity.price_id)
|
|
||||||
@pricelists[account_activity.price_id] = account_activity.price
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -9,10 +9,16 @@ class Dnskey < ApplicationRecord
|
||||||
validate :validate_protocol
|
validate :validate_protocol
|
||||||
validate :validate_flags
|
validate :validate_flags
|
||||||
|
|
||||||
before_save -> { generate_digest if public_key_changed? && !ds_digest_changed? }
|
before_save lambda {
|
||||||
|
generate_digest if will_save_change_to_public_key? && !will_save_change_to_ds_digest?
|
||||||
|
}
|
||||||
|
|
||||||
before_save lambda {
|
before_save lambda {
|
||||||
if (public_key_changed? || flags_changed? || alg_changed? || protocol_changed?) && !ds_key_tag_changed?
|
if (will_save_change_to_public_key? ||
|
||||||
|
will_save_change_to_flags? ||
|
||||||
|
will_save_change_to_alg? ||
|
||||||
|
will_save_change_to_protocol?) &&
|
||||||
|
!will_save_change_to_ds_key_tag?
|
||||||
generate_ds_key_tag
|
generate_ds_key_tag
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,6 @@ class Domain < ApplicationRecord
|
||||||
include Concerns::Domain::RegistryLockable
|
include Concerns::Domain::RegistryLockable
|
||||||
include Concerns::Domain::Releasable
|
include Concerns::Domain::Releasable
|
||||||
|
|
||||||
has_paper_trail class_name: "DomainVersion", meta: { children: :children_log }
|
|
||||||
|
|
||||||
attr_accessor :roles
|
attr_accessor :roles
|
||||||
|
|
||||||
attr_accessor :legal_document_id
|
attr_accessor :legal_document_id
|
||||||
|
@ -73,12 +71,13 @@ class Domain < ApplicationRecord
|
||||||
|
|
||||||
before_update :manage_statuses
|
before_update :manage_statuses
|
||||||
def manage_statuses
|
def manage_statuses
|
||||||
return unless registrant_id_changed? # rollback has not yet happened
|
return unless will_save_change_to_registrant_id? # rollback has not yet happened
|
||||||
|
|
||||||
pending_update! if registrant_verification_asked?
|
pending_update! if registrant_verification_asked?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
after_commit :update_whois_record, unless: 'domain_name.at_auction?'
|
after_commit :update_whois_record, unless: -> { domain_name.at_auction? }
|
||||||
|
|
||||||
after_create :update_reserved_domains
|
after_create :update_reserved_domains
|
||||||
def update_reserved_domains
|
def update_reserved_domains
|
||||||
|
@ -486,9 +485,9 @@ class Domain < ApplicationRecord
|
||||||
self.delete_date = nil
|
self.delete_date = nil
|
||||||
when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set
|
when DomainStatus::SERVER_MANUAL_INZONE # removal causes server hold to set
|
||||||
self.outzone_at = Time.zone.now if force_delete_scheduled?
|
self.outzone_at = Time.zone.now if force_delete_scheduled?
|
||||||
when DomainStatus::DomainStatus::EXPIRED # removal causes server hold to set
|
when DomainStatus::EXPIRED # removal causes server hold to set
|
||||||
self.outzone_at = self.expire_time + 15.day
|
self.outzone_at = self.expire_time + 15.day
|
||||||
when DomainStatus::DomainStatus::SERVER_HOLD # removal causes server hold to set
|
when DomainStatus::SERVER_HOLD # removal causes server hold to set
|
||||||
self.outzone_at = nil
|
self.outzone_at = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -547,7 +546,7 @@ class Domain < ApplicationRecord
|
||||||
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
activate if nameservers.reject(&:marked_for_destruction?).size >= Setting.ns_min_count
|
||||||
end
|
end
|
||||||
|
|
||||||
cancel_force_delete if force_delete_scheduled? && registrant_id_changed?
|
cancel_force_delete if force_delete_scheduled? && will_save_change_to_registrant_id?
|
||||||
|
|
||||||
if statuses.empty? && valid?
|
if statuses.empty? && valid?
|
||||||
statuses << DomainStatus::OK
|
statuses << DomainStatus::OK
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
class DomainStatus < ApplicationRecord
|
class DomainStatus < ApplicationRecord
|
||||||
include Versions # version/domain_status_version.rb
|
|
||||||
include EppErrors
|
include EppErrors
|
||||||
|
|
||||||
belongs_to :domain
|
belongs_to :domain
|
||||||
|
|
||||||
# Requests to delete the object MUST be rejected.
|
# Requests to delete the object MUST be rejected.
|
||||||
|
|
|
@ -182,7 +182,7 @@ class Epp::Contact < Contact
|
||||||
|
|
||||||
self.attributes = at
|
self.attributes = at
|
||||||
|
|
||||||
email_changed = email_changed?
|
email_changed = will_save_change_to_email?
|
||||||
old_email = email_was
|
old_email = email_was
|
||||||
updated = save
|
updated = save
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,13 @@ class Invoice < ApplicationRecord
|
||||||
include Versions
|
include Versions
|
||||||
include Concerns::Invoice::Cancellable
|
include Concerns::Invoice::Cancellable
|
||||||
include Concerns::Invoice::Payable
|
include Concerns::Invoice::Payable
|
||||||
|
include Concerns::Invoice::BookKeeping
|
||||||
|
|
||||||
belongs_to :buyer, class_name: 'Registrar'
|
belongs_to :buyer, class_name: 'Registrar'
|
||||||
has_one :account_activity
|
has_one :account_activity
|
||||||
has_many :items, class_name: 'InvoiceItem', dependent: :destroy
|
has_many :items, class_name: 'InvoiceItem', dependent: :destroy
|
||||||
has_many :directo_records, as: :item, class_name: 'Directo'
|
has_many :directo_records, as: :item, class_name: 'Directo'
|
||||||
|
has_many :payment_orders
|
||||||
|
|
||||||
accepts_nested_attributes_for :items
|
accepts_nested_attributes_for :items
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ class Invoice < ApplicationRecord
|
||||||
Country.new(buyer_country_code)
|
Country.new(buyer_country_code)
|
||||||
end
|
end
|
||||||
|
|
||||||
# order is used for directo/banklink description
|
# order is used for directo/banklink description
|
||||||
def order
|
def order
|
||||||
"Order nr. #{number}"
|
"Order nr. #{number}"
|
||||||
end
|
end
|
||||||
|
@ -102,6 +104,14 @@ class Invoice < ApplicationRecord
|
||||||
generator.generate
|
generator.generate
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def do_not_send_e_invoice?
|
||||||
|
e_invoice_sent? || cancelled? || paid?
|
||||||
|
end
|
||||||
|
|
||||||
|
def e_invoice_sent?
|
||||||
|
e_invoice_sent_at.present?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def apply_default_buyer_vat_no
|
def apply_default_buyer_vat_no
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Nameserver < ApplicationRecord
|
||||||
[:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }]
|
[:ipv6, :invalid, { value: { obj: 'hostAddr', val: ipv6 } }]
|
||||||
],
|
],
|
||||||
'2003' => [
|
'2003' => [
|
||||||
[:ipv4, :blank]
|
%i[base ip_required],
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -83,6 +83,7 @@ class Nameserver < ApplicationRecord
|
||||||
|
|
||||||
def glue_record_required?
|
def glue_record_required?
|
||||||
return unless hostname? && domain
|
return unless hostname? && domain
|
||||||
|
|
||||||
DomainName(hostname).domain == domain.name
|
DomainName(hostname).domain == domain.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
102
app/models/payment_order.rb
Normal file
102
app/models/payment_order.rb
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
class PaymentOrder < ApplicationRecord
|
||||||
|
include Versions
|
||||||
|
include ActionView::Helpers::NumberHelper
|
||||||
|
|
||||||
|
PAYMENT_INTERMEDIARIES = ENV['payments_intermediaries'].to_s.strip.split(', ').freeze
|
||||||
|
PAYMENT_BANKLINK_BANKS = ENV['payments_banks'].to_s.strip.split(', ').freeze
|
||||||
|
INTERNAL_PAYMENT_METHODS = %w[admin_payment system_payment].freeze
|
||||||
|
PAYMENT_METHODS = [PAYMENT_INTERMEDIARIES, PAYMENT_BANKLINK_BANKS,
|
||||||
|
INTERNAL_PAYMENT_METHODS].flatten.freeze
|
||||||
|
CUSTOMER_PAYMENT_METHODS = [PAYMENT_INTERMEDIARIES, PAYMENT_BANKLINK_BANKS].flatten.freeze
|
||||||
|
|
||||||
|
belongs_to :invoice, optional: false
|
||||||
|
|
||||||
|
validate :invoice_cannot_be_already_paid, on: :create
|
||||||
|
validate :supported_payment_method
|
||||||
|
|
||||||
|
enum status: { issued: 'issued', paid: 'paid', cancelled: 'cancelled',
|
||||||
|
failed: 'failed' }
|
||||||
|
|
||||||
|
attr_accessor :return_url, :response_url
|
||||||
|
|
||||||
|
def self.supported_methods
|
||||||
|
supported = []
|
||||||
|
|
||||||
|
PAYMENT_METHODS.each do |method|
|
||||||
|
class_name = ('PaymentOrders::' + method.camelize).constantize
|
||||||
|
raise(NoMethodError, class_name) unless class_name < PaymentOrder
|
||||||
|
|
||||||
|
supported << class_name
|
||||||
|
end
|
||||||
|
|
||||||
|
supported
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.new_with_type(type:, invoice:)
|
||||||
|
channel = ('PaymentOrders::' + type.camelize).constantize
|
||||||
|
|
||||||
|
PaymentOrder.new(type: channel, invoice: invoice)
|
||||||
|
end
|
||||||
|
|
||||||
|
# Name of configuration namespace
|
||||||
|
def self.config_namespace_name; end
|
||||||
|
|
||||||
|
def supported_payment_method
|
||||||
|
return if PaymentOrder.supported_method?(type)
|
||||||
|
|
||||||
|
errors.add(:type, 'is not supported')
|
||||||
|
end
|
||||||
|
|
||||||
|
def invoice_cannot_be_already_paid
|
||||||
|
return unless invoice&.paid?
|
||||||
|
|
||||||
|
errors.add(:invoice, 'is already paid')
|
||||||
|
end
|
||||||
|
|
||||||
|
def self.supported_method?(name, shortname: false)
|
||||||
|
some_class = if shortname
|
||||||
|
('PaymentOrders::' + name.camelize).constantize
|
||||||
|
else
|
||||||
|
name.constantize
|
||||||
|
end
|
||||||
|
supported_methods.include? some_class
|
||||||
|
rescue NameError
|
||||||
|
false
|
||||||
|
end
|
||||||
|
|
||||||
|
def base_transaction(sum:, paid_at:, buyer_name:)
|
||||||
|
BankTransaction.new(
|
||||||
|
description: invoice.order,
|
||||||
|
reference_no: invoice.reference_no,
|
||||||
|
currency: invoice.currency,
|
||||||
|
iban: invoice.seller_iban,
|
||||||
|
sum: sum,
|
||||||
|
paid_at: paid_at,
|
||||||
|
buyer_name: buyer_name
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def complete_transaction
|
||||||
|
return NoMethodError unless payment_received?
|
||||||
|
|
||||||
|
paid!
|
||||||
|
transaction = composed_transaction
|
||||||
|
transaction.save! && transaction.bind_invoice(invoice.number)
|
||||||
|
return unless transaction.errors.any?
|
||||||
|
|
||||||
|
worded_errors = 'Failed to bind. '
|
||||||
|
transaction.errors.full_messages.each do |err|
|
||||||
|
worded_errors << "#{err}, "
|
||||||
|
end
|
||||||
|
|
||||||
|
update!(notes: worded_errors)
|
||||||
|
end
|
||||||
|
|
||||||
|
def channel
|
||||||
|
type.gsub('PaymentOrders::', '')
|
||||||
|
end
|
||||||
|
|
||||||
|
def form_url
|
||||||
|
ENV["payments_#{self.class.config_namespace_name}_url"]
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,15 +0,0 @@
|
||||||
module PaymentOrders
|
|
||||||
PAYMENT_INTERMEDIARIES = ENV['payments_intermediaries'].to_s.strip.split(', ').freeze
|
|
||||||
PAYMENT_BANKLINK_BANKS = ENV['payments_banks'].to_s.strip.split(', ').freeze
|
|
||||||
PAYMENT_METHODS = [PAYMENT_INTERMEDIARIES, PAYMENT_BANKLINK_BANKS].flatten.freeze
|
|
||||||
|
|
||||||
def self.create_with_type(type, invoice, opts = {})
|
|
||||||
raise ArgumentError unless PAYMENT_METHODS.include?(type)
|
|
||||||
|
|
||||||
if PAYMENT_BANKLINK_BANKS.include?(type)
|
|
||||||
BankLink.new(type, invoice, opts)
|
|
||||||
elsif type == 'every_pay'
|
|
||||||
EveryPay.new(type, invoice, opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
9
app/models/payment_orders/admin_payment.rb
Normal file
9
app/models/payment_orders/admin_payment.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module PaymentOrders
|
||||||
|
class AdminPayment < PaymentOrder
|
||||||
|
CONFIG_NAMESPACE = 'admin_payment'.freeze
|
||||||
|
|
||||||
|
def self.config_namespace_name
|
||||||
|
CONFIG_NAMESPACE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,44 +1,44 @@
|
||||||
module PaymentOrders
|
module PaymentOrders
|
||||||
class BankLink < Base
|
class BankLink < PaymentOrder
|
||||||
BANK_LINK_VERSION = '008'
|
BANK_LINK_VERSION = '008'.freeze
|
||||||
|
|
||||||
NEW_TRANSACTION_SERVICE_NUMBER = '1012'
|
NEW_TRANSACTION_SERVICE_NUMBER = '1012'.freeze
|
||||||
SUCCESSFUL_PAYMENT_SERVICE_NUMBER = '1111'
|
SUCCESSFUL_PAYMENT_SERVICE_NUMBER = '1111'.freeze
|
||||||
CANCELLED_PAYMENT_SERVICE_NUMBER = '1911'
|
CANCELLED_PAYMENT_SERVICE_NUMBER = '1911'.freeze
|
||||||
|
|
||||||
NEW_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT
|
NEW_MESSAGE_KEYS = %w[VK_SERVICE VK_VERSION VK_SND_ID VK_STAMP VK_AMOUNT
|
||||||
VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL
|
VK_CURR VK_REF VK_MSG VK_RETURN VK_CANCEL
|
||||||
VK_DATETIME).freeze
|
VK_DATETIME].freeze
|
||||||
SUCCESS_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
|
SUCCESS_MESSAGE_KEYS = %w[VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
|
||||||
VK_T_NO VK_AMOUNT VK_CURR VK_REC_ACC VK_REC_NAME
|
VK_T_NO VK_AMOUNT VK_CURR VK_REC_ACC VK_REC_NAME
|
||||||
VK_SND_ACC VK_SND_NAME VK_REF VK_MSG
|
VK_SND_ACC VK_SND_NAME VK_REF VK_MSG
|
||||||
VK_T_DATETIME).freeze
|
VK_T_DATETIME].freeze
|
||||||
CANCEL_MESSAGE_KEYS = %w(VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
|
CANCEL_MESSAGE_KEYS = %w[VK_SERVICE VK_VERSION VK_SND_ID VK_REC_ID VK_STAMP
|
||||||
VK_REF VK_MSG).freeze
|
VK_REF VK_MSG].freeze
|
||||||
|
|
||||||
def form_fields
|
def form_fields
|
||||||
hash = {}
|
hash = {}
|
||||||
hash["VK_SERVICE"] = NEW_TRANSACTION_SERVICE_NUMBER
|
hash['VK_SERVICE'] = NEW_TRANSACTION_SERVICE_NUMBER
|
||||||
hash["VK_VERSION"] = BANK_LINK_VERSION
|
hash['VK_VERSION'] = BANK_LINK_VERSION
|
||||||
hash["VK_SND_ID"] = seller_account
|
hash['VK_SND_ID'] = seller_account
|
||||||
hash["VK_STAMP"] = invoice.number
|
hash['VK_STAMP'] = invoice.number
|
||||||
hash["VK_AMOUNT"] = number_with_precision(invoice.total, precision: 2, separator: ".")
|
hash['VK_AMOUNT'] = number_with_precision(invoice.total, precision: 2, separator: ".")
|
||||||
hash["VK_CURR"] = invoice.currency
|
hash['VK_CURR'] = invoice.currency
|
||||||
hash["VK_REF"] = ""
|
hash['VK_REF'] = ''
|
||||||
hash["VK_MSG"] = invoice.order
|
hash['VK_MSG'] = invoice.order
|
||||||
hash["VK_RETURN"] = return_url
|
hash['VK_RETURN'] = return_url
|
||||||
hash["VK_CANCEL"] = return_url
|
hash['VK_CANCEL'] = return_url
|
||||||
hash["VK_DATETIME"] = Time.zone.now.strftime("%Y-%m-%dT%H:%M:%S%z")
|
hash['VK_DATETIME'] = Time.zone.now.strftime('%Y-%m-%dT%H:%M:%S%z')
|
||||||
hash["VK_MAC"] = calc_mac(hash)
|
hash['VK_MAC'] = calc_mac(hash)
|
||||||
hash["VK_ENCODING"] = "UTF-8"
|
hash['VK_ENCODING'] = 'UTF-8'
|
||||||
hash["VK_LANG"] = "ENG"
|
hash['VK_LANG'] = 'ENG'
|
||||||
hash
|
hash
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_response_from_intermediary?
|
def valid_response_from_intermediary?
|
||||||
return false unless response
|
return false unless response
|
||||||
|
|
||||||
case response["VK_SERVICE"]
|
case response['VK_SERVICE']
|
||||||
when SUCCESSFUL_PAYMENT_SERVICE_NUMBER
|
when SUCCESSFUL_PAYMENT_SERVICE_NUMBER
|
||||||
valid_successful_transaction?
|
valid_successful_transaction?
|
||||||
when CANCELLED_PAYMENT_SERVICE_NUMBER
|
when CANCELLED_PAYMENT_SERVICE_NUMBER
|
||||||
|
@ -48,29 +48,31 @@ module PaymentOrders
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def complete_transaction
|
def payment_received?
|
||||||
return unless valid_successful_transaction?
|
valid_response_from_intermediary? && settled_payment?
|
||||||
|
end
|
||||||
|
|
||||||
transaction = compose_or_find_transaction
|
def create_failure_report
|
||||||
|
notes = "User failed to make payment. Bank responded with code #{response['VK_SERVICE']}"
|
||||||
|
status = 'cancelled'
|
||||||
|
update!(notes: notes, status: status)
|
||||||
|
end
|
||||||
|
|
||||||
transaction.sum = response['VK_AMOUNT']
|
def composed_transaction
|
||||||
transaction.bank_reference = response['VK_T_NO']
|
paid_at = Time.parse(response['VK_T_DATETIME'])
|
||||||
transaction.buyer_bank_code = response["VK_SND_ID"]
|
transaction = base_transaction(sum: response['VK_AMOUNT'],
|
||||||
transaction.buyer_iban = response["VK_SND_ACC"]
|
paid_at: paid_at,
|
||||||
transaction.buyer_name = response["VK_SND_NAME"]
|
buyer_name: response['VK_SND_NAME'])
|
||||||
transaction.paid_at = Time.parse(response["VK_T_DATETIME"])
|
|
||||||
|
|
||||||
transaction.save!
|
transaction.bank_reference = response['VK_T_NO']
|
||||||
transaction.bind_invoice(invoice.number)
|
transaction.buyer_bank_code = response['VK_SND_ID']
|
||||||
if transaction.errors.empty?
|
transaction.buyer_iban = response['VK_SND_ACC']
|
||||||
Rails.logger.info("Invoice ##{invoice.number} was marked as paid")
|
|
||||||
else
|
transaction
|
||||||
Rails.logger.error("Failed to bind invoice ##{invoice.number}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def settled_payment?
|
def settled_payment?
|
||||||
response["VK_SERVICE"] == SUCCESSFUL_PAYMENT_SERVICE_NUMBER
|
response['VK_SERVICE'] == SUCCESSFUL_PAYMENT_SERVICE_NUMBER
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -89,17 +91,15 @@ module PaymentOrders
|
||||||
|
|
||||||
def valid_amount?
|
def valid_amount?
|
||||||
source = number_with_precision(
|
source = number_with_precision(
|
||||||
BigDecimal.new(response["VK_AMOUNT"]), precision: 2, separator: "."
|
BigDecimal(response['VK_AMOUNT']), precision: 2, separator: '.'
|
||||||
)
|
|
||||||
target = number_with_precision(
|
|
||||||
invoice.total, precision: 2, separator: "."
|
|
||||||
)
|
)
|
||||||
|
target = number_with_precision(invoice.total, precision: 2, separator: '.')
|
||||||
|
|
||||||
source == target
|
source == target
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_currency?
|
def valid_currency?
|
||||||
invoice.currency == response["VK_CURR"]
|
invoice.currency == response['VK_CURR']
|
||||||
end
|
end
|
||||||
|
|
||||||
def sign(data)
|
def sign(data)
|
||||||
|
@ -117,7 +117,7 @@ module PaymentOrders
|
||||||
|
|
||||||
def valid_mac?(hash, keys)
|
def valid_mac?(hash, keys)
|
||||||
data = keys.map { |element| prepend_size(hash[element]) }.join
|
data = keys.map { |element| prepend_size(hash[element]) }.join
|
||||||
verify_mac(data, hash["VK_MAC"])
|
verify_mac(data, hash['VK_MAC'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def verify_mac(data, mac)
|
def verify_mac(data, mac)
|
||||||
|
@ -126,22 +126,22 @@ module PaymentOrders
|
||||||
end
|
end
|
||||||
|
|
||||||
def prepend_size(value)
|
def prepend_size(value)
|
||||||
value = (value || "").to_s.strip
|
value = (value || '').to_s.strip
|
||||||
string = ""
|
string = ''
|
||||||
string << format("%03i", value.size)
|
string << format("%03i", value.size)
|
||||||
string << value
|
string << value
|
||||||
end
|
end
|
||||||
|
|
||||||
def seller_account
|
def seller_account
|
||||||
ENV["payments_#{type}_seller_account"]
|
ENV["payments_#{self.class.config_namespace_name}_seller_account"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def seller_certificate
|
def seller_certificate
|
||||||
ENV["payments_#{type}_seller_private"]
|
ENV["payments_#{self.class.config_namespace_name}_seller_private"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def bank_certificate
|
def bank_certificate
|
||||||
ENV["payments_#{type}_bank_certificate"]
|
ENV["payments_#{self.class.config_namespace_name}_bank_certificate"]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
module PaymentOrders
|
|
||||||
class Base
|
|
||||||
include ActionView::Helpers::NumberHelper
|
|
||||||
|
|
||||||
attr_reader :type,
|
|
||||||
:invoice,
|
|
||||||
:return_url,
|
|
||||||
:response_url,
|
|
||||||
:response
|
|
||||||
|
|
||||||
def initialize(type, invoice, opts = {})
|
|
||||||
@type = type
|
|
||||||
@invoice = invoice
|
|
||||||
@return_url = opts[:return_url]
|
|
||||||
@response_url = opts[:response_url]
|
|
||||||
@response = opts[:response]
|
|
||||||
end
|
|
||||||
|
|
||||||
def create_transaction
|
|
||||||
transaction = BankTransaction.where(description: invoice.order).first_or_initialize(
|
|
||||||
reference_no: invoice.reference_no,
|
|
||||||
currency: invoice.currency,
|
|
||||||
iban: invoice.seller_iban
|
|
||||||
)
|
|
||||||
|
|
||||||
transaction.save!
|
|
||||||
end
|
|
||||||
|
|
||||||
def compose_or_find_transaction
|
|
||||||
transaction = BankTransaction.find_by(base_transaction_params)
|
|
||||||
|
|
||||||
# Transaction already autobinded (possibly) invalid invoice
|
|
||||||
if transaction.binded?
|
|
||||||
Rails.logger.info("Transaction #{transaction.id} is already binded")
|
|
||||||
Rails.logger.info('Creating new BankTransaction record.')
|
|
||||||
|
|
||||||
transaction = new_base_transaction
|
|
||||||
end
|
|
||||||
|
|
||||||
transaction
|
|
||||||
end
|
|
||||||
|
|
||||||
def new_base_transaction
|
|
||||||
BankTransaction.new(base_transaction_params)
|
|
||||||
end
|
|
||||||
|
|
||||||
def base_transaction_params
|
|
||||||
{
|
|
||||||
description: invoice.order,
|
|
||||||
currency: invoice.currency,
|
|
||||||
iban: invoice.seller_iban,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
def form_url
|
|
||||||
ENV["payments_#{type}_url"]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,9 +1,15 @@
|
||||||
module PaymentOrders
|
module PaymentOrders
|
||||||
class EveryPay < Base
|
class EveryPay < PaymentOrder
|
||||||
USER = ENV['payments_every_pay_api_user'].freeze
|
USER = ENV['payments_every_pay_api_user']
|
||||||
KEY = ENV['payments_every_pay_api_key'].freeze
|
KEY = ENV['payments_every_pay_api_key']
|
||||||
ACCOUNT_ID = ENV['payments_every_pay_seller_account'].freeze
|
ACCOUNT_ID = ENV['payments_every_pay_seller_account']
|
||||||
SUCCESSFUL_PAYMENT = %w(settled authorized).freeze
|
SUCCESSFUL_PAYMENT = %w[settled authorized].freeze
|
||||||
|
|
||||||
|
CONFIG_NAMESPACE = 'every_pay'.freeze
|
||||||
|
|
||||||
|
def self.config_namespace_name
|
||||||
|
CONFIG_NAMESPACE
|
||||||
|
end
|
||||||
|
|
||||||
def form_fields
|
def form_fields
|
||||||
base_json = base_params
|
base_json = base_params
|
||||||
|
@ -25,25 +31,23 @@ module PaymentOrders
|
||||||
end
|
end
|
||||||
|
|
||||||
def settled_payment?
|
def settled_payment?
|
||||||
SUCCESSFUL_PAYMENT.include?(response[:payment_state])
|
SUCCESSFUL_PAYMENT.include?(response['payment_state'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def complete_transaction
|
def payment_received?
|
||||||
return unless valid_response_from_intermediary? && settled_payment?
|
valid_response_from_intermediary? && settled_payment?
|
||||||
|
end
|
||||||
|
|
||||||
transaction = compose_or_find_transaction
|
def composed_transaction
|
||||||
|
base_transaction(sum: response['amount'],
|
||||||
|
paid_at: Date.strptime(response['timestamp'], '%s'),
|
||||||
|
buyer_name: response['cc_holder_name'])
|
||||||
|
end
|
||||||
|
|
||||||
transaction.sum = response[:amount]
|
def create_failure_report
|
||||||
transaction.paid_at = Date.strptime(response[:timestamp], '%s')
|
notes = "User failed to make valid payment. Payment state: #{response['payment_state']}"
|
||||||
transaction.buyer_name = response[:cc_holder_name]
|
status = 'cancelled'
|
||||||
|
update!(notes: notes, status: status)
|
||||||
transaction.save!
|
|
||||||
transaction.bind_invoice(invoice.number)
|
|
||||||
if transaction.errors.empty?
|
|
||||||
Rails.logger.info("Invoice ##{invoice.number} marked as paid")
|
|
||||||
else
|
|
||||||
Rails.logger.error("Failed to bind invoice ##{invoice.number}")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -63,24 +67,27 @@ module PaymentOrders
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_hmac?
|
def valid_hmac?
|
||||||
hmac_fields = response[:hmac_fields].split(',')
|
hmac_fields = response['hmac_fields'].split(',')
|
||||||
hmac_hash = {}
|
hmac_hash = {}
|
||||||
hmac_fields.map do |field|
|
hmac_fields.map do |field|
|
||||||
symbol = field.to_sym
|
hmac_hash[field] = response[field]
|
||||||
hmac_hash[symbol] = response[symbol]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
hmac_string = hmac_hash.map { |key, _v| "#{key}=#{hmac_hash[key]}" }.join('&')
|
hmac_string = hmac_hash.map { |key, _v| "#{key}=#{hmac_hash[key]}" }.join('&')
|
||||||
expected_hmac = OpenSSL::HMAC.hexdigest('sha1', KEY, hmac_string)
|
expected_hmac = OpenSSL::HMAC.hexdigest('sha1', KEY, hmac_string)
|
||||||
expected_hmac == response[:hmac]
|
expected_hmac == response['hmac']
|
||||||
|
rescue NoMethodError
|
||||||
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_amount?
|
def valid_amount?
|
||||||
invoice.total == BigDecimal.new(response[:amount])
|
return false unless response.key? 'amount'
|
||||||
|
|
||||||
|
invoice.total == BigDecimal(response['amount'])
|
||||||
end
|
end
|
||||||
|
|
||||||
def valid_account?
|
def valid_account?
|
||||||
response[:account_id] == ACCOUNT_ID
|
response['account_id'] == ACCOUNT_ID
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
7
app/models/payment_orders/lhv.rb
Normal file
7
app/models/payment_orders/lhv.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module PaymentOrders
|
||||||
|
class Lhv < BankLink
|
||||||
|
def self.config_namespace_name
|
||||||
|
'lhv'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
app/models/payment_orders/seb.rb
Normal file
7
app/models/payment_orders/seb.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module PaymentOrders
|
||||||
|
class Seb < BankLink
|
||||||
|
def self.config_namespace_name
|
||||||
|
'seb'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
7
app/models/payment_orders/swed.rb
Normal file
7
app/models/payment_orders/swed.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module PaymentOrders
|
||||||
|
class Swed < BankLink
|
||||||
|
def self.config_namespace_name
|
||||||
|
'swed'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
9
app/models/payment_orders/system_payment.rb
Normal file
9
app/models/payment_orders/system_payment.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module PaymentOrders
|
||||||
|
class SystemPayment < PaymentOrder
|
||||||
|
CONFIG_NAMESPACE = 'system_payment'.freeze
|
||||||
|
|
||||||
|
def self.config_namespace_name
|
||||||
|
CONFIG_NAMESPACE
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -1,5 +1,6 @@
|
||||||
class Registrar < ApplicationRecord
|
class Registrar < ApplicationRecord
|
||||||
include Versions # version/registrar_version.rb
|
include Versions # version/registrar_version.rb
|
||||||
|
include Concerns::Registrar::BookKeeping
|
||||||
|
|
||||||
has_many :domains, dependent: :restrict_with_error
|
has_many :domains, dependent: :restrict_with_error
|
||||||
has_many :contacts, dependent: :restrict_with_error
|
has_many :contacts, dependent: :restrict_with_error
|
||||||
|
@ -21,9 +22,9 @@ class Registrar < ApplicationRecord
|
||||||
validates :reference_no, format: Billing::ReferenceNo::REGEXP
|
validates :reference_no, format: Billing::ReferenceNo::REGEXP
|
||||||
validate :forbid_special_code
|
validate :forbid_special_code
|
||||||
|
|
||||||
validates :vat_rate, presence: true, if: 'vat_liable_in_foreign_country? && vat_no.blank?'
|
validates :vat_rate, presence: true, if: -> { vat_liable_in_foreign_country? && vat_no.blank? }
|
||||||
validates :vat_rate, absence: true, if: :vat_liable_locally?
|
validates :vat_rate, absence: true, if: :vat_liable_locally?
|
||||||
validates :vat_rate, absence: true, if: 'vat_liable_in_foreign_country? && vat_no?'
|
validates :vat_rate, absence: true, if: -> { vat_liable_in_foreign_country? && vat_no? }
|
||||||
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than: 100 },
|
validates :vat_rate, numericality: { greater_than_or_equal_to: 0, less_than: 100 },
|
||||||
allow_nil: true
|
allow_nil: true
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ class Registrar < ApplicationRecord
|
||||||
after_initialize :set_defaults
|
after_initialize :set_defaults
|
||||||
|
|
||||||
validates :email, email_format: { message: :invalid },
|
validates :email, email_format: { message: :invalid },
|
||||||
allow_blank: true, if: proc { |c| c.email_changed? }
|
allow_blank: true, if: proc { |c| c.will_save_change_to_email? }
|
||||||
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
|
validates :billing_email, email_format: { message: :invalid }, allow_blank: true
|
||||||
|
|
||||||
alias_attribute :contact_email, :email
|
alias_attribute :contact_email, :email
|
||||||
|
@ -99,9 +100,7 @@ class Registrar < ApplicationRecord
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
SendEInvoiceJob.enqueue(invoice.id)
|
||||||
e_invoice = invoice.to_e_invoice
|
|
||||||
e_invoice.deliver
|
|
||||||
|
|
||||||
invoice
|
invoice
|
||||||
end
|
end
|
||||||
|
|
4
app/models/version/payment_order_version.rb
Normal file
4
app/models/version/payment_order_version.rb
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
class PaymentOrderVersion < PaperTrail::Version
|
||||||
|
self.table_name = :log_payment_orders
|
||||||
|
self.sequence_name = :log_payment_orders_id_seq
|
||||||
|
end
|
|
@ -21,3 +21,5 @@
|
||||||
.col-md-6= render 'registrar/invoices/partials/buyer'
|
.col-md-6= render 'registrar/invoices/partials/buyer'
|
||||||
.row
|
.row
|
||||||
.col-md-12= render 'registrar/invoices/partials/items'
|
.col-md-12= render 'registrar/invoices/partials/items'
|
||||||
|
.row
|
||||||
|
.col-md-12= render 'registrar/invoices/partials/payment_orders'
|
||||||
|
|
|
@ -32,5 +32,5 @@
|
||||||
|
|
||||||
.footer.text-right
|
.footer.text-right
|
||||||
Version
|
Version
|
||||||
= CURRENT_COMMIT_HASH
|
= current_commit_link
|
||||||
= javascript_include_tag 'admin-manifest', async: true
|
= javascript_include_tag 'admin-manifest', async: true
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 text-right">
|
<div class="col-md-6 text-right">
|
||||||
Version
|
Version
|
||||||
<%= CURRENT_COMMIT_HASH %>
|
<%= current_commit_link %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 text-right">
|
<div class="col-md-6 text-right">
|
||||||
Version
|
Version
|
||||||
<%= CURRENT_COMMIT_HASH %>
|
<%= current_commit_link %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 text-right">
|
<div class="col-md-6 text-right">
|
||||||
Version
|
Version
|
||||||
<%= CURRENT_COMMIT_HASH %>
|
<%= current_commit_link %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,6 +6,10 @@
|
||||||
class: 'btn btn-default') %>
|
class: 'btn btn-default') %>
|
||||||
<%= link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
|
<%= link_to(t(:delete), delete_registrar_domains_path(domain_name: params[:domain_name]),
|
||||||
class: 'btn btn-default') %>
|
class: 'btn btn-default') %>
|
||||||
|
<% if @client_holded %>
|
||||||
|
<%= link_to(t(:remove_client_hold), remove_hold_registrar_domains_path(domain_name: params[:domain_name]),
|
||||||
|
class: 'btn btn-default') %>
|
||||||
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path(domain_name: params[:domain_name]),
|
<%= link_to t('.transfer_btn'), new_registrar_domain_transfer_path(domain_name: params[:domain_name]),
|
||||||
class: 'btn btn-default' %>
|
class: 'btn btn-default' %>
|
||||||
|
|
19
app/views/registrar/invoices/partials/_payment_orders.haml
Normal file
19
app/views/registrar/invoices/partials/_payment_orders.haml
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
%h4= "Payment Orders"
|
||||||
|
%hr
|
||||||
|
.table-responsive
|
||||||
|
%table.table.table-hover.table-condensed
|
||||||
|
%thead
|
||||||
|
%tr
|
||||||
|
%th{class: 'col-xs-1'}= "#"
|
||||||
|
%th{class: 'col-xs-1'}= "Channel"
|
||||||
|
%th{class: 'col-xs-2'}= "Status"
|
||||||
|
%th{class: 'col-xs-3'}= "Initiated"
|
||||||
|
%th{class: 'col-xs-4'}= "Notes"
|
||||||
|
%tbody
|
||||||
|
- @invoice.payment_orders.each do |payment_order|
|
||||||
|
%tr
|
||||||
|
%td= payment_order.id
|
||||||
|
%td= payment_order.channel
|
||||||
|
%td= payment_order.status
|
||||||
|
%td= payment_order.created_at
|
||||||
|
%td= payment_order.notes
|
|
@ -17,4 +17,4 @@
|
||||||
|
|
||||||
- if @invoice.payable?
|
- if @invoice.payable?
|
||||||
.row.semifooter
|
.row.semifooter
|
||||||
.col-md-6-offset-6.text-right= render 'registrar/invoices/partials/banklinks', locals: { payment_channels: PaymentOrders::PAYMENT_METHODS }
|
.col-md-6-offset-6.text-right= render 'registrar/invoices/partials/banklinks', locals: { payment_channels: PaymentOrder::CUSTOMER_PAYMENT_METHODS }
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
= t('registrar.invoices.redirected_to_intermediary')
|
= t('registrar.invoices.redirected_to_intermediary')
|
||||||
|
|
||||||
.payment-form
|
.payment-form
|
||||||
= form_tag @payment.form_url, method: :post do
|
= form_tag @payment_order.form_url, method: :post do
|
||||||
- @payment.form_fields.each do |k, v|
|
- @payment_order.form_fields.each do |k, v|
|
||||||
= hidden_field_tag k, v
|
= hidden_field_tag k, v
|
||||||
= submit_tag t('registrar.invoices.go_to_intermediary')
|
= submit_tag t('registrar.invoices.go_to_intermediary')
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd">
|
||||||
|
<command>
|
||||||
|
<update>
|
||||||
|
<domain:update
|
||||||
|
xmlns:domain="https://epp.tld.ee/schema/domain-eis-1.0.xsd">
|
||||||
|
<domain:name>example.ee</domain:name>
|
||||||
|
<domain:rem>
|
||||||
|
<domain:status s="clientHold"/>
|
||||||
|
</domain:rem>
|
||||||
|
</domain:update>
|
||||||
|
</update>
|
||||||
|
<clTRID>timo-1579351654</clTRID>
|
||||||
|
</command>
|
||||||
|
</epp>
|
|
@ -29,6 +29,9 @@
|
||||||
,
|
,
|
||||||
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'delete'}}
|
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'delete'}}
|
||||||
Delete
|
Delete
|
||||||
|
,
|
||||||
|
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'domain', epp_action: 'client_hold'}}
|
||||||
|
Remove Client Hold
|
||||||
|
|
||||||
%h4 Poll
|
%h4 Poll
|
||||||
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'poll', epp_action: 'poll'}}
|
%a.js-load-xml{href: 'javascript:void(0)', data: {obj: 'poll', epp_action: 'poll'}}
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __dir__)
|
||||||
load Gem.bin_path('bundler', 'bundle')
|
load Gem.bin_path('bundler', 'bundle')
|
||||||
|
|
25
bin/setup
25
bin/setup
|
@ -1,33 +1,38 @@
|
||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'fileutils'
|
include FileUtils
|
||||||
|
|
||||||
# path to your application root.
|
# path to your application root.
|
||||||
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
APP_ROOT = Pathname.new File.expand_path('../../', __dir__)
|
||||||
|
|
||||||
|
|
||||||
def system!(*args)
|
def system!(*args)
|
||||||
system(*args) || abort("\n== Command #{args} failed ==")
|
system(*args) || abort("\n== Command #{args} failed ==")
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir APP_ROOT do
|
chdir APP_ROOT do
|
||||||
|
# This script is a starting point to setup your application.
|
||||||
|
# Add necessary setup steps to this file.
|
||||||
|
|
||||||
puts '== Installing dependencies with bundler =='
|
puts '== Installing dependencies =='
|
||||||
system! 'gem install bundler --conservative'
|
system! 'gem install bundler --conservative'
|
||||||
system('bundle check') || system!('bundle install')
|
system('bundle check') || system!('bundle install')
|
||||||
|
|
||||||
puts "\n== Copying sample development database config files =="
|
# Install JavaScript dependencies if using Yarn
|
||||||
|
# system('bin/yarn')
|
||||||
|
|
||||||
|
puts "\n== Copying sample files =="
|
||||||
unless File.exist?('config/database.yml')
|
unless File.exist?('config/database.yml')
|
||||||
system! 'cp config/database-example-development.yml config/database.yml'
|
system! 'cp config/database.yml.sample config/database.yml'
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "\n== Preparing database =="
|
puts "\n== Preparing database =="
|
||||||
system! 'bin/rails db:setup'
|
system! 'bin/rails db:setup'
|
||||||
|
|
||||||
puts "\n== Removing old logs and tempfiles =="
|
puts "\n== Removing old logs and tempfiles =="
|
||||||
system! 'bin/rake log:clear tmp:clear'
|
system! 'bin/rails log:clear tmp:clear'
|
||||||
|
|
||||||
puts "\n== Restarting application server =="
|
puts "\n== Restarting application server =="
|
||||||
system! 'touch tmp/restart.txt'
|
system! 'bin/rails restart'
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
0
bin/update
Normal file → Executable file
0
bin/update
Normal file → Executable file
9
bin/yarn
Executable file
9
bin/yarn
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
APP_ROOT = File.expand_path('..', __dir__)
|
||||||
|
Dir.chdir(APP_ROOT) do
|
||||||
|
exec 'yarnpkg', *ARGV
|
||||||
|
rescue Errno::ENOENT
|
||||||
|
$stderr.puts 'Yarn executable was not detected in the system.'
|
||||||
|
$stderr.puts 'Download Yarn at https://yarnpkg.com/en/docs/install'
|
||||||
|
exit 1
|
||||||
|
end
|
|
@ -16,6 +16,7 @@ end
|
||||||
|
|
||||||
module DomainNameRegistry
|
module DomainNameRegistry
|
||||||
class Application < Rails::Application
|
class Application < Rails::Application
|
||||||
|
config.load_defaults 5.1
|
||||||
# Settings in config/environments/* take precedence over those specified here.
|
# Settings in config/environments/* take precedence over those specified here.
|
||||||
# Application configuration should go into files in config/initializers
|
# Application configuration should go into files in config/initializers
|
||||||
# -- all .rb files in that directory are automatically loaded.
|
# -- all .rb files in that directory are automatically loaded.
|
||||||
|
|
|
@ -7,3 +7,4 @@ test:
|
||||||
production:
|
production:
|
||||||
adapter: redis
|
adapter: redis
|
||||||
url: redis://localhost:6379/1
|
url: redis://localhost:6379/1
|
||||||
|
channel_prefix: domain_name_registry_production
|
||||||
|
|
|
@ -66,7 +66,7 @@ Rails.application.configure do
|
||||||
|
|
||||||
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
||||||
# the I18n.default_locale when a translation cannot be found).
|
# the I18n.default_locale when a translation cannot be found).
|
||||||
config.i18n.fallbacks = [I18n.default_locale]
|
config.i18n.fallbacks = true
|
||||||
|
|
||||||
# Send deprecation notices to registered listeners.
|
# Send deprecation notices to registered listeners.
|
||||||
config.active_support.deprecation = :notify
|
config.active_support.deprecation = :notify
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
Rails.application.configure do
|
Rails.application.configure do
|
||||||
|
$VERBOSE = nil
|
||||||
# Settings specified here will take precedence over those in config/application.rb.
|
# Settings specified here will take precedence over those in config/application.rb.
|
||||||
|
|
||||||
# The test environment is used exclusively to run your application's
|
# The test environment is used exclusively to run your application's
|
||||||
|
@ -30,7 +32,7 @@ Rails.application.configure do
|
||||||
config.action_mailer.raise_delivery_errors = false
|
config.action_mailer.raise_delivery_errors = false
|
||||||
|
|
||||||
# Print deprecation notices to the stderr.
|
# Print deprecation notices to the stderr.
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :silence
|
||||||
|
|
||||||
# Raises error for missing translations
|
# Raises error for missing translations
|
||||||
config.action_view.raise_on_missing_translations = true
|
config.action_view.raise_on_missing_translations = true
|
||||||
|
|
|
@ -3,6 +3,9 @@ Airbrake.configure do |config|
|
||||||
config.project_id = ENV['airbrake_project_id']
|
config.project_id = ENV['airbrake_project_id']
|
||||||
config.project_key = ENV['airbrake_project_key']
|
config.project_key = ENV['airbrake_project_key']
|
||||||
config.root_directory = Rails.root
|
config.root_directory = Rails.root
|
||||||
|
config.job_stats = false
|
||||||
|
config.query_stats = false
|
||||||
|
config.performance_stats = false
|
||||||
config.logger =
|
config.logger =
|
||||||
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
||||||
Logger.new(STDOUT, level: Rails.logger.level)
|
Logger.new(STDOUT, level: Rails.logger.level)
|
||||||
|
|
|
@ -5,7 +5,7 @@ Rails.application.configure do
|
||||||
config.assets.version = '1.0'
|
config.assets.version = '1.0'
|
||||||
|
|
||||||
# Add additional assets to the asset load path
|
# Add additional assets to the asset load path
|
||||||
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts')
|
config.assets.paths << Rails.root.join('vendor', 'assets', 'fonts', 'node_modules')
|
||||||
|
|
||||||
# Precompile additional assets.
|
# Precompile additional assets.
|
||||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||||
|
@ -14,4 +14,5 @@ Rails.application.configure do
|
||||||
config.assets.precompile += %w(admin-manifest.css admin-manifest.js)
|
config.assets.precompile += %w(admin-manifest.css admin-manifest.js)
|
||||||
config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js)
|
config.assets.precompile += %w(registrar-manifest.css registrar-manifest.js)
|
||||||
config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js)
|
config.assets.precompile += %w(registrant-manifest.css registrant-manifest.js)
|
||||||
|
config.assets.precompile += %w( admin.js admin.css )
|
||||||
end
|
end
|
||||||
|
|
25
config/initializers/content_security_policy.rb
Normal file
25
config/initializers/content_security_policy.rb
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
|
# Define an application-wide content security policy
|
||||||
|
# For further information see the following documentation
|
||||||
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||||
|
|
||||||
|
# Rails.application.config.content_security_policy do |policy|
|
||||||
|
# policy.default_src :self, :https
|
||||||
|
# policy.font_src :self, :https, :data
|
||||||
|
# policy.img_src :self, :https, :data
|
||||||
|
# policy.object_src :none
|
||||||
|
# policy.script_src :self, :https
|
||||||
|
# policy.style_src :self, :https
|
||||||
|
|
||||||
|
# # Specify URI for violation reports
|
||||||
|
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||||
|
# end
|
||||||
|
|
||||||
|
# If you are using UJS then enable automatic nonce generation
|
||||||
|
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||||
|
|
||||||
|
# Report CSP violations to a specified URI
|
||||||
|
# For further information see the following documentation:
|
||||||
|
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||||
|
# Rails.application.config.content_security_policy_report_only = true
|
|
@ -1 +0,0 @@
|
||||||
CURRENT_COMMIT_HASH = `git rev-parse --short HEAD`
|
|
|
@ -1,4 +1,6 @@
|
||||||
MoneyRails.configure do |config|
|
MoneyRails.configure do |config|
|
||||||
# Wrapper for Money#default_currency with additional functionality
|
# Wrapper for Money#default_currency with additional functionality
|
||||||
config.default_currency = :eur
|
config.default_currency = :eur
|
||||||
|
config.rounding_mode = BigDecimal::ROUND_HALF_EVEN
|
||||||
|
config.locale_backend = :i18n
|
||||||
end
|
end
|
|
@ -6,7 +6,8 @@
|
||||||
#
|
#
|
||||||
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
|
# DEPRECATION WARNING: raise_on_unfiltered_parameters is deprecated and has no effect in Rails 5.1.
|
||||||
|
#Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
|
||||||
|
|
||||||
# Enable per-form CSRF tokens. Previous versions had false.
|
# Enable per-form CSRF tokens. Previous versions had false.
|
||||||
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
Rails.application.config.action_controller.per_form_csrf_tokens = true
|
||||||
|
@ -19,7 +20,9 @@ Rails.application.config.action_controller.forgery_protection_origin_check = tru
|
||||||
ActiveSupport.to_time_preserves_timezone = true
|
ActiveSupport.to_time_preserves_timezone = true
|
||||||
|
|
||||||
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
# Do not halt callback chains when a callback returns false. Previous versions had true.
|
||||||
ActiveSupport.halt_callback_chains_on_return_false = false
|
# DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and
|
||||||
|
# will be removed in Rails 5.2.
|
||||||
|
#ActiveSupport.halt_callback_chains_on_return_false = false
|
||||||
|
|
||||||
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
# Configure SSL options to enable HSTS with subdomains. Previous versions had false.
|
||||||
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
||||||
|
|
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
14
config/initializers/new_framework_defaults_5_1.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.1 upgrade.
|
||||||
|
#
|
||||||
|
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
|
# Make `form_with` generate non-remote forms.
|
||||||
|
Rails.application.config.action_view.form_with_generates_remote_forms = false
|
||||||
|
|
||||||
|
# Unknown asset fallback will return the path passed in when the given
|
||||||
|
# asset is not present in the asset pipeline.
|
||||||
|
# Rails.application.config.assets.unknown_asset_fallback = false
|
38
config/initializers/new_framework_defaults_5_2.rb
Normal file
38
config/initializers/new_framework_defaults_5_2.rb
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
# Be sure to restart your server when you modify this file.
|
||||||
|
#
|
||||||
|
# This file contains migration options to ease your Rails 5.2 upgrade.
|
||||||
|
#
|
||||||
|
# Once upgraded flip defaults one by one to migrate to the new default.
|
||||||
|
#
|
||||||
|
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
|
||||||
|
|
||||||
|
# Make Active Record use stable #cache_key alongside new #cache_version method.
|
||||||
|
# This is needed for recyclable cache keys.
|
||||||
|
# Rails.application.config.active_record.cache_versioning = true
|
||||||
|
|
||||||
|
# Use AES-256-GCM authenticated encryption for encrypted cookies.
|
||||||
|
# Also, embed cookie expiry in signed or encrypted cookies for increased security.
|
||||||
|
#
|
||||||
|
# This option is not backwards compatible with earlier Rails versions.
|
||||||
|
# It's best enabled when your entire app is migrated and stable on 5.2.
|
||||||
|
#
|
||||||
|
# Existing cookies will be converted on read then written with the new scheme.
|
||||||
|
# Rails.application.config.action_dispatch.use_authenticated_cookie_encryption = true
|
||||||
|
|
||||||
|
# Use AES-256-GCM authenticated encryption as default cipher for encrypting messages
|
||||||
|
# instead of AES-256-CBC, when use_authenticated_message_encryption is set to true.
|
||||||
|
# Rails.application.config.active_support.use_authenticated_message_encryption = true
|
||||||
|
|
||||||
|
# Add default protection from forgery to ActionController::Base instead of in
|
||||||
|
# ApplicationController.
|
||||||
|
# Rails.application.config.action_controller.default_protect_from_forgery = true
|
||||||
|
|
||||||
|
# Store boolean values are in sqlite3 databases as 1 and 0 instead of 't' and
|
||||||
|
# 'f' after migrating old data.
|
||||||
|
# Rails.application.config.active_record.sqlite3.represent_boolean_as_integer = true
|
||||||
|
|
||||||
|
# Use SHA-1 instead of MD5 to generate non-sensitive digests, such as the ETag header.
|
||||||
|
# Rails.application.config.active_support.use_sha1_digests = true
|
||||||
|
|
||||||
|
# Make `form_with` generate id attributes for any generated HTML tags.
|
||||||
|
# Rails.application.config.action_view.form_with_generates_ids = true
|
1
config/initializers/paper_trail.rb
Normal file
1
config/initializers/paper_trail.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
PaperTrail.config.track_associations = false
|
|
@ -206,6 +206,7 @@ en:
|
||||||
statuses: 'Statuses'
|
statuses: 'Statuses'
|
||||||
description: 'Description'
|
description: 'Description'
|
||||||
delete: 'Delete'
|
delete: 'Delete'
|
||||||
|
remove_client_hold: 'Remove clientHold'
|
||||||
are_you_sure: 'Are you sure?'
|
are_you_sure: 'Are you sure?'
|
||||||
back: 'Back'
|
back: 'Back'
|
||||||
new_domain: 'New domain'
|
new_domain: 'New domain'
|
||||||
|
@ -580,6 +581,7 @@ en:
|
||||||
tech: Tech contact
|
tech: Tech contact
|
||||||
valid: Valid
|
valid: Valid
|
||||||
object_is_not_eligible_for_renewal: 'Object is not eligible for renewal'
|
object_is_not_eligible_for_renewal: 'Object is not eligible for renewal'
|
||||||
|
object_is_not_holded: 'Object is not holded'
|
||||||
bank_statement_desc: 'Import file row will match only when matching following attributes: <b><br>ref number<br>payment amount<br>invoice number (the first numerical value in comment field)</b>.'
|
bank_statement_desc: 'Import file row will match only when matching following attributes: <b><br>ref number<br>payment amount<br>invoice number (the first numerical value in comment field)</b>.'
|
||||||
create_bank_statement: 'Create bank statement'
|
create_bank_statement: 'Create bank statement'
|
||||||
create_bank_transaction: 'Create bank transaction'
|
create_bank_transaction: 'Create bank transaction'
|
||||||
|
|
7
config/locales/registrar/payments.en.yml
Normal file
7
config/locales/registrar/payments.en.yml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
en:
|
||||||
|
registrar:
|
||||||
|
payments:
|
||||||
|
back:
|
||||||
|
payment_successful: 'Thank you! Payment received successfully.'
|
||||||
|
successful_payment_backend_error: 'We received your payment, but something went wrong on our side. Please contact us via email or phone.'
|
||||||
|
payment_not_received: 'Payment was unsuccessful. Please make sure you have enough funds on your account and try again.'
|
|
@ -1,4 +1,8 @@
|
||||||
en:
|
en:
|
||||||
|
registrar:
|
||||||
|
invoice_yearly_product_description: '%{tld} registration: %{length} year(s)'
|
||||||
|
invoice_monthly_product_description: '%{tld} registration: %{length} month(s)'
|
||||||
|
monthly_summary_title: 'Domain registrations - %{date}'
|
||||||
activerecord:
|
activerecord:
|
||||||
errors:
|
errors:
|
||||||
models:
|
models:
|
||||||
|
|
5
config/locales/registrars.et.yml
Normal file
5
config/locales/registrars.et.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
et:
|
||||||
|
registrar:
|
||||||
|
invoice_yearly_product_description: '%{tld} registreerimine: %{length} aasta(t)'
|
||||||
|
invoice_monthly_product_description: '%{tld} registreerimine: %{length} kuu(d)'
|
||||||
|
monthly_summary_title: 'Domeenide registreerimine - %{date}'
|
|
@ -1,13 +1,13 @@
|
||||||
# Puma can serve each request in a thread from an internal thread pool.
|
# Puma can serve each request in a thread from an internal thread pool.
|
||||||
# The `threads` method setting takes two numbers a minimum and maximum.
|
# The `threads` method setting takes two numbers: a minimum and maximum.
|
||||||
# Any libraries that use thread pools should be configured to match
|
# Any libraries that use thread pools should be configured to match
|
||||||
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
# the maximum value specified for Puma. Default is set to 5 threads for minimum
|
||||||
# and maximum, this matches the default thread size of Active Record.
|
# and maximum; this matches the default thread size of Active Record.
|
||||||
#
|
#
|
||||||
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
|
threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
|
||||||
threads threads_count, threads_count
|
threads threads_count, threads_count
|
||||||
|
|
||||||
# Specifies the `port` that Puma will listen on to receive requests, default is 3000.
|
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
|
||||||
#
|
#
|
||||||
port ENV.fetch("PORT") { 3000 }
|
port ENV.fetch("PORT") { 3000 }
|
||||||
|
|
||||||
|
@ -32,16 +32,25 @@ environment ENV.fetch("RAILS_ENV") { "development" }
|
||||||
#
|
#
|
||||||
# preload_app!
|
# preload_app!
|
||||||
|
|
||||||
|
# If you are preloading your application and using Active Record, it's
|
||||||
|
# recommended that you close any connections to the database before workers
|
||||||
|
# are forked to prevent connection leakage.
|
||||||
|
#
|
||||||
|
# before_fork do
|
||||||
|
# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
|
||||||
|
# end
|
||||||
|
|
||||||
# The code in the `on_worker_boot` will be called if you are using
|
# The code in the `on_worker_boot` will be called if you are using
|
||||||
# clustered mode by specifying a number of `workers`. After each worker
|
# clustered mode by specifying a number of `workers`. After each worker
|
||||||
# process is booted this block will be run, if you are using `preload_app!`
|
# process is booted, this block will be run. If you are using the `preload_app!`
|
||||||
# option you will want to use this block to reconnect to any threads
|
# option, you will want to use this block to reconnect to any threads
|
||||||
# or connections that may have been created at application boot, Ruby
|
# or connections that may have been created at application boot, as Ruby
|
||||||
# cannot share connections between processes.
|
# cannot share connections between processes.
|
||||||
#
|
#
|
||||||
# on_worker_boot do
|
# on_worker_boot do
|
||||||
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
|
||||||
# end
|
# end
|
||||||
|
#
|
||||||
|
|
||||||
# Allow puma to be restarted by `rails restart` command.
|
# Allow puma to be restarted by `rails restart` command.
|
||||||
plugin :tmp_restart
|
plugin :tmp_restart
|
||||||
|
|
|
@ -99,6 +99,7 @@ Rails.application.routes.draw do
|
||||||
get 'check'
|
get 'check'
|
||||||
get 'delete'
|
get 'delete'
|
||||||
get 'search_contacts'
|
get 'search_contacts'
|
||||||
|
get 'remove_hold'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :domain_transfers, only: %i[new create]
|
resources :domain_transfers, only: %i[new create]
|
||||||
|
@ -127,11 +128,11 @@ Rails.application.routes.draw do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get 'pay/return/:bank' => 'payments#back', as: 'return_payment_with'
|
get 'pay/return/:payment_order' => 'payments#back', as: 'return_payment_with'
|
||||||
post 'pay/return/:bank' => 'payments#back'
|
post 'pay/return/:payment_order' => 'payments#back'
|
||||||
put 'pay/return/:bank' => 'payments#back'
|
put 'pay/return/:payment_order' => 'payments#back'
|
||||||
post 'pay/callback/:bank' => 'payments#callback', as: 'response_payment_with'
|
post 'pay/callback/:payment_order' => 'payments#callback', as: 'response_payment_with'
|
||||||
get 'pay/go/:bank' => 'payments#pay', as: 'payment_with'
|
get 'pay/go/:bank' => 'payments#pay', as: 'payment_with'
|
||||||
|
|
||||||
namespace :settings do
|
namespace :settings do
|
||||||
resource :balance_auto_reload, controller: :balance_auto_reload, only: %i[edit update destroy]
|
resource :balance_auto_reload, controller: :balance_auto_reload, only: %i[edit update destroy]
|
||||||
|
|
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
%w(
|
||||||
|
.ruby-version
|
||||||
|
.rbenv-vars
|
||||||
|
tmp/restart.txt
|
||||||
|
tmp/caching-dev.txt
|
||||||
|
).each { |path| Spring.watch(path) }
|
34
config/storage.yml
Normal file
34
config/storage.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
test:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("tmp/storage") %>
|
||||||
|
|
||||||
|
local:
|
||||||
|
service: Disk
|
||||||
|
root: <%= Rails.root.join("storage") %>
|
||||||
|
|
||||||
|
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||||
|
# amazon:
|
||||||
|
# service: S3
|
||||||
|
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||||
|
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||||
|
# region: us-east-1
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Remember not to checkin your GCS keyfile to a repository
|
||||||
|
# google:
|
||||||
|
# service: GCS
|
||||||
|
# project: your_project
|
||||||
|
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||||
|
# bucket: your_own_bucket
|
||||||
|
|
||||||
|
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||||
|
# microsoft:
|
||||||
|
# service: AzureStorage
|
||||||
|
# storage_account_name: your_account_name
|
||||||
|
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||||
|
# container: your_container_name
|
||||||
|
|
||||||
|
# mirror:
|
||||||
|
# service: Mirror
|
||||||
|
# primary: local
|
||||||
|
# mirrors: [ amazon, google, microsoft ]
|
|
@ -1,16 +1,15 @@
|
||||||
class AddCertCommonName < ActiveRecord::Migration
|
class AddCertCommonName < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Certificate.all.each do |x|
|
# Certificate.all.each do |x|
|
||||||
if x.crt.blank? && x.csr.present?
|
# if x.crt.blank? && x.csr.present?
|
||||||
pc = x.parsed_csr.try(:subject).try(:to_s) || ''
|
# pc = x.parsed_csr.try(:subject).try(:to_s) || ''
|
||||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||||
x.common_name = cn.split('/').first
|
# x.common_name = cn.split('/').first
|
||||||
end
|
# end
|
||||||
x.save
|
# x.save
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
class AddCertMd5 < ActiveRecord::Migration
|
class AddCertMd5 < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Certificate.all.each do |x|
|
# Certificate.all.each do |x|
|
||||||
if x.crt.present? && x.csr.present?
|
# if x.crt.present? && x.csr.present?
|
||||||
x.interface = Certificate::REGISTRAR
|
# x.interface = Certificate::REGISTRAR
|
||||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
# x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||||
|
#
|
||||||
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
# pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||||
x.common_name = cn.split('/').first
|
# x.common_name = cn.split('/').first
|
||||||
elsif x.crt.present? && x.csr.blank?
|
# elsif x.crt.present? && x.csr.blank?
|
||||||
x.interface = Certificate::API
|
# x.interface = Certificate::API
|
||||||
x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
# x.md5 = OpenSSL::Digest::MD5.new(x.parsed_crt.to_der).to_s
|
||||||
|
#
|
||||||
pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
# pc = x.parsed_crt.try(:subject).try(:to_s) || ''
|
||||||
cn = pc.scan(/\/CN=(.+)/).flatten.first
|
# cn = pc.scan(/\/CN=(.+)/).flatten.first
|
||||||
x.common_name = cn.split('/').first
|
# x.common_name = cn.split('/').first
|
||||||
elsif x.crt.blank? && x.csr.present?
|
# elsif x.crt.blank? && x.csr.present?
|
||||||
x.interface = Certificate::REGISTRAR
|
# x.interface = Certificate::REGISTRAR
|
||||||
end
|
# end
|
||||||
x.save
|
# x.save
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
class AddRenewSetting < ActiveRecord::Migration
|
class AddRenewSetting < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Setting.days_to_renew_domain_before_expire = 90
|
# Setting.days_to_renew_domain_before_expire = 90
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
class AddExpireSettings < ActiveRecord::Migration
|
class AddExpireSettings < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Setting.expire_warning_period = 15
|
# Setting.expire_warning_period = 15
|
||||||
Setting.redemption_grace_period = 30
|
# Setting.redemption_grace_period = 30
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
class RefactorDomainStatuses < ActiveRecord::Migration
|
class RefactorDomainStatuses < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Domain.find_each do |x|
|
# Domain.find_each do |x|
|
||||||
statuses = []
|
# statuses = []
|
||||||
x.domain_statuses.each do |ds|
|
# x.domain_statuses.each do |ds|
|
||||||
statuses << ds.value
|
# statuses << ds.value
|
||||||
end
|
# end
|
||||||
x.update_column('statuses', statuses)
|
# x.update_column('statuses', statuses) if x.statuses.blank?
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
class RefactorContactStatuses < ActiveRecord::Migration
|
class RefactorContactStatuses < ActiveRecord::Migration[5.1]
|
||||||
def self.up
|
def self.up
|
||||||
Contact.find_each do |contact|
|
# Contact.find_each do |contact|
|
||||||
statuses = []
|
# statuses = []
|
||||||
contact.depricated_statuses.each do |ds|
|
# contact.depricated_statuses.each do |ds|
|
||||||
statuses << ds.value
|
# statuses << ds.value
|
||||||
end
|
# end
|
||||||
contact.update_column('statuses', statuses)
|
# contact.update_column('statuses', statuses)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
raise ActiveRecord::IrreversibleMigration
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
19
db/data/20200225085234_convert_domain_delete_date.rb
Normal file
19
db/data/20200225085234_convert_domain_delete_date.rb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
class ConvertDomainDeleteDate < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
# processed_domain_count = 0
|
||||||
|
#
|
||||||
|
# Domain.transaction do
|
||||||
|
# Domain.find_each do |domain|
|
||||||
|
# next unless domain.delete_date
|
||||||
|
#
|
||||||
|
# domain.update_columns(delete_date: domain.delete_date + 1.day)
|
||||||
|
# processed_domain_count += 1
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# puts "Domains processed: #{processed_domain_count}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,18 @@
|
||||||
|
class DeleteOrphanedRegistrantVerifications < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
# orphaned_registrant_verifications = RegistrantVerification.where.not(domain_id: Domain.ids)
|
||||||
|
# orphaned_registrant_verification_count = orphaned_registrant_verifications.count
|
||||||
|
# processed_registrant_verification_count = 0
|
||||||
|
#
|
||||||
|
# orphaned_registrant_verifications.each do |registrant_verification|
|
||||||
|
# registrant_verification.destroy!
|
||||||
|
# processed_registrant_verification_count += 1
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# puts "Processed: #{processed_registrant_verification_count} out of" \
|
||||||
|
# " #{orphaned_registrant_verification_count}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,19 @@
|
||||||
|
class RegenerateRegistrarReferenceNumbers < ActiveRecord::Migration[5.1]
|
||||||
|
def up
|
||||||
|
# processed_registrar_count = 0
|
||||||
|
#
|
||||||
|
# Registrar.transaction do
|
||||||
|
# Registrar.all.each do |registrar|
|
||||||
|
# next unless registrar.reference_no.start_with?('RF')
|
||||||
|
#
|
||||||
|
# registrar.update_columns(reference_no: Billing::ReferenceNo.generate)
|
||||||
|
# processed_registrar_count += 1
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
#
|
||||||
|
# puts "Registrars processed: #{processed_registrar_count}"
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
2
db/data_schema.rb
Normal file
2
db/data_schema.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# encoding: UTF-8
|
||||||
|
DataMigrate::Data.define(version: 20150707103801)
|
15
db/migrate/20200130092113_create_payment_orders.rb
Normal file
15
db/migrate/20200130092113_create_payment_orders.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
class CreatePaymentOrders < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
create_table :payment_orders do |t|
|
||||||
|
t.string :type, null: false
|
||||||
|
t.string :status, default: 'issued', null: false
|
||||||
|
t.belongs_to :invoice, foreign_key: true
|
||||||
|
t.jsonb :response, null: true
|
||||||
|
t.string :notes, null: true
|
||||||
|
t.string :creator_str
|
||||||
|
t.string :updator_str
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
16
db/migrate/20200203143458_create_payment_order_versions.rb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
class CreatePaymentOrderVersions < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
create_table :log_payment_orders do |t|
|
||||||
|
t.string :item_type, null: false
|
||||||
|
t.integer :item_id, null: false
|
||||||
|
t.string :event, null: false
|
||||||
|
t.string :whodunnit
|
||||||
|
t.jsonb :object
|
||||||
|
t.jsonb :object_changes
|
||||||
|
t.datetime :created_at
|
||||||
|
t.string :session
|
||||||
|
t.jsonb :children
|
||||||
|
t.string :uuid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue