Transactions¶
Contrôleur HTTP des transactions wallet investisseur côté admin : consultation, refund d'achat primaire, retrait, annulation de retrait, crédit manuel, et replay des transactions bloquées. Source : transactions.controller.ts.
Tous les endpoints requièrent une session admin BetterAuth valide (AdminAuthGuard). Les endpoints muteurs sont tracés via CreateAdminActionInterceptor.
Préfixe de routes : /administration/transactions.
GET /waiting-revenue-by-project¶
Liste les montants de revenus (loyers / coupons) en attente de paiement, agrégés par projet.
Response¶
Tableau via RevenueTransactionsRepository.getWaitingRevenueAmountsByProject.
GET /customer/:customerId¶
Retourne toutes les wallet transactions d'un investisseur, avec un résumé et les soldes (Lemonway et gift balance).
Path param¶
customerId— UUIDv4
Response¶
{
"summary": {
"total": 100000,
"giftBalance": 5000,
"...": "agrégats divers"
},
"transactions": [
{
"id": "wt-uuid",
"kind": "PRIMARY_PURCHASE",
"value": 5000,
"balance": 95000,
"status": "...",
"createdAt": "...",
"...": "..."
}
]
}
balance est calculé par WalletTransactionsService.getWalletTransactionsWithBalance (cumul progressif).
POST /:transactionId/refund¶
Rembourse une wallet transaction. Seules les transactions PRIMARY_PURCHASE sont refundables. Trace une TRANSACTION_REFUND.
Path param¶
transactionId— UUIDv4 de la WT à rembourser
Effet¶
Si wt.kind === PRIMARY_PURCHASE → appelle primaryPurchaseService.refundPrimaryPurchase avec refundReason: 'performedByAdmin'. Sinon → erreur.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (not found) | 404 | WT introuvable |
wallet-transaction.state-not-refundable |
400 | Type de WT non supporté (≠ PRIMARY_PURCHASE) |
bricks-purchase.refund.WALLET_TRANSACTION_NOT_FOUND |
404 | WT introuvable côté service refund |
bricks-purchase.refund.PROPERTY_NOT_FOUND |
404 | Property introuvable |
property.spv.not-found |
404 | SPV introuvable |
property.spv.lemonway-wallet-not-found |
500 | SPV sans wallet Lemonway |
reservation-should-be-confirmed |
500 | État de réservation incohérent |
| (other) | 400 | Autres erreurs métier du refund |
POST /customer/:customerId/withdraw¶
Déclenche un retrait pour un investisseur (wire-out Lemonway vers un IBAN enregistré). Trace une WITHDRAW.
Path param¶
customerId— UUIDv4
Request body¶
Le customerId du body est forcé par celui du path. Validé via withdrawPayload.
Response¶
Résultat de InvestorWithdrawService.withdraw (initiator 'admin').
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (validation) | 400 | Erreurs de validation du payload |
POST /withdraw/:wtId/cancel¶
Annule un retrait en cours. Trace une WITHDRAW_CANCEL.
Path param¶
wtId— UUIDv4 de la WT de retrait
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
withdraw-not-found |
404 | WT de retrait introuvable |
withdraw-already-processed-on-lemonway |
400 | Le retrait a déjà été traité côté Lemonway |
check-lemonway-failed |
500 | Échec de la vérification du statut Lemonway |
POST /customer/:customerId/manual-credit¶
Crédite manuellement le wallet d'un investisseur (geste commercial, virement Crédit Agricole, topup manuel). Trace une TRANSACTION_CREDIT_FROM_EXTERNAL_SOURCE.
Path param¶
customerId— UUIDv4
Request body¶
type ∈ 'Credit Agricole' | 'Geste commercial' | 'Topup manuel'.
Validé via manualCreditPayload. Le customerId du body est forcé par celui du path.
Response¶
Résultat de TransactionCreditService.manualCreditCustomer.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (validation) | 400 | Erreurs de validation du payload |
POST /customer/:investorId/replay-blocked¶
Re-tente l'exécution des wallet transactions bloquées (P2P Lemonway en échec ou WTs legacy bloquées) d'un investisseur. Trace une TRANSACTION_REPLAY_BLOCKED.
Path param¶
investorId— UUIDv4
Effet¶
Appelle replayBlockedWalletTransactionService.replayFailedP2POrLegacyWtsForInvestors.
Erreurs¶
| Code | Statut | Cause |
|---|---|---|
| (variable) | 400 | Erreur retournée par le service de replay |
Liens¶
- Service achat primaire :
primary-purchase.service.ts - Service retrait :
investor-withdraw.service.ts - Service crédit manuel :
transactions-credit.service.ts - Service replay :
replay-blocked-wallet-transaction.service.ts - Service WT :
wallet-transactions.service.ts - Service balance :
customer-balance.service.ts - Repository revenues :
revenue-transactions.repository.ts