-
Notifications
You must be signed in to change notification settings - Fork 0
Newsletter Deals
The link in the newsletter will direct to https://my.sublimevideo.net/d/rts1
-
d
is fordeal
-
rts1
is the token of the deal.
Note:
- The user has to be logged-in to be able to activate a deal.
- The user has to satisfy the
deal
'savailability_scope
scope to be able activate a deal. - A cookie is set in case the user doesn't have an account yet so the deal will be activated upon his first log-in (i.e. after sign-up).
Visiting such URL:
- Create a record in the
deal_activations
table, - Redirect to https://my.sublimevideo.net/sites
When a deal is currently available:
- A sticky notice is shown to inform the user that the deal is currently available (in /sites, /sites/new and /sites/:token/plan/edit)
- Discounted prices are shown in /sites/new and /sites/:token/plan/edit.
When a deal is used (for an invoice item):
- Discount is displayed as "promotional discount" in the invoice.
-
name
:Real-Time Stats promotion #1
-
description
:20% discount on the Yearly plans
-
token
:rts1
-
kind
:yearly_plans_discount
(other possible value ismonthly_plans_discount
,plans_discount
andPLAN_NAME_plan_discount
, e.g.plus_plan_discount
) -
value
:0.2
=> 20% (can be nil because maybe it'd not be applicable for all deals) -
availability_scope
:subscribed_to_newsletter
=> A scope that defines which users have access to the deal -
started_at
/ended_at
In Plan
, the #discounted?(site)
method should:
- take the latest activated deal for the site's user
- if the site's trial started before the deal ended or if the deal is still active, return true if the deal is applicable to the tested plan
- return nil otherwise
In Plan
, the #discounted_percentage(site)
method should:
- return the deal's
value
if#discounted?(site)
is true - return 0 otherwise
In Plan
, the #price(site)
method should:
- return
price * (1 - discounted_percentage(site))
Table: deal_activations
Keeps track of which deals a user has activated.
deal_id
user_id
activated_at
Table: invoice_items
New field to keep track of the deal used in an invoice item: deal_id
Store stats about activated deals every day.
Collection: deals_stats
-
d
=> Day -
activated
:{ 'rts1' => 1000 }
-
used
:{ 'rts1' => 200 }
heroku run rake db:migrate
Deal.create!(token: 'rts1', name: 'Real-Time Stats promotion #1', description: '<strong>Exclusive Newsletter Promotion: Save 20%</strong> when you sign up for or upgrade to a yearly plan', kind: 'yearly_plans_discount', value: 0.2, availability_scope: 'newsletter(true)', started_at: Time.now.utc, ended_at: Time.utc(2012, 3, 1).midnight)