-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement payment beta (#5831)
* feat: add script to add payment betaflag by email * feat: update user schema with payment betaflag * feat: remove rendering of payment settings and sidebar for non payment beta users * feat: add utility function to verify if user has selected betaflag * feat: prevent user from accessing payment and stripe apis if beta flag is not enabled * fix: typo bug in payments flag in user.server.model
- Loading branch information
Showing
8 changed files
with
149 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* eslint-disable */ | ||
|
||
/* | ||
Adding payment beta flag to specfic user | ||
*/ | ||
|
||
/* | ||
List of user emails to add payment flag to | ||
*/ | ||
const emails = [ | ||
// user emails to update | ||
] | ||
|
||
/* | ||
Count of users who should have payment flag added to | ||
*/ | ||
emails.length | ||
|
||
/* | ||
Get count of users who are to | ||
*/ | ||
|
||
db.getCollection('users') | ||
.find({email: {$in: emails}}) | ||
.count(); | ||
|
||
// check length of emails to count of users | ||
|
||
/* | ||
Get count of current users who have payment set to true | ||
*/ | ||
db.getCollection('users').find({ betaFlags: { | ||
payment: true | ||
} }).count() | ||
|
||
/* | ||
Update selected user's payment betaflag to true | ||
*/ | ||
db.getCollection('users').update({ | ||
email: {$in: emails} | ||
}, { | ||
$set: { | ||
betaFlags: { | ||
payment: true | ||
} | ||
} | ||
}, { | ||
multi: true | ||
}) | ||
|
||
/* | ||
Get count of updated number of users who have payment set to true | ||
*/ | ||
db.getCollection('users').find({ betaFlags: { | ||
payment: true | ||
} }).count() | ||
|
||
// check that beforeCount === afterCount + noOfUsersToAdd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters