Update paypal and discord.

main
Zed A. Shaw 2 years ago
parent 73b379ffcb
commit 8db880768e
  1. 2
      package-lock.json
  2. 2
      package.json
  3. 10
      queues/discord.js
  4. 8
      queues/paypal.js

2
package-lock.json generated

@ -50,7 +50,7 @@
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"pino": "^6.14.0", "pino": "^6.14.0",
"pino-pretty": "^4.8.0", "pino-pretty": "^4.8.0",
"playwright": "^1.28.1", "playwright": "1.28.1",
"pm2": "^5.2.2", "pm2": "^5.2.2",
"random": "3.0.6", "random": "3.0.6",
"randomcolor": "^0.6.2", "randomcolor": "^0.6.2",

@ -110,7 +110,7 @@
"passport-local": "^1.0.0", "passport-local": "^1.0.0",
"pino": "^6.14.0", "pino": "^6.14.0",
"pino-pretty": "^4.8.0", "pino-pretty": "^4.8.0",
"playwright": "^1.28.1", "playwright": "1.28.1",
"pm2": "^5.2.2", "pm2": "^5.2.2",
"random": "3.0.6", "random": "3.0.6",
"randomcolor": "^0.6.2", "randomcolor": "^0.6.2",

@ -1,6 +1,6 @@
import assert from "assert"; import assert from "assert";
import logging from '../lib/logging.js'; import logging from '../lib/logging.js';
import { Client, IntentsBitField, Partials } from "discord.js"; import { Client, IntentsBitField, Partials, ChannelType } from "discord.js";
import { User } from "../lib/models.js"; import { User } from "../lib/models.js";
import { company } from '../emails/config.js'; import { company } from '../emails/config.js';
import { discord } from "../lib/config.js"; import { discord } from "../lib/config.js";
@ -27,8 +27,8 @@ const load_guild_channel = async (client) => {
const channels = await guild.channels.fetch(); const channels = await guild.channels.fetch();
for(let chan of channels.entries()) { for(let chan of channels.entries()) {
if(chan[1].type === "GUILD_TEXT") { if(chan[1].type === ChannelType.GuildText) {
// remember, return await puts the errors here log.info(`Found guild text channel ${JSON.stringify(chan[1])}`);
return [guild, await chan[1].fetch()]; return [guild, await chan[1].fetch()];
} }
} }
@ -43,8 +43,8 @@ await client.login(discord.token);
const [guild, channel] = await load_guild_channel(client); const [guild, channel] = await load_guild_channel(client);
// if it doesn't exist make it and add it to their account // if it doesn't exist make it and add it to their account
log.info("Connected to Sever/Guild", guild.name); log.info(`Connected to Sever/Guild ${guild.name}`);
log.info("Sending invites from Channel", channel.name); log.info(`!!Sending invites from Channel ${JSON.stringify(channel, null, 4)}`);
const invite_email = await load_templates("discord_email"); const invite_email = await load_templates("discord_email");

@ -82,6 +82,12 @@ export const validate_order = async (job) => {
await Payment.update({id: payment.id}, {status: "failed", status_reason}); await Payment.update({id: payment.id}, {status: "failed", status_reason});
} }
} catch(error) { } catch(error) {
log.error(error, `Processing payment paypal varification for ${job.data.payment_id}`); log.error(error, `Processing payment paypal verification for ${job.data.payment_id}`);
try {
await Payment.update({id: job.data.payment_id}, {status: "failed", status_reason: "check_logs"});
} catch (e) {
log.error(error, `Failed to update the database with failure on payment id ${job.data.payment_id}`);
}
} }
} }

Loading…
Cancel
Save