Skip to content

Commit

Permalink
Update Ruby and Rails versions, refactor LHV payment processing
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
OlegPhenomenon committed Nov 26, 2024
1 parent 6154d4c commit 26bfe80
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,6 @@ vendor/gems
/public/assets
/public/packs
/public/packs-test
/public/assets/
/public/assets/

.DS_Store
33 changes: 27 additions & 6 deletions app/jobs/payment_lhv_connect_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 26bfe80

Please sign in to comment.