Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
05659ebd
Commit
05659ebd
authored
Apr 16, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add refactoring summary for payment settings reorganization
parent
7ea471cc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
181 additions
and
0 deletions
+181
-0
REFACTORING_SUMMARY.md
REFACTORING_SUMMARY.md
+181
-0
No files found.
REFACTORING_SUMMARY.md
0 → 100644
View file @
05659ebd
# Payment Settings Refactoring - Summary
## Changes Made
### 1. API Tokens Navigation Link - Hidden for Config Admin
**File**
:
`templates/base.html`
**Change**
: Wrapped API Tokens link with
`{% if request.session.user_id %}`
condition
**Before**
:
```
html
<a
href=
"{{ url_for(request, '/dashboard/user/tokens') }}"
>
API Tokens
</a>
```
**After**
:
```
html
{% if request.session.user_id %}
<a
href=
"{{ url_for(request, '/dashboard/user/tokens') }}"
>
API Tokens
</a>
{% endif %}
```
**Reason**
:
-
Config admin user (defined in
`aisbf.json`
) has
`user_id = None`
-
Database users have a valid
`user_id`
-
API tokens are user-specific, so config admin doesn't need this link
### 2. Payment Gateway Settings - Moved to Payment Settings Page
**From**
:
`templates/dashboard/admin_tiers.html`
(lines 115-290 removed)
**To**
:
`templates/dashboard/admin_payment_settings.html`
(added after System Status section)
**What Was Moved**
:
-
PayPal configuration (Client ID, Secret, Webhook Secret, Sandbox mode)
-
Stripe configuration (Publishable Key, Secret Key, Webhook Secret, Test mode)
-
Bitcoin configuration (Address, Confirmations, Expiration time)
-
Ethereum configuration (Address, Confirmations, Chain ID)
-
USDT configuration (Address, Network, Confirmations)
-
USDC configuration (Address, Network, Confirmations)
-
JavaScript functions:
`loadPaymentGateways()`
and
`savePaymentGateways()`
**Lines Removed from admin_tiers.html**
:
-
HTML section: 176 lines (115-290)
-
JavaScript functions: 118 lines (459-576)
-
Function call: 1 line (233)
-
**Total removed**
: 295 lines
**Lines Added to admin_payment_settings.html**
:
-
HTML section: 176 lines
-
JavaScript functions: 125 lines (includes loading in DOMContentLoaded)
-
**Total added**
: 301 lines
### 3. Admin Tiers Page - Now Focused on Tiers Only
**File**
:
`templates/dashboard/admin_tiers.html`
**Before**
: 780 lines (tiers + currency + payment gateways)
**After**
: 484 lines (tiers + currency only)
**Reduction**
: 296 lines (38% smaller)
**Now Contains**
:
-
Tier list and management
-
Currency settings (code, symbol, decimals)
-
Tier creation/editing modal
-
JavaScript for tier CRUD operations
**No Longer Contains**
:
-
Payment gateway configuration
-
Payment gateway JavaScript functions
### 4. Admin Payment Settings Page - Complete Payment Hub
**File**
:
`templates/dashboard/admin_payment_settings.html`
**Before**
: 416 lines (status + price sources + blockchain + email + consolidation)
**After**
: 715 lines (all of the above + payment gateways)
**Addition**
: 299 lines (72% larger)
**Now Contains**
:
1.
System Status Dashboard
2.
**Payment Gateways Configuration**
(NEW)
3.
Price Sources Configuration
4.
Blockchain Monitoring
5.
Email Notifications
6.
Wallet Consolidation
## File Statistics
| File | Before | After | Change |
|------|--------|-------|--------|
|
`base.html`
| - | +2 lines | API Tokens conditional |
|
`admin_tiers.html`
| 780 | 484 | -296 lines (-38%) |
|
`admin_payment_settings.html`
| 416 | 715 | +299 lines (+72%) |
## Benefits
### 1. Better Organization
-
**Admin Tiers**
: Business configuration (what tiers exist, pricing)
-
**Admin Payment Settings**
: Technical configuration (how payments work)
### 2. Clearer User Experience
-
Config admin doesn't see irrelevant "API Tokens" link
-
Database users see all features they need
-
Payment configuration is centralized in one place
### 3. Logical Grouping
Payment Settings page now has all payment-related configuration:
-
Gateway credentials (Stripe, PayPal)
-
Crypto addresses (BTC, ETH, USDT, USDC)
-
Price sources (where to get crypto prices)
-
Blockchain monitoring (how to check for payments)
-
Email notifications (when to notify users)
-
Consolidation (when to move funds)
## User Impact
### Config Admin (from aisbf.json)
-
✅ No longer sees "API Tokens" link (they don't have tokens)
-
✅ Can still access all admin features
-
✅ Cleaner navigation bar
### Database Users
-
✅ Still see "API Tokens" link (they have tokens)
-
✅ No change to their experience
-
✅ All features work as before
### Admin Users (both types)
-
✅ Payment gateway settings moved to logical location
-
✅ Admin Tiers page is simpler and faster to load
-
✅ Admin Payment Settings page is comprehensive payment hub
## Technical Details
### Session Variables Used
-
`request.session.user_id`
:
-
`None`
for config admin (from aisbf.json)
-
Integer for database users
-
`request.session.role`
:
-
`'admin'`
for both config and database admins
### API Endpoints (unchanged)
-
`GET /api/admin/settings/payment-gateways`
- Load gateway config
-
`POST /api/admin/settings/payment-gateways`
- Save gateway config
### JavaScript Functions
Both pages now have their own complete set of functions:
-
**admin_tiers.html**
: Tier CRUD, currency settings
-
**admin_payment_settings.html**
: System status, price sources, blockchain, email, consolidation,
**payment gateways**
## Testing Checklist
-
[
]
Config admin login (from aisbf.json) - verify no API Tokens link
-
[
]
Database admin login - verify API Tokens link appears
-
[
]
Database regular user login - verify API Tokens link appears
-
[
]
Admin Tiers page loads correctly (no payment gateway section)
-
[
]
Admin Payment Settings page loads correctly (with payment gateway section)
-
[
]
Payment gateway configuration saves successfully
-
[
]
Payment gateway configuration loads on page refresh
-
[
]
All 6 payment gateways (PayPal, Stripe, BTC, ETH, USDT, USDC) work
## Commit Information
**Commit**
: 7ea471c
**Branch**
: feature/subscription-payment-system
**Files Changed**
: 3 files, 302 insertions(+), 296 deletions(-)
**Message**
: "refactor: move payment gateway settings to payment settings page and hide API Tokens for config admin"
## Related Commits
1.
`926949e`
- Add admin payment settings UI with complete API endpoints
2.
`a1dabcd`
- docs: add admin settings implementation documentation
3.
`0735029`
- docs: add comprehensive payment system summary
4.
`7ea471c`
- refactor: move payment gateway settings to payment settings page (THIS COMMIT)
## Next Steps
1.
Manual testing of both admin types (config vs database)
2.
Verify payment gateway save/load functionality
3.
Test navigation for all user types
4.
Deploy to staging environment
5.
User acceptance testing
6.
Merge to master
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment