feat(donate): Add donate api (#17459)
* feat(donate): Add donate api * feat(donation): Add ability to track donations via email
This commit is contained in:
committed by
Quincy Larson
parent
3f61c1356f
commit
4f77da02be
@ -518,6 +518,25 @@ module.exports = function(User) {
|
||||
)({ ttl });
|
||||
};
|
||||
|
||||
User.prototype.createDonation = function createDonation(donation = {}) {
|
||||
return Observable.fromNodeCallback(
|
||||
this.donations.create.bind(this.donations)
|
||||
)(donation)
|
||||
.do(() => this.update$({
|
||||
$set: {
|
||||
isDonating: true
|
||||
},
|
||||
$push: {
|
||||
donationEmails: donation.email
|
||||
}
|
||||
})
|
||||
)
|
||||
.do(() => {
|
||||
this.isDonating = true;
|
||||
this.donationEmails = [ ...this.donationEmails, donation.email ];
|
||||
});
|
||||
};
|
||||
|
||||
User.prototype.getEncodedEmail = function getEncodedEmail(email) {
|
||||
if (!email) {
|
||||
return null;
|
||||
|
Reference in New Issue
Block a user