# iamngoni/ecocash architecture

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

- Interactive diagram: https://gitdiagram.com/iamngoni/ecocash
- Repository: https://github.com/iamngoni/ecocash

## Overview

Ecocash Payments SDK is a small Dart client library for C2B payments, transaction lookups, and refunds. Its documented workflow is to initialize the SDK with an API key and sandbox/live selection, submit a typed request through an operation, and handle the returned Result. The README documents the public operations and result handling, but no source excerpts were provided, so internal HTTP, serialization, and error-mapping relationships cannot be verified here.

Main entry points: [`lib/src/ecocash.dart`](https://github.com/iamngoni/ecocash/blob/master/lib/src/ecocash.dart) (Ecocash client), [`lib/src/models/result.dart`](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/result.dart) (Result handling), [`lib/src/models/payment_request.dart`](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/payment_request.dart) (Payment request), [`lib/src/models/lookup_request.dart`](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/lookup_request.dart) (Lookup request)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sdk["SDK runtime"]
  node_sdk_api["Ecocash client<br/>[ecocash.dart]"]
end

subgraph group_types["Domain types"]
  node_payments["Payment request"]
  node_lookup_request["Lookup request"]
  node_refund_request["Refund request"]
  node_lookup_response["Lookup response"]
  node_refund_response["Refund response"]
  node_result["Result handling<br/>[result.dart]"]
  node_exception["Structured errors"]
end

node_app(("Client application"))
node_ecocash_service{{"Ecocash service"}}

node_app -->|"initializes and invokes"| node_sdk_api
node_app -->|"builds request"| node_payments
node_sdk_api -->|"processes payments"| node_ecocash_service
node_sdk_api -->|"returns result"| node_result
node_app -->|"builds request"| node_lookup_request
node_sdk_api -->|"looks up transaction"| node_ecocash_service
node_sdk_api -->|"returns lookup data"| node_lookup_response
node_app -->|"builds request"| node_refund_request
node_sdk_api -->|"processes refund"| node_ecocash_service
node_sdk_api -->|"returns refund data"| node_refund_response
node_result -->|"contains error"| node_exception

click node_sdk_api "https://github.com/iamngoni/ecocash/blob/master/lib/src/ecocash.dart"
click node_payments "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/payment_request.dart"
click node_lookup_request "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/lookup_request.dart"
click node_refund_request "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/refund_request.dart"
click node_lookup_response "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/lookup_response.dart"
click node_refund_response "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/refund_response.dart"
click node_result "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/result.dart"
click node_exception "https://github.com/iamngoni/ecocash/blob/master/lib/src/models/ecocash_exception.dart"

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_sdk_api,node_app toneBlue
class node_payments,node_lookup_request,node_refund_request,node_lookup_response,node_refund_response,node_result,node_exception toneAmber
class node_ecocash_service toneIndigo
```

## Components

### SDK runtime

- [Ecocash client](https://github.com/iamngoni/ecocash/blob/master/lib/src/ecocash.dart): `lib/src/ecocash.dart`

### Domain types

- [Payment request](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/payment_request.dart): `lib/src/models/payment_request.dart`
- [Lookup request](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/lookup_request.dart): `lib/src/models/lookup_request.dart`
- [Refund request](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/refund_request.dart): `lib/src/models/refund_request.dart`
- [Lookup response](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/lookup_response.dart): `lib/src/models/lookup_response.dart`
- [Refund response](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/refund_response.dart): `lib/src/models/refund_response.dart`
- [Result handling](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/result.dart): `lib/src/models/result.dart`
- [Structured errors](https://github.com/iamngoni/ecocash/blob/master/lib/src/models/ecocash_exception.dart): `lib/src/models/ecocash_exception.dart`

### Other components

- **Client application**
- **Ecocash service**

## Connections

- Client application → Ecocash client: initializes and invokes (evidence: `README.md`)
- Client application → Payment request: builds request (evidence: `README.md`)
- Ecocash client → Ecocash service: processes payments (evidence: `README.md`)
- Ecocash client → Result handling: returns result (evidence: `README.md`)
- Client application → Lookup request: builds request (evidence: `README.md`)
- Ecocash client → Ecocash service: looks up transaction (evidence: `README.md`)
- Ecocash client → Lookup response: returns lookup data (evidence: `README.md`)
- Client application → Refund request: builds request (evidence: `README.md`)
- Ecocash client → Ecocash service: processes refund (evidence: `README.md`)
- Ecocash client → Refund response: returns refund data (evidence: `README.md`)
- Result handling → Structured errors: contains error (evidence: `README.md`)
