## Major Features Added: - **Stripe Disable/Enable**: Added per-shop Stripe enable/disable functionality similar to crypto currencies - **Shop-themed Link Styling**: Implemented comprehensive link theming system using CSS classes - **Responsive Checkout Layout**: Simplified checkout page to always use single-column responsive design ## Database Changes: - Added `stripe_enabled` column to `mps_shop` table (defaults to enabled) - Created Alembic migration with proper SQLite `server_default="1"` handling ## Template Updates: - **Shop Settings**: Added Stripe disable/re-enable buttons with proper conditional logic - **Checkout Page**: Simplified to single-column responsive layout (640px max, mobile-friendly) - **Link Theming**: Added `shop-theme-link-color` class to all product/shop links across templates - **Button Consistency**: Standardized all "Update" buttons to "Save" in shop settings ## Code Architecture: - **Request Methods**: Added `request.stripe_globally_enabled` for clean separation of global vs per-shop settings - **DRY Refactor**: Made `request.stripe_enabled` use `request.stripe_globally_enabled` to eliminate code duplication - **CSS Grid Only**: Removed flexbox usage, enforced CSS Grid for all layouts per project standards ## Bug Fixes: - Fixed "refund pending" messages showing incorrectly for `underpaid-not-refunded` status - Fixed economically unviable refund emails showing incorrect "no fees deducted" messages - Fixed checkout page horizontal scrolling issues on mobile/desktop - Fixed CSS specificity issues with global link styles overriding shop themes ## Documentation: - **CLAUDE.md**: Added comprehensive database migration guide with SQLite best practices - **CSS Requirements**: Documented CSS Grid-only layout policy - **Migration Examples**: Added server_default examples for SQLite column additions ## Templates Modified: - cart.j2, cart_checkout.j2, shop_settings.j2, crypto_quotes_history.j2 - All template files updated with consistent shop-theme-link-color classes - Ribbon snippet updated with proper CSS class definitions This update provides shop owners full control over their Stripe payment acceptance while maintaining backwards compatibility and improving overall user experience.
6.7 KiB
Claude Development Notes
Project Setup
This project uses a Makefile for most development operations. Use make commands instead of running tools directly.
Common Development Tasks
Testing
- Run tests:
make test- This installs development dependencies and runs the test suite with py.test
- Tests are located in
make_post_sell/tests/
Installation & Setup
- Install from source for development:
make install-from-source - Install from PyPI:
make install-from-pypi - Initialize database:
make init-db
Development Server
- Start development server:
make serve- Runs with auto-reload enabled
- Uses
data/development.iniconfiguration
Environment Management
- Create virtual environment:
make venv - Clean up environment:
make clean - Activate environment:
source env/bin/activate
Code Structure
Key Directories
make_post_sell/views/- View controllersmake_post_sell/models/- Database modelsmake_post_sell/tests/- Test suite
Important Files
make_post_sell/views/cart.py- Cart and checkout logicdevelopment.ini- Configuration file
Testing Notes
The project uses pytest with unittest framework. There are three types of tests:
Test Types
- Unit tests (
test_models.py) - Test individual model methods and properties in isolation - Integration tests (
test_integration.py) - Test interactions between models and business logic - Functional tests (
test_functional.py) - End-to-end tests through the web interface
Running Tests
Before running tests: Source environment variables with source vars.sh to set required Stripe API keys and other configuration.
# Run all tests
make test
# Run specific test types
env/bin/py.test make_post_sell/tests/test_models.py # Unit tests
env/bin/py.test make_post_sell/tests/test_integration.py # Integration tests
env/bin/py.test make_post_sell/tests/test_functional.py # Functional tests
# Run with coverage
env/bin/py.test --cov=make_post_sell.models.cart --cov-report=term-missing make_post_sell/tests/test_models.py::TestCart
Current Coverage
- Cart model unit tests cover critical business logic like
requires_paymentthreshold (64 cents) - Integration tests verify the original AttributeError bug fix for free coupon checkout
- Functional tests provide end-to-end coverage of cart/checkout/payment flows
Database Location
The SQLite database is located at: data/make_post_sell.sqlite
CRITICAL WARNING: NEVER delete or remove database files without explicit user permission. The database contains production data and cannot be easily recovered. Always ask before any destructive operations.
MANDATORY: ALWAYS create a backup of the database before any database operations (migrations, schema changes, etc.):
cp data/make_post_sell.sqlite data/make_post_sell.sqlite.backup-$(date +%Y%m%d-%H%M%S)
Query crypto payments:
-- Note: Remove dashes from UUIDs when querying
SELECT * FROM mps_crypto_payment WHERE id = 'paymentuuidherewithoutdashes';
Database Migrations
When making changes to database models, always create Alembic migrations:
Creating Migrations
# Activate environment first
source env/bin/activate
# Create a new migration
alembic -c data/development.ini revision -m "description of change"
# Edit the generated migration file in make_post_sell/scripts/alembic/versions/
# Add your upgrade() and downgrade() logic
# Apply the migration
alembic -c data/development.ini upgrade head
Migration Commands
# Check current database revision
alembic -c data/development.ini current
# View migration history
alembic -c data/development.ini history
# Upgrade to latest
alembic -c data/development.ini upgrade head
# Auto-generate migration from model changes (review before applying!)
alembic -c data/development.ini revision --autogenerate -m "auto-generated changes"
Important Migration Notes
SQLite Column Defaults: When adding NOT NULL columns with defaults to existing tables in SQLite, use server_default with raw SQL values:
# Correct - uses server_default for raw SQL
op.add_column(
"mps_shop",
sa.Column("stripe_enabled", sa.Boolean(), nullable=False, server_default="1"),
)
# Wrong - default won't work with existing data
op.add_column(
"mps_shop",
sa.Column("stripe_enabled", sa.Boolean(), nullable=False, default=True),
)
Cryptocurrency RPC Access
Monero Wallet RPC
When debugging or manually testing Monero RPC calls, use digest authentication with these credentials (from Makefile):
- Username:
test_user - Password:
test_pass - URL:
http://127.0.0.1:18083/json_rpc
Example curl command with digest auth:
curl --digest -u "test_user:test_pass" -X POST http://127.0.0.1:18083/json_rpc \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":"0","method":"get_transfer_by_txid","params":{"txid":"transaction_hash_here"}}'
Dogecoin Core RPC
Dogecoin uses basic authentication (from dogecoin.conf):
- Username:
mps_doge_user - Password:
change_this_password_in_production - URL:
http://127.0.0.1:22555
Common Issues and Solutions
UUID Objects
Always use uuid_str when you need a string copy of the identifier. Models inherit uuid_str property from RBase.
IMPORTANT: UUIDs are stored in the database WITHOUT dashes. When querying by ID, remove dashes from the UUID:
- Correct:
WHERE id = '0f92cd2a86f54dc1b98ef5c8b37bc7f8' - Wrong:
WHERE id = '0f92cd2a-86f5-4dc1-b98e-f5c8b37bc7f8'
Development Standards and Expectations
CRITICAL WORK ETHIC: The user pays significant money for development work and expects thorough, complete solutions. NEVER try to do the minimum or cut corners. When asked to implement features, provide comprehensive, production-ready implementations that consider all aspects of the request.
CSS LAYOUT REQUIREMENTS: This project uses CSS Grid exclusively for layout. NEVER use Flexbox (flex) for layout. Always use CSS Grid properties for positioning and alignment.
TESTING INTEGRITY: NEVER skip, delete, or disable unit tests or integration tests when they break. When tests fail:
- FIX THE TESTS - Update them to work with new functionality
- FIX THE CODE - If the tests reveal actual bugs, fix the underlying issue
- ADD MORE TESTS - Ensure new functionality is properly covered
Disabling or removing tests weakens the codebase and is unacceptable. Tests are critical safety nets that prevent regressions.
Commit Message Guidelines
CRITICAL: Do not include Claude Code attribution in commit messages. Attributing human work to Claude is inappropriate and misrepresents the actual authorship of the code. All code changes should be attributed to the human developer who reviewed, approved, and committed the work.