feat(donations): add txnCount for each purchase

This commit is contained in:
Tyler Renelle 2014-02-18 17:12:29 -08:00
parent 7baaf42884
commit a50f025132
2 changed files with 3 additions and 0 deletions

View file

@ -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');

View file

@ -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,