diff --git a/website/server/libs/payments.js b/website/server/libs/payments.js index 6ea848c73d..4f2d6df15a 100644 --- a/website/server/libs/payments.js +++ b/website/server/libs/payments.js @@ -56,9 +56,9 @@ function _dateDiff (earlyDate, lateDate) { api.addSubscriptionToGroupUsers = async function addSubscriptionToGroupUsers (group) { let members; if (group.type === 'guild') { - members = await User.find({guilds: group._id}).select('_id purchased items').exec(); + members = await User.find({guilds: group._id}).select('_id purchased items auth profile.name').exec(); } else { - members = await User.find({'party._id': group._id}).select('_id purchased items').exec(); + members = await User.find({'party._id': group._id}).select('_id purchased items auth profile.name').exec(); } let promises = members.map((member) => { @@ -379,7 +379,8 @@ api.createSubscription = async function createSubscription (data) { email: getUserInfo(data.gift.member, ['email']).email, } : {}, paymentMethod: data.paymentMethod, - months, + months: group ? 1 : months, + groupId, }); }; diff --git a/website/server/libs/slack.js b/website/server/libs/slack.js index f195c02199..dd60f84a2c 100644 --- a/website/server/libs/slack.js +++ b/website/server/libs/slack.js @@ -69,6 +69,7 @@ function sendSubscriptionNotification ({ recipient, paymentMethod, months, + groupId, }) { if (!SLACK_SUBSCRIPTIONS_URL) { return; @@ -77,6 +78,8 @@ function sendSubscriptionNotification ({ let timestamp = new Date(); if (recipient.id) { text = `${buyer.name} ${buyer.id} ${buyer.email} bought a ${months}-month gift subscription for ${recipient.name} ${recipient.id} ${recipient.email} using ${paymentMethod} on ${timestamp}`; + } else if (groupId) { + text = `${buyer.name} ${buyer.id} ${buyer.email} bought a 1-month recurring group-plan for ${groupId} using ${paymentMethod} on ${timestamp}`; } else { text = `${buyer.name} ${buyer.id} ${buyer.email} bought a ${months}-month recurring subscription using ${paymentMethod} on ${timestamp}`; }