PDF ai import (#1006)

Add support to review transactions for AI pdf import
This commit is contained in:
soky srm
2026-02-16 21:11:41 +01:00
committed by GitHub
parent 16aca7812a
commit d79d86d848
6 changed files with 26 additions and 18 deletions

View File

@@ -68,7 +68,7 @@ class PdfImport < Import
end
def extract_transactions
return unless bank_statement?
return unless statement_with_transactions?
provider = Provider::Registry.get_provider(:openai)
raise "AI provider not configured" unless provider
@@ -91,6 +91,10 @@ class PdfImport < Import
document_type == "bank_statement"
end
def statement_with_transactions?
document_type.in?(%w[bank_statement credit_card_statement])
end
def has_extracted_transactions?
extracted_data.present? && extracted_data["transactions"].present?
end
@@ -147,7 +151,7 @@ class PdfImport < Import
end
def publishable?
account.present? && bank_statement? && cleaned? && mappings.all?(&:valid?)
account.present? && statement_with_transactions? && cleaned? && mappings.all?(&:valid?)
end
def column_keys