Skip to content

BiliqisO/payment-processing-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payment Processing System

A Rust-based payment processing system built with Axum web framework, featuring async/await throughout and PostgreSQL for data persistence.

Features

  • RESTful API for payment processing
  • Paystack payment gateway integration
  • PostgreSQL database with connection pooling
  • Async/await implementation with Tokio runtime
  • Modular gateway architecture for easy payment provider additions

Prerequisites

  • Rust (latest stable version)
  • PostgreSQL database
  • Environment variables configured (see Configuration section)

Quick Start

  1. Clone and setup

    git clone https://github.com/BiliqisO/payment-processing-system.git
    cd payment-processing-system
  2. Configure environment Create a .env file with:

    DATABASE_URL=postgresql://username:password@localhost/dbname
    PAYSTACK_SECRET_KEY=your_paystack_secret_key
    
  3. Build and run

    cargo build
    cargo run

The server will start on localhost:3000.

Development Commands

Building and Running

cargo build          # Build the project
cargo run            # Run the application
cargo check          # Check code without building
cargo run --release  # Run with optimizations

Code Quality

cargo fmt      # Format code
cargo clippy   # Run linter
cargo test     # Run tests

API Endpoints

Payment Processing

  • POST /pay - Initialize payment transaction
    {
      "user_id": "uuid",
      "email": "string",
      "amount": number
    }

Architecture

Core Structure

  • API Layer (src/api/): Axum HTTP handlers and routing
  • Database Layer (src/db/): SQLx models and schema definitions
  • Services Layer (src/services/): Business logic and payment gateway integrations
  • Configuration (src/config.rs): Environment-based app configuration

Database Models

  • User: UUID, email, timestamps
  • Wallet: User balance and currency tracking
  • Transaction: Payment records with gateway references

Payment Gateways

  • Paystack: Fully implemented with amount conversion (Naira to Kobo)
  • Modular design allows easy addition of new payment providers

Configuration

Required environment variables:

  • DATABASE_URL: PostgreSQL connection string
  • PAYSTACK_SECRET_KEY: Paystack API secret key

Contributing

When adding new features:

  1. Follow existing async patterns
  2. Use SQLx for database operations
  3. Implement proper error handling
  4. Add new payment gateways in src/services/gateways/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages