Missed some recurly/plan code for yearly

This commit is contained in:
Seth Call 2026-01-14 22:12:58 -06:00
parent 0fd37809c8
commit e92e54fcd3
1 changed files with 14 additions and 3 deletions

View File

@ -176,18 +176,29 @@ class ApiRecurlyController < ApiController
plan_code = params[:plan_code]
value = '0.00'
# Determine value based on plan (approximate monthly cost)
# Determine value based on plan (approximate cost)
case plan_code
when SubscriptionDefinitions::JAM_SILVER
value = '5.00'
when SubscriptionDefinitions::JAM_SILVER_YEARLY
value = '50.00'
when SubscriptionDefinitions::JAM_GOLD
value = '10.00'
when SubscriptionDefinitions::JAM_GOLD_YEARLY
value = '100.00'
when SubscriptionDefinitions::JAM_PLATINUM
value = '20.00'
when SubscriptionDefinitions::JAM_PLATINUM_YEARLY
value = '200.00'
end
# Calculate predicted LTV (e.g., 12 months)
ltv = (value.to_f * 12).to_s
# Calculate predicted LTV (12 months for monthly, 1 year for yearly)
# If it's a yearly plan, the value IS the yearly revenue
if plan_code.to_s.include?('yearly')
ltv = value
else
ltv = (value.to_f * 12).to_s
end
CapiTransmitter.send_event('Subscribe', current_user, { value: value, currency: 'USD', predicted_ltv: ltv })
rescue => e