mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
fix linting
This commit is contained in:
@@ -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, {});
|
||||
},
|
||||
|
||||
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user