Skip to content

Commit

Permalink
Merge pull request #24 from enhancv/fix-subscription
Browse files Browse the repository at this point in the history
add deleted subscription check
  • Loading branch information
ggeneva authored Jun 12, 2019
2 parents 97637b2 + 3cbfdaf commit 6a7cde2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongoose-subscriptions",
"version": "2.8.3",
"version": "2.8.4",
"description": "Processor agnostic payment subscription backend",
"main": "src/index.js",
"repository": "git@github.com:enhancv/mongoose-subscriptions.git",
Expand Down
5 changes: 4 additions & 1 deletion src/Schema/Customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ Customer.method("addSubscription", function addSubscription(

const waitForSubs = this.validSubscriptions(date)
.filter(
item => item.plan.level >= plan.level && item.status !== SubscriptionStatus.PAST_DUE
item =>
item.plan.level >= plan.level &&
item.status !== SubscriptionStatus.PAST_DUE &&
!item.deleted
)
.sort((a, b) => (b.billingPeriodEndDate < a.billingPeriodEndDate ? -1 : 1));

Expand Down

0 comments on commit 6a7cde2

Please sign in to comment.