You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SwiftPay is a mobile-first payment application that enables users to send money, pay bills, and manage their finances securely and instantly — all from their smartphone. Once completed, SwiftPay will allow individuals to transfer funds between accounts, track spending, and receive real-time transaction notifications without needing a traditional bank branch.
📄 Project Documents
Assignment 3 — System Specification & Architecture
Branch protection rules explanation and setup guide
How to Run Tests Locally
git clone https://github.com/YOUR_USERNAME/SwiftPay.git
cd SwiftPay
python3 --version # Requires Python 3.10+
python3 tests/run_all_tests.py # Runs all 41 tests — no pip install needed
How the CI/CD Pipeline Works
Every push triggers the test job which runs all 4 test suites. If all pass, and the push is to main, the release job builds a zip artifact and creates a GitHub Release automatically. PRs to main are blocked from merging unless the test job passes.
The RepositoryFactory was chosen over Dependency Injection frameworks because SwiftPay uses Python's stdlib only — no Spring, no FastAPI, no DI container. The factory provides the same decoupling benefit (storage backend swappable by changing one string) with zero external dependencies. The SWIFTPAY_STORAGE environment variable controls which backend is used at runtime.
Assignment 10 — From Class Diagrams to Code + Creational Patterns
Full Python implementation of all 7 domain classes (User, Wallet, Transaction, Notification, OTP, Session, AuditLog) translated from the UML class diagram
Full change log tracking all Assignment 10 progress
Language Choice
Python 3.10+ was chosen because:
The class diagram maps cleanly to Python's dataclass-style classes and Enum types
Python's abc.ABC and @abstractmethod support the Factory Method and Abstract Factory patterns natively
threading.Lock provides the concurrency primitives needed for a thread-safe Singleton
copy.deepcopy makes the Prototype pattern trivial to implement correctly
No compilation step — tests run immediately with python3 tests/run_tests.py
Creational Pattern Rationale
Pattern
Applied To
Justification
Simple Factory
NotificationFactory
5 notification types share identical construction logic but differ only in title/body templates. Centralising creation eliminates copy-pasted template strings across the codebase.
Each payment type has different validation rules (balance check, required fields). Delegating to subclasses keeps each processor focused without a monolithic if/else chain.
The system must swap the entire notification stack (FCM + SendGrid) between production and test environments. The Abstract Factory guarantees all products come from the same family — no accidental real FCM calls in unit tests.
Builder
UserBuilder
User creation involves mandatory field validation, optional activation, optional wallet credit, and password hashing. A builder enforces the construction sequence and prevents partially-built User objects from being used.
Prototype
TransactionPrototypeCache
Creating a Transaction with correct defaults (currency, type, initial status) is repetitive. The cache stores validated templates and produces independent deep-copied clones, guaranteeing each transaction starts from a known-good state.
Singleton
DatabaseConnectionPool
Multiple connection pool instances would exhaust database connections and cause race conditions. One pool, created once, reused everywhere — with thread-safe double-checked locking for concurrent access safety.
Domain model for 7 entities: User, Wallet, Transaction, Notification, OTP, AuditLog, Session — with attributes, methods, relationships, and 15 business rules
Full UML class diagram in Mermaid.js with 10 classes, 3 interfaces, 9 enumerations, composition/inheritance/association relationships, multiplicity, and design decision explanations
Activity workflow diagrams for 8 workflows: Registration, Login, P2P Transfer, Password Reset, Bill Payment, Admin Suspend, Top Up, Transaction History