feat: Implement promoter payout system for event revenue processing

- Add Payout model with associations to User and Event
- Create payout requests for completed events with proper earnings calculation
- Exclude refunded tickets from payout calculations
- Add promoter dashboard views for managing payouts
- Implement admin interface for processing payouts
- Integrate with Stripe for actual payment processing
- Add comprehensive tests for payout functionality

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
kbe
2025-09-17 00:29:20 +02:00
parent 58141dca94
commit 59e1854803
20 changed files with 587 additions and 254 deletions

22
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_09_16_220259) do
ActiveRecord::Schema[8.0].define(version: 2025_09_16_221454) do
create_table "earnings", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.integer "amount_cents"
t.integer "fee_cents"
@@ -70,6 +70,23 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_220259) do
t.index ["user_id"], name: "index_orders_on_user_id"
end
create_table "payouts", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.bigint "user_id", null: false
t.bigint "event_id", null: false
t.integer "amount_cents", null: false
t.integer "fee_cents", default: 0, null: false
t.integer "status", default: 0, null: false
t.string "stripe_payout_id"
t.integer "total_orders_count", default: 0, null: false
t.integer "refunded_orders_count", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["event_id"], name: "index_payouts_on_event_id"
t.index ["status"], name: "index_payouts_on_status"
t.index ["stripe_payout_id"], name: "index_payouts_on_stripe_payout_id", unique: true
t.index ["user_id"], name: "index_payouts_on_user_id"
end
create_table "ticket_types", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.string "name"
t.text "description"
@@ -125,4 +142,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_220259) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
t.index ["stripe_connected_account_id"], name: "index_users_on_stripe_connected_account_id", unique: true
end
add_foreign_key "payouts", "events"
add_foreign_key "payouts", "users"
end