diff --git a/src/controllers/user.js b/src/controllers/user.js index b8979639c4..70cc0cd7c4 100644 --- a/src/controllers/user.js +++ b/src/controllers/user.js @@ -324,6 +324,7 @@ api.buyGems = function(req, res, next) { ga.event('checkout', 'Stripe').send() ga.transaction(response.id, 5).item(5, 1, "stripe-checkout", "Gems > Stripe").send() } + user.txnCount++; user.save(cb); } ], function(err, saved){ @@ -369,6 +370,7 @@ api.buyGemsPaypalIPN = function(req, res, next) { if (_.isEmpty(user)) err = "user not found with uuid " + uuid + " when completing paypal transaction"; if (err) return nex(err); user.balance += 5; + user.txnCount++; //user.purchased.ads = true; user.save(); logging.info('PayPal transaction completed and user updated'); diff --git a/src/models/user.js b/src/models/user.js index 9c1c5ba0cc..a78956fae0 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -81,6 +81,7 @@ var UserSchema = new Schema({ skin: {type: Schema.Types.Mixed, 'default': {}}, // eg, {skeleton: true, pumpkin: true, eb052b: true} hair: {type: Schema.Types.Mixed, 'default': {}}, shirt: {type: Schema.Types.Mixed, 'default': {}}, + txnCount: {type: Number, 'default':0}, plan: { planId: String, customerId: String,