feat(payouts): implement promoter earnings viewing, request flow, and admin Stripe processing with webhooks

Add model methods for accurate net calculations (€0.50 + 1.5% fees), eligibility, refund handling
Update promoter/payouts controller for index (pending events), create (eligibility checks)
Integrate admin processing via Stripe::Transfer, webhook for status sync
Enhance views: index pending cards, events/show preview/form
Add comprehensive tests (models, controllers, service, integration); run migrations
This commit is contained in:
kbe
2025-09-17 02:07:52 +02:00
parent 47f4f50e5b
commit 3c1e17c2af
31 changed files with 1096 additions and 148 deletions

5
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_221454) do
ActiveRecord::Schema[8.0].define(version: 2025_09_16_230003) do
create_table "earnings", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.integer "amount_cents"
t.integer "fee_cents"
@@ -24,6 +24,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_221454) do
t.datetime "updated_at", null: false
t.index ["event_id"], name: "index_earnings_on_event_id"
t.index ["order_id"], name: "index_earnings_on_order_id"
t.index ["status"], name: "index_earnings_on_status"
t.index ["user_id"], name: "index_earnings_on_user_id"
end
@@ -81,6 +82,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_221454) do
t.bigint "event_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["event_id", "status"], name: "index_payouts_on_event_id_and_status"
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
@@ -116,6 +118,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_221454) do
t.datetime "updated_at", null: false
t.index ["order_id"], name: "index_tickets_on_order_id"
t.index ["qr_code"], name: "index_tickets_on_qr_code", unique: true
t.index ["status", "order_id"], name: "index_tickets_on_status_and_order_id"
t.index ["ticket_type_id"], name: "index_tickets_on_ticket_type_id"
end