billing frontend for mariadb. setup as otb_billing for outsidethebox.top accounting. also involved with outsidethedb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

15 KiB

v3.0.2 edit invoice Save and Send - 2026-06-01 UTC

  • Added a second button on the admin Edit Invoice page: “Save and Send”.
  • “Save Invoice” keeps the existing save-only behavior.
  • “Save and Send” saves the invoice first, then reuses the existing invoice email workflow.
  • The email workflow continues to generate and attach the invoice PDF.
  • Successful sends redirect back to the invoice view with email_sent=1.
  • Failed sends redirect back to the invoice view with email_failed=1.
  • Works with the v3.0.1 multi-line invoice edit workflow.

Verified:

  • Save Invoice still saves without sending.
  • Save and Send saves the invoice and sends the client invoice email.

v3.0.1 multi-line invoice edit safety - 2026-06-01 UTC

  • Updated admin invoice edit workflow to preserve multi-line invoice items.
  • Edit Invoice now loads existing invoice_items rows instead of treating the invoice as one total/notes row.
  • Save Invoice now recalculates subtotal from edited line items.
  • Save Invoice now preserves separate subtotal_amount, tax_amount, and total_amount fields.
  • Save Invoice now recreates invoice_items from submitted line rows without flattening the invoice into one line.
  • Added editable Tax / HST field plus a “Set 13% HST” helper button.
  • Locked invoices with payment activity still protect core accounting fields and line items.
  • This prevents converted invoices such as INV-0041 from being accidentally collapsed if opened and saved.

v3.0.0 selected portal invoice downloads - 2026-05-29 UTC

  • Added invoice selection checkboxes to the client portal dashboard.
  • Added a select-all checkbox in the portal invoice table header.
  • Converted portal invoice ZIP download from all-only GET behavior to GET/POST behavior.
  • Clicking “Download All Invoices” with no invoices selected still downloads all portal invoices.
  • Clicking “Download All Invoices” with checked invoices downloads only the selected invoices.
  • Selected downloads use selected_invoices.zip; full downloads continue using all_invoices.zip.
  • Auto-refresh now pauses when one or more invoice checkboxes are selected so the page does not reload during selection.
  • Existing portal invoice authorization is preserved: downloads are restricted to the logged-in client’s own invoices.

Verified:

  • No selected invoices downloads all invoices.
  • Selected invoices download only those invoice PDFs.
  • Header checkbox selects/deselects visible invoices.

v2.0.9 portal account-credit payments - 2026-05-29 UTC

  • Added portal “Use available credit” payment option for unpaid CAD invoices.
  • Added /portal/invoice/<invoice_id>/apply-credit route.
  • Added first-class credit value to payments.payment_method.
  • Applying credit now writes a confirmed payments row with payment_method='credit'.
  • Applying credit now writes a matching credit_ledger debit using entry_type='invoice_deduction'.
  • Invoice totals/status are recalculated through the existing recalc_invoice_totals() workflow.
  • Portal invoice detail now shows credit success/error messages.
  • Portal payment history and admin invoice payment history now show Credit payments.
  • Added SQL migration record: sql/migrations/20260529_v2_0_9_credit_payment_method.sql.

Verified:

  • INV-0045 / invoice id 52 was paid using $11.30 CAD account credit.
  • Credit ledger balance dropped from $25.00 CAD to $13.70 CAD.

v2.0.8 multi-line invoice creation - 2026-05-29 UTC

  • Added multi-line invoice item creation on the admin Create Invoice page.
  • Added “+ Add Line” support with per-line description, quantity, unit cost, and HST checkbox.
  • Invoice subtotal is now calculated from the sum of all line totals.
  • HST is calculated from taxable lines only.
  • Invoice creation now inserts one invoice_items row per invoice line.
  • Admin invoice view now displays all invoice line items with quantity, unit cost, and amount.
  • Invoice PDFs now render all invoice line items instead of only the invoice-level notes field.
  • Existing single-line invoices remain compatible.
  • Fixed Create Invoice table header/input styling for dark theme readability.

v2.0.7 PDF invoice description wrapping - 2026-05-29 UTC

  • Fixed invoice PDFs so long invoice descriptions wrap across multiple lines instead of being truncated.
  • Updated PDF invoice item line to show subtotal/line amount instead of tax-included total.
  • PDF totals now show HST only when tax exists.
  • Portal Download All Invoices now creates client-copy PDFs without the optional invoice footer block.
  • Kept admin/portal HTML invoice views unchanged.

v2.0.6 health revenue dashboard - 2026-05-29 UTC

  • Added Square / Revenue Health panel to /health.
  • Added confirmed payment totals for today, this month, and this year.
  • Added all-confirmed payment totals alongside Square-only totals.
  • Added latest confirmed payment summary.
  • Added Receivables Aging panel showing unpaid invoice totals and aging buckets.
  • Added matching revenue and receivables data to /health.json.
  • Cleaned health labels from Operations Bal / Treasury Bal to Operations Balance / Treasury Balance.

