feat: process pending transactions from lunchflow (#731)

* feat(config): add Lunchflow runtime configuration flags

* feat(api): add include_pending parameter to Lunchflow API

* feat(processor): add pending metadata support to Lunchflow processor

* feat(processor): generate temporary IDs for pending transactions

* feat(importer): integrate pending transaction support in sync

* fix(importer): improve deduplication for transactions without IDs

* feat(model): add Lunchflow pending support to Transaction scopes

* test: add Lunchflow processor pending metadata tests

* docs: update AGENTS.md for Lunchflow pending support

* chore: remove unused variable

* fix: simplify key check

* fix: dotenv-linter key order

* fix: avoid collapsing distinct pending transactions

* fix: prevent unbounded raw payload growth for blank IDs
This commit is contained in:
AdamWHY2K
2026-01-22 23:53:24 +00:00
committed by GitHub
parent 2c827fbc88
commit 3f5fff27ea
12 changed files with 587 additions and 15 deletions

View File

@@ -35,6 +35,7 @@ class Transaction < ApplicationRecord
where(<<~SQL.squish)
(transactions.extra -> 'simplefin' ->> 'pending')::boolean = true
OR (transactions.extra -> 'plaid' ->> 'pending')::boolean = true
OR (transactions.extra -> 'lunchflow' ->> 'pending')::boolean = true
SQL
}
@@ -42,6 +43,7 @@ class Transaction < ApplicationRecord
where(<<~SQL.squish)
(transactions.extra -> 'simplefin' ->> 'pending')::boolean IS DISTINCT FROM true
AND (transactions.extra -> 'plaid' ->> 'pending')::boolean IS DISTINCT FROM true
AND (transactions.extra -> 'lunchflow' ->> 'pending')::boolean IS DISTINCT FROM true
SQL
}
@@ -63,7 +65,8 @@ class Transaction < ApplicationRecord
def pending?
extra_data = extra.is_a?(Hash) ? extra : {}
ActiveModel::Type::Boolean.new.cast(extra_data.dig("simplefin", "pending")) ||
ActiveModel::Type::Boolean.new.cast(extra_data.dig("plaid", "pending"))
ActiveModel::Type::Boolean.new.cast(extra_data.dig("plaid", "pending")) ||
ActiveModel::Type::Boolean.new.cast(extra_data.dig("lunchflow", "pending"))
rescue
false
end