Banks Module - Payment Service Providers (PSPs)

Overview

The Banks module contains four Payment Service Provider (PSP) implementations that simulate real banking services in the SAMPARK ecosystem. Each bank provides core banking functionality including account management, card services, and payment processing.

Bank Services

1. Paisa Vasool Bank (Port: 3004)

  • IIN: 321987

  • IFSC Prefix: PVB

  • Sponsored TPAP: BazzarPe

  • Specialty: Merchant payments & marketplace solutions

  • Branch: Thoda Aur Refill Branch

2. Babu Rao Ganpatrao Bank (Port: 3001)

  • IIN: 654321

  • IFSC Prefix: BRG

  • Sponsored TPAP: ChillarPay

  • Specialty: P2P transfers & micro-payments

  • Branch: Hera Pheri Main Branch

3. Chinta Mat Karo Bank (Port: 3003)

  • IIN: 456123

  • IFSC Prefix: CMK

  • Sponsored TPAP: Available for sponsorship

  • Specialty: Worry-free banking solutions

4. Chai Pani Bank (Port: 3002)

  • IIN: 789456

  • IFSC Prefix: CPB

  • Sponsored TPAP: Available for sponsorship

  • Specialty: Micro-transaction specialists

Common Architecture

Each bank service follows a standardized architecture:

Technology Stack

  • Runtime: Bun

  • Framework: Express.js + TypeScript

  • Database: PostgreSQL with Prisma ORM

  • Caching: Redis Stack

  • Messaging: Kafka integration

Service Dependencies

  • PostgreSQL database (dedicated per bank)

  • Redis Stack instance (dedicated per bank)

  • Kafka cluster (shared)

  • NTH service (for inter-bank transactions)

API Endpoints

All banks implement the same REST API structure:

Account Management

Create New Account

Response:

Card Management

Create New Card

Update Card PIN

Data Models

Account Model

Card Model

Database Configuration

Each bank has its own PostgreSQL database:

Connection Details

  • Host: {bank-name}-db

  • Port: 5432

  • Database: {bank_name}_db

  • User: {bank_name}_user

  • Password: {bank_name}_password

Prisma Commands

Redis Configuration

Each bank has a dedicated Redis instance:

Connection Details

  • Host: {bank-name}-redis-stack

  • Port: 6379 (internal), mapped to unique external ports

  • Web UI: Available on mapped port + 1

Usage

  • Session management

  • Transaction caching

  • Rate limiting

  • Temporary data storage

Environment Variables

Development Setup

Individual Bank Development

  1. Navigate to bank directory:

  1. Install dependencies:

  1. Set up environment:

  1. Run database migrations:

  1. Start development server:

Docker Development

Start specific bank service:

View logs:

Integration with NTH

Banks integrate with the National Transaction Hub for:

  • Inter-bank fund transfers

  • Transaction routing

  • Settlement processing

  • Status notifications

Kafka Topics

  • bank.{bank-name}.transactions.outbound

  • bank.{bank-name}.transactions.inbound

  • bank.{bank-name}.settlements

Testing

Each bank includes comprehensive test suites:

Monitoring & Observability

Health Checks

Each bank exposes health check endpoints:

Metrics

Integration with Prometheus for monitoring:

  • Transaction volumes

  • Response times

  • Error rates

  • Database connections

Security Features

  • Input validation and sanitization

  • Rate limiting

  • PIN encryption

  • Secure headers

  • CORS configuration

  • Request logging

Error Handling

Standardized error responses:

Performance Optimization

  • Redis caching for frequent queries

  • Database connection pooling

  • Optimized Prisma queries

  • Async processing for non-critical operations

Last updated