v2.0.5 final invoice workflow - 2026-05-29 UTC

  • Create Invoice now supports a real invoice line description, quantity, unit cost, and optional 13% HST checkbox.
  • Invoice subtotal is calculated as quantity × unit cost.
  • Tax is calculated server-side only when Apply 13% HST is checked.
  • Invoice totals now store subtotal_amount, tax_amount, and total_amount correctly.
  • Portal invoice detail now displays Subtotal, HST 13% when applicable, Total Amount, Paid, and Outstanding.
  • Invoice item descriptions support long invoice text through invoice_items.description as TEXT.
  • Existing invoices are preserved.

v2.0.5 portal invoice summary fix - 2026-05-29 UTC

  • Portal invoice detail now selects subtotal_amount and tax_amount from invoices.
  • Portal invoice summary now displays Subtotal, HST 13% when tax exists, Total Amount, Paid, and Outstanding correctly.
  • Reconciliation refresh path also preserves formatted subtotal and tax values.

v2.0.5 follow-up - 2026-05-29 UTC

  • Added Qty to Create Invoice.
  • Unit Cost now combines with Qty to calculate invoice line subtotal.
  • Portal invoice detail now shows invoice subtotal, HST 13% when present, total amount, paid, and outstanding under the invoice items table.

v2.0.5 - 2026-05-29 UTC

  • Updated Create Invoice flow to use Cost / Subtotal plus optional 13% HST checkbox.
  • Final Total Amount is now calculated from subtotal + tax server-side.
  • Invoice line description is entered as a proper multi-line description and stored in invoice_items.
  • Invoice view/print output now shows line amount as subtotal and hides the tax row when tax is zero.
  • Preserves existing invoices and uses existing subtotal_amount, tax_amount, and total_amount columns.

v2.0.2 - 2026-05-24 19:40 UTC

  • Added Square / Revenue Health panel to /health before crypto balance panels.
  • Revenue panel now uses confirmed rows from the payments table, not invoice guesses.
  • Shows Square confirmed payment count + CAD total for today, this month, and this year.
  • Shows all confirmed payment count + CAD total for today, this month, and this year.
  • Added Receivables Aging panel with current, 1-30, 31-60, 61-90, and 90+ day unpaid buckets.
  • Renamed health cards from Operations Bal / Treasury Bal to Operations Balance / Treasury Balance.

PROJECT_STATE - OTB Billing

v2.0.1 - 2026-05-18

Current state:

  • Current version: v2.0.1.
  • /health Crypto Reconcile card remains compact and in the normal health grid.
  • Reconcile Now button starts the existing crypto reconciliation worker.
  • Manual reconcile feedback is now shown only as a temporary bottom-right toast.
  • No persistent manual reconcile status text is rendered inside the Crypto Reconcile card.
  • Toast feedback auto-hides after 3 seconds and removes the reconcile query string from the URL.
  • Previous v2.0.0 functionality remains:
    • Operations Bal and Treasury Bal cards
    • clickable explorer links for payment assets
    • Crypto Reconcile timer/service status
    • Last Run and Last Result fields
    • pending / confirmed today / stale pending stats

PROJECT_STATE - OTB Billing

v2.0.0 - 2026-05-18

Current state:

  • OTB Billing is running on outsidethedb.
  • Service: otb_billing.service.
  • App port: 5050.
  • Project path: /home/def/otb_billing.
  • Current version: v2.0.0.
  • /health renders the standard health grid with Status, Database, Uptime, Load Average, Memory, Disk, Operations Bal, Treasury Bal, and Crypto Reconcile.
  • Operations Bal wallet: 0x44f6c44C42e6ae0392E7289F032384C0d37F56D5.
  • Treasury Bal wallet: 0xbe1fdc8c69f712d62cfcd3bf23f636de1dbd213f.
  • Wallet coin names are clickable explorer links:
    • USDC uses Arbiscan
    • ETH uses Etherscan
    • ETHO uses explorer.ethoprotocol.com
    • EGAZ and ETI use explorer.etica-stats.org
  • Crypto Reconcile card shows:
    • timer status
    • service status
    • last run timestamp
    • last result
    • pending payment count
    • confirmed today count
    • stale pending count
    • Reconcile Now button
  • Crypto reconciliation worker:
    • Timer: otb-billing-crypto-reconcile.timer
    • Service: otb-billing-crypto-reconcile.service
    • Script: /home/def/otb_billing/scripts/crypto_reconciliation_worker.py
    • Timer cadence: every 15 minutes
  • The reconcile service is one-shot; inactive between runs is normal when the timer is active.

PROJECT_STATE - OTB Billing

v1.4.0 - 2026-05-18

