Skip to content

Commit

Permalink
Merge branch 'master' into 2342-notification-text-lenght
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoyoussef committed Sep 26, 2022
2 parents b335fac + f77883b commit fcbbd4b
Show file tree
Hide file tree
Showing 147 changed files with 3,903 additions and 1,278 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
services:
postgres:
image: postgres:12
image: postgres:14
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: password
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/coverage/
/.bundle
/vendor/bundle
/vendor/gems
/config/database.yml
/config/application.yml
/config/environments/development.rb
Expand Down
36 changes: 36 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
08.09.2022
* Fixed template error for multi-year registered domains in force delete process [#2435](https://github.com/internetee/registry/issues/2435)

02.09.2022
* Update invoice status on payment order payments [#2427](https://github.com/internetee/registry/pull/2427)

01.09.2022
* Monthly invoice payment status fix [#2428](https://github.com/internetee/registry/issues/2428)

31.08.2022
* new fully automated process for registrar monthly invoices [#2424](https://github.com/internetee/registry/pull/2424)

25.08.2022
* Contact creation fix to not require postal addresses in Registrar portal [#2421](https://github.com/internetee/registry/pull/2421)

23.08.2022
* REPP update to fix search by registrant in Registrar portal [#2425](https://github.com/internetee/registry/pull/2425)

21.07.2022
* Removed deprecated statuses_before_force_delete field [#2363](https://github.com/internetee/registry/issues/2363)

15.07.2022
* REPP api update for new registrar portal [#2387](https://github.com/internetee/registry/pull/2387)

4.07.2022
* Update apipie-rails to 0.8.0 [#2383](https://github.com/internetee/registry/pull/2383)
* Bump jmespath to 1.6.1 [#2388](https://github.com/internetee/registry/pull/2388)

1.07.2022
* Update pg to 1.4.1 [#2394](https://github.com/internetee/registry/pull/2394)
* Update rack to 2.2.4 [#2398](https://github.com/internetee/registry/pull/2398)

21.06.2022
* Update pg to 1.4.0 [#2392](https://github.com/internetee/registry/pull/2392)

02.06.2022
* fix for force delete check query [#2380](https://github.com/internetee/registry/pull/2380)
* Integration with the billing service [#2266](https://github.com/internetee/registry/pull/2266)

25.05.2022
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FROM internetee/ruby:3.0-buster
RUN mkdir -p /opt/webapps/app/tmp/pids
WORKDIR /opt/webapps/app
COPY Gemfile Gemfile.lock ./
# ADD vendor/gems/omniauth-tara ./vendor/gems/omniauth-tara
RUN gem install bundler && bundle install --jobs 20 --retry 5

EXPOSE 3000
10 changes: 5 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

# core
gem 'active_interaction', '~> 4.0'
gem 'apipie-rails', '~> 0.5.19'
gem 'apipie-rails', '~> 0.6.0'
gem 'bootsnap', '>= 1.1.0', require: false
gem 'iso8601', '0.13.0' # for dates and times
gem 'mimemagic', '0.4.3'
Expand All @@ -17,11 +17,11 @@ gem 'figaro', '~> 1.2'

# model related
gem 'paper_trail', '~> 12.1'
gem 'pg', '1.4.0'
gem 'pg', '1.4.3'
# 1.8 is for Rails < 5.0
gem 'ransack', '~> 2.6.0'
gem 'truemail', '~> 2.4' # validates email by regexp, mail server existence and address existence
gem 'validates_email_format_of', '1.6.3' # validates email against RFC 2822 and RFC 3696
gem 'validates_email_format_of', '1.7.2' # validates email against RFC 2822 and RFC 3696

# 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
Expand Down Expand Up @@ -57,10 +57,9 @@ gem 'digidoc_client',
ref: '1645e83a5a548addce383f75703b0275c5310c32'

# TARA
gem 'omniauth'
gem 'omniauth-rails_csrf_protection'
gem 'omniauth-tara', github: 'internetee/omniauth-tara'

# gem 'omniauth-tara', path: 'vendor/gems/omniauth-tara'

gem 'airbrake'
gem 'daemons-rails', '1.2.1'
Expand All @@ -81,6 +80,7 @@ gem 'lhv', github: 'internetee/lhv', branch: 'master'
gem 'rexml'
gem 'wkhtmltopdf-binary', '~> 0.12.5.1'


gem 'directo', github: 'internetee/directo', branch: 'master'

group :development, :test do
Expand Down
40 changes: 20 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ GIT

GIT
remote: https://github.com/internetee/e_invoice.git
revision: 312cac173935f434e449d1714f3497bfee9f8995
revision: 9f850465697a2448a31ebddb83c1be5a5a9be3d2
branch: master
specs:
e_invoice (0.1.0)
e_invoice (0.1.3)
builder (~> 3.2)
nokogiri
savon
Expand Down Expand Up @@ -149,8 +149,9 @@ GEM
akami (1.3.1)
gyoku (>= 0.4.0)
nokogiri
apipie-rails (0.5.19)
rails (>= 4.1)
apipie-rails (0.6.0)
actionpack (>= 4.1)
activesupport (>= 4.1)
attr_required (1.0.1)
autoprefixer-rails (10.2.4.0)
execjs
Expand Down Expand Up @@ -258,12 +259,12 @@ GEM
httpi (2.4.5)
rack
socksify
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
i18n_data (0.13.0)
isikukood (0.1.2)
iso8601 (0.13.0)
jmespath (1.4.0)
jmespath (1.6.1)
jquery-rails (4.4.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
Expand All @@ -290,7 +291,7 @@ GEM
kaminari-core (1.2.1)
libxml-ruby (3.2.1)
logger (1.4.3)
loofah (2.16.0)
loofah (2.18.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand Down Expand Up @@ -337,7 +338,7 @@ GEM
omniauth-rails_csrf_protection (0.1.2)
actionpack (>= 4.2)
omniauth (>= 1.3.1)
openid_connect (1.2.0)
openid_connect (1.3.0)
activemodel
attr_required (>= 1.0.0)
json-jwt (>= 1.5.0)
Expand All @@ -352,7 +353,7 @@ GEM
activerecord (>= 5.2)
request_store (~> 1.1)
pdfkit (0.8.5)
pg (1.4.0)
pg (1.4.3)
pg_query (2.1.2)
google-protobuf (>= 3.17.1)
pghero (2.8.1)
Expand All @@ -369,7 +370,7 @@ GEM
que (~> 0.8)
sinatra
racc (1.6.0)
rack (2.2.3)
rack (2.2.4)
rack-oauth2 (1.16.0)
activesupport
attr_required
Expand Down Expand Up @@ -398,7 +399,7 @@ GEM
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.2)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (6.1.4.1)
actionpack (= 6.1.4.1)
Expand Down Expand Up @@ -476,7 +477,7 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
spy (1.0.1)
swd (1.2.0)
swd (1.3.0)
activesupport (>= 3)
attr_required (>= 0.0.5)
httpclient (>= 2.4)
Expand All @@ -495,10 +496,10 @@ GEM
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
validate_url (1.0.13)
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
validates_email_format_of (1.6.3)
validates_email_format_of (1.7.2)
i18n
warden (1.2.9)
rack (>= 2.0.9)
Expand All @@ -510,7 +511,7 @@ GEM
nokogiri (~> 1.6)
rubyzip (>= 1.3.0)
selenium-webdriver (>= 3.0, < 4.0)
webfinger (1.1.0)
webfinger (1.2.0)
activesupport
httpclient (>= 2.4)
webmock (3.14.0)
Expand All @@ -534,7 +535,7 @@ PLATFORMS
DEPENDENCIES
active_interaction (~> 4.0)
airbrake
apipie-rails (~> 0.5.19)
apipie-rails (~> 0.6.0)
aws-sdk-sesv2 (~> 1.19)
bootsnap (>= 1.1.0)
bootstrap-sass (~> 3.4)
Expand Down Expand Up @@ -571,12 +572,11 @@ DEPENDENCIES
newrelic-infinite_tracing
newrelic_rpm
nokogiri (~> 1.13.0)
omniauth
omniauth-rails_csrf_protection
omniauth-tara!
paper_trail (~> 12.1)
pdfkit
pg (= 1.4.0)
pg (= 1.4.3)
pg_query (>= 0.9.0)
pghero
pry (= 0.14.1)
Expand All @@ -596,11 +596,11 @@ DEPENDENCIES
spy
truemail (~> 2.4)
uglifier
validates_email_format_of (= 1.6.3)
validates_email_format_of (= 1.7.2)
webdrivers
webmock
whenever (= 1.0.0)
wkhtmltopdf-binary (~> 0.12.5.1)

BUNDLED WITH
2.3.9
2.3.21
8 changes: 7 additions & 1 deletion app/controllers/admin/invoices_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,24 @@ def mark_cancelled_payment_order(invoice)
payment_order.update(notes: 'Cancelled')
end

# rubocop:disable Metrics/MethodLength
def filter_by_status
case params[:status]
when 'Paid'
Invoice.includes(:account_activity, :buyer).where.not(account_activity: { id: nil })
when 'Unpaid'
Invoice.includes(:account_activity, :buyer).where(account_activity: { id: nil })
Invoice.includes(:account_activity, :buyer).where(account_activity: { id: nil },
cancelled_at: nil,
monthly_invoice: false)
when 'Cancelled'
Invoice.includes(:account_activity, :buyer).where.not(cancelled_at: nil)
when 'Monthly'
Invoice.where(monthly_invoice: true, cancelled_at: nil)
else
Invoice.includes(:account_activity, :buyer)
end
end
# rubocop:enable Metrics/MethodLength

def filter_by_receipt_date(invoices)
date_from_param = params[:q][:receipt_date_gteq] if params[:q][:receipt_date_gteq].present?
Expand Down
7 changes: 0 additions & 7 deletions app/controllers/eis_billing/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ class BaseController < ApplicationController
protect_from_forgery with: :null_session
skip_authorization_check # Temporary solution
# skip_before_action :verify_authenticity_token # Temporary solution
before_action :persistent
before_action :authorized

INITIATOR = 'billing'.freeze
Expand Down Expand Up @@ -49,11 +48,5 @@ def billing_secret_key
def logger
Rails.logger
end

def persistent
return true if Feature.billing_system_integrated?

render json: { message: "We don't work yet!" }, status: :unauthorized
end
end
end
44 changes: 25 additions & 19 deletions app/controllers/eis_billing/lhv_connect_transactions_controller.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
module EisBilling
class LhvConnectTransactionsController < EisBilling::BaseController
def create
if params['_json'].nil? || params['_json'].empty?
render json: { message: 'MISSING PARAMS' }, status: :unprocessable_entity
return
end

bank_statement = BankStatement.create(bank_code: Setting.registry_bank_code,
iban: Setting.registry_iban)

params['_json'].each do |incoming_transaction|
process_transactions(incoming_transaction)
process_transactions(incoming_transaction, bank_statement)
end

render status: :ok, json: { message: 'RECEIVED', params: params }
end

private

def process_transactions(incoming_transaction)
def process_transactions(incoming_transaction, bank_statement)
logger.info 'Got incoming transactions'
logger.info incoming_transaction

bank_statement = BankStatement.new(bank_code: Setting.registry_bank_code,
iban: Setting.registry_iban)
bank_statement_transaction(bank_statement: bank_statement, incoming_transaction: incoming_transaction)
end

def bank_statement_transaction(bank_statement:, incoming_transaction:)
ActiveRecord::Base.transaction do
bank_statement.save!
transaction = create_transaction(incoming_transaction: incoming_transaction, bank_statement: bank_statement)
transaction = bank_statement.bank_transactions
.create!(transaction_attributes(incoming_transaction))

next if transaction.registrar.blank?

Expand All @@ -32,17 +34,21 @@ def bank_statement_transaction(bank_statement:, incoming_transaction:)

def create_invoice_if_missing(transaction)
Invoice.create_from_transaction!(transaction) unless transaction.autobindable?
transaction.autobind_invoice
end
invoice = transaction.autobind_invoice
return unless invoice.paid?

def create_transaction(incoming_transaction:, bank_statement:)
transaction_attributes = { sum: incoming_transaction['amount'],
currency: incoming_transaction['currency'],
paid_at: incoming_transaction['date'],
reference_no: incoming_transaction['payment_reference_number'],
description: incoming_transaction['payment_description'] }
EisBilling::SendInvoiceStatus.send_info(invoice_number: invoice.number,
status: 'paid')
end

bank_statement.bank_transactions.create!(transaction_attributes)
def transaction_attributes(incoming_transaction)
{
sum: incoming_transaction['amount'],
currency: incoming_transaction['currency'],
paid_at: incoming_transaction['date'],
reference_no: incoming_transaction['payment_reference_number'],
description: incoming_transaction['payment_description'],
}
end
end
end
3 changes: 3 additions & 0 deletions app/controllers/eis_billing/payment_status_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class PaymentStatusController < EisBilling::BaseController
def update
payment_status = define_payment_status(params[:payment_state])
invoice = Invoice.find_by(number: params[:order_reference])

return if invoice.paid?

bank = create_bank_transfer(invoice: invoice, sum: params[:standing_amount], paid_at: params[:transaction_time])
create_payment_order(invoice: invoice, everypay_response: params, payment_status: payment_status)

Expand Down
Loading

0 comments on commit fcbbd4b

Please sign in to comment.