Merge pull request #5537 from HabitRPG/paglias/amazon-payments
feat(amazon-payments): add a lastBillingDate attribute
This commit is contained in:
@@ -53,7 +53,10 @@ exports.createSubscription = function(data, cb) {
|
||||
paymentMethod: data.paymentMethod,
|
||||
extraMonths: +p.extraMonths
|
||||
+ +(p.dateTerminated ? moment(p.dateTerminated).diff(new Date(),'months',true) : 0),
|
||||
dateTerminated: null
|
||||
dateTerminated: null,
|
||||
// Specify a lastBillingDate just for Amazon Payments
|
||||
// Resetted every time the subscription restarts
|
||||
lastBillingDate: data.paymentMethod === 'Amazon Payments' ? new Date() : undefined
|
||||
}).defaults({ // allow non-override if a plan was previously used
|
||||
dateCreated: new Date(),
|
||||
mysteryItems: []
|
||||
|
||||
@@ -109,6 +109,7 @@ var UserSchema = new Schema({
|
||||
extraMonths: {type:Number, 'default':0},
|
||||
gemsBought: {type: Number, 'default': 0},
|
||||
mysteryItems: {type: Array, 'default': []},
|
||||
lastBillingDate: Date, // Used only for Amazon Payments to keep track of billing date
|
||||
consecutive: {
|
||||
count: {type:Number, 'default':0},
|
||||
offset: {type:Number, 'default':0}, // when gifted subs, offset++ for each month. offset-- each new-month (cron). count doesn't ++ until offset==0
|
||||
|
||||
Reference in New Issue
Block a user