Investor Investment Plan¶
Contrôleur HTTP du plan d'investissement automatique (auto-invest) : configuration du plan, confirmation/annulation des achats automatiques, acquittement des opportunités manquées. Source : investor-investment-plan.controller.ts.
Tous les endpoints requièrent un JWT investisseur valide (JwtAuthGuard), le rôle CUSTOMER (UserRoleGuard) et le feature flag ENABLE_INVESTMENT_PLAN actif (sauf GET / qui ne le vérifie pas).
GET /investor/investment-plan¶
Retourne le plan d'investissement courant de l'investisseur (actif ou désactivé), le compteur d'investissements automatiques réalisés ce mois-ci, les investissements en attente de confirmation et les opportunités manquées non acquittées. Source : investor-investment-plan.controller.ts#L36.
Response¶
Type partagé : GetInvestorInvestmentPlansResponse (investor-investment-plan.endpoint.ts).
{
"investorInvestmentPlans": [
{ "plan": { "id": "...", "status": "active", "config": { "...": "..." } }, "investmentsCount": 3 }
],
"investmentsCountForCurrentMonth": 1,
"investmentsWaitingForConfirmation": [{ "purchaseId": "...", "propertyId": "...", "...": "..." }],
"investmentsMissedOpportunities": [{ "id": "uuidv7", "reason": "not_enough_bricks", "...": "..." }]
}
Erreurs¶
À documenter (pas de cas d'erreur métier explicite côté contrôleur).
POST /investor/investment-plan¶
Crée un nouveau plan d'investissement. Désactive le plan actif éventuel puis crée le nouveau dans la même transaction. Émet l'événement InvestmentPlanActivated à customer.io. Source : investor-investment-plan.controller.ts#L43.
Pré-conditions¶
- Feature flag
ENABLE_INVESTMENT_PLANactif - Onboarding investisseur complété (
assertCompletedInvestorOnboarding) - Droits transactionnels actifs (
assertTransactionRights('all'))
Request body¶
Validé par InvestorInvestmentPlan.configuration (investor-investment-plan.ts) :
{
"bricksCountPerProperty": 5,
"maxInvestmentsPerMonth": 10,
"yieldMin": 8,
"horizonRangeInYears": { "min": 3, "max": 10 }
}
maxInvestmentsPerMonth, yieldMin et horizonRangeInYears sont optionnels. Les bornes (min/max de chaque champ) sont définies par businessRules.primaryObligation.investmentPlan.
Response¶
204 No Content (le contrôleur ne retourne rien).
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (vide) | 403 | Feature flag désactivé |
customer.investor-onboarding-not-completed |
403 | Onboarding investisseur incomplet |
customer.rights.account-is-being-verified |
403 | Compte gelé / Lemonway en cours de vérification |
customer.rights.account-not-completed |
403 | KYC non verified |
investor-investment-plan-already-exists |
400 | Un plan actif existe déjà (cas non atteignable car disable est appelé avant) |
DELETE /investor/investment-plan/¶
Désactive le plan d'investissement actif. Émet l'événement InvestmentPlanDisabled à customer.io. Source : investor-investment-plan.controller.ts#L73.
Pré-conditions¶
- Feature flag
ENABLE_INVESTMENT_PLANactif
Response¶
204 No Content.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (vide) | 403 | Feature flag désactivé |
no-plan-to-disable |
400 | Aucun plan actif à désactiver |
POST /investor/investment-plan/purchase/confirm¶
Confirme un achat automatique en attente. Met à jour le WalletTransaction (refundableUntil prolongé), passe le PrimaryPurchase en waiting_for_p2p_creation. Source : investor-investment-plan.controller.ts#L93.
Pré-conditions¶
- Feature flag
ENABLE_INVESTMENT_PLANactif - Onboarding investisseur complété
- Droits transactionnels actifs
Request body¶
Validé via walletTransactionId (branded ID).
Response¶
204 No Content.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (vide) | 403 | Feature flag, onboarding ou droits |
| (vide) | 400 | investment-not-automatic-nor-waiting-for-confirmation ou investment-expired (le contrôleur n'expose pas le détail) |
POST /investor/investment-plan/purchase/cancel¶
Annule un achat automatique en attente — déclenche un remboursement (refundPrimaryPurchase) avec refundReason=performedByCustomer. Source : investor-investment-plan.controller.ts#L121.
Pré-conditions¶
- Feature flag
ENABLE_INVESTMENT_PLANactif - Onboarding investisseur complété
- Droits transactionnels actifs
Request body¶
Response¶
204 No Content.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (vide) | 403 | Feature flag, onboarding ou droits |
| (vide) | 400 | investment-not-automatic-nor-waiting-for-confirmation, investment-expired ou erreur de remboursement |
POST /investor/investment-plan/missed-opportunity/acknowledge¶
Marque comme acquittée une opportunité d'investissement manquée (ex. plus assez de bricks au moment du déclenchement du plan). Une fois acquittée, elle disparaît du payload investmentsMissedOpportunities. Source : investor-investment-plan.controller.ts#L149.
Pré-conditions¶
- Feature flag
ENABLE_INVESTMENT_PLANactif
Request body¶
Validé par acknowledgeMissedOpportunityEndpoint.request.body :
Response¶
204 No Content.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (vide) | 403 | Feature flag désactivé |
Liens¶
- Service plan :
investor-investment-plan.service.ts - Service achat automatique :
investor-automatic-investment.service.ts - Repository :
automatic-funding.repository.ts