feat(amazon-payments): add a lastBillingDate attribute

This commit is contained in:
Matteo Pagliazzi
2015-07-01 18:59:51 +02:00
parent 851868296f
commit 4e7afcbe94
2 changed files with 5 additions and 1 deletions
+4 -1
View File
@@ -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: []