feat(promotion code): Promotion code system done

I added the features for users to use promotion code
and for promoters to create on their events.
May be rewrite to discount code?
This commit is contained in:
kbe
2025-09-29 15:25:52 +02:00
parent 72d54e02ab
commit 87ccebf229
19 changed files with 391 additions and 302 deletions

View File

@@ -280,3 +280,26 @@ TicketType.find_or_create_by!(event: belle_epoque_october_event, name: "Entry 10
end
puts "Created 3 additional events from Bizouk with ticket types"
# Create promotion codes for events
# Promotion code for belle_epoque_event
PromotionCode.find_or_create_by!(code: "BELLE10") do |pc|
pc.discount_amount_cents = 1000 # 10€ discount
pc.expires_at = belle_epoque_event.start_time + 1.day
pc.active = true
pc.usage_limit = 20
pc.user = promoter
pc.event = belle_epoque_october_event
end
# Promotion code for belle_epoque_october_event
PromotionCode.find_or_create_by!(code: "OCTOBRE5") do |pc|
pc.discount_amount_cents = 500 # 5€ discount
pc.expires_at = belle_epoque_october_event.start_time + 1.day
pc.active = true
pc.usage_limit = 30
pc.user = promoter
pc.event = belle_epoque_october_event
end
puts "Created promotion codes for events"