API

The extension exposes a simple API for advanced users or developers.

Modules

class fava_tax_payment.TaxPaymentExtension(*args, **kwargs)[source]

Bases: FavaExtensionBase

A Fava extension for generating tax payment PDFs and managing tax configurations.

report_title: str | None = 'Tax Payment PDFs'

Name for a HTML report for this extension.

has_js_module: bool = True

Whether this extension includes a Javascript module.

get_expense_accounts()[source]

Get a list of expense accounts from the ledger.

Returns:

A list of expense accounts.

Return type:

list

save_config()[source]

Save the updated tax configuration to the local configuration file.

Returns:

JSON response indicating success or failure.

generate_tax_pdfs()[source]

Generate tax payment PDFs based on the ledger transactions.

Returns:

JSON response with the list of generated files or an error message.

fill_pdf_form(output_path, data)[source]

Fill a PDF form with the provided data.

Parameters:
  • output_path (str) – The path to save the filled PDF.

  • data (dict) – The data to populate the PDF form.

Endpoints

  • GET /extension/TaxPaymentExtension/: Displays the configuration and generation UI.

  • POST /extension/TaxPaymentExtension/generate_tax_pdfs: Generates PDFs for tagged transactions.

  • POST /extension/TaxPaymentExtension/save_config: Saves the configuration JSON.

Example Request

curl -X POST -H "Content-Type: application/json" \
     -d '{"payer": {"name": "John Doe"}}' \
     http://localhost:5000/extension/TaxPaymentExtension/save_config

Development

The extension is built with Flask and integrates with Fava’s extension system. Contributions are welcome — see the GitHub repo for details.