feat(donations): add txnCount for each purchase
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user