KrediFlow Documentation

Solvability Scoring & Closed-Loop Supply Chain Finance

1. System Architecture NestJS + Mongo

The ecosystem connects four distinct portals to a central decision engine. (Click diagram to zoom)

flowchart TD subgraph Mobile["Mobile App (Flutter)"] Buyer["Buyer / Producer
The Farmer"] end subgraph Web["Web Portals (React / Vite)"] Seller["Seller / Supplier
Inventory & POS"] Finance["Finance Partner
Risk & Disbursement"] Admin["Super Admin
Governance"] end subgraph Backend["Core System (NestJS + MongoDB)"] API["API Gateway"] Engine["Solvability Engine
Scoring Logic"] OCR["OCR Service
Document Analysis"] Escrow["Escrow Manager
Waterfall Payment"] end Buyer -->|Uploads Proofs and Signs Debt| API Seller -->|Scans QR – Proof of Delivery| API Finance -->|Approves Credit| API Admin -->|Monitors Health| API API <--> Engine API <--> OCR API <--> Escrow

2. Detailed User Journey

A step-by-step breakdown from Onboarding to Repayment.

  • Phase 1: Activation (The Trust Layer)
  • 1. Auth: Buyer authenticates via Phone Number + OTP.
  • 2. e-KYC: Buyer performs ID Scan (OCR) and Selfie check.
  • 3. Data Permission: Buyer grants access to Mobile Money history & GPS.
  • 4. Legal Setup: Buyer digitally signs the Framework Financing Agreement.
  • 5. Scoring: System calculates Credit Limit based on ingested data.
  • Phase 2: Marketplace Discovery
  • 6. Search: Buyer browses geolocated Sellers (Seeds, Equipment).
  • 7. Cart: Buyer selects items and proceeds to checkout.
  • Phase 3: The Guarantee (Collateral)
  • 8. Selection: Buyer chooses "Pay with Finance Partner".
  • 9. Collateral Upload: Buyer uploads a Contract or Invoice from their End-Client.
  • 10. Validation: System validates the collateral dates against loan duration.
  • Phase 4: Commitment (Legal Lock)
  • 11. Review: Buyer sees "Irrevocable Payment Order".
  • 12. Signature: Buyer uses Slide-to-Sign gesture to bind the debt.
  • 13. Notify Client: System emails Buyer's Client with Escrow IBAN details.
  • Phase 5: Approval & Fulfillment
  • 14. Approval: Finance Partner approves request; funds are reserved.
  • 15. Token Generation: System generates a Secure Pickup QR Code.
  • 16. Handover: Buyer visits Seller; Seller scans QR Code.
  • 17. Proof of Delivery: System marks Order as DELIVERED.
  • Phase 6: Settlement & Repayment
  • 18. Settlement: Finance Partner automatically transfers funds to Seller.
  • 19. Inflow: Buyer's Client pays invoice into Platform Escrow Account.
  • 20. Waterfall Split: System automatically:
       a. Repays Finance Partner (Principal + Fees).
       b. Sends profit to Buyer.
  • 21. Growth: Loan closed; Solvability Score increases.

3. Transaction Logic

Visualizing the data flow between stakeholders. (Click diagram to zoom)

sequenceDiagram autonumber participant B as Buyer App participant S as Seller Portal participant SYS as System NestJS participant FIN as Finance Partner participant CLI as End Client Note over B,FIN: Phase 1 - Financing Request B->>SYS: Checkout + Slide-to-Sign Debt Agreement B->>SYS: Upload Collateral Invoice for Client SYS->>FIN: Request Approval Scoring and Collateral FIN->>SYS: Approve Financing and Lock Funds SYS-->>B: Generate Pickup QR Code Note over B,S: Phase 2 - Fulfillment B->>S: Visit Store and Present QR Code S->>SYS: Scan QR Proof of Delivery SYS->>S: Validate and Confirm Handover Note over SYS,S: Phase 3 - Settlement SYS->>FIN: Trigger Payout Instruction FIN->>S: Transfer Funds Closed Loop Note over CLI,B: Phase 4 - Waterfall Repayment CLI->>SYS: Pay Invoice to Escrow Account SYS->>FIN: Priority 1 Repay Loan and Fees SYS->>B: Priority 2 Transfer Remaining Profit SYS->>B: Update Solvability Score

KrediFlow

Le Parcours Utilisateur : De l'Accroche au Remboursement Waterfall

Architecture du Flux Financier (Moussa, AutoParts & BTP Construction)

Cliquez sur le diagramme pour zoomer.

sequenceDiagram autonumber participant M as Moussa (Transporteur) participant S as AutoParts (Fournisseur) participant KF as KrediFlow (IA/Back) participant BQ as Banque (Financement) participant BTP as BTP Const. (Client Final) Note over M, BQ: Phase 1-5 : Activation & Scoring M->>KF: Signe Convention Cadre (OTP) M->>KF: Upload Documents KYC (OCR) KF->>KF: Calcul Scoring (B+) & Limite (2500€) Note over M, BTP: Phase 7-8 : La Garantie & Commande M->>M: Panier AutoParts (800€) M->>KF: Upload Facture BTP (1500€) KF->>KF: Validation Facture (Revenu > Dette) M->>KF: "Slide-to-Sign" (Cession de Créance) KF->>BTP: Notifie nouveau RIB (Compte Séquestre) KF->>BQ: Bloque Fonds (800€) Note over M, S: Phase 9 : Livraison M->>S: Présente QR Code S->>KF: Scanne QR (Preuve Livraison) KF->>S: Virement Immédiat (800€) Note over BTP, M: Phase 10 : Remboursement Waterfall BTP->>KF: Paie Facture (1500€) sur Séquestre KF->>BQ: Rembourse Dette (800€ + Frais) KF->>M: Vire le Reste (680€) sur Mobile Money KF->>M: Augmente Score (A-)
PHASE 1 : L'ACCROCHE (SPLASH & AUTH)

Écran 1 : L'Accueil (La Promesse)

KREDIFLOW (Logo Vert & Bleu) BOOSTEZ VOTRE ACTIVITÉ MAINTENANT 1. Commandez vos intrants (Carburant, Pneus) 2. La Banque paie pour vous 3. Remboursez après votre vente [ CRÉER MON COMPTE PRO ] [ J'ai déjà un compte ] Français | Arabe | Wolof

Écran 2 : Authentification

< Retour SÉCURITÉ Entrez votre numéro de mobile [ +212 | 6 00 00 00 00 ] Nous allons vous envoyer un code SMS. [ RECEVOIR MON CODE ]
Objectif : Lutte contre la fraude SIM swap.
PHASE 2 : L'IDENTITÉ NUMÉRIQUE (E-KYC)

Écran 3 : Qui êtes-vous ? (Scan ID)

ÉTAPE 1/3 VOTRE IDENTITÉ Pour activer votre financement, la banque doit vous identifier. 1. SCANNER VOTRE PIÈCE D'IDENTITÉ (CNI) [ Icône Caméra : Recto ] [ Icône Caméra : Verso ] 2. SELFIE DE SÉCURITÉ (Liveness Check) "Tournez la tête à gauche..." [ Cadre Rond pour le visage ] [ SUIVANT >> ]

Écran 4 : Votre Activité

ÉTAPE 2/3 VOTRE MÉTIER Quel est votre secteur d'activité ? ( ) 🚜 Producteur Agricole (•) 🚚 Transporteur / Logistique ( ) 🏪 Commerçant PREUVE D'ACTIVITÉ (Facultatif) [ 📷 Photo Carte Grise / Camion ] [ 📷 Photo Patente / Registre ] [ SUIVANT >> ]
PHASE 3 : LA CONNEXION DATA

Écran 5 : Le Scoring

ÉTAPE 3/3 CALCUL DE VOTRE CRÉDIT Pour obtenir un plafond élevé, connectez vos sources de revenus. ANALYSE DES FLUX FINANCIERS [x] Autoriser lecture SMS Mobile Money (Orange Money, Wave, M-Pesa...) --> "Analyse en cours... ✅" GÉOLOCALISATION [x] Autoriser l'accès GPS [ CALCULER MA CAPACITÉ >> ]
PHASE 4 : LE CADRE JURIDIQUE

Écran 6 : La Signature

CONTRAT CADRE DE FINANCEMENT Félicitations Moussa ! D'après vos données, vous êtes éligible. Pour activer votre compte, signez la Convention Cadre KrediFlow. CE QUE CELA IMPLIQUE : 1. Mandat de paiement direct aux fournisseurs. 2. Engagement de remboursement sur recettes. 3. Accord de partage de données bancaires. [ Lire le contrat complet (PDF) ] [x] Je certifie avoir lu et accepté. [ GLISSER POUR SIGNER LE CONTRAT ]
PHASE 5 : L'ARRIVÉE (DASHBOARD)

Écran 7 : Tableau de Bord

[=] KrediFlow - Compte Vérifié ✅ [🔔] Bonjour Moussa, Votre ligne de crédit est active ! /--------\ / SCORE \ | B+ | Plafond: 2 500 € \ Bon / \--------/ VOS ACTIONS : [ 🛒 FAIRE MA PREMIÈRE COMMANDE ] (Pneus, Carburant, Pièces...) [ 📄 AJOUTER UN CONTRAT CLIENT ] (Pour augmenter votre plafond)
Back-end: IA a analysé 800€/mois de flux stable. Limite fixée à 30% (~240€/mois).
PHASE 6 : LA RECHERCHE (MARKETPLACE)

Écran 8 : Marketplace

< Retour MARKETPLACE PRO Que cherchez-vous ? [ 🔍 Pneus Poids Lourd... ] RÉSULTATS À PROXIMITÉ (Rabat - 10km) [IMG] Pneu Michelin X Multi Fournisseur : AutoParts Pro Prix : 400 € / unité [ - ] 2 [ + ] [ AJOUTER ] [IMG] Batterie Varta Truck Fournisseur : ElecAuto Prix : 150 € [ AJOUTER ] -------------------------------------------- PANIER (2 articles) : 800 € [ VOIR MON PANIER ]
PHASE 7 : LA GARANTIE (LE 4ÈME ACTEUR)

Écran 9 : Le Financement "Collatéralisé"

ÉTAPE DE SÉCURISATION TOTAL À FINANCER : 800 € SOURCE DE REMBOURSEMENT Pour valider ce crédit, liez un contrat client. [ + AJOUTER UN CONTRAT / FACTURE ] > Formulaire d'ajout : Client Final : BTP CONSTRUCTION SARL Contact (Email) : compta@btp-const.ma Montant Facture : 1 500 € Echéance : 30 Jours [ 📷 PRENDRE PHOTO DU BON DE COMMANDE ] (L'OCR vérifie les dates et montants) [ VALIDER LA GARANTIE ]
Back-end: Vérification 1500€ (Revenu) > 800€ (Dette). Email envoyé au client BTP.
PHASE 8 : L'ENGAGEMENT (SIGNATURE)

Écran 10 : Slide-to-Sign

RÉCAPITULATIF CONTRACTUEL 1. COMMANDE : 2 Pneus (800€) chez AutoParts. 2. CESSION : Vous cédez la facture BTP Const. (1500€) au profit de la Banque. ENGAGEMENT IRRÉVOCABLE "Je reconnais devoir 800€ (+ frais) à la Banque et j'ordonne à BTP Construction de payer sur le compte séquestre KrediFlow." [ GLISSER POUR SIGNER & COMMANDER >>> ] (Le bouton devient vert au passage)

Écran 11 : Confirmation

Succès ! Fonds Bloqués. AutoParts a reçu l'argent. Allez récupérer vos pneus. Note : Un email de notification de RIB a été envoyé à BTP Construction.
PHASE 9 : LA LIVRAISON (QR CODE)

Écran 12 : Bon de Retrait (Moussa)

BON DE RETRAIT #CMD-884 Présentez ce code au fournisseur [ QR CODE COMPLEXE ] [ (Sécurisé/Unique) ] Produits : 2x Pneus Michelin Statut Banque : PAYÉ (Bloqué) "Ce code vaut signature du bon de livraison"

Écran 13 : Le Scan (Fournisseur)

SCANNER LE QR CODE CLIENT... [ V ] Validé ! Livraison Confirmée. Virement de 800€ déclenché vers votre compte AutoParts.
PHASE 10 : LE REMBOURSEMENT (WATERFALL)

Écran 14 : Notification Split

ARGENT REÇU ! (COMPTE SÉQUESTRE) L'argent de BTP CONSTRUCTION est arrivé. Montant Total : + 1 500 € RÉPARTITION AUTOMATIQUE (Waterfall) -------------------------------------------- 1. REMBOURSEMENT BANQUE (Pneus) Dette Principale : - 800 € Frais & Intérêts : - 20 € Statut : [ CLÔTURÉ ✅ ] -------------------------------------------- 2. VOTRE PROFIT (Reste à vivre) Solde Restant : + 680 € [ TRANSFÉRER VERS MON MOBILE MONEY ]

Écran 15 : Clôture & Gamification

CYCLE TERMINÉ Bravo Moussa ! 🌟 Vous avez remboursé votre crédit pneus. IMPACT SUR VOTRE SCORE : Score Précédent : B+ Nouveau Score : A- (Excellent) ⬆️ Votre nouveau plafond est de : 3 500 € (Était 2 500 €) [ FAIRE UNE NOUVELLE COMMANDE ]
Mécanique: Smart Contract exécute IF Solde > Dette THEN Pay Bank FIRST.