bmc_hub/scripts/reprocess_supplier_invoice_files.py
Christian 3311b8e590 Add comprehensive tests for internet connections module, invoice parsing, and subscription provisioning
- Implement tests for the internet connections module, covering routes, IP range creation, and connection validation.
- Add tests for the Invoice2DataService to validate extraction from GlobalConnect invoices.
- Create tests for subscription network provisioning, ensuring proper handling of network items and IP allocations.
- Include validation checks for subtotal mismatches and ensure error handling for missing IP selections.
2026-07-09 23:44:30 +02:00

35 lines
876 B
Python

#!/usr/bin/env python3
"""Reprocess stored supplier-invoice files through the app code."""
from __future__ import annotations
import argparse
import asyncio
import json
from app.billing.backend.supplier_invoices import reprocess_uploaded_file
from app.core.database import init_db
async def _run(file_ids: list[int]) -> list[dict]:
results = []
for file_id in file_ids:
result = await reprocess_uploaded_file(file_id)
results.append({"file_id": file_id, "result": result})
return results
def main() -> int:
parser = argparse.ArgumentParser()
parser.add_argument("file_ids", nargs="+", type=int)
args = parser.parse_args()
init_db()
payload = asyncio.run(_run(args.file_ids))
print(json.dumps(payload, ensure_ascii=False, indent=2, default=str))
return 0
if __name__ == "__main__":
raise SystemExit(main())