# itsofficialshrijan-svg/ozeats_payment_service architecture

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

- Interactive diagram: https://gitdiagram.com/itsofficialshrijan-svg/ozeats_payment_service
- Repository: https://github.com/itsofficialshrijan-svg/ozeats_payment_service

## Overview

OzEats Payment Service accepts payment API requests, validates and processes card or wallet payments, tracks payment status through authorization, capture, refund or payout, and stores payment records in memory. The main request path is server startup → Express app → payment routes → payment service → store. The service also simulates gateway authorization and calculates commission and restaurant/driver payouts; these behaviors are implemented together. The README documents the broader lifecycle and endpoints; no separate gateway or payout integration is shown in the sampled source.

Main entry points: [`src/services/paymentService.ts`](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/services/paymentService.ts) (Payment Service), [`src/routes/paymentRoutes.ts`](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/routes/paymentRoutes.ts) (Payment Routes), [`src/app.ts`](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/app.ts) (Express App), [`src/data/store.ts`](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/data/store.ts) (In-memory Store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["HTTP Runtime"]
  node_server["HTTP Server<br/>[server.ts]"]
  node_app["Express App<br/>[app.ts]"]
  node_routes["Payment Routes<br/>[paymentRoutes.ts]"]
end

subgraph group_payments["Payment Domain"]
  node_service["Payment Service<br/>[paymentService.ts]"]
  node_types["Payment Contracts<br/>[payment.ts]"]
end

subgraph group_state["Payment State"]
  node_store[("In-memory Store<br/>[store.ts]")]
end

node_customer(("API Client"))

node_customer -->|"calls API"| node_routes
node_server -->|"starts"| node_app
node_app -->|"mounts"| node_routes
node_routes -->|"dispatches"| node_service
node_service -->|"reads and writes"| node_store
node_service -->|"uses contracts"| node_types
node_store -->|"stores payments"| node_types

click node_server "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/server.ts"
click node_app "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/app.ts"
click node_routes "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/routes/paymentRoutes.ts"
click node_service "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/services/paymentService.ts"
click node_store "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/data/store.ts"
click node_types "https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/types/payment.ts"

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_server,node_app,node_routes,node_customer toneBlue
class node_service,node_types toneAmber
class node_store toneMint
```

## Components

### HTTP Runtime

- [HTTP Server](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/server.ts): `src/server.ts`
- [Express App](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/app.ts): `src/app.ts`
- [Payment Routes](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/routes/paymentRoutes.ts): `src/routes/paymentRoutes.ts`

### Payment Domain

- [Payment Service](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/services/paymentService.ts): `src/services/paymentService.ts`
- [Payment Contracts](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/types/payment.ts): `src/types/payment.ts`

### Payment State

- [In-memory Store](https://github.com/itsofficialshrijan-svg/ozeats_payment_service/blob/main/src/data/store.ts): `src/data/store.ts`

### Other components

- **API Client**

## Connections

- API Client → Payment Routes: calls API (evidence: `README.md`)
- HTTP Server → Express App: starts (evidence: `src/server.ts`)
- Express App → Payment Routes: mounts (evidence: `src/app.ts`)
- Payment Routes → Payment Service: dispatches (evidence: `src/routes/paymentRoutes.ts`)
- Payment Service → In-memory Store: reads and writes (evidence: `src/services/paymentService.ts`)
- Payment Service → Payment Contracts: uses contracts (evidence: `src/services/paymentService.ts`)
- In-memory Store → Payment Contracts: stores payments (evidence: `src/data/store.ts`)
