Skip to main content

Community Workers Payments

This page documents the payment management for Community Workers, including monthly payment slips and payment batches.


Payment Architecture​

┌─────────────────────────────────────────────────────────────────────────┐
│ PAYMENT BATCH │
│ ┌─────────────────────────────────────────────────────────────────┐ │
│ │ Reference: LOT-2026-06-001 │ │
│ │ Period: June 2026 │ │
│ │ Status: in_progress │ │
│ │ Total amount: 15,000,000 XOF │ │
│ └─────────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌─────────────────────────────┼─────────────────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Slip #1 │ │ Slip #2 │ │ Slip #3 │ │
│ │ PMT-2606-001 │ │ PMT-2606-002 │ │ PMT-2606-003 │ │
│ │ Agent │ │ Agent │ │ Agent │ │
│ │ 100,000 XOF │ │ 100,000 XOF │ │ 100,000 XOF │ │
│ │ Paid ✓ │ │ In progress │ │ Blocked │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
└─────────────────────────────────────────────────────────────────────────┘

Payment Slip (CWFichePaiement)​

A payment slip represents a Community Worker's monthly payment.

Data Model​

FieldTypeDescription
idUUIDUnique identifier
codestringUnique code (format: PMT-YYMM-XXXXX)
communityWorkerobjectRelated community worker
periodestringPeriod text (e.g., "June 2026")
anneeintYear (2020-2100)
moisintMonth (1-12)
salaireBasedecimalBase salary
primeTerraindecimalField bonus
primePerformancedecimalPerformance bonus
retenuesdecimalDeductions
brutdecimalGross total (calculated)
netAPayerdecimalNet payable (calculated)
modePaiementstringPayment method
numeroMobileMoneystringMobile Money number
compteBancairestringBank account
referenceOperateurstringOperator reference
statutstringSlip status
motifBlocagetextBlocking reason
datePaiementdatetimeActual payment date
lotobjectAssociated payment batch

Slip Statuses​

StatusDescription
brouillonSlip being edited
en_attenteValidated slip, awaiting processing
en_coursPayment being processed
payePayment successfully completed
bloquePayment blocked (reason required)

Payment Methods​

MethodDescription
mobile_moneyMobile Money payment
virementBank transfer
especesCash payment

Net Payment Calculation​

The net payable is calculated automatically:

Gross = Base Salary + Field Bonus + Performance Bonus
Net = max(0, Gross - Deductions)

Payment Batch (CWLotPaiement)​

A payment batch groups multiple payment slips for batch processing.

Data Model​

FieldTypeDescription
idUUIDUnique identifier
referencestringBatch reference
anneeintYear
moisintMonth
statutstringBatch status
nbFichesintNumber of slips
montantTotaldecimalTotal amount
fichesarrayList of slips

Batch Statuses​

StatusDescription
brouillonBatch being prepared
valideValidated batch, ready for transmission
transmisTransmitted to operator
en_coursProcessing in progress
termineAll payments completed
clotureBatch permanently closed

API Endpoints​

Payment Slips​

EndpointMethodDescription
/api/cw-paiements/fichesGETList slips
/api/cw-paiements/fiches/{id}GETSlip details
/api/cw-paiements/fiches/{id}PUT, PATCHUpdate amounts and payment method
/api/cw-paiements/fiches/{id}/marquer-payePOSTMark as paid
/api/cw-paiements/fiches/{id}/bloquerPOSTBlock a slip (motif required)
/api/cw-paiements/fiches/{id}/debloquerPOSTUnblock a slip
/api/cw-paiements/genererPOSTGenerate the month's slips
/api/cw-paiements/statsGETStatistics

There is no single-slip creation: slips are produced by the monthly generation.

Payment Batches​

EndpointMethodDescription
/api/cw-paiements/lotsGETList batches
/api/cw-paiements/lotsPOSTCreate a batch (regionId, annee, mois required)
/api/cw-paiements/lots/{id}GETBatch details
/api/cw-paiements/lots/{id}/soumettrePOSTSubmit for validation
/api/cw-paiements/lots/{id}/validerPOSTValidate the batch
/api/cw-paiements/lots/{id}/rejeterPOSTReject the batch (motif required)
/api/cw-paiements/lots/{id}/executerPOSTExecute the batch

Example: Generate Monthly Slips​

POST /api/cw-paiements/generer
{
"annee": 2026,
"mois": 6,
"salaireBase": "50000",
"primeTerrain": "10000"
}

All fields are optional: by default the current month, a base salary of 50,000 and a field bonus of 10,000. A slip that already exists for the month is skipped.

{
"success": true,
"message": "45 fiches créées, 5 ignorées (déjà existantes)",
"data": { "created": 45, "skipped": 5 }
}

Example: Mark Slip as Paid​

POST /api/cw-paiements/fiches/{id}/marquer-paye
{ "referenceOperateur": "TXN-2026-06-12345" }
{
"success": true,
"message": "Fiche marquée comme payée",
"data": { "id": "…", "statut": "paye", "referenceOperateur": "TXN-2026-06-12345" }
}

Payment Workflow​

┌──────────┐ ┌───────────┐ ┌─────────┐ ┌────────┐
│ Draft │ --> │ Pending │ --> │ In prog │ --> │ Paid │
└──────────┘ └───────────┘ └─────────┘ └────────┘
│
▼
┌─────────┐
│ Blocked │ <-- (reason required)
└─────────┘
  1. Draft: Slip created, amounts being edited
  2. Pending: Slip validated, ready for batch integration
  3. In progress: Batch transmitted to operator, payment being processed
  4. Paid: Payment received by beneficiary
  5. Blocked: Issue identified (invalid number, closed account, etc.)