Skip to content

A .NET 9 Web API system that aggregates customer financial transaction data from multiple mock data sources and categorizes the transactions. Containerized with Docker and fully Swagger-documented.

Notifications You must be signed in to change notification settings

Yoda-Mag/transaction-aggregation-api-dotnet

Repository files navigation

Transaction Aggregation API

A .NET 9 Web API for aggregating customer transactions from multiple bank sources. Supports fetching transactions, querying by customer, and aggregating totals by category, source, and direction (money in/out).


Table of Contents


Features

  • Retrieve all customers
  • Retrieve all transactions
  • Retrieve transactions by customer
  • Aggregate transactions by category, source, and money direction (in/out)
  • Swagger UI for interactive testing
  • Dockerized for easy deployment

Technologies

  • .NET 9 Web API
  • C#
  • Dependency Injection
  • Docker
  • Swagger (OpenAPI)

Getting Started

Prerequisites

Clone the Repository

git clone https://github.com/Yoda-Mag/transaction-aggregation-api-dotnet.git
cd transaction-aggregation-api-dotnet/ProjectsTransactionAggregation/TransactionAggregationApi

Running the API

Running Locally

  1. Build the project
   dotnet build
  1. Run the application
   dotnet run
  1. Access the API

    • HTTPS → https://localhost:5139
    • HTTP → http://localhost:5138
  2. Swagger UI

    • Visit: https://localhost:5139/swagger/index.html

API Endpoints

Method Endpoint Description
GET /api/customers Get all customers
GET /api/transactions/all Get all transactions
GET /api/transactions/customer/{customerId} Get transactions for a specific customer
GET /api/transactions/aggregate/category Get total and count of transactions per category
GET /api/transactions/aggregate/source-by-month Get totals per source, grouped by month
GET /api/transactions/aggregate/moneyIn Get total amount and count of all incoming funds
GET /api/transactions/aggregate/moneyOut Get total amount and count of all outgoing funds

Example Requests

Get All Transactions

curl -X GET "https://localhost:5139/api/transactions/all"

Get Transactions by Customer

curl -X GET "https://localhost:5139/api/transactions/customer/{customerId}"

Aggregate by Category

curl -X GET "https://localhost:5139/api/transactions/aggregate/category"

Docker

Build Docker Image

docker build -t transaction-aggregation-api .

Run Container

docker run -d -p 8081:8080 transaction-aggregation-api

API will be available at:
-> http://localhost:8081

Swagger (inside Docker):
-> http://localhost:8081/swagger/index.html


Docker Compose

Build and Run:

docker-compose up -d --build

Stop Services:

docker-compose down

Access via Docker Compose:
-> http://localhost:8081


Future Enhancements

  • Add unit and integration tests
  • Introduce global exception handling middleware
  • Add structured logging and request monitoring
  • Enable filtering/sorting by date range or amount
  • Integrate with a SQL or NoSQL database
  • Add authentication & authorization (JWT or OAuth)
  • Introduce caching for performance
  • Add CI/CD pipeline (GitHub Actions)

Author

Letlhogonolo Magano
Final Year IT Student | Backend & Data Enthusiast

GitHub


About

A .NET 9 Web API system that aggregates customer financial transaction data from multiple mock data sources and categorizes the transactions. Containerized with Docker and fully Swagger-documented.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published