# bareltinc/internshipentrytask architecture

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

- Interactive diagram: https://gitdiagram.com/bareltinc/internshipentrytask
- Repository: https://github.com/bareltinc/internshipentrytask

## Overview

The product is a .NET payment service that accepts operations, schedules submissions to an external provider, records provider receipts and exposes operation state and event history. The main workflow is routed by Program.cs; PaymentWorker owns queued and retrying submission, while ProviderClient performs the HTTP request. SQLite persists operations and event records. The sampled source shows these principal calls and routes; the provider and client are external actors, and no independent durable queue is shown.

Main entry points: [`Program.cs`](https://github.com/bareltinc/internshipentrytask/blob/main/Program.cs) (HTTP routes), [`Data/AppDbContext.cs`](https://github.com/bareltinc/internshipentrytask/blob/main/Data/AppDbContext.cs) (EF database context), [`Services/PaymentWorker.cs`](https://github.com/bareltinc/internshipentrytask/blob/main/Services/PaymentWorker.cs) (Payment worker), [`Services/ProviderClient.cs`](https://github.com/bareltinc/internshipentrytask/blob/main/Services/ProviderClient.cs) (Provider client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Payment API"]
  node_api["HTTP routes<br/>[Program.cs]"]
  node_operation_dto["Operation DTOs<br/>[OperationDTO.cs]"]
end

subgraph group_processing["Payment Processing"]
  node_worker["Payment worker<br/>[PaymentWorker.cs]"]
  node_provider_client["Provider client<br/>[ProviderClient.cs]"]
  node_provider_dto["Provider DTOs<br/>[ProviderDTO.cs]"]
end

subgraph group_persistence["Persistence Model"]
  node_db_context["EF database context<br/>[AppDbContext.cs]"]
  node_sqlite[("SQLite database")]
  node_operation["Payment operation<br/>[Operation.cs]"]
  node_event["Operation event<br/>[OperationEvent.cs]"]
end

node_client(("Payment client"))
node_provider["Payment provider"]

node_client -->|"sends requests"| node_api
node_api -->|"accepts payloads"| node_operation_dto
node_api -->|"reads and writes"| node_db_context
node_api -->|"creates and updates"| node_operation
node_api -->|"records transitions"| node_event
node_api -->|"enqueues submission"| node_worker
node_worker -->|"loads and saves"| node_db_context
node_worker -->|"submits payment"| node_provider_client
node_worker -->|"processes state"| node_operation
node_provider_client -->|"builds request"| node_provider_dto
node_provider_client -->|"posts payment"| node_provider
node_provider -.->|"posts receipt"| node_api
node_db_context -->|"persists records"| node_sqlite
node_db_context -->|"maps entity"| node_operation
node_db_context -->|"maps entity"| node_event

click node_api "https://github.com/bareltinc/internshipentrytask/blob/main/Program.cs"
click node_operation_dto "https://github.com/bareltinc/internshipentrytask/blob/main/DTOs/OperationDTO.cs"
click node_worker "https://github.com/bareltinc/internshipentrytask/blob/main/Services/PaymentWorker.cs"
click node_provider_client "https://github.com/bareltinc/internshipentrytask/blob/main/Services/ProviderClient.cs"
click node_provider_dto "https://github.com/bareltinc/internshipentrytask/blob/main/DTOs/ProviderDTO.cs"
click node_db_context "https://github.com/bareltinc/internshipentrytask/blob/main/Data/AppDbContext.cs"
click node_operation "https://github.com/bareltinc/internshipentrytask/blob/main/Models/Operation.cs"
click node_event "https://github.com/bareltinc/internshipentrytask/blob/main/Models/OperationEvent.cs"

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_api,node_operation_dto,node_client toneBlue
class node_worker,node_provider_client,node_provider_dto toneAmber
class node_db_context,node_sqlite,node_operation,node_event toneMint
class node_provider toneIndigo
```

## Components

### Payment API

- [HTTP routes](https://github.com/bareltinc/internshipentrytask/blob/main/Program.cs): `Program.cs`
- [Operation DTOs](https://github.com/bareltinc/internshipentrytask/blob/main/DTOs/OperationDTO.cs): `DTOs/OperationDTO.cs`

### Payment Processing

- [Payment worker](https://github.com/bareltinc/internshipentrytask/blob/main/Services/PaymentWorker.cs): `Services/PaymentWorker.cs`
- [Provider client](https://github.com/bareltinc/internshipentrytask/blob/main/Services/ProviderClient.cs): `Services/ProviderClient.cs`
- [Provider DTOs](https://github.com/bareltinc/internshipentrytask/blob/main/DTOs/ProviderDTO.cs): `DTOs/ProviderDTO.cs`

### Persistence Model

- [EF database context](https://github.com/bareltinc/internshipentrytask/blob/main/Data/AppDbContext.cs): `Data/AppDbContext.cs`
- **SQLite database**
- [Payment operation](https://github.com/bareltinc/internshipentrytask/blob/main/Models/Operation.cs): `Models/Operation.cs`
- [Operation event](https://github.com/bareltinc/internshipentrytask/blob/main/Models/OperationEvent.cs): `Models/OperationEvent.cs`

### Other components

- **Payment client**
- **Payment provider**

## Connections

- Payment client → HTTP routes: sends requests (evidence: `Program.cs`)
- HTTP routes → Operation DTOs: accepts payloads (evidence: `Program.cs`)
- HTTP routes → EF database context: reads and writes (evidence: `Program.cs`)
- HTTP routes → Payment operation: creates and updates (evidence: `Program.cs`)
- HTTP routes → Operation event: records transitions (evidence: `Program.cs`)
- HTTP routes → Payment worker: enqueues submission (evidence: `Program.cs`)
- Payment worker → EF database context: loads and saves (evidence: `Services/PaymentWorker.cs`)
- Payment worker → Provider client: submits payment (evidence: `Services/PaymentWorker.cs`)
- Payment worker → Payment operation: processes state (evidence: `Services/PaymentWorker.cs`)
- Provider client → Provider DTOs: builds request (evidence: `Services/ProviderClient.cs`)
- Provider client → Payment provider: posts payment (evidence: `Services/ProviderClient.cs`)
- Payment provider → HTTP routes: posts receipt (evidence: `Program.cs`)
- EF database context → SQLite database: persists records
- EF database context → Payment operation: maps entity (evidence: `Data/AppDbContext.cs`)
- EF database context → Operation event: maps entity (evidence: `Data/AppDbContext.cs`)
