Merge newer features and remove legacy code

This commit is contained in:
kbe
2025-09-18 01:04:55 +02:00
parent a0640b5401
commit 355d4e45d7
12 changed files with 1450 additions and 200 deletions

View File

@@ -0,0 +1,57 @@
# Manual Payouts for French Users
## Overview
Due to regulatory restrictions, Stripe Global Payouts are not available in France. As a result, we've implemented a manual payout system using SEPA (Single Euro Payments Area) bank transfers for French promoters.
## How It Works
### 1. Payout Request
- When a French promoter's event ends and they have earnings, they can request a payout through their dashboard
- The system creates a payout record with status "pending"
### 2. Admin Processing
- Admins can view pending payouts in the admin panel
- For French users, the "Process Payout" button automatically marks the payout as a SEPA transfer
- Admins can also manually mark a payout as a SEPA transfer using the "Mark as SEPA Transfer" button
### 3. SEPA Transfer
- When a payout is marked as a SEPA transfer, the system:
- Updates the payout status to "completed"
- Generates a unique SEPA transfer ID
- Updates all related earnings to "paid" status
- Admins then manually process the bank transfer outside the application using SEPA
### 4. Promoter Notification
- Promoters receive a notification that their payout is being processed via SEPA transfer
- They are informed that funds should appear in their account within 1-3 business days
## Technical Implementation
### Payout Model
- `manual_payout?` method checks if the payout is a SEPA transfer (ID starts with "SEPA_")
- `sepa_transfer?` method is an alias for `manual_payout?`
- `mark_as_manually_processed!` method generates a SEPA transfer ID
### Payout Service
- `should_process_manually?` method is hardcoded to return true for French users
- `process_manually!` method handles the SEPA transfer process
### Views
- Admin and promoter views display "SEPA Transfer" instead of "Manual Transfer"
- Specific messaging about SEPA transfer timelines is shown to promoters
## Testing
The manual payout system is thoroughly tested with:
- Unit tests for the payout model methods
- Service tests for the payout processing logic
- Controller tests for the admin interface
- Integration tests for the end-to-end flow
## Future Improvements
- Automatically detect user country from their address or IP
- Integrate with a SEPA transfer API for automated bank transfers
- Add email notifications for payout status changes
- Implement a dashboard for admins to track SEPA transfers