diff --git a/website/server/controllers/top-level/payments/stripe.js b/website/server/controllers/top-level/payments/stripe.js index c5bc2e68de..b684b20c91 100644 --- a/website/server/controllers/top-level/payments/stripe.js +++ b/website/server/controllers/top-level/payments/stripe.js @@ -91,13 +91,7 @@ api.handleWebhooks = { method: 'POST', url: '/stripe/webhooks', async handler (req, res) { - console.log('start handling webhook'); - - try { - await stripePayments.handleWebhooks({requestBody: req.body}); - } catch (err) { - console.log(err); - } + await stripePayments.handleWebhooks({requestBody: req.body}); return res.respond(200, {}); }, diff --git a/website/server/libs/stripePayments.js b/website/server/libs/stripePayments.js index a81b057a62..eacd2f143b 100644 --- a/website/server/libs/stripePayments.js +++ b/website/server/libs/stripePayments.js @@ -288,7 +288,6 @@ api.handleWebhooks = async function handleWebhooks (options, stripeInc) { // Verify the event by fetching it from Stripe const event = await stripeApi.events.retrieve(requestBody.id); - console.log(event); switch (event.type) { case 'customer.subscription.deleted': { @@ -304,7 +303,6 @@ api.handleWebhooks = async function handleWebhooks (options, stripeInc) { let groupId; if (isGroupSub) { - console.log('is group sub'); let groupFields = basicGroupFields.concat(' purchased'); let group = await Group.findOne({ 'purchased.plan.customerId': customerId, @@ -316,7 +314,6 @@ api.handleWebhooks = async function handleWebhooks (options, stripeInc) { user = await User.findById(group.leader).exec(); } else { - console.log('is not group sub'); user = await User.findOne({ 'purchased.plan.customerId': customerId, 'purchased.plan.paymentMethod': this.constants.PAYMENT_METHOD, @@ -325,21 +322,14 @@ api.handleWebhooks = async function handleWebhooks (options, stripeInc) { if (!user) throw new NotFound(i18n.t('userNotFound')); - console.log('groupId', groupId); - console.log('userId', user._id); - await stripeApi.customers.del(customerId); - console.log('deleted stripe customer'); - await payments.cancelSubscription({ user, groupId, paymentMethod: this.constants.PAYMENT_METHOD, }); - console.log('cancelled subscription'); - break; } default: {