# byshivam/payments-api-testing architecture

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

- Interactive diagram: https://gitdiagram.com/byshivam/payments-api-testing
- Repository: https://github.com/byshivam/payments-api-testing

## Overview

Arya Bank’s fictional FastAPI/SQLite payments service is paired with a Java test suite designed to verify its API, business flows, ledger invariants, concurrency behavior, and consumer contract; a k6 scenario checks load and money conservation. The separate bug-hunt runner exercises planted defects and reports whether tests catch them. Java implementation details were not sampled, so test-module relationships below rely on README descriptions; unsampled modules are represented by exact paths from the tree.

Main entry points: [`app/arya_payments/main.py`](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/main.py) (HTTP API), [`app/arya_payments/bugs.py`](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/bugs.py) (Planted defects), [`scripts/bug_hunt.py`](https://github.com/byshivam/payments-api-testing/blob/main/scripts/bug_hunt.py) (Bug-hunt runner), [`app/arya_payments/money.py`](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/money.py) (Money parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_service["Payments service"]
  node_api["HTTP API<br/>[main.py]"]
  node_bugswitch["Planted defects<br/>[bugs.py]"]
end

subgraph group_storage["Money and storage"]
  node_money["Money parsing<br/>[money.py]"]
  node_sqlite[("SQLite ledger<br/>[db.py]")]
end

subgraph group_verification["Test suite"]
  node_api_tests["API tests"]
  node_bdd["BDD scenarios<br/>[PaymentSteps.java]"]
  node_db_tests["Ledger checks"]
  node_concurrency["Concurrency tests"]
  node_contract_consumer["Mobile consumer contract"]
  node_contract_provider["Provider verification"]
end

subgraph group_operations["Bug hunt and load"]
  node_load["Transfer load test<br/>[transfers.js]"]
  node_bug_hunt["Bug-hunt runner<br/>[bug_hunt.py]"]
end

node_client(("API clients"))

node_client -->|"calls endpoints"| node_api
node_api -->|"reads and writes"| node_sqlite
node_api -->|"parses amounts"| node_money
node_api -->|"checks switches"| node_bugswitch
node_money -->|"checks switch"| node_bugswitch
node_api_tests -->|"tests HTTP behavior"| node_api
node_bdd -->|"runs business flows"| node_api
node_db_tests -->|"checks ledger"| node_sqlite
node_concurrency -->|"tests parallel transfers"| node_api
node_contract_consumer -->|"checks expectations"| node_api
node_contract_provider -->|"verifies provider"| node_api
node_load -->|"sends transfers"| node_api
node_bug_hunt -->|"selects defects"| node_bugswitch
node_bug_hunt -->|"starts test runs"| node_api

click node_api "https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/main.py"
click node_money "https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/money.py"
click node_bugswitch "https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/bugs.py"
click node_sqlite "https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/db.py"
click node_api_tests "https://github.com/byshivam/payments-api-testing/tree/main/src/test/java/com/aryabank/payments/api"
click node_bdd "https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/bdd/PaymentSteps.java"
click node_db_tests "https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/db/LedgerIntegrityTest.java"
click node_concurrency "https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/api/ConcurrencyTest.java"
click node_contract_consumer "https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/contract/MobileAppConsumerPactTest.java"
click node_contract_provider "https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/contract/PaymentsProviderPactIT.java"
click node_load "https://github.com/byshivam/payments-api-testing/blob/main/load/transfers.js"
click node_bug_hunt "https://github.com/byshivam/payments-api-testing/blob/main/scripts/bug_hunt.py"

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_bugswitch,node_client toneBlue
class node_money,node_sqlite toneAmber
class node_api_tests,node_bdd,node_db_tests,node_concurrency,node_contract_consumer,node_contract_provider toneMint
class node_load,node_bug_hunt toneRose
```

## Components

### Payments service

- [HTTP API](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/main.py): `app/arya_payments/main.py`
- [Planted defects](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/bugs.py): `app/arya_payments/bugs.py`

### Money and storage

- [Money parsing](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/money.py): `app/arya_payments/money.py`
- [SQLite ledger](https://github.com/byshivam/payments-api-testing/blob/main/app/arya_payments/db.py): `app/arya_payments/db.py`

### Test suite

- [API tests](https://github.com/byshivam/payments-api-testing/tree/main/src/test/java/com/aryabank/payments/api): `src/test/java/com/aryabank/payments/api`
- [BDD scenarios](https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/bdd/PaymentSteps.java): `src/test/java/com/aryabank/payments/bdd/PaymentSteps.java`
- [Ledger checks](https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/db/LedgerIntegrityTest.java): `src/test/java/com/aryabank/payments/db/LedgerIntegrityTest.java`
- [Concurrency tests](https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/api/ConcurrencyTest.java): `src/test/java/com/aryabank/payments/api/ConcurrencyTest.java`
- [Mobile consumer contract](https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/contract/MobileAppConsumerPactTest.java): `src/test/java/com/aryabank/payments/contract/MobileAppConsumerPactTest.java`
- [Provider verification](https://github.com/byshivam/payments-api-testing/blob/main/src/test/java/com/aryabank/payments/contract/PaymentsProviderPactIT.java): `src/test/java/com/aryabank/payments/contract/PaymentsProviderPactIT.java`

### Bug hunt and load

- [Transfer load test](https://github.com/byshivam/payments-api-testing/blob/main/load/transfers.js): `load/transfers.js`
- [Bug-hunt runner](https://github.com/byshivam/payments-api-testing/blob/main/scripts/bug_hunt.py): `scripts/bug_hunt.py`

### Other components

- **API clients**

## Connections

- API clients → HTTP API: calls endpoints (evidence: `README.md`)
- HTTP API → SQLite ledger: reads and writes (evidence: `app/arya_payments/main.py`)
- HTTP API → Money parsing: parses amounts (evidence: `app/arya_payments/main.py`)
- HTTP API → Planted defects: checks switches (evidence: `app/arya_payments/main.py`)
- Money parsing → Planted defects: checks switch (evidence: `app/arya_payments/money.py`)
- API tests → HTTP API: tests HTTP behavior (evidence: `README.md`)
- BDD scenarios → HTTP API: runs business flows (evidence: `README.md`)
- Ledger checks → SQLite ledger: checks ledger (evidence: `README.md`)
- Concurrency tests → HTTP API: tests parallel transfers (evidence: `README.md`)
- Mobile consumer contract → HTTP API: checks expectations (evidence: `README.md`)
- Provider verification → HTTP API: verifies provider (evidence: `README.md`)
- Transfer load test → HTTP API: sends transfers (evidence: `load/transfers.js`)
- Bug-hunt runner → Planted defects: selects defects (evidence: `app/arya_payments/bugs.py`)
- Bug-hunt runner → HTTP API: starts test runs (evidence: `scripts/bug_hunt.py`)