Current state:

  • OTB Billing is running on outsidethedb.
  • Service: otb_billing.service.
  • App port: 5050.
  • Project path: /home/def/otb_billing.
  • /health renders the standard health grid with:
    • Status
    • Database
    • Uptime
    • Load Average
    • Memory
    • Disk
    • Operations Bal
    • Treasury Bal
    • Crypto Reconcile
  • Operations Bal and Treasury Bal show USDC, ETH, ETHO, EGAZ, and ETI balances.
  • Coin names in balance cards are clickable and open the relevant explorer address page:
    • Arbiscan for Arbitrum USDC
    • Etherscan for Ethereum ETH
    • explorer.ethoprotocol.com for ETHO
    • explorer.etica-stats.org for EGAZ/ETI
  • Crypto Reconcile card shows timer/service state plus payment queue stats.
  • Reconcile Now button on /health manually starts the existing crypto reconciliation worker.
  • Crypto reconcile worker remains timer-driven by otb-billing-crypto-reconcile.timer every 15 minutes.
  • otb-billing-crypto-reconcile.service is a one-shot service; inactive between timer runs is normal.
  • Current version: v1.4.0.

PROJECT_STATE - OTB Billing

v1.3.0 - 2026-05-17

Current state:

  • OTB Billing health page is working at /health.
  • /health.json is working.
  • Health page now includes:
    • Operations Bal card for 0x44f6c44C42e6ae0392E7289F032384C0d37F56D5
    • Treasury Bal card for 0xbe1fdc8c69f712d62cfcd3bf23f636de1dbd213f
  • Both cards report payment-asset balances for USDC, ETH, ETHO, EGAZ, and ETI.
  • Existing wallet_balances JSON key remains as a backward-compatible alias for operations_balances.
  • Service name: otb_billing.service
  • Runtime host: outsidethedb
  • App port: 5050
  • Project path: /home/def/otb_billing

Recent verification:

  • /health renders the new Operations Bal and Treasury Bal cards.
  • ETHO, EGAZ, and ETI balances resolve through existing project RPCs.
  • Arbitrum USDC and Ethereum ETH rows now use fallback-capable RPC helpers.
  • OTB Operations wallet alias has been added in both Etica and ETHO Blockscout explorers.

v0.6.2 - Service Templates Stabilization

  • Verified template CRUD working
  • Verified template autofill working in service forms
  • Cleaned repo tracking (logs + temp scripts removed)

Status: STABLE Next: Add template_id to services for linkage + billing automation

v0.6.1 - Service Templates Phase 1

  • Added service_templates table
  • Implemented admin CRUD routes in app.py
  • Added templates UI pages
  • Integrated template selection into services/new and services/edit
  • Auto-fill JS implemented for template selection

Status: FUNCTIONAL Next: link templates to services + invoice integration


Project State Update - v0.6.0

Updated: 2026-04-11 01:49:22 UTC

Current Version

v0.6.0

Current Status

OTB Billing is now a service-launch platform, not just billing.

Completed This Session

  • Added /portal/services page
  • Added portal_services.py route module
  • Created portal_base.html shared template
  • Converted dashboard + services page to shared layout
  • Restored consistent branding, nav, footer, toggle
  • Added service cards (Follow-me, Video, Miner)
  • Fixed external service routing
  • Enabled new-tab launch for services

Architecture

Using shared base template: templates/portal_base.html

All pages now: {% extends "portal_base.html" %}

Next Steps

  • Unify client identity across all routes
  • Add Follow-me provisioning + billing linkage
  • Move inline CSS into shared styles later

v0.5.3 - 2026-03-27 21:25:28

  • OTB Billing crypto payment flow is now stable end-to-end.
  • Stale pending payment attempts no longer trap the invoice after quote expiry.
  • Wallet flow, auto-retry email behavior, and portal invoice UX validated.
  • Payment selector dropdown styling corrected for dark theme.
  • Project is in a clean state for continued production hardening.

Project: OTB Billing Version: v0.4.3 Last Updated: 2026-03-13 Status: Portal lifecycle complete

Current capabilities:

  • Admin can enable/disable portal access
  • Admin can generate/reset one-time access codes
  • Admin can send portal invite email
  • Admin can send portal password reset email

Client portal features:

  • First login via single-use access code
  • Forced password creation
  • Email + password authentication after setup
  • Invoice dashboard
  • Invoice detail page
  • Secure invoice PDF downloads

Infrastructure:

  • Flask backend running via systemd
  • MariaDB backend
  • SMTP email integration
  • Portal domain: portal.outsidethebox.top
  • Billing admin: otb-billing.outsidethebox.top

v1.0.0 - 2026-05-03

  • Portal onboarding flow upgraded
  • Email invites now include clickable activation link
  • /portal/set-password now supports direct email+code login
  • Auto session creation from invite link
  • Improved UX: no manual code entry required
  • Portal onboarding now production-ready

v1.1.0 - 2026-05-03

  • Added portal-based Android app download system
  • Secure APK delivery through OTB Billing (authenticated route)
  • "Download Android App" button added to OTB Cloud service card
  • Centralized app distribution strategy established
  • Foundation laid for future Follow-me and additional app downloads

v1.2.0 - 2026-05-03

  • Rewrote Service Agreement to platform-based terms
  • Removed aggressive "tracking app" language
  • Added multi-service structure (OTB Cloud, Follow-Me, future services)
  • Clarified data ownership and privacy model
  • Improved tone and professionalism of legal agreement
  • Terms now align with platform architecture