Contributing¶
Development Setup¶
git clone https://github.com/danangharissetiawan/django-subscription-midtrans.git
cd django-subscription-midtrans
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Running Tests¶
python manage.py test subscriptions.tests
Or with specific test modules:
python manage.py test subscriptions.tests.test_models
python manage.py test subscriptions.tests.test_services
python manage.py test subscriptions.tests.test_views
python manage.py test subscriptions.tests.test_client
python manage.py test subscriptions.tests.test_middleware
Code Structure¶
subscriptions/models.py— All Django modelssubscriptions/services.py— Business logic (SubscriptionService, WalletService)subscriptions/client.py— Midtrans API clientsubscriptions/views.py— DRF ViewSets and API viewssubscriptions/serializers.py— DRF serializerssubscriptions/signals.py— Django signalssubscriptions/tasks.py— Celery taskssubscriptions/middleware.py— Subscription access middlewaresubscriptions/admin.py— Django Unfold adminsubscriptions/tests/— Test suite with factories
Testing Conventions¶
Use
factories.pyfor test data (Django model factories)Mock Midtrans API calls in service tests
Test both success and failure paths
Test signal dispatch
Pull Requests¶
Fork the repository
Create a feature branch (
git checkout -b feature/your-feature)Write tests for new functionality
Ensure all tests pass
Submit a pull request
Reporting Issues¶
Open an issue on GitHub with:
Python and Django version
Steps to reproduce
Expected vs actual behavior
Relevant logs or tracebacks