From c744a81e4cf321cdfa1c578e2f6bf34a17951d56 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Fri, 16 Oct 2020 14:53:54 +0500 Subject: [PATCH 1/4] Improve invoice processing logging --- Gemfile | 2 +- Gemfile.lock | 4 ++-- lib/tasks/invoices/process_payments.rake | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 25c3eafff..af8ce8ecd 100644 --- a/Gemfile +++ b/Gemfile @@ -71,7 +71,7 @@ gem 'airbrake' gem 'company_register', github: 'internetee/company_register', branch: 'master' gem 'e_invoice', github: 'internetee/e_invoice', branch: :master -gem 'lhv', github: 'internetee/lhv', branch: 'master' +gem 'lhv', github: 'internetee/lhv', branch: '1712-improve-logging-autotopup-fix' gem 'domain_name' gem 'haml', '~> 5.0' gem 'wkhtmltopdf-binary', '~> 0.12.5.1' diff --git a/Gemfile.lock b/Gemfile.lock index 6c94dc56f..8f22a94a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,8 +45,8 @@ GIT GIT remote: https://github.com/internetee/lhv.git - revision: 1825240b3bf8b262418cc6c8ef7ed1aba386dd7d - branch: master + revision: 3f27d87dddd16b7ef9fc6502f048f1a6718750dc + branch: 1712-improve-logging-autotopup-fix specs: lhv (0.1.0) logger diff --git a/lib/tasks/invoices/process_payments.rake b/lib/tasks/invoices/process_payments.rake index 3e02a8838..edf6609b9 100644 --- a/lib/tasks/invoices/process_payments.rake +++ b/lib/tasks/invoices/process_payments.rake @@ -23,6 +23,9 @@ namespace :invoices do end if incoming_transactions.any? + log 'Got incoming transactions' + log incoming_transactions + bank_statement = BankStatement.new(bank_code: Setting.registry_bank_code, iban: Setting.registry_iban) @@ -41,8 +44,15 @@ namespace :invoices do transaction.autobind_invoice end end + else + log 'Got no incoming transactions parsed, aborting' end puts "Transactions processed: #{incoming_transactions.size}" end + + def log(msg) + @log ||= Logger.new(STDOUT) + @log.info(msg) + end end From cac3fa6cb4cb7c1fa7fb0c12fcb0503fdcc263de Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 19 Oct 2020 13:08:16 +0500 Subject: [PATCH 2/4] Renew lhv gem version --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index af8ce8ecd..25c3eafff 100644 --- a/Gemfile +++ b/Gemfile @@ -71,7 +71,7 @@ gem 'airbrake' gem 'company_register', github: 'internetee/company_register', branch: 'master' gem 'e_invoice', github: 'internetee/e_invoice', branch: :master -gem 'lhv', github: 'internetee/lhv', branch: '1712-improve-logging-autotopup-fix' +gem 'lhv', github: 'internetee/lhv', branch: 'master' gem 'domain_name' gem 'haml', '~> 5.0' gem 'wkhtmltopdf-binary', '~> 0.12.5.1' diff --git a/Gemfile.lock b/Gemfile.lock index 8f22a94a1..c628257a2 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -45,8 +45,8 @@ GIT GIT remote: https://github.com/internetee/lhv.git - revision: 3f27d87dddd16b7ef9fc6502f048f1a6718750dc - branch: 1712-improve-logging-autotopup-fix + revision: 1fb07818369425510a0172ad53bc86e85b6f83cc + branch: master specs: lhv (0.1.0) logger From 3b46367dbcdb5ed694b38a5a8a9613bdd039f750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20V=C3=B5hmar?= Date: Mon, 19 Oct 2020 13:46:04 +0300 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index af19f4ad6..2ef45bf81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +19.10.2020 +* Improved logging for LHV-connect messages [#1712](https://github.com/internetee/registry/issues/1712) +* LHV-connect gem update to handle blank descriptions [#1714](https://github.com/internetee/registry/issues/1714) + 16.10.2020 * Improved error handling for registrant API comapnies endpoint [#1713](https://github.com/internetee/registry/pull/1713) From f58659041d148370e2bc2b12acbcec849e8a04b0 Mon Sep 17 00:00:00 2001 From: Alex Sherman Date: Mon, 19 Oct 2020 17:43:49 +0500 Subject: [PATCH 4/4] Fix company contacts stub --- .../registrant_api_companies_test.rb | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/test/integration/api/registrant/registrant_api_companies_test.rb b/test/integration/api/registrant/registrant_api_companies_test.rb index 97e2fd3c2..4f23aeac1 100644 --- a/test/integration/api/registrant/registrant_api_companies_test.rb +++ b/test/integration/api/registrant/registrant_api_companies_test.rb @@ -34,18 +34,6 @@ class RegistrantApiCompaniesTest < ApplicationIntegrationTest assert_equal(:companies, response_json.keys.first) end - def test_status_if_nil_result - contacts(:john).update!(ident: '12344321', ident_type: 'priv', ident_country_code: 'US') - - CompanyRegister.const_set(:Client, CompanyRegisterClientZeroStub) - - get '/api/v1/registrant/companies', headers: @auth_headers - response_json = JSON.parse(response.body, symbolize_names: true) - assert_equal(1, response_json.count) - assert_equal(200, response.status) - assert_equal(:companies, response_json.keys.first) - end - private def auth_token @@ -54,12 +42,3 @@ class RegistrantApiCompaniesTest < ApplicationIntegrationTest "Bearer #{hash[:access_token]}" end end - -class CompanyRegisterClientZeroStub - Company = Struct.new(:registration_number, :company_name) - - def representation_rights(citizen_personal_code:, citizen_country_code:) - [] - end -end -