mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user