Add development-only virtual card provisioning tools with Flask API endpoints#2
Conversation
|
🚅 Deployed to the bank-platform-pr-2 environment in beneficial-heart
|
Co-authored-by: Avonce901 <243675487+Avonce901@users.noreply.github.com>
Co-authored-by: Avonce901 <243675487+Avonce901@users.noreply.github.com>
@copilot ✅ STEP 1: ACCOUNTS ACTIVATED & CARDS PROVISIONEDStatus: COMPLETE ✅ STEP 2: VIRTUAL CARD DETAILSAll cards generated with: ✅ STEP 3: API ENDPOINTS AVAILABLEServer: Running on http://127.0.0.1:8001 ✅ STEP 4: NEXT ACTIONSTo access provisioning data:
======================================================================
|
|
@copilot (.venv-3) PS C:\Users\antho\project_root\output> python activate_and_provision |
The script needs to be run from the repository root with the full path: python scripts/activate_and_provision.pyFrom your current directory (
cd /path/to/bank-platform
python scripts/activate_and_provision.py
python C:\path\to\bank-platform\scripts\activate_and_provision.pyThe script file is |
|
@copilot Configuration: Scripts: Documentation: DEPLOYMENT OPTIONS (Choose One) [1] HEROKU Easiest (5 min) NEXT STEPS
STATUS: PRODUCTION READY (.venv-3) PS C:\Users\antho\project_root\output> Create superuser
(.venv-3) PS C:\Users\antho\project_root\output> cd "c:\Users\antho\project_root\output"; Write-Host @"
|
Implements simulated wallet provisioning infrastructure for development/testing: account activation, virtual card generation, and API endpoints for wallet payload retrieval. Adapted from Django requirements to Flask/SQLAlchemy architecture.
Database & Models
VirtualCardmodel with card metadata (last4, expiry, cardholder, provisioning token, status)Accountmodel via foreign keyCLI Provisioning Script
scripts/activate_and_provision.py- Creates/activates 3 accounts with $1M balance, generates virtual cards with simulated tokens:API Endpoint
GET /api/v1/cards/<card_id>/wallet_payload- Returns simulated provisioning payload:{ "card_id": "abc-123", "cardholder_name": "Test User", "last4": "1001", "exp_month": 11, "exp_year": 2028, "provisioning_token": "sim-token-...", "wallet_instructions": "Simulated payload. Use real provider for production." }Client Tools
scripts/provision_cards_via_api.py- Batch fetch wallet payloadsverify_api.py- Hardened API health check with timeout handling (5s/7s)scripts/test_provisioning_workflow.py- Automated validation of entire stackSafety
All scripts use defensive imports with try/except, won't crash on missing models. Explicit dev-only markings throughout.
Documentation
docs/DEV_PROVISIONING.md- Complete setup, usage, API reference, troubleshooting, production considerations.Original prompt
Add a safe, development-only feature set that: (1) activates or creates three accounts with $1,000,000 balance, (2) creates/provisions simulated virtual cards for those accounts, (3) exposes a dev API endpoint that returns a wallet-ready provisioning payload for a given card, and (4) includes small client scripts and a hardened verify_api helper. All changes are explicitly development/test only and include protective checks so they won't break if models or apps are named differently in the repository.
Files to add (adjust import paths to avoid failing if models are missing):