# lamjounah/billing-invoice architecture

> Architecture diagram of the GitHub repository lamjounah/billing-invoice, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lamjounah/billing-invoice
- Repository: https://github.com/lamjounah/billing-invoice
- Video tour (about a minute): https://gitdiagram.com/lamjounah/billing-invoice/video

## Overview

This is a Spring billing-invoice service: REST clients create, retrieve, search, update, and delete invoices, while invoice-control requests start a validation process and payment results can update invoice status. Invoice creation resolves customer, creditor, and point-of-sale references before persisting the invoice. The tree also shows separate creditor and point-of-sale management, plus messaging and workflow components. The README is empty; sampled sources establish the invoice and point-of-sale paths, while some listed integrations and delegates are represented only at their supported subsystem level.

Main entry points: [`src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/InvoiceServiceImpl.java`](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/InvoiceServiceImpl.java) (Invoice service), [`src/main/java/ma/atos/billing/invoice/billing_invoice/services/CreancierService.java`](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/CreancierService.java) (Creditor service), [`src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/PointDeVenteServiceImp.java`](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/PointDeVenteServiceImp.java) (Point-of-sale service), [`src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CreancierRepository.java`](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CreancierRepository.java) (Creditor repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_invoice_api["Invoice API"]
  node_workflow_api["Control API"]
  node_creditor_api["Creditor API"]
  node_pos_api["Point-of-sale API"]
end

subgraph group_domain["Billing domain"]
  node_invoice_service["Invoice service"]
  node_creditor_service["Creditor service"]
  node_pos_service["Point-of-sale service"]
  node_invoice_mapper["Invoice mapping<br/>[InvoiceMapper.java]"]
  node_creditor_mapper["Creditor mapping"]
  node_pos_mapper["Point-of-sale mapping"]
end

subgraph group_integrations["Workflow and messaging"]
  node_workflow_service["Invoice workflow service"]
  node_workflow_delegates["Validation delegates"]
  node_event_publisher["Invoice event publisher"]
  node_payment_listener["Payment result listener"]
  node_payment_events["Payment events"]
end

subgraph group_persistence["Persistence"]
  node_invoice_repo["Invoice repository"]
  node_creditor_repo["Creditor repository"]
  node_customer_repo["Customer repository"]
  node_pos_repo["Point-of-sale repository"]
end

node_client(("API client"))
node_camunda["Camunda engine"]
node_broker["Message broker"]
node_payment_service["Payment service"]
node_db[("Relational database")]

node_client -->|"calls"| node_invoice_api
node_client -->|"calls"| node_workflow_api
node_client -->|"calls"| node_creditor_api
node_client -->|"calls"| node_pos_api
node_invoice_api -->|"invokes"| node_invoice_service
node_workflow_api -->|"invokes"| node_workflow_service
node_creditor_api -->|"invokes"| node_creditor_service
node_pos_api -->|"invokes"| node_pos_service
node_invoice_service -->|"reads/writes"| node_invoice_repo
node_invoice_service -->|"resolves customer"| node_customer_repo
node_invoice_service -->|"resolves creditor"| node_creditor_repo
node_invoice_service -->|"resolves point-of-sale"| node_pos_repo
node_invoice_service -->|"maps"| node_invoice_mapper
node_invoice_service -->|"publishes"| node_event_publisher
node_creditor_service -->|"reads/writes"| node_creditor_repo
node_creditor_service -->|"maps"| node_creditor_mapper
node_pos_service -->|"reads/writes"| node_pos_repo
node_pos_service -->|"maps"| node_pos_mapper
node_workflow_service -->|"starts process"| node_camunda
node_payment_listener -->|"updates status"| node_invoice_service
node_event_publisher -->|"publishes events"| node_broker
node_broker -.->|"routes messages"| node_payment_service
node_payment_service -.->|"returns results"| node_broker
node_broker -->|"delivers results"| node_payment_listener
node_invoice_repo -->|"reads/writes"| node_db
node_creditor_repo -->|"reads/writes"| node_db
node_customer_repo -->|"reads"| node_db
node_pos_repo -->|"reads/writes"| node_db

click node_invoice_api "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceController.java"
click node_workflow_api "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceWorkflowController.java"
click node_creditor_api "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/CreancierController.java"
click node_pos_api "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/PointDeVenteController.java"
click node_invoice_service "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/InvoiceServiceImpl.java"
click node_creditor_service "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/CreancierService.java"
click node_pos_service "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/PointDeVenteServiceImp.java"
click node_invoice_mapper "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/InvoiceMapper.java"
click node_creditor_mapper "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/CreancierMapper.java"
click node_pos_mapper "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/PointDeVenteMapper.java"
click node_workflow_service "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/InvoiceWorkflowService.java"
click node_workflow_delegates "https://github.com/lamjounah/billing-invoice/tree/main/src/main/java/ma/atos/billing/invoice/billing_invoice/workflow"
click node_event_publisher "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/InvoiceEventPublisher.java"
click node_payment_listener "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentResultListener.java"
click node_payment_events "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentRequestEvent.java"
click node_invoice_repo "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/InvoiceRepository.java"
click node_creditor_repo "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CreancierRepository.java"
click node_customer_repo "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CustomerRepository.java"
click node_pos_repo "https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/PointDeVenteRepository.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_invoice_api,node_workflow_api,node_creditor_api,node_pos_api,node_client toneBlue
class node_invoice_service,node_creditor_service,node_pos_service,node_invoice_mapper,node_creditor_mapper,node_pos_mapper,node_db toneAmber
class node_workflow_service,node_workflow_delegates,node_event_publisher,node_payment_listener,node_payment_events toneMint
class node_invoice_repo,node_creditor_repo,node_customer_repo,node_pos_repo toneRose
class node_camunda,node_broker,node_payment_service toneIndigo
```

## Components

### REST API

- [Invoice API](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceController.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceController.java`
- [Control API](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceWorkflowController.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/InvoiceWorkflowController.java`
- [Creditor API](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/CreancierController.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/CreancierController.java`
- [Point-of-sale API](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/PointDeVenteController.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/controllers/PointDeVenteController.java`

### Billing domain

- [Invoice service](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/InvoiceServiceImpl.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/InvoiceServiceImpl.java`
- [Creditor service](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/CreancierService.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/services/CreancierService.java`
- [Point-of-sale service](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/PointDeVenteServiceImp.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/services/imp/PointDeVenteServiceImp.java`
- [Invoice mapping](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/InvoiceMapper.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/InvoiceMapper.java`
- [Creditor mapping](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/CreancierMapper.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/CreancierMapper.java`
- [Point-of-sale mapping](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/PointDeVenteMapper.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/mappers/PointDeVenteMapper.java`

### Workflow and messaging

- [Invoice workflow service](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/services/InvoiceWorkflowService.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/services/InvoiceWorkflowService.java`
- [Validation delegates](https://github.com/lamjounah/billing-invoice/tree/main/src/main/java/ma/atos/billing/invoice/billing_invoice/workflow): `src/main/java/ma/atos/billing/invoice/billing_invoice/workflow`
- [Invoice event publisher](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/InvoiceEventPublisher.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/InvoiceEventPublisher.java`
- [Payment result listener](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentResultListener.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentResultListener.java`
- [Payment events](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentRequestEvent.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/messaging/PaymentRequestEvent.java`

### Persistence

- [Invoice repository](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/InvoiceRepository.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/repository/InvoiceRepository.java`
- [Creditor repository](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CreancierRepository.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CreancierRepository.java`
- [Customer repository](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CustomerRepository.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/repository/CustomerRepository.java`
- [Point-of-sale repository](https://github.com/lamjounah/billing-invoice/blob/main/src/main/java/ma/atos/billing/invoice/billing_invoice/repository/PointDeVenteRepository.java): `src/main/java/ma/atos/billing/invoice/billing_invoice/repository/PointDeVenteRepository.java`

### Other components

- **API client**
- **Camunda engine**
- **Message broker**
- **Payment service**
- **Relational database**

## Connections

- API client → Invoice API: calls
- API client → Control API: calls
- API client → Creditor API: calls
- API client → Point-of-sale API: calls
- Invoice API → Invoice service: invokes
- Control API → Invoice workflow service: invokes
- Creditor API → Creditor service: invokes
- Point-of-sale API → Point-of-sale service: invokes
- Invoice service → Invoice repository: reads/writes
- Invoice service → Customer repository: resolves customer
- Invoice service → Creditor repository: resolves creditor
- Invoice service → Point-of-sale repository: resolves point-of-sale
- Invoice service → Invoice mapping: maps
- Invoice service → Invoice event publisher: publishes
- Creditor service → Creditor repository: reads/writes
- Creditor service → Creditor mapping: maps
- Point-of-sale service → Point-of-sale repository: reads/writes
- Point-of-sale service → Point-of-sale mapping: maps
- Invoice workflow service → Camunda engine: starts process
- Payment result listener → Invoice service: updates status
- Invoice event publisher → Message broker: publishes events
- Message broker → Payment service: routes messages
- Payment service → Message broker: returns results
- Message broker → Payment result listener: delivers results
- Invoice repository → Relational database: reads/writes
- Creditor repository → Relational database: reads/writes
- Customer repository → Relational database: reads
- Point-of-sale repository → Relational database: reads/writes
