mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-10 14:29:11 +00:00
feat(donations): add txnCount for each purchase
This commit is contained in:
parent
7baaf42884
commit
a50f025132
2 changed files with 3 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue