mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
PDF ai import (#1006)
Add support to review transactions for AI pdf import
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user