summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/lib/schemas/Plan.js2
-rw-r--r--server/lib/schemas/User.js1
-rw-r--r--server/lib/webhook/index.js1
-rw-r--r--views/about/brochure.ejs19
4 files changed, 19 insertions, 4 deletions
diff --git a/server/lib/schemas/Plan.js b/server/lib/schemas/Plan.js
index 1208672..8a19b99 100644
--- a/server/lib/schemas/Plan.js
+++ b/server/lib/schemas/Plan.js
@@ -10,6 +10,8 @@ var PlanSchema = new mongoose.Schema({
name: { type: String },
slug: { type: String },
+ level: { type: Number },
+
monthly_price: { type: Number },
yearly_price: { type: Number },
diff --git a/server/lib/schemas/User.js b/server/lib/schemas/User.js
index ae1d912..867939e 100644
--- a/server/lib/schemas/User.js
+++ b/server/lib/schemas/User.js
@@ -56,6 +56,7 @@ var UserSchema = new mongoose.Schema({
},
plan_level: { type: Number, default: 0 },
+ subscription_id: { type: mongoose.Schema.ObjectId },
location: { type: String, default: "" },
photo: { type: String, default: "" },
diff --git a/server/lib/webhook/index.js b/server/lib/webhook/index.js
index c4b4b76..ebbd01a 100644
--- a/server/lib/webhook/index.js
+++ b/server/lib/webhook/index.js
@@ -33,6 +33,7 @@ var subscription = module.exports = {
callbacks: {
// accounts
new_account_notification: function(data){
+ //
},
canceled_account_notification: function(data){
},
diff --git a/views/about/brochure.ejs b/views/about/brochure.ejs
index e75f8c6..cffa51f 100644
--- a/views/about/brochure.ejs
+++ b/views/about/brochure.ejs
@@ -33,8 +33,14 @@
<li> Each new floor plan can have up to [[- plans.basic.basic_project_limit ]] exhibitions
<li> VValls logo appears when embedding an exhibition on a web page
<li>
- <!-- check current subscription plan -->
- <button>Buy Now</button>
+ [[ if (! logged_in) { ]]
+ <button href="/signup">Sign Up</button>
+ [[ } else if (! profile.plan_level || profile.plan_level < plan.level) { ]]
+ <button href="https://vvalls.recurly.com/subscribe/basic/[[- profile._id ]]/[[- profile.username ]]">Buy Now</button>
+ [[ } else if (profile.plan_level == plan.level) { ]]
+ Current Level
+ [[ } else { ]]
+ [[ } ]]
</ul>
</div>
@@ -49,8 +55,13 @@
<li> Includes planning for 3D objects in the room
<li> No VValls logo on embed
<li>
- <!-- check current subscription plan -->
- <button>Buy Now</button>
+ [[ if (! logged_in) { ]]
+ <button href="/signup">Sign Up</button>
+ [[ } else if (! profile.plan_level || profile.plan_level < plan.level) { ]]
+ <button href="https://vvalls.recurly.com/subscribe/pro/[[- profile._id ]]/[[- profile.username ]]">Buy Now</button>
+ [[ } else if (profile.plan_level == plan.level) { ]]
+ Current Level
+ [[ } ]]
</ul>
</div>