Skip to content

Commit

Permalink
Merge pull request #2 from enhancv/version-error-fix
Browse files Browse the repository at this point in the history
Possible version error fix
  • Loading branch information
ginovski authored Feb 1, 2018
2 parents 261644f + 20d1907 commit 3a2ece3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 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-braintree",
"version": "1.6.0",
"version": "1.6.1",
"description": "Braintree processor for mongoose-subscriptions",
"main": "src/index.js",
"repository": "[email protected]:enhancv/mongoose-subscriptions-braintree.git",
Expand Down
12 changes: 10 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ function isChanged(item) {

function saveCollection(name, saveItem, customer) {
return some(isChanged, customer[name])
? Promise.all(customer[name].map(saveItem(customer))).then(() => customer.save())
? Promise.all(customer[name].map(saveItem(customer))).then(() => {
delete customer.__v;
customer.save();
})
: Promise.resolve();
}

function saveCustomer(saveItem, customer) {
return isChanged(customer) ? saveItem(customer).then(() => customer.save()) : Promise.resolve();
return isChanged(customer)
? saveItem(customer).then(() => {
delete customer.__v;
customer.save();
})
: Promise.resolve();
}

class BraintreeProcessor extends AbstractProcessor {
Expand Down

0 comments on commit 3a2ece3

Please sign in to comment.