fix(event model): duplicate payout status enum removed

This commit is contained in:
kbe
2025-09-17 00:08:14 +02:00
parent d2c43cfc2f
commit 58141dca94
3 changed files with 15 additions and 22 deletions

View File

@@ -67,15 +67,6 @@ class Event < ApplicationRecord
# === Instance Methods ===
# Payout status enum
enum :payout_status, {
not_requested: 0,
requested: 1,
processing: 2,
completed: 3,
failed: 4
}, default: :not_requested
# Payout methods
def can_request_payout?
event_ended? && earnings.pending.any? && user.can_receive_payouts?

View File

@@ -3,12 +3,12 @@ class StripeConnectService
return if user.stripe_connected_account_id.present?
account = Stripe::Account.create(
type: 'express',
country: 'FR',
type: "express",
country: "FR",
email: user.email,
capabilities: {
card_payments: {requested: true},
transfers: {requested: true}
card_payments: { requested: true },
transfers: { requested: true }
}
)
@@ -23,7 +23,7 @@ class StripeConnectService
account: user.stripe_connected_account_id,
refresh_url: Rails.application.routes.url_helpers.promoter_stripe_refresh_url,
return_url: Rails.application.routes.url_helpers.promoter_stripe_return_url,
type: 'account_onboarding'
type: "account_onboarding"
)
account_link.url

12
db/schema.rb generated
View File

@@ -10,18 +10,18 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_09_16_215119) do
ActiveRecord::Schema[8.0].define(version: 2025_09_16_220259) do
create_table "earnings", charset: "utf8mb4", collation: "utf8mb4_uca1400_ai_ci", force: :cascade do |t|
t.integer "amount_cents"
t.integer "fee_cents"
t.integer "status"
t.string "stripe_payout_id"
t.integer "net_amount_cents"
t.bigint "event_id", null: false
t.bigint "user_id", null: false
t.bigint "order_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "net_amount_cents"
t.index ["event_id"], name: "index_earnings_on_event_id"
t.index ["order_id"], name: "index_earnings_on_order_id"
t.index ["user_id"], name: "index_earnings_on_user_id"
@@ -42,12 +42,13 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_215119) do
t.boolean "featured", default: false, null: false
t.bigint "user_id", null: false
t.boolean "allow_booking_during_event", default: false, null: false
t.integer "payout_status"
t.datetime "payout_requested_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "payout_requested_at"
t.integer "payout_status"
t.index ["featured"], name: "index_events_on_featured"
t.index ["latitude", "longitude"], name: "index_events_on_latitude_and_longitude"
t.index ["payout_status"], name: "index_events_on_payout_status"
t.index ["state"], name: "index_events_on_state"
t.index ["user_id"], name: "index_events_on_user_id"
end
@@ -117,10 +118,11 @@ ActiveRecord::Schema[8.0].define(version: 2025_09_16_215119) do
t.string "company_website"
t.string "stripe_customer_id"
t.boolean "onboarding_completed", default: false, null: false
t.string "stripe_connected_account_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "stripe_connected_account_id"
t.index ["email"], name: "index_users_on_email", unique: true
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
end