A simple banking API built with ASP.NET Core 6 and Entity Framework Core. It supports operations like deposits, withdrawals, transfers, balance history tracking, daily transaction limits, and transaction fee calculations.
- .NET 6 SDK
- SQL Server or SQL Server Express
- Postman or
curlfor testing
-
Clone the repository
git clone https://github.com/your-repo/digital-banking-api.git cd digital-banking-api -
Configure the Database Connection Edit
appsettings.json:"ConnectionStrings": { "DefaultConnection": "Server=localhost;Database=BankingDb;Trusted_Connection=True;" }
-
Apply EF Core Migrations
dotnet ef migrations add InitialCreate dotnet ef database update
-
Run the API
dotnet run
-
Visit Swagger UI at:
https://localhost:7044/swagger
curl -X POST https://localhost:7044/api/Customers \
-H "Content-Type: application/json" \
-d '{"firstName":"Juan","lastName":"Dela Cruz","email":"juan@example.com","phone":"09123456789"}'curl https://localhost:7044/api/Customerscurl https://localhost:7044/api/Customers/1curl -X POST https://localhost:7044/api/Accounts \
-H "Content-Type: application/json" \
-d '{"customerId":1,"accountType":"Savings"}'curl https://localhost:7044/api/Accountscurl https://localhost:7044/api/Accounts/1curl -X PUT https://localhost:7044/api/Accounts/status \
-H "Content-Type: application/json" \
-d '{"accountNumber":"10000001", "isActive": false}'curl -X POST https://localhost:7044/api/Transactions/deposit \
-H "Content-Type: application/json" \
-d '{"accountNumber":"10000001","amount":1000,"description":"Initial deposit"}'curl -X POST https://localhost:7044/api/Transactions/withdraw \
-H "Content-Type: application/json" \
-d '{"accountNumber":"10000001","amount":500,"description":"ATM withdraw"}'curl -X POST https://localhost:7044/api/Transactions/transfer \
-H "Content-Type: application/json" \
-d '{"fromAccount":"10000001","toAccount":"10000002","amount":200,"description":"Send money"}'curl https://localhost:7044/api/Transactions/history/10000001curl "https://localhost:7044/api/Transactions/search?accountNumber=10000001&amount=500"
curl "https://localhost:7044/api/Transactions/search?accountNumber=10000001&description=deposit"curl https://localhost:7044/api/Transactions/balance-history/10000001curl https://localhost:7044/api/Transactions/balance-history/export/10000001?format=csv
curl https://localhost:7044/api/Transactions/balance-history/export/10000001?format=pdf| Field | Type |
|---|---|
| Id | int (PK) |
| FirstName | string |
| LastName | string |
| string | |
| Phone | string |
| CreatedDate | datetime |
| Field | Type |
|---|---|
| Id | int (PK) |
| AccountNumber | string (unique) |
| CustomerId | int (FK) |
| AccountType | string |
| Balance | decimal(18,2) |
| DailyLimit | decimal(18,2) |
| IsActive | bool |
| CreatedDate | datetime |
| Field | Type |
|---|---|
| Id | int (PK) |
| FromAccountId | int (FK) |
| ToAccountId | int? (FK) |
| Amount | decimal(18,2) |
| TransactionType | string |
| Description | string |
| Timestamp | datetime |
| Status | string |
| Field | Type |
|---|---|
| Id | int (PK) |
| AccountId | int (FK) |
| Balance | decimal(18,2) |
| Timestamp | datetime |
| TransactionId | int? (FK) |
-
Daily Transaction Limit
- Each account has a
DailyLimitto restrict total outgoing transactions per day. - Transactions exceeding this amount return a 400 error.
- Each account has a
-
Transaction Fees
- A flat or tiered transaction fee is applied (e.g., transfer fees).
-
Balance History Tracking
- Balance snapshots are recorded after every transaction and can be exported.
-
Inactive Accounts
- Accounts marked as
IsActive = falseare blocked from transactions.
- Accounts marked as
-
Unique Account Numbers
- AccountNumber field is unique and indexed.
-
Currency
- All currency is represented in Philippine Peso (β±) using
decimal(18,2)format.
- All currency is represented in Philippine Peso (β±) using
{
"message": "Daily transaction limit exceeded. You can still transact β±2000.00 today."
}{
"message": "Account 10000001 is inactive and cannot perform transactions."
}{
"message": "Account with ID 99999 not found."
}{
"message": "Insufficient balance to complete the transaction."
}{
"message": "An unexpected error occurred. Please contact support."
}You can import the DigitalBankingAPI.postman_collection.json file into Postman for easy testing.
This project is open-source and free to use for educational or non-commercial projects.