-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor invoice structure and financial orchestration logic. Updated… #325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LVT-ENG
wants to merge
5
commits into
main
Choose a base branch
from
cursor/stripe-ledger-a4a63
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
45b38a6
Refactor invoice structure and financial orchestration logic. Updated…
d8db4e1
Refactor QONTO_SUBMISSION.md for clarity and accuracy in transaction …
54a530d
Refactor net liquidity calculation in `update_net_liquidity.py`. Upda…
90f3eab
Refactor Qonto submission and liquidity calculation logic. Updated tr…
c457d62
Update invoice details and improve liquidity calculation logic
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="fr"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
| <title>F-2026-001-PARTIAL</title> | ||
| <style> | ||
| body { font-family: system-ui, sans-serif; max-width: 720px; margin: 2rem auto; color: #111; } | ||
| h1 { font-size: 1.25rem; } | ||
| table { width: 100%; border-collapse: collapse; margin-top: 1rem; } | ||
| th, td { border: 1px solid #ccc; padding: 0.5rem; text-align: left; } | ||
| th { background: #f5f5f5; } | ||
| .num { text-align: right; } | ||
| .muted { color: #555; font-size: 0.9rem; } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <h1>Facture F-2026-001-PARTIAL — B2B Paris (EUR)</h1> | ||
| <p class="muted">Émetteur : Rubén Espinar Rodríguez (EI) — SIREN 943 610 196<br /> | ||
| Client : Galeries Lafayette Haussmann — SIRET 552 129 211 00011</p> | ||
| <table> | ||
| <tr><th>Description</th><th class="num">Base HT</th><th class="num">TVA 20%</th><th class="num">Total TTC</th></tr> | ||
| <tr> | ||
| <td>Pago del hito 1: Licencia PauPeacockEngine V12</td> | ||
| <td class="num">404 090,00 €</td> | ||
| <td class="num">80 818,00 €</td> | ||
| <td class="num">484 908,00 €</td> | ||
| </tr> | ||
| </table> | ||
| <p><strong>Total TTC : 484 908,00 €</strong></p> | ||
| <p class="muted">Imprimer « Enregistrer au format PDF » depuis le navigateur pour obtenir le PDF.</p> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,44 @@ | ||
| { | ||
| "invoice_reference": "F-2026-001-PARTIAL", | ||
| "issue_date": "2026-05-04", | ||
| "currency": "EUR", | ||
| "invoice_number": "F-2026-001-PARTIAL", | ||
| "type": "facture_b2b", | ||
| "jurisdiction": "FR", | ||
| "place_of_supply": "Paris", | ||
| "currency": "EUR", | ||
| "emitter": { | ||
| "name": "Rubén Espinar Rodríguez", | ||
| "legal_name": "Rubén Espinar Rodríguez (EI)", | ||
| "legal_form": "EI", | ||
| "siren": "943610196", | ||
| "siren_formatted": "943 610 196", | ||
| "address_lines": [ | ||
| "France" | ||
| ] | ||
| "address_hint": "Paris, France" | ||
| }, | ||
| "client": { | ||
| "name": "Galeries Lafayette Haussmann", | ||
| "legal_name": "Galeries Lafayette Haussmann", | ||
| "siret": "55212921100011", | ||
| "siret_formatted": "552 129 211 00011", | ||
| "address_lines": [ | ||
| "40 Boulevard Haussmann", | ||
| "75009 Paris", | ||
| "France" | ||
| ] | ||
| "siret_formatted": "552 129 211 00011" | ||
| }, | ||
| "lines": [ | ||
| "line_items": [ | ||
| { | ||
| "description": "Pago del hito 1: Licencia PauPeacockEngine V12", | ||
| "quantity": 1, | ||
| "unit_ht_eur": 404090.0, | ||
| "total_ht_eur": 404090.0, | ||
| "vat_rate": 0.2, | ||
| "vat_amount_eur": 80818.0, | ||
| "total_ttc_eur": 484908.0 | ||
| "unit_ht": 404090.0, | ||
| "total_ht": 404090.0 | ||
| } | ||
| ], | ||
| "totals": { | ||
| "total_ht_eur": 404090.0, | ||
| "total_vat_eur": 80818.0, | ||
| "total_ttc_eur": 484908.0 | ||
| "base_ht": 404090.0, | ||
| "base_ht_formatted": "404.090,00 €", | ||
| "tva_rate": 0.2, | ||
| "tva_amount": 80818.0, | ||
| "tva_amount_formatted": "80.818,00 €", | ||
| "total_ttc": 484908.0, | ||
| "total_ttc_formatted": "484.908,00 €" | ||
| }, | ||
| "references": { | ||
| "contract": "DIVINEO-V10", | ||
| "milestone": "Hito 1 / Jalon 1" | ||
| }, | ||
| "pdf_export_hint": { | ||
| "title": "Facture F-2026-001-PARTIAL", | ||
| "locale": "fr_FR" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # Soumission Qonto — DIVINEO-V10 / F-2026-001-PARTIAL | ||
|
|
||
| **Objet :** régularisation du montant — Jalon 1 (Hito 1) | ||
|
|
||
| --- | ||
|
|
||
| ## Texte à coller (français) | ||
|
|
||
| Cette opération de **484.908,00 €** correspond au **premier jalon (Hito 1)** du contrat **DIVINEO-V10**. La facture jointe **F-2026-001-PARTIAL** corrige l’**écart de montant** avec le **contrat-cadre général**. | ||
|
|
||
| --- | ||
|
|
||
| ## Variante (espacement des milliers à la française) | ||
|
|
||
| Cette opération de **484 908,00 €** correspond au **premier jalon (Hito 1)** du contrat **DIVINEO-V10**. La facture jointe **F-2026-001-PARTIAL** corrige l’**écart de montant** avec le **contrat-cadre général**. | ||
|
|
||
| --- | ||
|
|
||
| *Références : `F-2026-001-PARTIAL.json` ; SIREN émetteur 943 610 196 ; SIRET client 552 129 211 00011. Net après frais : `master_ledger_status.json` (`update_net_liquidity.py`).* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +1,20 @@ | ||
| liberar_fondos_pau.py | ||
| import json | ||
| import os | ||
| from datetime import datetime | ||
| """Délégation Divineo V7 — exécute ``update_net_liquidity.py`` à la racine du dépôt.""" | ||
|
|
||
| # --- PROTOCOLO DIVINEO V7: CIERRE FINANCIERO MILESTONE 1 --- | ||
| from __future__ import annotations | ||
|
|
||
| def ejecutar_orquestacion_financiera(): | ||
| print("🔱 [SISTEMA] Iniciando Protocolo de Sincronización Estricta...") | ||
| import subprocess | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| # 1. DATOS LEGALES PARA LA FACTURA (PARÍS) | ||
| factura_data = { | ||
| "numero": "F-2026-001-PARTIAL", | ||
| "fecha": datetime.now().strftime("%d/%m/%Y"), | ||
| "emisor": { | ||
| "nombre": "Rubén Espinar Rodriguez (EI)", | ||
| "siren": "943 610 196", | ||
| "siret": "94361019600017", | ||
| "ubicacion": "75001 Paris, France" | ||
| }, | ||
| "cliente": { | ||
| "nombre": "Galeries Lafayette Haussmann", | ||
| "siret": "552 129 211 00011", | ||
| "direccion": "40 Boulevard Haussmann, 75009 Paris" | ||
| }, | ||
| "totales": { | ||
| "base_ht": 404090.00, | ||
| "tva_20_pct": 80818.00, | ||
| "total_ttc": 484908.00 # <--- Debe ser exacto al ingreso en Qonto | ||
| }, | ||
| "concepto": "Paiement Jalon 1 (Milestone 1) - Licence technologique PauPeacockEngine V12" | ||
| } | ||
| _ROOT = Path(__file__).resolve().parents[1] | ||
|
|
||
| # 2. CÁLCULO DE DISPONIBILIDAD NETA | ||
| comision_stripe = 484908.00 * 0.015 | ||
| tasa_qonto = 25.00 | ||
| saldo_neto_gastable = 484908.00 - comision_stripe - tasa_qonto | ||
|
|
||
| # 3. ACTUALIZACIÓN DEL MASTER LEDGER | ||
| ledger_update = { | ||
| "account_id": "acct_1TP8bNEcp6PrE3M", | ||
| "status": "LIQUIDITY_DEPLOYABLE", | ||
| "last_audit": datetime.now().isoformat(), | ||
| "net_balance_eur": round(saldo_neto_gastable, 2), | ||
| "compliance_msg": "Match exitoso con F-2026-001-PARTIAL" | ||
| } | ||
| def ejecutar_orquestacion_financiera() -> int: | ||
| return subprocess.call( | ||
| [sys.executable, str(_ROOT / "update_net_liquidity.py")], | ||
| cwd=str(_ROOT), | ||
| ) | ||
|
|
||
| # Generar archivos de evidencia para el Arquitecto | ||
| with open("F-2026-001-PARTIAL.json", "w") as f: | ||
| json.dump(factura_data, f, indent=4) | ||
|
|
||
| with open("master_ledger_status.json", "w") as f: | ||
| json.dump(ledger_update, f, indent=4) | ||
|
|
||
| # 4. MENSAJE PARA COMPLIANCE BANCARIO | ||
| mensaje_frances = f""" | ||
| À l'attention du département de Conformité Qonto, | ||
|
|
||
| Ce virement de {factura_data['totales']['total_ttc']} € correspond au paiement du Premier Jalon Opérationnel (Milestone 1) du contrat DIVINEO-V10. | ||
| La facture jointe F-2026-001-PARTIAL régularise la discordance de montant avec le contrat-cadre global. | ||
| Merci de libérer les fonds immédiatement. | ||
| """ | ||
|
|
||
| print(f"\n✅ PASO 1: Factura JSON generada.") | ||
| print(f"✅ PASO 2: Master Ledger sincronizado.") | ||
| print(f"✅ PASO 3: Saldo neto certificado: {ledger_update['net_balance_eur']} €") | ||
| print("\n--- COPIA ESTE MENSAJE PARA EL CHAT DE QONTO ---") | ||
| print(mensaje_frances) | ||
| print("-----------------------------------------------") | ||
|
|
||
| if __name__ == "__main__": | ||
| ejecutar_orquestacion_financiera() | ||
|
|
||
|
|
||
| raise SystemExit(ejecutar_orquestacion_financiera()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| { | ||
| "schema": "master_ledger_status_v1", | ||
| "generated_at_utc": "2026-05-04T09:11:49.187944Z", | ||
| "currency": "EUR", | ||
| "gross_ttc_eur": 484908.0, | ||
| "stripe_fee_eur": 7273.62, | ||
| "stripe_fee_rate": 0.015, | ||
| "qonto_fee_eur": 25.0, | ||
| "net_deployable_eur": 477609.38, | ||
| "status": "LIQUIDITY_DEPLOYABLE", | ||
| "invoice_ref": "F-2026-001-PARTIAL", | ||
| "note": "Cálculo contable local; validar contra extractos Stripe/Qonto antes de desembolso." | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,15 @@ | ||
| { | ||
| "invoice_reference": "F-2026-001-PARTIAL", | ||
| "gross_ttc_eur": 484908.0, | ||
| "stripe_fee_rate": 0.015, | ||
| "stripe_commission_eur": 7273.62, | ||
| "qonto_commission_eur": 25.0, | ||
| "net_deployable_eur": 477609.38, | ||
| "invoice_ref": "F-2026-001-PARTIAL", | ||
| "contract": "DIVINEO-V10", | ||
| "currency": "EUR", | ||
| "gross_ttc": 484908.0, | ||
| "commissions": { | ||
| "stripe_1_5pct": -7273.62, | ||
| "qonto_flat": -25.0 | ||
| }, | ||
| "net_deployable": 477609.38, | ||
| "status": "LIQUIDITY_DEPLOYABLE", | ||
| "updated_utc": "2026-05-04T08:20:28.673368Z" | ||
| "computed_at_utc": "2026-05-04T12:32:58.112257Z", | ||
| "computed_at_paris": "2026-05-04T14:32:58+02:00", | ||
| "source": "update_net_liquidity.py" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/usr/bin/env python3 | ||
| """Divineo V7 — calcule le net gaspable et écrit ``master_ledger_status.json`` (racine du dépôt).""" | ||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| import sys | ||
| from datetime import datetime, timezone | ||
| from pathlib import Path | ||
| from zoneinfo import ZoneInfo | ||
|
|
||
| _TZ_PARIS = ZoneInfo("Europe/Paris") | ||
|
|
||
| ROOT = Path(__file__).resolve().parent | ||
| OUT = ROOT / "master_ledger_status.json" | ||
|
|
||
| GROSS_TTC = 484_908.00 | ||
| STRIPE_COM = round(GROSS_TTC * 0.015, 2) | ||
| QONTO_COM = 25.00 | ||
| NET = round(GROSS_TTC - STRIPE_COM - QONTO_COM, 2) | ||
|
|
||
|
|
||
| def main() -> int: | ||
| if abs(STRIPE_COM - 7273.62) > 0.01 or abs(NET - 477_609.38) > 0.01: | ||
| print("ERR: totaux incohérents", file=sys.stderr) | ||
| return 2 | ||
|
|
||
| payload = { | ||
| "invoice_ref": "F-2026-001-PARTIAL", | ||
| "contract": "DIVINEO-V10", | ||
| "currency": "EUR", | ||
| "gross_ttc": GROSS_TTC, | ||
| "commissions": { | ||
| "stripe_1_5pct": -STRIPE_COM, | ||
| "qonto_flat": -QONTO_COM, | ||
| }, | ||
| "net_deployable": NET, | ||
| "status": "LIQUIDITY_DEPLOYABLE", | ||
| "computed_at_utc": datetime.now(timezone.utc).isoformat().replace("+00:00", "Z"), | ||
| "computed_at_paris": datetime.now(_TZ_PARIS).isoformat(timespec="seconds"), | ||
| "source": "update_net_liquidity.py", | ||
| } | ||
| OUT.write_text(json.dumps(payload, indent=2, ensure_ascii=False), encoding="utf-8") | ||
| print("✅ SISTEMA SINCRONIZADO. SALDO DISPONIBLE: 477.609,38 €") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| raise SystemExit(main()) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.