Task flow · Calculator deposit
Calculator deposit
A visitor confirms a mission interest and pays the quoted deposit through the calculator flow.
Flow
flowchart TD
A["Visitor opens /outils/calculator/"] --> B{"Access granted?"}
B -- No --> C["Show access gate form"]
C --> D["Visitor states professional email"]
D --> E{"Domain allowed?"}
E -- No --> F["Refuse + explain"]
E -- Yes --> G["Open calculator access"]
B -- Yes --> G
G --> H["Visitor fills 5-step mission form"]
H --> I["POST /api/quote"]
I --> J{"Payload valid?"}
J -- No --> K["400 + errors"]
J -- Yes --> L{"Mandate required?"}
L -- Yes --> M["400 mandate_required"]
L -- No --> N["Run pricing engine + optimiser"]
N --> O["Store QuoteRequest + public projection"]
O --> P["Return public JSON"]
P --> Q["Visitor reviews quote"]
Q --> R["Visitor clicks confirm interest"]
R --> S["POST contact with confirm_devis=1"]
S --> T["Render detailed quote + deposit button"]
T --> U["Visitor clicks pay deposit"]
U --> V["POST /paiement/devis/acompte/"]
V --> W["Recompute deposit server-side"]
W --> X["Create Payment row"]
X --> Y["Create Stripe Checkout session"]
Y --> Z["Redirect to Stripe"]
Z --> AA{"Buyer action"}
AA -- "Pays" --> AB["Webhook settles + grant entitlement"]
AA -- "Cancels" --> AC["Nothing charged"]
Security and integrity rules
| Rule | Enforcement |
|---|---|
| Amount authority | Deposit is recomputed server-side from stored qualification and the published deposit ladder. |
| Terms freeze | terms_version is stamped at payment creation. |
| Settlement authority | Only the signed Stripe webhook writes PAID. |
| Domain gate | The calculator refuses disposable and non-routable domains before any engine or quote is touched. |
| Throttling | Max 10 pending payments per email per hour. |
Validation and recovery
| Condition | System response |
|---|---|
| Calculator domain is blocked | Access gate refuses the email and explains why. No engine is touched. |
| Calculator payload is invalid | 400 with field errors; no quote is stored, no quota is consumed. |
| Mandate missing for facility rental | 400 with mandate_required; visitor must declare a signed mandate or select a different responsibility. |
| Devis token is invalid or expired | Redirect to /contact with an error; the visitor must restart qualification. |
| Webhook signature is invalid | 400; nothing is written. Stripe retries. |
Entitlement and delivery
When the webhook records a settled deposit, grant_entitlements() creates the corresponding Entitlement row. The buyer receives a Stripe receipt by email and a personal delivery link.