A .NET 9 application for managing credit cards and transactions with secure API endpoints.
- .NET 9 SDK
 - PostgreSQL (Choose one option):
- PostgreSQL installed locally
 - Docker for running PostgreSQL in a container
 
 
git clone https://github.com/appitoriadev/RapidPay.git
cd RapidPaydocker run --env=POSTGRES_USER=postgres \
    --env=POSTGRES_PASSWORD=admin123 \
    --env=POSTGRES_DB=rapidpay \
    -p 5432:5432 \
    --name rapidPay \
    -d postgres- Install PostgreSQL from the official website
 - Create a new database:
 
CREATE DATABASE rapidpay;- Navigate to 
Rapidpay.API/appsettings.Development.json - Update the connection string if needed:
 
{
  "ConnectionStrings": {
    "RapidPayDbConnection": "Host=localhost;Port=5432;Database=rapidpay;Username=postgres;Password=admin123"
  }
}- For first-time setup, enable database seeding by setting:
 
{
  "DbPopulate": true
}# Navigate to the API project directory
cd Rapidpay.API
# Apply migrations
dotnet ef database update# Build the solution
dotnet build
# Run the application
dotnet run --project Rapidpay.APIThe API will be available at:
- HTTPS: https://localhost:7158
 - HTTP: http://localhost:5158
 - Swagger UI: https://localhost:7158/swagger/index.html
 
dotnet testThe API provides the following main endpoints with example requests:
- POST 
/api/auth/register- Register a new user 
{
  "username": "Jane Doe",
  "password": "password345"
}- POST 
/api/auth/login- Login and get JWT token 
{
  "username": "Jane Doe",
  "password": "password345"
}- POST 
/api/auth/refresh- Refresh JWT token 
- POST 
/api/cards- Create a new card 
{
  "userId": 2,
  "cardNumber": "1234567890120000",
  "expiryMonth": "03",
  "expiryYear": "2035",
  "cvv": "123",
  "cardHolderName": "Jane Doe",
  "balance": 2500,
  "cardType": 1,
  "cardBrand": 1
}- GET 
/api/cards/{id}- Get card by ID - GET 
/api/cards/user/{userId}- Get user's cards 
- POST 
/api/transactions- Create a new transaction 
{
  "cardId": 2,
  "amount": 105.0,
  "currency": "USD",
  "description": "test"
}- GET 
/api/transactions/{id}- Get transaction by ID - GET 
/api/transactions/card/{cardId}- Get card's transactions 
When DbPopulate is set to true, the following test data will be created:
- 
Test User:
- Email: [email protected]
 - Password: Test123!
 
 - 
Test Card:
- Card Number: 1234567890123456
 - Expiry: 12/25
 - CVV: 123
 
 
- 
The JWT secret key in appsettings is for development only. In production:
- Use a secure key management system
 - Never commit production keys to source control
 - Use different keys for different environments
 
 - 
Update the default database password in production
 
- 
Database Connection Issues:
- Verify PostgreSQL is running: 
docker psorpg_isready - Check connection string in appsettings
 - Ensure port 5432 is not in use
 
 - Verify PostgreSQL is running: 
 - 
Migration Issues:
# Remove existing migrations dotnet ef migrations remove # Add new migration dotnet ef migrations add InitialCreate # Update database dotnet ef database update
 - 
Common Issues:
- If you get a certificate error, you may need to trust the development certificate:
dotnet dev-certs https --trust
 - If the database is not accessible, ensure PostgreSQL is running and the port is not blocked
 - For JWT token issues, check that the system time is correct and the token hasn't expired
 
 - If you get a certificate error, you may need to trust the development certificate:
 
- Fork the repository
 - Create a feature branch
 - Commit your changes
 - Push to the branch
 - Create a Pull Request
 
This project is licensed under the MIT License - see the LICENSE file for details