Skip to content

mglasder/invoice-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invoice Manager

This is a CLI app to manage and process invoices. You can import invoices from pdf files and manage their status via the CLI interface.

To request refunds, the app uses the Gmail API to send out emails. The invoice files the refunds are requested for are attached to the email.

Technologies

The app relies on the following main technologies:

  • Pydantic for data modelling
  • Typer for CLI
  • Pytest for testing
  • Gmail API for sending emails

Simplified Class Structure

classDiagram

class InvoiceCLI

class RefundCLI

class InvoiceRepository {
    <<abstract>>
    +create_invoice()*
    +read_invoice()*
    +update_invoice()*
    +delete_invoice()*
    +list_all()*
}

class InvoiceJsonRepository

class InvoiceMemoryRepository

class InvoiceProcessor {
    -InvoiceRepository repo
    +add_invoice()
    +delete_invoice()
    +pay_invoice()
    +unpay_invoice()
}
class PaymentProcessor {
    -InvoiceRepository repo
}
class RefundProcessor {
    -InvoiceRepository repo
    +request()
    +confirm()
    +decline()
    +complete()
    +rollback()
}

class StatsCalculator {
    -InvoiceRepository repo
    -List<Invoice> invoices
    +List<float> payment_stats
    +List<float> refund_stats
    -calc_total()
    -calc_payment_status()
    -calc_refund_status()
}

class InvoiceLister {
    -InvoiceRepository repo
    -List<Invoice> invoices
    +filter_invoices()
    -filter_payment_status()
    -filter_refund_status()
    -logical_combine()
}

InvoiceCLI *.. RefundCLI

InvoiceCLI *.. InvoiceProcessor
InvoiceCLI *.. InvoiceLister
InvoiceCLI *.. PaymentProcessor
InvoiceCLI *.. StatsCalculator

RefundCLI *.. RefundProcessor

InvoiceRepository <|.. InvoiceJsonRepository : implements
InvoiceRepository <|.. InvoiceMemoryRepository : implements
  
InvoiceProcessor *.. InvoiceRepository 
PaymentProcessor *.. InvoiceRepository
RefundProcessor *.. InvoiceRepository
StatsCalculator *.. InvoiceRepository
InvoiceLister *.. InvoiceRepository
    
Loading

Prerequisites

Modify the config.yaml file to your needs:

  • invoice_directory: the path to the folder on your machine where pdf invoices are stored
  • repo_directory: the path to the folder on your machine, where the invoice repository (the database of the app) should be stored
  • gmail_credentials: the credentials for the Gmail API (see below)
  • the remaining should be self-explanatory

Setup Gmail to be usable by the app and retrieve your credentials: Follow the "Authorize credentials for a desktop application" section in this guide: https://developers.google.com/gmail/api/quickstart/python

Installation

To install the app, clone the repository and run the following commands:

# Create environment using the exported environment file
conda env create -f conda.yml

# Activate environment
conda activate invoices39

# Install python dependencies
poetry install

# Start the CLI and have a look at the documentation
invoice --help

About

A CLI tool for invoice processing and automatic refund requests via Email

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages