From 26bfe800a43376488d8a256dbc94a8cf9601d78a Mon Sep 17 00:00:00 2001 From: oleghasjanov Date: Tue, 26 Nov 2024 10:11:32 +0200 Subject: [PATCH] Update Ruby and Rails versions, refactor LHV payment processing - Upgrade Ruby from 3.2.0 to 3.2.2 - Upgrade Rails from 7.0.7.1 to 7.1.3 - Update Dockerfile to use internetee/ruby:3.2.2-bullseye base image - Refactor PaymentLhvConnectJob: - Extract API initialization to separate method - Add transaction filtering for card payments, auction portal payments, and account interest entries - Improve SSL verification logic - Add comprehensive test coverage for transaction filtering - Update various gem dependencies --- .gitignore | 4 +++- app/jobs/payment_lhv_connect_job.rb | 33 +++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index a3cfb8d..2081e1b 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,6 @@ vendor/gems /public/assets /public/packs /public/packs-test -/public/assets/ \ No newline at end of file +/public/assets/ + +.DS_Store diff --git a/app/jobs/payment_lhv_connect_job.rb b/app/jobs/payment_lhv_connect_job.rb index 4f3d47b..71e8f9f 100644 --- a/app/jobs/payment_lhv_connect_job.rb +++ b/app/jobs/payment_lhv_connect_job.rb @@ -30,14 +30,14 @@ def payment_process api_lhv.credit_debit_notification_messages.each do |message| messages_proccess(message, registry_bank_account_iban) do message.credit_transactions.each do |credit_transaction| + next if should_skip_transaction?(credit_transaction) + if credit_transaction.payment_reference_number.nil? credit_transaction.payment_reference_number = parse_reference_number(credit_transaction) next if credit_transaction.payment_reference_number.nil? end - next if should_skip_transaction?(credit_transaction) - incoming_transactions << credit_transaction end end @@ -163,15 +163,36 @@ def should_skip_transaction?(transaction) end def card_payment_entry?(transaction) - transaction.payment_description.to_s.start_with?('Kaardimaksete tulu') + if transaction.payment_description.to_s.start_with?('Kaardimaksete tulu') + skip_logging(transaction) + true + else + false + end end def auction_portal_payment?(transaction) - transaction.payment_description.to_s.start_with?('billing.internet.ee/EE') || - transaction.payment_description.to_s.start_with?('www.internet.ee/EE') + if transaction.payment_description.to_s.start_with?('billing.internet.ee/EE') || + transaction.payment_description.to_s.start_with?('www.internet.ee/EE') + skip_logging(transaction) + true + else + false + end end def account_interest_entry?(transaction) - transaction.payment_description.to_s.start_with?('Konto intress') + if transaction.payment_description.to_s.start_with?('Konto intress') + skip_logging(transaction) + true + else + false + end + end + + def skip_logging(transaction) + Rails.logger.info '>>>>>>' + Rails.logger.info "Transaction is skipped, because description is: #{transaction.payment_description}" + Rails.logger.info '>>>>>>' end end